[Libreoffice-commits] core.git: include/vcl vcl/qt5 vcl/source

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 22 10:22:50 UTC 2020


 include/vcl/salnativewidgets.hxx |    2 ++
 vcl/qt5/Qt5Graphics_Controls.cxx |    5 +++++
 vcl/source/control/button.cxx    |    2 ++
 3 files changed, 9 insertions(+)

New commits:
commit c519dd2ea19cb6c53c29aeeb67e263f6b9f832b2
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Wed Oct 21 17:40:09 2020 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Oct 22 12:22:09 2020 +0200

    Qt5 forward the flat push button style
    
    Change-Id: I0835f66b8ce478f645ca2e5c376bef9a0740c8c8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104637
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/include/vcl/salnativewidgets.hxx b/include/vcl/salnativewidgets.hxx
index faa273b3f571..75c25d3f0fe0 100644
--- a/include/vcl/salnativewidgets.hxx
+++ b/include/vcl/salnativewidgets.hxx
@@ -519,6 +519,7 @@ public:
         , mbBevelButton(false)
         , mbSingleLine(true)
         , mbIsAction(false)
+        , m_bFlatButton(false)
     {}
 
     virtual ~PushButtonValue() override;
@@ -532,6 +533,7 @@ public:
     bool mbBevelButton:1; // only used on OSX
     bool mbSingleLine:1;  // only used on OSX
     bool mbIsAction:1;
+    bool m_bFlatButton:1;
 };
 
 
diff --git a/vcl/qt5/Qt5Graphics_Controls.cxx b/vcl/qt5/Qt5Graphics_Controls.cxx
index b28734b4aefc..6f88d66a1c3b 100644
--- a/vcl/qt5/Qt5Graphics_Controls.cxx
+++ b/vcl/qt5/Qt5Graphics_Controls.cxx
@@ -306,8 +306,13 @@ bool Qt5Graphics_Controls::drawNativeControl(ControlType type, ControlPart part,
 
     if (type == ControlType::Pushbutton)
     {
+        const PushButtonValue& rPBValue = static_cast<const PushButtonValue&>(value);
         assert(part == ControlPart::Entire);
         QStyleOptionButton option;
+        if (nControlState & ControlState::DEFAULT)
+            option.features |= QStyleOptionButton::DefaultButton;
+        if (rPBValue.m_bFlatButton)
+            option.features |= QStyleOptionButton::Flat;
         draw(QStyle::CE_PushButton, option, m_image.get(), rBackgroundColor,
              vclStateValue2StateFlag(nControlState, value));
     }
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index ead095de7a74..66a399c15bbc 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -999,6 +999,8 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext)
             nButtonStyle &= ~DrawButtonFlags::Pressed;
         }
 
+        if (GetStyle() & WB_FLATBUTTON)
+            aControlValue.m_bFlatButton = true;
         if (GetStyle() & WB_BEVELBUTTON)
             aControlValue.mbBevelButton = true;
 


More information about the Libreoffice-commits mailing list