diff options
-rw-r--r-- | vcl/inc/qt5/Qt5Graphics_Controls.hxx | 3 | ||||
-rw-r--r-- | vcl/qt5/Qt5Graphics_Controls.cxx | 36 |
2 files changed, 7 insertions, 32 deletions
diff --git a/vcl/inc/qt5/Qt5Graphics_Controls.hxx b/vcl/inc/qt5/Qt5Graphics_Controls.hxx index 50d1de3b1cec..2676fa6413a4 100644 --- a/vcl/inc/qt5/Qt5Graphics_Controls.hxx +++ b/vcl/inc/qt5/Qt5Graphics_Controls.hxx @@ -31,12 +31,9 @@ class VCLPLUG_QT5_PUBLIC Qt5Graphics_Controls final : public vcl::WidgetDrawInterface { - std::unique_ptr<QPushButton> m_focusedButton; std::unique_ptr<QImage> m_image; QRect m_lastPopupRect; - void initStyles(); - public: Qt5Graphics_Controls(); diff --git a/vcl/qt5/Qt5Graphics_Controls.cxx b/vcl/qt5/Qt5Graphics_Controls.cxx index 491c12e657ba..bee5c33dc0e2 100644 --- a/vcl/qt5/Qt5Graphics_Controls.cxx +++ b/vcl/qt5/Qt5Graphics_Controls.cxx @@ -21,7 +21,6 @@ #include <QtGui/QPainter> #include <QtWidgets/QApplication> -#include <QtWidgets/QPushButton> #include <QtWidgets/QStyle> #include <QtWidgets/QStyleOption> #include <QtWidgets/QFrame> @@ -65,7 +64,7 @@ static QStyle::State vclStateValue2StateFlag(ControlState nControlState, return nState; } -Qt5Graphics_Controls::Qt5Graphics_Controls() { initStyles(); } +Qt5Graphics_Controls::Qt5Graphics_Controls() {} bool Qt5Graphics_Controls::isNativeControlSupported(ControlType type, ControlPart part) { @@ -78,8 +77,9 @@ bool Qt5Graphics_Controls::isNativeControlSupported(ControlType type, ControlPar case ControlType::Radiobutton: case ControlType::Checkbox: - case ControlType::Pushbutton: return (part == ControlPart::Entire) || (part == ControlPart::Focus); + case ControlType::Pushbutton: + return (part == ControlPart::Entire); case ControlType::ListHeader: return (part == ControlPart::Button); @@ -250,21 +250,10 @@ bool Qt5Graphics_Controls::drawNativeControl(ControlType type, ControlPart part, if (type == ControlType::Pushbutton) { - if (part == ControlPart::Entire) - { - QStyleOptionButton option; - draw(QStyle::CE_PushButton, &option, m_image.get(), - vclStateValue2StateFlag(nControlState, value)); - } - else if (part == ControlPart::Focus) - { - QStyleOptionButton option; - option.state = QStyle::State_HasFocus; - option.rect = m_image->rect(); - QPainter painter(m_image.get()); - m_focusedButton->style()->drawControl(QStyle::CE_PushButton, &option, &painter, - m_focusedButton.get()); - } + assert(part == ControlPart::Entire); + QStyleOptionButton option; + draw(QStyle::CE_PushButton, &option, m_image.get(), + vclStateValue2StateFlag(nControlState, value)); } else if (type == ControlType::Menubar) { @@ -1038,15 +1027,4 @@ bool Qt5Graphics_Controls::hitTestNativeControl(ControlType nType, ControlPart n return false; } -void Qt5Graphics_Controls::initStyles() -{ - // button focus - m_focusedButton.reset(new QPushButton()); - QString aHighlightColor = QApplication::palette().color(QPalette::Highlight).name(); - QString focusStyleSheet("background-color: rgb(0,0,0,0%); border: 1px; border-radius: 2px; " - "border-color: %1; border-style:solid;"); - focusStyleSheet.replace("%1", aHighlightColor); - m_focusedButton->setStyleSheet(focusStyleSheet); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |