Inspired by Label on QToolBar, possible? I'm trying to develop it. But my button do not blink on click, why?
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();
Aucun commentaire:
Enregistrer un commentaire