SearchLineEditWidget.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file SearchLineEditWidget.h
22 
23  \brief Defines a component used as a search field.
24 */
25 #ifndef __TERRALIB_QT_WIDGETS_INTERNAL_SEARCHLINEEDITWIDGET_H
26 #define __TERRALIB_QT_WIDGETS_INTERNAL_SEARCHLINEEDITWIDGET_H
27 
29 
30 //! Qt include files
31 #include <QLineEdit>
32 #include <QToolButton>
33 #include <QValidator>
34 #include <QWidget>
35 
36 namespace te
37 {
38  namespace qt
39  {
40  namespace widgets
41  {
42 
43  /*!
44  \class CustomLineEdit
45 
46  \brief Reimplements QLineEdit to get focus event
47  */
48  class CustomLineEdit : public QLineEdit
49  {
50  Q_OBJECT
51 
52  public:
53  CustomLineEdit(QWidget* parent = 0);
55 
56  signals:
57  void focussed(bool hasFocus);
58 
59  protected:
60  virtual void focusInEvent(QFocusEvent* e);
61  virtual void focusOutEvent(QFocusEvent* e);
62  };
63 
64  /*!
65  \class SearchLineEditWidget
66 
67  \brief Defines a component used as a search field.
68  */
69  class TEQTWIDGETSEXPORT SearchLineEditWidget : public QWidget
70  {
71  Q_OBJECT
72 
73  public:
74 
75  /*!
76  \brief Constructor.
77  */
78  SearchLineEditWidget(QWidget* parent=0);
79 
80  /*!
81  \brief Destructor.
82  */
84 
85  public:
86 
87  void setSearchFieldTextBackground(QString str);
88 
89  void setSearchFieldValidator(QValidator* validator);
90 
91  protected slots:
92 
93  void onLineEditFocussed(bool hasFocus);
94 
95  void onSearchToolButtonTriggered();
96 
97  void onClearToolButtonTriggered();
98 
99  signals:
100 
101  void search(QString str);
102 
103  void clearSearch();
104 
105  protected:
106 
108  QToolButton* m_searchToolButton;
109  QToolButton* m_clearToolButton;
111 
112  };
113  }
114  }
115 }
116 
117 #endif //! __TERRALIB_QT_WIDGETS_INTERNAL_SEARCHLINEEDITWIDGET_H
#define slots
te::qt::widgets::CustomLineEdit * m_lineEdit
Configuration flags for the TerraLib Qt Widgets.
TerraLib.
Defines a component used as a search field.
virtual void focusOutEvent(QFocusEvent *e)
void focussed(bool hasFocus)
virtual void focusInEvent(QFocusEvent *e)
Reimplements QLineEdit to get focus event.
CustomLineEdit(QWidget *parent=0)
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63