summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2020-10-21 17:40:09 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2020-10-22 12:22:09 +0200
commitc519dd2ea19cb6c53c29aeeb67e263f6b9f832b2 (patch)
treef567fa87154f2f561a310f102d387134a6abaa27
parent3f7515258e91266f10e5c7bafee2d3d6fa9c91c2 (diff)
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@fbihome.de>
-rw-r--r--include/vcl/salnativewidgets.hxx2
-rw-r--r--vcl/qt5/Qt5Graphics_Controls.cxx5
-rw-r--r--vcl/source/control/button.cxx2
3 files changed, 9 insertions, 0 deletions
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;