Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLNodeComboBoxMenuDelegate.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 __qMRMLNodeComboBoxMenuDelegate_h
22 #define __qMRMLNodeComboBoxMenuDelegate_h
23 
24 // Qt includes
25 #include <QAbstractItemDelegate>
26 
27 // MRMLWidgets includes
28 #include "qMRMLWidgetsExport.h"
29 
30 class QComboBox;
31 
42 class QMRML_WIDGETS_EXPORT qMRMLNodeComboBoxMenuDelegate: public QAbstractItemDelegate
43 {
44  Q_OBJECT
45 public:
46  typedef QAbstractItemDelegate Superclass;
47  qMRMLNodeComboBoxMenuDelegate(QObject *parent, QComboBox *cmb);
48 
49 protected:
50  void paint(QPainter *painter,
51  const QStyleOptionViewItem &option,
52  const QModelIndex &index) const override;
53  QSize sizeHint(const QStyleOptionViewItem &option,
54  const QModelIndex &index) const override;
55 
56 private:
60  QStyleOptionMenuItem getStyleOption(const QStyleOptionViewItem &option,
61  const QModelIndex &index) const;
62  QComboBox *mCombo;
63  Q_DISABLE_COPY(qMRMLNodeComboBoxMenuDelegate);
64 };
65 
66 #endif // __qMRMLNodeComboBoxMenuDelegate_h
Abstract Item delegate to show unselectable items highlighed when the mouse is over them to give a fe...