diff 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
line wrap: on
line diff
--- a/ui/certificateitemwidget.cpp	Wed Sep 24 17:50:09 2014 +0200
+++ b/ui/certificateitemwidget.cpp	Wed Sep 24 17:50:23 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();
 }

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