QMenu *menu = new QMenu("FILE"); menu->addAction("test menu item 1"); menu->addAction("test menu item 2"); QToolBar *tbMenu = addToolBar("menu"); tbMenu->setMovable(false); tbMenu->addAction(menu->menuAction());
QToolBar *tbMenu = addToolBar("menu"); tbMenu->setMovable(false); QToolButton *tb = new QToolButton; tb->setText("Файл"); tb->setPopupMode(QToolButton::InstantPopup); tb->setStyleSheet("QToolButton::menu-indicator { width: 0px; }"); tbMenu->addWidget(tb); QMenu *menu = new QMenu("FILE"); menu->addAction("test menu item 1"); menu->addAction("test menu item 2"); tb->setMenu(menu);
QMainWindow wnd;QMenu *menu = new QMenu("FILE");menu->addAction("test menu item 1");menu->addAction("test menu item 2");QToolBar *tbMenu = wnd.addToolBar("menu");tbMenu->setMovable(false);QToolButton *btn = new QToolButton();btn->setDefaultAction(menu->menuAction());btn->setPopupMode(QToolButton::InstantPopup);btn->setStyleSheet("QToolButton::menu-indicator { width: 0px; }");tbMenu->addWidget(btn);wnd.show();
QWidget *wCentral = new QWidget; setCentralWidget(wCentral); QBoxLayout *lCentral = new QVBoxLayout; lCentral->setMargin(0); wCentral->setLayout(lCentral); lCentral->addWidget(viewer = new Viewer,1); lCentral->addWidget(control = new Control); lCentral->setSpacing(0);