0
爲什麼不做這項工作?它應該是這樣工作的:當單擊「文件」時,工具欄(不是菜單欄)顯示在菜單欄下方,菜單欄上有不同的按鈕,可以在「文件」菜單中找到,當單擊「編輯」時, 「文件」工具欄被隱藏,並顯示「編輯」工具欄。Qt工具欄和菜單欄
menubar = new MyMenuBar(this);//this is a menubar with "file" and "edit"
menubar->setGeometry(0,0,1100,30);
ftoolbar = new MyFileToolBar(this); // this is a toolbar with buttons that would be
// found in a "file" menu
ftoolbar->setGeometry(0,30,1100,40);
ftoolbar->hide();
etoolbar = new MyEditToolBar(this); // this is a toolbar with buttons that would be
//found in an "edit" menu
etoolbar->setGeometry(0,30,1100,40);
etoolbar->hide();
//here down does not work
connect(menubar->File, SIGNAL(aboutToShow()), ftoolbar, SLOT(show()));
connect(menubar->File, SIGNAL(aboutToHide()), ftoolbar, SLOT(hide()));
connect(menubar->Edit, SIGNAL(aboutToShow()), etoolbar, SLOT(show()));
connect(menubar->Edit, SIGNAL(aboutToHide()), etoolbar, SLOT(hide()));
文件 編輯
沒關係!我解決了它,但由於某種原因,stacko不讓我回答我的問題......所以不要回答。我用aboutToShow()替換觸發(QAction *) –
我有興趣看到菜單欄內的工具欄的屏幕截圖。 – 2011-12-11 07:23:21
@Sosukodo:在菜單欄下方(正常位置)。不在裏面。 – TonyK