comparison ui/certificateitemwidget.h @ 1106:6f7b7d88f048

(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 15 Sep 2014 17:43:56 +0200
parents 2b3526ef2d69
children 9bb9932bb819
comparison
equal deleted inserted replaced
1105:0c60ec9c2461 1106:6f7b7d88f048
12 * @brief Item delegate drawing custom certificate items in list views. 12 * @brief Item delegate drawing custom certificate items in list views.
13 * 13 *
14 */ 14 */
15 #include <QWidget> 15 #include <QWidget>
16 #include <QLabel> 16 #include <QLabel>
17 #include <QComboBox>
18 17
19 #include "certificate.h" 18 #include "certificate.h"
20 /** @brief A combo box that shows the text only in the popup
21 *
22 * The text shown is the data set as Qt::UserRole
23 */
24 class IconOnlyTextPopupBox : public QComboBox
25 {
26 protected:
27 virtual void showPopup();
28 virtual void hidePopup();
29 };
30 19
20 class QToolButton;
31 21
32 class CertificateItemWidget : public QWidget 22 class CertificateItemWidget : public QWidget
33 { 23 {
34 Q_OBJECT 24 Q_OBJECT
35 public: 25 public:
36 CertificateItemWidget( 26 CertificateItemWidget(
37 QWidget *parent = 0, 27 QWidget *parent = 0,
38 const Certificate &cert = Certificate(), 28 const Certificate &cert = Certificate(),
39 bool state = false, 29 bool state = false,
40 bool editable = true, 30 QToolButton * btn = NULL);
41 const QString& installLabel = QString(),
42 const QString& removeLabel = QString());
43 31
44 bool state(); 32 bool state();
45 void setState(bool state); 33 void setState(bool state);
46 Certificate *certificate(); 34 Certificate *certificate();
47 35
48 private: 36 private:
49 void setupGUI(); 37 void setupGUI();
50 38
51 Certificate mCertificate; 39 Certificate mCertificate;
52 bool mState; 40 bool mState;
53 bool mEditable;
54 QLabel *mLabel; 41 QLabel *mLabel;
55 IconOnlyTextPopupBox *mComboBox; 42 QToolButton *mButton;
56 QString mInstallLabel;
57 QString mRemoveLabel;
58 43
59 private slots: 44 private slots:
60 void currentStateChanged(int ndx); 45 void currentStateChanged(bool state);
61 46
62 signals: 47 signals:
63 void stateChanged(bool state, const Certificate &cert); 48 void stateChanged(bool state, const Certificate &cert);
64 }; 49 };
65 #endif 50 #endif

http://wald.intevation.org/projects/trustbridge/