Reputation: 361
I need to create a menu example like this when we click to the plus icon
I just created the text.
QMenu *menu = new QMenu(this);
menuicd->addAction("Choose the job from:");
menuicd->addAction("Our job portal");
menuicd->addAction("Our database");
menuicd->addAction("University website");
ui.plusbutton->setMenu(menu);
How can I make the white text with blue background for the options? And how can i add the cancel button in this menu?
Upvotes: 0
Views: 1231
Reputation: 19
If you want to create a custom context menu you can use a style sheet like that:
QMenu
{
border: 1px solid #76797C;
color: #eff0f1;
margin: 2px;
}
QMenu::icon
{
margin: 5px;
}
QMenu::item
{
padding: 5px 30px 5px 30px;
margin-left: 5px;
border: 1px solid transparent; /* reserve space for selection border */
}
But this image is like a QDialog
Upvotes: 1