CTK 0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Loading...
Searching...
No Matches
ctkMenuComboBox.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Library: CTK
4
5 Copyright (c) Kitware Inc.
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0.txt
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18
19=========================================================================*/
20
21#ifndef __ctkMenuComboBox_h
22#define __ctkMenuComboBox_h
23
24// Qt includes
25#include <QMenu>
26#include <QMetaType>
27#include <QWidget>
28class QComboBox;
29class QToolButton;
30
31// CTK includes
32#include "ctkWidgetsExport.h"
33class ctkCompleter;
34class ctkMenuComboBoxPrivate;
35
48
52
53class CTK_WIDGETS_EXPORT ctkMenuComboBox : public QWidget
54{
55 Q_OBJECT
56 Q_ENUMS(EditableBehavior)
60 Q_PROPERTY(QString defaultText READ defaultText WRITE setDefaultText)
64 Q_PROPERTY(QIcon defaultIcon READ defaultIcon WRITE setDefaultIcon)
70 Q_PROPERTY(EditableBehavior editBehavior READ editableBehavior WRITE setEditableBehavior)
73 Q_PROPERTY(bool searchIconVisible READ isSearchIconVisible WRITE setSearchIconVisible)
78 Q_PROPERTY(Qt::ToolButtonStyle toolButtonStyle READ toolButtonStyle WRITE setToolButtonStyle)
79public:
81 NotEditable = 0,
84 EditableOnPopup
85 };
86
88 typedef QWidget Superclass;
89
91 ctkMenuComboBox(QWidget* parent = 0);
93
95 void setMenu(QMenu* menu);
96 QMenu* menu()const;
97
98 void setDefaultText(const QString&);
99 QString defaultText()const;
100
101 void setDefaultIcon(const QIcon&);
102 QIcon defaultIcon()const;
103
106
107 void setSearchIconVisible(bool state);
109
110 Qt::ToolButtonStyle toolButtonStyle() const;
111
114 void setMinimumContentsLength(int characters);
115
117 QComboBox* menuComboBoxInternal() const;
118
120 QToolButton* toolButtonInternal() const;
121
124
125protected:
126 virtual bool eventFilter(QObject* target, QEvent* event);
127
128public Q_SLOTS:
130 void setToolButtonStyle(Qt::ToolButtonStyle style);
131
132Q_SIGNALS:
133 void actionChanged(QAction* action);
135
136protected Q_SLOTS:
140 void onActionSelected(QAction* action);
143
144protected:
145 QScopedPointer<ctkMenuComboBoxPrivate> d_ptr;
146
147private:
148 Q_DECLARE_PRIVATE(ctkMenuComboBox);
149 Q_DISABLE_COPY(ctkMenuComboBox);
150};
151
153
154#endif
virtual ~ctkMenuComboBox()
bool isSearchIconVisible() const
EditableBehavior editableBehavior() const
void setMenu(QMenu *menu)
Add a menu to the QcomboBox and set a QCompleter.
void setToolButtonStyle(Qt::ToolButtonStyle style)
QWidget Superclass
Superclass typedef.
void setDefaultText(const QString &)
void setEditableBehavior(EditableBehavior editBehavior)
void clearActiveAction()
ctkCompleter * searchCompleter() const
Return the internal completer.
Qt::ToolButtonStyle toolButtonStyle() const
QToolButton * toolButtonInternal() const
Return the internal tool button.
void setSearchIconVisible(bool state)
QMenu * menu() const
void setDefaultIcon(const QIcon &)
void setMinimumContentsLength(int characters)
ctkMenuComboBox(QWidget *parent=0)
void onEditingFinished()
action selected from the line edit or the completer.
void actionChanged(QAction *action)
QComboBox * menuComboBoxInternal() const
Return the internal combo box.
QIcon defaultIcon() const
void onActionSelected(QAction *action)
QString defaultText() const
virtual bool eventFilter(QObject *target, QEvent *event)
QScopedPointer< ctkMenuComboBoxPrivate > d_ptr
Q_DECLARE_METATYPE(ctkDICOMPersonName)