comparison ui/certificateitemwidget.cpp @ 1241:4692f8860a24

Merged.
author Emanuel Schuetze <emanuel@intevation.de>
date Wed, 24 Sep 2014 17:50:23 +0200
parents ad4fc3649ffb
children 265583011f24
comparison
equal deleted inserted replaced
1240:17aa7cf0bedd 1241:4692f8860a24
9 9
10 #include <QHBoxLayout> 10 #include <QHBoxLayout>
11 #include <QDebug> 11 #include <QDebug>
12 #include <QStyleFactory> 12 #include <QStyleFactory>
13 #include <QToolButton> 13 #include <QToolButton>
14 #include <QSignalBlocker>
15
16 void CheckLessToolBtn::paintEvent(QPaintEvent * pe) {
17
18 /* Hack to always paint the button as if it were
19 * not checked. */
20 bool oldchecked = isChecked();
21 QIcon oldIcon = icon();
22 QIcon tmpIcon;
23 if (isEnabled())
24 tmpIcon = QIcon(oldIcon.pixmap(QSize(48, 48), QIcon::Normal, oldchecked ? QIcon::On : QIcon::Off));
25 else {
26 tmpIcon = QIcon(oldIcon.pixmap(QSize(48, 48), QIcon::Disabled, oldchecked ? QIcon::On : QIcon::Off));
27 }
28 QSignalBlocker blk(this);
29 setChecked(false);
30 setIcon(tmpIcon);
31 QToolButton::paintEvent(pe);
32 setIcon(oldIcon);
33 setChecked(oldchecked);
34 }
14 35
15 CertificateItemWidget::CertificateItemWidget(QWidget *parent, 36 CertificateItemWidget::CertificateItemWidget(QWidget *parent,
16 const Certificate &cert, 37 const Certificate &cert,
17 bool state, 38 bool state,
18 QToolButton *btn) : 39 QToolButton *btn) :
20 mButton(btn) 41 mButton(btn)
21 { 42 {
22 mCertificate = cert; 43 mCertificate = cert;
23 mOriginalState = state; 44 mOriginalState = state;
24 btn->setCheckable(true); 45 btn->setCheckable(true);
25 btn->setStyleSheet("QToolButton:Checked{" 46 /* btn->setStyleSheet("QToolButton:Checked{"
26 "border: 1px solid #8f8f91;" 47 "border: 1px solid #8f8f91;"
27 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," 48 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
28 "stop: 0 #f6f7fa, stop: 1 #dadbde);" 49 "stop: 0 #f6f7fa, stop: 1 #dadbde);"
29 "}" 50 "}"
30 ); 51 );*/
31 setState(state); 52 setState(state);
32 setupGUI(); 53 setupGUI();
33 } 54 }
34 55
35 void CertificateItemWidget::setupGUI() 56 void CertificateItemWidget::setupGUI()

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