mardi 21 avril 2015

Add an Icon to a QAction in toolbar

I'm working with Qt in visual studio. I want to add Icons in the menuBar of my application. Here is what I have so far :

QToolBar *View3DToolBar;
QAction * XYZviewAct;
XYZviewAct = new QAction(tr("3D view"), this);
XYZviewAct->setIcon(QIcon("3dicon.png"));
View3DToolBar->addAction(XYZviewAct);

The menu bar is shown but it doesn't display the Icon.

Has anyone done this using Qt/C++? Could anyone point me to a solution?

Aucun commentaire:

Enregistrer un commentaire