PDA

View Full Version : Tool button dropdown



saransiva_ps
1st November 2012, 13:26
I have to create a drop down with only image applied to it. Similar to the one shown below
8385

I'm using QToolButton to achieve this using the following code


m_pPrimitiveToolBar = addToolBar(tr("Primitives"));

m_pPrimitiveToolButton = new QToolButton(m_pPrimitiveToolBar);
m_pPrimitiveToolButton->setGeometry(8, 1, 120, 30);

m_pSphereToolAction = new QAction(QIcon("Resources/UI/icons/Sphere.png"),tr(""), this);
m_pSphereToolAction->setStatusTip(tr("Create Sphere"));

m_pCubeToolAction = new QAction(QIcon("Resources/UI/icons/Cube.png"), tr(""), this);
m_pCubeToolAction->setStatusTip(tr("Create Cube"));

m_pPrimitiveToolButton->setPopupMode(QToolButton::MenuButtonPopup);
m_pPrimitiveToolButton->addAction(m_pSphereToolAction);
m_pPrimitiveToolButton->addAction(m_pCubeToolAction);


I'm getting the following output
8386

Please suggest me the correct way to achieve this.