itom
Loading...
Searching...
No Matches
searchBox.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut für Technische Optik (ITO),
5 Universität Stuttgart, Germany
6
7 This file is part of itom and its software development toolkit (SDK).
8
9 itom is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Library General Public Licence as published by
11 the Free Software Foundation; either version 2 of the Licence, or (at
12 your option) any later version.
13
14 In addition, as a special exception, the Institut für Technische
15 Optik (ITO) gives you certain additional rights.
16 These rights are described in the ITO LGPL Exception version 1.0,
17 which can be found in the file LGPL_EXCEPTION.txt in this package.
18
19 itom is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
22 General Public Licence for more details.
23
24 You should have received a copy of the GNU Library General Public License
25 along with itom. If not, see <http://www.gnu.org/licenses/>.
26
27 This file is a port and modified version of the
28 Common framework (http://www.commontk.org)
29*********************************************************************** */
30
31#ifndef SEARCHBOX_H
32#define SEARCHBOX_H
33
34// QT includes
35#include <QIcon>
36#include <QLineEdit>
37
38// CTK includes
39#include "commonWidgets.h"
40
42
57class ITOMWIDGETS_EXPORT SearchBox : public QLineEdit
58{
59 Q_OBJECT
60#if QT_VERSION < 0x040700
63 Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText)
64#endif
67 Q_PROPERTY(bool showSearchIcon READ showSearchIcon WRITE setShowSearchIcon)
68
69
71 Q_PROPERTY(QIcon searchIcon READ searchIcon WRITE setSearchIcon)
74 Q_PROPERTY(QIcon clearIcon READ clearIcon WRITE setClearIcon)
75
76public:
78 typedef QLineEdit Superclass;
79
80 SearchBox(QWidget *parent = 0);
81 virtual ~SearchBox();
82
83#if QT_VERSION < 0x040700
84 QString placeholderText()const;
85 void setPlaceholderText(const QString& defaultText);
86#endif
88 void setShowSearchIcon(bool show);
89 bool showSearchIcon()const;
90
92 void setAlwaysShowClearIcon(bool show);
93 bool alwaysShowClearIcon()const;
94
96 void setSearchIcon(const QIcon& icon);
98 QIcon searchIcon()const;
99
101 void setClearIcon(const QIcon& icon);
103 QIcon clearIcon()const;
104
105protected Q_SLOTS:
107 void updateClearButtonState();
108
109protected:
110 virtual void paintEvent(QPaintEvent*);
111 virtual void mousePressEvent(QMouseEvent* event);
112 virtual void mouseMoveEvent(QMouseEvent *event);
113 virtual void resizeEvent(QResizeEvent * event);
114
115 QScopedPointer<SearchBoxPrivate> d_ptr;
116
117private:
118 Q_DECLARE_PRIVATE(SearchBox);
119 Q_DISABLE_COPY(SearchBox);
120};
121#endif // __SearchBox_h
Definition searchBox.h:58
QLineEdit Superclass
Superclass typedef.
Definition searchBox.h:78
Definition searchBox.cpp:45