Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLNodeComboBoxDelegate.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Kitware Inc.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  This file was originally developed by Benjamin Long, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qMRMLNodeComboBoxDelegate_h
22 #define __qMRMLNodeComboBoxDelegate_h
23 
24 //QT includes
25 #include <QItemDelegate>
26 
27 // MRMLWidgets includes
28 #include "qMRMLWidgetsExport.h"
29 
37 
39 
40 class QComboBox;
41 
42 class QMRML_WIDGETS_EXPORT qMRMLNodeComboBoxDelegate : public QItemDelegate
43 {
44  Q_OBJECT
45 public :
46  typedef QItemDelegate Superclass;
47  qMRMLNodeComboBoxDelegate(QObject* parent, QComboBox* comboBox);
48 
49  static bool isSeparator(const QModelIndex &index);
50  static void setSeparator(QAbstractItemModel *model, const QModelIndex &index);
51 
52 protected:
56  virtual void paint(QPainter *painter,
57  const QStyleOptionViewItem &option,
58  const QModelIndex &index) const;
59 
60  virtual QSize sizeHint(const QStyleOptionViewItem &option,
61  const QModelIndex &index) const;
62 
63  virtual void drawDisplay(QPainter *painter,
64  const QStyleOptionViewItem &option,
65  const QRect &rect,
66  const QString &text) const;
67 
68  virtual void drawFocus(QPainter *painter,
69  const QStyleOptionViewItem &option,
70  const QRect &rect) const;
71 
72 private:
73  QComboBox* mCombo;
74  Q_DISABLE_COPY(qMRMLNodeComboBoxDelegate);
75 };
76 
77 #endif // __qMRMLNodeComboBoxDelegate_h