ParaView
pqSearchBox.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: pqSearchBox.h
5 
6  Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
7  All rights reserved.
8 
9  ParaView is a free software; you can redistribute it and/or modify it
10  under the terms of the ParaView license version 1.2.
11 
12  See License_v1.2.txt for the full ParaView license.
13  A copy of this license can be obtained by contacting
14  Kitware Inc.
15  28 Corporate Drive
16  Clifton Park, NY 12065
17  USA
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 ========================================================================*/
32 #ifndef pqSearchBox_h
33 #define pqSearchBox_h
34 
35 #include "pqComponentsModule.h"
36 #include <QScopedPointer>
37 #include <QWidget>
38 
39 class QSettings;
51 class PQCOMPONENTS_EXPORT pqSearchBox : public QWidget
52 {
53  Q_OBJECT
54 
58  Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged USER true)
59 
60 
61  Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText)
65 
66 
67  Q_PROPERTY(bool advancedSearchActive
71  READ isAdvancedSearchActive
72  WRITE setAdvancedSearchActive
73  NOTIFY advancedSearchActivated)
74 
75 
76  Q_PROPERTY(bool advancedSearchEnabled
79  READ isAdvancedSearchEnabled
80  WRITE setAdvancedSearchEnabled)
81 
82 
83  Q_PROPERTY(QString settingKey
93  READ settingKey
94  WRITE setSettingKey
95  NOTIFY settingKeyChanged)
96 
97 public:
98  typedef QWidget Superclass;
99 
100  pqSearchBox(QWidget *parent=0);
101  pqSearchBox(
102  bool advancedSearchEnabled,
103  const QString &settingKey = "",
104  QWidget *parent=0);
105 
106  virtual ~pqSearchBox();
107 
110  bool isAdvancedSearchActive() const;
111 
114  QString text() const;
115 
118  QString placeholderText() const;
119  void setPlaceholderText(const QString& text);
120 
123  QString settingKey() const;
124 
127  QSettings* settings() const;
128 
131  bool isAdvancedSearchEnabled() const;
132 
133 signals:
137  void advancedSearchActivated(bool);
138 
141  void textChanged(const QString &);
142 
145  void settingKeyChanged(const QString &);
146 
147 public slots:
151  void setAdvancedSearchActive(bool use);
152 
155  void setText(const QString& text);
156 
163  QString setSettingKey(const QString& key);
164 
167  void setAdvancedSearchEnabled(bool enable);
168 
169 protected:
170  virtual void keyPressEvent(QKeyEvent *e);
171 
172 protected slots:
173  void onAdvancedButtonClicked(bool);
174  void updateSettings();
175  void updateFromSettings();
176 
177 private:
178  Q_DISABLE_COPY(pqSearchBox)
179 
180  class pqInternals;
181  friend class pqInternals;
182 
183  const QScopedPointer<pqInternals> Internals;
184  QString SettingKey;
185 };
186 
187 #endif
pqSearchBox is a line edit and an advanced tool button in the same layout.
Definition: pqSearchBox.h:51
QWidget Superclass
Definition: pqSearchBox.h:98