vcl/qt5/QtGraphics_Controls.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 0e0054dfd7dbf382325696cefb24a6bc48474293
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Mar 3 07:42:46 2023 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Mar 4 07:42:41 2023 +0000

    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.l...@gmail.com>

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:

Reply via email to