Mercurial > trustbridge
diff ui/certificateitemwidget.cpp @ 1234:ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 24 Sep 2014 16:25:27 +0200 |
parents | 6594e8e63a25 |
children | 265583011f24 |
line wrap: on
line diff
--- a/ui/certificateitemwidget.cpp Wed Sep 24 15:49:27 2014 +0200 +++ b/ui/certificateitemwidget.cpp Wed Sep 24 16:25:27 2014 +0200 @@ -11,6 +11,27 @@ #include <QDebug> #include <QStyleFactory> #include <QToolButton> +#include <QSignalBlocker> + +void CheckLessToolBtn::paintEvent(QPaintEvent * pe) { + + /* Hack to always paint the button as if it were + * not checked. */ + bool oldchecked = isChecked(); + QIcon oldIcon = icon(); + QIcon tmpIcon; + if (isEnabled()) + tmpIcon = QIcon(oldIcon.pixmap(QSize(48, 48), QIcon::Normal, oldchecked ? QIcon::On : QIcon::Off)); + else { + tmpIcon = QIcon(oldIcon.pixmap(QSize(48, 48), QIcon::Disabled, oldchecked ? QIcon::On : QIcon::Off)); + } + QSignalBlocker blk(this); + setChecked(false); + setIcon(tmpIcon); + QToolButton::paintEvent(pe); + setIcon(oldIcon); + setChecked(oldchecked); +} CertificateItemWidget::CertificateItemWidget(QWidget *parent, const Certificate &cert, @@ -22,12 +43,12 @@ mCertificate = cert; mOriginalState = state; btn->setCheckable(true); - btn->setStyleSheet("QToolButton:Checked{" +/* btn->setStyleSheet("QToolButton:Checked{" "border: 1px solid #8f8f91;" "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," "stop: 0 #f6f7fa, stop: 1 #dadbde);" "}" - ); + );*/ setState(state); setupGUI(); }