OSDN Git Service

QCommandLinkButtonPrivate cleanup
authorIvailo Monev <xakepa10@laimg.moc>
Sat, 8 Jun 2019 11:11:49 +0000 (11:11 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Sat, 8 Jun 2019 11:11:49 +0000 (11:11 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/gui/widgets/qcommandlinkbutton.cpp

index d69d14f..27d8d96 100644 (file)
@@ -102,7 +102,6 @@ public:
 
     void init();
     qreal titleSize() const;
-    bool usingVistaStyle() const;
 
     QFont titleFont() const;
     QFont descriptionFont() const;
@@ -140,12 +139,8 @@ QFont QCommandLinkButtonPrivate::titleFont() const
 {
     Q_Q(const QCommandLinkButton);
     QFont font = q->font();
-    if (usingVistaStyle()) {
-        font.setPointSizeF(12.0);
-    } else {
-        font.setBold(true);
-        font.setPointSizeF(9.0);
-    }
+    font.setBold(true);
+    font.setPointSizeF(9.0);
 
     // Note the font will be resolved against
     // QPainters font, so we need to restore the mask
@@ -204,15 +199,6 @@ int QCommandLinkButtonPrivate::descriptionOffset() const
     return topMargin() + fm.height();
 }
 
-bool QCommandLinkButtonPrivate::usingVistaStyle() const
-{
-    Q_Q(const QCommandLinkButton);
-    //### This is a hack to detect if we are indeed running Vista style themed and not in classic
-    // When we add api to query for this, we should change this implementation to use it.
-    return q->style()->inherits("QWindowsVistaStyle")
-        && !q->style()->pixelMetric(QStyle::PM_ButtonShiftHorizontal);
-}
-
 void QCommandLinkButtonPrivate::init()
 {
     Q_Q(QCommandLinkButton);
@@ -366,16 +352,6 @@ void QCommandLinkButton::paintEvent(QPaintEvent *)
                                   isChecked() ? QIcon::On : QIcon::Off));
 
     //Draw title
-    QColor textColor = palette().buttonText().color();
-    if (isEnabled() && d->usingVistaStyle()) {
-        textColor = QColor(21, 28, 85);
-        if (underMouse() && !isDown())
-            textColor = QColor(7, 64, 229);
-        //A simple text color transition
-        d->currentColor = d->mergedColors(textColor, d->currentColor, 60);
-        option.palette.setColor(QPalette::ButtonText, d->currentColor);
-    }
-
     int textflags = Qt::TextShowMnemonic;
     if (!style()->styleHint(QStyle::SH_UnderlineShortcut, &option, this))
         textflags |= Qt::TextHideMnemonic;