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>
This commit is contained in:
parent
615b92008a
commit
e8b1e7e319
@ -61,6 +61,17 @@ private:
|
|||||||
QPointer<QWidget> m_menu;
|
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()
|
tst_QToolButton::tst_QToolButton()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -150,16 +161,6 @@ void tst_QToolButton::triggered()
|
|||||||
|
|
||||||
void tst_QToolButton::collapseTextOnPriority()
|
void tst_QToolButton::collapseTextOnPriority()
|
||||||
{
|
{
|
||||||
class MyToolButton : public QToolButton
|
|
||||||
{
|
|
||||||
friend class tst_QToolButton;
|
|
||||||
public:
|
|
||||||
void initStyleOption(QStyleOptionToolButton *option)
|
|
||||||
{
|
|
||||||
QToolButton::initStyleOption(option);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
MyToolButton button;
|
MyToolButton button;
|
||||||
button.setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
button.setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||||
QAction action(button.style()->standardIcon(QStyle::SP_ArrowBack), "test", 0);
|
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
|
//we check that the iconsize returned bu initStyleOption is valid
|
||||||
//when the toolbutton has no parent
|
//when the toolbutton has no parent
|
||||||
class MyToolButton : public QToolButton
|
|
||||||
{
|
|
||||||
friend class tst_QToolButton;
|
|
||||||
public:
|
|
||||||
void initStyleOption(QStyleOptionToolButton *option)
|
|
||||||
{
|
|
||||||
QToolButton::initStyleOption(option);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
MyToolButton button;
|
MyToolButton button;
|
||||||
QStyleOptionToolButton option;
|
QStyleOptionToolButton option;
|
||||||
button.initStyleOption(&option);
|
button.initStyleOption(&option);
|
||||||
|
Loading…
Reference in New Issue
Block a user