summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-03-03 07:42:46 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2023-03-04 07:42:41 +0000
commit0e0054dfd7dbf382325696cefb24a6bc48474293 (patch)
treee77ead337f57cf5447de8d377f8978088c6158ff
parent5b9089a23757805ffdc852944d6483cf0db15121 (diff)
tdf#153803 qt: Let Qt style draw combobox popup borders
... and listbox popup borders as well. Declare suppport for native drawing of focus for pushbuttons, since the Qt-based VCL plugins take care of drawing focus for controls. As far as I can see, there is no need to actually implement drawing of focus separately for the Qt-based VCL plugins, though, since that is already handled by the `ControlState::FOCUSED` state when drawing the entire control. Support for this is what `ComboBox::ImplInit` and `ListBox::ImplInit` check and if it's not supported, they enable double buffering for the window (which would have the result that the `pWin` in `ImplDrawFrame` in vcl/source/window/decoview.cxx would be nullptr and thus no native drawing of the frame would happen), s.a. commit d4714b0fdb81e6e561ae526cc517ecc9a40a603e Date: Mon Jun 17 17:02:54 2019 +0200 tdf#101978 vcl combobox/listbox floating window: avoid flicker With this in place, the border in the popup windows for listboxes and comboboxes are drawn by the Qt style. Yet another way to achieve this would be to support drawing `ControlPart::ListboxWindow` for `ControlType::Listbox`, so that the other rendering path in `ImplSmallBorderWindowView::DrawWindow` is taken, but that is currently complicated by the fact that bounding and content rect are not really used consequently there, so that would have to be cleaned up first, s.a. the commit message in commit 5c96e813bed3293605f8d746f188cc051d1e5949 Date: Thu Feb 2 15:27:37 2023 +0000 tdf#150451 Fix borders in Editbox controls (kf5) for more details. Change-Id: I8cd2396e7075a475e53e016acbb16d6fb54bad2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148160 Tested-by: Jenkins Reviewed-by: Rafael Lima <rafael.palma.lima@gmail.com>
-rw-r--r--vcl/qt5/QtGraphics_Controls.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/vcl/qt5/QtGraphics_Controls.cxx b/vcl/qt5/QtGraphics_Controls.cxx
index d3ebf5e34bf4..81ab7a7edc7b 100644
--- a/vcl/qt5/QtGraphics_Controls.cxx
+++ b/vcl/qt5/QtGraphics_Controls.cxx
@@ -91,11 +91,10 @@ bool QtGraphics_Controls::isNativeControlSupported(ControlType type, ControlPart
case ControlType::ListNode:
return (part == ControlPart::Entire);
+ case ControlType::Pushbutton:
case ControlType::Radiobutton:
case ControlType::Checkbox:
return (part == ControlPart::Entire) || (part == ControlPart::Focus);
- case ControlType::Pushbutton:
- return (part == ControlPart::Entire);
case ControlType::ListHeader:
return (part == ControlPart::Button);
@@ -310,6 +309,11 @@ bool QtGraphics_Controls::drawNativeControl(ControlType type, ControlPart part,
if (type == ControlType::Pushbutton)
{
const PushButtonValue& rPBValue = static_cast<const PushButtonValue&>(value);
+ if (part == ControlPart::Focus)
+ // Nothing to do. Drawing focus separately is not needed because that's
+ // already handled by the ControlState::FOCUSED state being set when
+ // drawing the entire control
+ return true;
assert(part == ControlPart::Entire);
QStyleOptionButton option;
if (nControlState & ControlState::DEFAULT)
@@ -740,6 +744,8 @@ bool QtGraphics_Controls::getNativeControlRegion(ControlType type, ControlPart p
retVal = true;
}
}
+ else if (part == ControlPart::Focus)
+ retVal = true;
break;
case ControlType::Editbox:
case ControlType::MultilineEditbox: