CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkComboBox.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 __ctkComboBox_h
22 #define __ctkComboBox_h
23 
24 // Qt includes
25 #include <QComboBox>
26 
27 // CTK includes
28 #include "ctkPimpl.h"
29 #include "ctkWidgetsExport.h"
30 class ctkComboBoxPrivate;
31 
44 class CTK_WIDGETS_EXPORT ctkComboBox : public QComboBox
45 {
46  Q_OBJECT
47  Q_PROPERTY(QString defaultText READ defaultText WRITE setDefaultText)
48  Q_PROPERTY(QIcon defaultIcon READ defaultIcon WRITE setDefaultIcon)
49  Q_PROPERTY(bool forceDefault READ isDefaultForced WRITE forceDefault)
50  Q_PROPERTY(Qt::TextElideMode elideMode READ elideMode WRITE setElideMode)
54  Q_PROPERTY(ScrollEffect scrollWheelEffect READ scrollWheelEffect WRITE setScrollWheelEffect)
55 
56  Q_ENUMS(ScrollEffect);
57 public:
59  explicit ctkComboBox(QWidget* parent = 0);
60  virtual ~ctkComboBox();
61 
63  void setDefaultText(const QString&);
64  QString defaultText()const;
65 
67  void setDefaultIcon(const QIcon&);
68  QIcon defaultIcon()const;
69 
72  void forceDefault(bool forceDefault);
73  bool isDefaultForced()const;
74 
77  void setElideMode(const Qt::TextElideMode& newMode);
78  Qt::TextElideMode elideMode()const;
79 
81  enum ScrollEffect
82  {
92  ScrollWithNoVScrollBar
93  };
96  ScrollEffect scrollWheelEffect()const;
99  void setScrollWheelEffect(ScrollEffect scroll);
100 
102  virtual QSize minimumSizeHint()const;
104  virtual QSize sizeHint()const;
105 
106 protected:
108  virtual void paintEvent(QPaintEvent* event);
109  virtual void changeEvent(QEvent* event);
110  virtual void wheelEvent(QWheelEvent* event);
111 
112 protected:
113  QScopedPointer<ctkComboBoxPrivate> d_ptr;
114 
115 private:
116  Q_DECLARE_PRIVATE(ctkComboBox);
117  Q_DISABLE_COPY(ctkComboBox);
118 };
119 
120 #endif
Scrolling is not possible with the mouse wheel.
Definition: ctkComboBox.h:84
ctkComboBox is an advanced QComboBox. It adds multiple features:
Definition: ctkComboBox.h:44
ScrollEffect
turn into flags ?
Definition: ctkComboBox.h:81
QScopedPointer< ctkComboBoxPrivate > d_ptr
Definition: ctkComboBox.h:113
Scrolling is always possible with the mouse wheel.
Definition: ctkComboBox.h:86