COPASI API  4.16.103
CQPushButtonDelegate.h
Go to the documentation of this file.
1 // Copyright (C) 2011 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 #ifndef COPASI_CQPushButtonDelegate
7 #define COPASI_CQPushButtonDelegate
8 
9 #include <QtGui/QStyledItemDelegate>
10 
11 class QAbstractButton;
12 
13 class CQPushButtonDelegate: public QStyledItemDelegate
14 {
15  Q_OBJECT
16 
17 public:
19 
20  CQPushButtonDelegate(const ButtonType & buttonType, QObject *parent = 0);
21  CQPushButtonDelegate(const QIcon & icon, const QString & text, const ButtonType & buttonType, QObject *parent = 0);
22  virtual ~CQPushButtonDelegate();
23 
24  virtual QWidget *createEditor(QWidget * parent,
25  const QStyleOptionViewItem & option,
26  const QModelIndex & index) const;
27 
28  virtual void setEditorData(QWidget * pEditor, const QModelIndex & index) const;
29 
30  virtual void setModelData(QWidget * pEditor,
31  QAbstractItemModel * pModel,
32  const QModelIndex & index) const;
33 
34  virtual void updateEditorGeometry(QWidget * pEditor,
35  const QStyleOptionViewItem & option,
36  const QModelIndex & index) const;
37 
38 protected slots:
39  void slotButtonClicked();
40  void slotEditorDeleted(QObject * pObject);
41 
42 signals:
43  void clicked(const QModelIndex &);
44 
45 private:
46  mutable QIcon mIcon;
47  mutable QString mText;
49 
50  mutable QMap< QAbstractButton * , QModelIndex > mEditorToIndex;
51 };
52 
53 #endif // COPASI_CQPushButtonDelegate
virtual void updateEditorGeometry(QWidget *pEditor, const QStyleOptionViewItem &option, const QModelIndex &index) const
virtual QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
void slotEditorDeleted(QObject *pObject)
CQPushButtonDelegate(const ButtonType &buttonType, QObject *parent=0)
virtual void setEditorData(QWidget *pEditor, const QModelIndex &index) const
QMap< QAbstractButton *, QModelIndex > mEditorToIndex
virtual void setModelData(QWidget *pEditor, QAbstractItemModel *pModel, const QModelIndex &index) const
void clicked(const QModelIndex &)