Inspired by Label on QToolBar, possible? I'm trying to develop it. But my button do not blink on click, why?
I see in the other app looks like the button color gets gray during the click (while pressed) and the normal button gets blue. But my button which is just all an image don't have any behavior during the click.
On the left side is the toolbar using QAction
(question linked above) and on the right side is the code below.
QApplication a(argc, argv);
QMainWindow w;
QToolBar barA;
barA.setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
QWidget widget;
QVBoxLayout vLayout(&widget);
QHBoxLayout hLayout;
vLayout.addLayout(&hLayout);
QPixmap pixmap("../../../on.png");
QIcon ButtonIcon(pixmap);
QPushButton bt;
bt.setIcon(ButtonIcon);
bt.setIconSize(QSize(32,32));
bt.setFixedSize(QSize(32,32));
bt.show();
hLayout.addWidget(&bt);
barA.addWidget(&widget);
QPushButton bt2("clickc");
barA.addWidget(&bt2);
w.addToolBar(&barA);
w.show();
return a.exec();