Solved Pop up menu QT
-
Hey everyone, I'm currently trying to make a notepad in Qt. I want to put a pop up menu to my button like this:
Sorry if it's in italian.
How can I do this in my Qt project? -
@HenkCoder
Alternative:QWidget* popup = new QWidget( button, Qt::Popup ); // position popup in screen coordinates QPoint popupTopLeft = button->mapToGlobal(rect.bottomLeft()); popup->setGeometry(QRect(popupTopLeft , QSize(300,100))); popup->show();
-
Use a QToolButton and add the actions your want.
-
@Christian-Ehrlicher
And how do I do that? -
@HenkCoder said in Pop up menu QT:
And how do I do that?
What exactly? What did you try? Create a QToolBar, add a QToolButton and to this button add the actions you want.
-
@HenkCoder
Alternative:QWidget* popup = new QWidget( button, Qt::Popup ); // position popup in screen coordinates QPoint popupTopLeft = button->mapToGlobal(rect.bottomLeft()); popup->setGeometry(QRect(popupTopLeft , QSize(300,100))); popup->show();