Override initStyleOption() for QCommandLinkButton
In QPushButton::initStyleOption() there is no style option feature set to distinguish QCommandLinkButtons. The QStyleOptionButton::CommandLink Button feature is only set during the paintEvent, but in some cases we need to check for this feature before painting. To fix, override initStyleOption for QCommandLinkButton and set the fea ture there. Pick-to: 5.15 6.0 Change-Id: I8831a6be7da642dcf8830812d99681213e7515dc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
86a655387c
commit
d3ee976aca
@ -264,6 +264,12 @@ QSize QCommandLinkButton::minimumSizeHint() const
|
||||
return size;
|
||||
}
|
||||
|
||||
void QCommandLinkButton::initStyleOption(QStyleOptionButton *option) const
|
||||
{
|
||||
QPushButton::initStyleOption(option);
|
||||
option->features |= QStyleOptionButton::CommandLinkButton;
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a command link with no text and a \a parent.
|
||||
*/
|
||||
|
@ -69,6 +69,7 @@ public:
|
||||
QSize sizeHint() const override;
|
||||
int heightForWidth(int) const override;
|
||||
QSize minimumSizeHint() const override;
|
||||
void initStyleOption(QStyleOptionButton *option) const override;
|
||||
|
||||
protected:
|
||||
bool event(QEvent *e) override;
|
||||
|
Loading…
Reference in New Issue
Block a user