vcl/inc/qt5/Qt5Graphics_Controls.hxx |    3 --
 vcl/qt5/Qt5Graphics_Controls.cxx     |   36 ++++++-----------------------------
 2 files changed, 7 insertions(+), 32 deletions(-)

New commits:
commit 24ead97534d7fde86c3593705f36a39e7e7cbb08
Author:     Jan-Marek Glogowski <glo...@fbihome.de>
AuthorDate: Thu Jul 11 02:22:16 2019 +0000
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Tue Jul 16 00:27:34 2019 +0200

    Qt5 drop special QPushButton handling
    
    Basically reverts commit 3f0dbdd61df ("Draw button focus so that
    it doesn't obscure the actual button") and declares qt5 doesn't
    support an extra native focus for a button.
    
    LO's own "ant" focus is prevented by Qt5Data::Qt5Data():
    
    pSVData->maNWFData.mbNoFocusRects = true;
    pSVData->maNWFData.mbNoFocusRectsForFlatButtons = true;
    
    Change-Id: Ifdce615cac92f69b008780cf986cdfd0915ccd14
    Reviewed-on: https://gerrit.libreoffice.org/75415
    Tested-by: Jenkins
    Reviewed-by: Katarina Behrens <katarina.behr...@cib.de>
    (cherry picked from commit 77eb3a7ff88c30d6145a3aa6d454d08ed93206df)
    Reviewed-on: https://gerrit.libreoffice.org/75494
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/vcl/inc/qt5/Qt5Graphics_Controls.hxx 
b/vcl/inc/qt5/Qt5Graphics_Controls.hxx
index 50d1de3b1cec..2676fa6413a4 100644
--- a/vcl/inc/qt5/Qt5Graphics_Controls.hxx
+++ b/vcl/inc/qt5/Qt5Graphics_Controls.hxx
@@ -31,12 +31,9 @@
 
 class VCLPLUG_QT5_PUBLIC Qt5Graphics_Controls final : public 
vcl::WidgetDrawInterface
 {
-    std::unique_ptr<QPushButton> m_focusedButton;
     std::unique_ptr<QImage> m_image;
     QRect m_lastPopupRect;
 
-    void initStyles();
-
 public:
     Qt5Graphics_Controls();
 
diff --git a/vcl/qt5/Qt5Graphics_Controls.cxx b/vcl/qt5/Qt5Graphics_Controls.cxx
index 08e57f53f5a6..c82bcdcc7064 100644
--- a/vcl/qt5/Qt5Graphics_Controls.cxx
+++ b/vcl/qt5/Qt5Graphics_Controls.cxx
@@ -21,7 +21,6 @@
 
 #include <QtGui/QPainter>
 #include <QtWidgets/QApplication>
-#include <QtWidgets/QPushButton>
 #include <QtWidgets/QStyle>
 #include <QtWidgets/QStyleOption>
 #include <QtWidgets/QFrame>
@@ -65,7 +64,7 @@ static QStyle::State vclStateValue2StateFlag(ControlState 
nControlState,
     return nState;
 }
 
-Qt5Graphics_Controls::Qt5Graphics_Controls() { initStyles(); }
+Qt5Graphics_Controls::Qt5Graphics_Controls() {}
 
 bool Qt5Graphics_Controls::isNativeControlSupported(ControlType type, 
ControlPart part)
 {
@@ -78,8 +77,9 @@ bool 
Qt5Graphics_Controls::isNativeControlSupported(ControlType type, ControlPar
 
         case ControlType::Radiobutton:
         case ControlType::Checkbox:
-        case ControlType::Pushbutton:
             return (part == ControlPart::Entire) || (part == 
ControlPart::Focus);
+        case ControlType::Pushbutton:
+            return (part == ControlPart::Entire);
 
         case ControlType::ListHeader:
             return (part == ControlPart::Button);
@@ -250,21 +250,10 @@ bool Qt5Graphics_Controls::drawNativeControl(ControlType 
type, ControlPart part,
 
     if (type == ControlType::Pushbutton)
     {
-        if (part == ControlPart::Entire)
-        {
-            QStyleOptionButton option;
-            draw(QStyle::CE_PushButton, &option, m_image.get(),
-                 vclStateValue2StateFlag(nControlState, value));
-        }
-        else if (part == ControlPart::Focus)
-        {
-            QStyleOptionButton option;
-            option.state = QStyle::State_HasFocus;
-            option.rect = m_image->rect();
-            QPainter painter(m_image.get());
-            m_focusedButton->style()->drawControl(QStyle::CE_PushButton, 
&option, &painter,
-                                                  m_focusedButton.get());
-        }
+        assert(part == ControlPart::Entire);
+        QStyleOptionButton option;
+        draw(QStyle::CE_PushButton, &option, m_image.get(),
+             vclStateValue2StateFlag(nControlState, value));
     }
     else if (type == ControlType::Menubar)
     {
@@ -1050,15 +1039,4 @@ bool 
Qt5Graphics_Controls::hitTestNativeControl(ControlType nType, ControlPart n
     return false;
 }
 
-void Qt5Graphics_Controls::initStyles()
-{
-    // button focus
-    m_focusedButton.reset(new QPushButton());
-    QString aHighlightColor = 
QApplication::palette().color(QPalette::Highlight).name();
-    QString focusStyleSheet("background-color: rgb(0,0,0,0%); border: 1px; 
border-radius: 2px; "
-                            "border-color: %1; border-style:solid;");
-    focusStyleSheet.replace("%1", aHighlightColor);
-    m_focusedButton->setStyleSheet(focusStyleSheet);
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to