C++ (Qt) QToolBar* ptb = new QToolBar("Sample ToolBar"); QMenu* pmFile = new QMenu("&File"); this->addToolBar(ptb); menuBar()->addMenu(pmFile); QAction* actions[3]={.....}; pmFile->addAction(actions[0]);/// 1 экшн в меню ptb->addAction(actions[1]);/// 1 экшн на тулбаре ///1 экшн и в меню и на тулбаре : pmFile->addAction(actions[2]); ptb->addAction(actions[2]);
C++ (Qt)QAction *act1 = new QAction(...);QAction *act2 = new QAction(...);QAction *act3 = new QAction(...); connect( act1, SIGNAL( triggered() ), SLOT( slot_act1() ) );connect( act2, SIGNAL( triggered() ), SLOT( slot_act2() ) );connect( act3, SIGNAL( triggered() ), SLOT( slot_act3() ) ); pmFile->addAction( act1 );pmFile->addAction( act3 ); ptb->addAction( act2 );ptb->addAction( act3 );