0

Is it possible to have the QMenu popup on the left of QToolButton instead of the bottom. I am currently doing something like this

QMenu *menu_contacts = new QMenu("Contacts",this);
menu_contacts->setStyleSheet(menu_sheet.c_str());

QAction *actaddContact = new QAction(menu_contacts);
actaddContact->setText("New Contacts");

ui.toolButton_3->setMenu(menu_contacts);
MistyD
  • 16,373
  • 40
  • 138
  • 240

1 Answers1

0

Add this code in onclicked SLOT of your toolbutton

  menu_contacts->popup(mapToGlobal(ui->toolButton->pos()-
                      QPoint(menu_contacts->sizeHint().width(),0)));
uchar
  • 2,552
  • 4
  • 29
  • 50