Different icons for checkable QPushButton is not works on Linux and Android
Hello. I want to make different icons for checked and unchecked state of QPushButton. The code:
Code:
MainWindow
::MainWindow(QWidget *parent
){
widget->setLayout(layout1);
setCentralWidget(widget);
icon1.
addFile(QStringLiteral
(":/norecord.png"),
QSize(),
QIcon::Normal,
QIcon::Off);
icon1.
addFile(QStringLiteral
(":/active.png"),
QSize(),
QIcon::Normal,
QIcon::On);
button1->setCheckable(true);
button1->setText("Sample Text");
button1->setIcon(icon1);
layout1->addWidget(button1);
}
I use Qt 5.15.2. This code works in Windows, but not in Linux and Android, there always shows an icon for a unchecked state.
On Qt 5.11.3 and earlier versions it worked.
As far as I could understand, the problem causes this code in the Fusion style, file src/widgets/styles/qfusionstyle.cpp:
Code:
case CE_PushButtonLabel:
// no PM_ButtonShiftHorizontal and PM_ButtonShiftVertical for fusion style
b.state &= ~(State_On | State_Sunken);
}
break;
I want to ask: Is it a correct code? Is it a bug or style feature?
Re: Different icons for checkable QPushButton is not works on Linux and Android
Re: Different icons for checkable QPushButton is not works on Linux and Android
Quote:
Originally Posted by
ChristianEhrlicher
Yes, Fusion. Thanks. Fixed at 6.1...