summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-09-16 17:56:46 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-09-17 13:26:39 +0200
commite8b1e7e3192c258c21f01b85d52b698fe43c73e0 (patch)
tree12e558ab35e307981e4ec192630fc83cd9e0d4ec /tests/auto
parent615b92008a7e6673bc74ec6e971a6bca5f5c81f6 (diff)
Fix warning from shadowing virtual function
QToolButton::initStyleOption is const. Apply some DRY while at it. Change-Id: If29a52e828bbc2aa58df2852c4c434545acfef3e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp31
1 files changed, 11 insertions, 20 deletions
diff --git a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp
index 6111d5b0dd..32003f2124 100644
--- a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp
+++ b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp
@@ -61,6 +61,17 @@ private:
QPointer<QWidget> m_menu;
};
+class MyToolButton : public QToolButton
+{
+ friend class tst_QToolButton;
+public:
+ void initStyleOption(QStyleOptionToolButton *option) const override
+ {
+ QToolButton::initStyleOption(option);
+ }
+};
+
+
tst_QToolButton::tst_QToolButton()
{
}
@@ -150,16 +161,6 @@ void tst_QToolButton::triggered()
void tst_QToolButton::collapseTextOnPriority()
{
- class MyToolButton : public QToolButton
- {
- friend class tst_QToolButton;
- public:
- void initStyleOption(QStyleOptionToolButton *option)
- {
- QToolButton::initStyleOption(option);
- }
- };
-
MyToolButton button;
button.setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
QAction action(button.style()->standardIcon(QStyle::SP_ArrowBack), "test", 0);
@@ -178,16 +179,6 @@ void tst_QToolButton::task230994_iconSize()
{
//we check that the iconsize returned bu initStyleOption is valid
//when the toolbutton has no parent
- class MyToolButton : public QToolButton
- {
- friend class tst_QToolButton;
- public:
- void initStyleOption(QStyleOptionToolButton *option)
- {
- QToolButton::initStyleOption(option);
- }
- };
-
MyToolButton button;
QStyleOptionToolButton option;
button.initStyleOption(&option);