From d3ed5a8d6b3c86844532927c6450ffddc63549a3 Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Thu, 11 Jul 2019 02:45:32 +0000 Subject: Qt5 fix drawing of the toolbar handle This is visible in Writer, where the 2nd toolbar misses the handle. Change-Id: Iddf3a002c9d75f668c40977cf02671640b38f083 Reviewed-on: https://gerrit.libreoffice.org/75417 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski --- vcl/qt5/Qt5Graphics_Controls.cxx | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'vcl') diff --git a/vcl/qt5/Qt5Graphics_Controls.cxx b/vcl/qt5/Qt5Graphics_Controls.cxx index 32a2d132efc5..08e57f53f5a6 100644 --- a/vcl/qt5/Qt5Graphics_Controls.cxx +++ b/vcl/qt5/Qt5Graphics_Controls.cxx @@ -399,24 +399,20 @@ bool Qt5Graphics_Controls::drawNativeControl(ControlType type, ControlPart part, } else if ((type == ControlType::Toolbar) && (part == ControlPart::ThumbVert || part == ControlPart::ThumbHorz)) - { // reduce paint area only to the handle area + { + // reduce paint area only to the handle area const int handleExtend = QApplication::style()->pixelMetric(QStyle::PM_ToolBarHandleExtent); QStyleOption option; - option.state = vclStateValue2StateFlag(nControlState, value); - - QPainter painter(m_image.get()); + QRect aRect = m_image->rect(); if (part == ControlPart::ThumbVert) { - option.rect = QRect(0, 0, handleExtend, widgetRect.height()); - painter.setClipRect(widgetRect.x(), widgetRect.y(), handleExtend, widgetRect.height()); - option.state |= QStyle::State_Horizontal; + aRect.setWidth(handleExtend); + option.state = QStyle::State_Horizontal; } else - { - option.rect = QRect(0, 0, widgetRect.width(), handleExtend); - painter.setClipRect(widgetRect.x(), widgetRect.y(), widgetRect.width(), handleExtend); - } - QApplication::style()->drawPrimitive(QStyle::PE_IndicatorToolBarHandle, &option, &painter); + aRect.setHeight(handleExtend); + draw(QStyle::PE_IndicatorToolBarHandle, &option, m_image.get(), + vclStateValue2StateFlag(nControlState, value), aRect); } else if (type == ControlType::Editbox || type == ControlType::MultilineEditbox) { -- cgit