QToolButton設定彈出選單
轉自:http://blog.csdn.net/ny13524/article/details/3790112
QToolButton設定彈出選單
QToolButton *toolButton= new QToolButton;
QMenu *menu=new QMenu();
menu->addMenu(tr("0"));
menu->addMenu(tr("1"));
menu->addMenu(tr("3"));
toolButton->setIcon( QPixmap( "images//photo1.png" ) );
toolButton->setIconSize( QPixmap( "images//photo1.png").size() );
toolButton->setToolButtonStyle( Qt::ToolButtonTextUnderIcon);
toolButton->setPopupMode(QToolButton::InstantPopup );
toolButton->setMenu(menu);
彈出選單的彈出方式有以下幾種模式參考(參考Qt4.1.0參考文件):
ToolButtonPopupMode
Describes how a menu should be popped up for tool buttons that has a menu set or contains a list of actions.
Constant | Value | Description |
---|---|---|
QToolButton::DelayedPopup | 0 | After pressing and holding the tool button down for a certain amount of time (the timeout is style dependant, seeQStyle::SH_ToolButton_PopupDelay), the menu is displayed. A typical application example is the "back" button in some web browsers's tool bars. If the user clicks it, the browser simply browses back to the previous page. If the user presses and holds the button down for a while, the tool button shows a menu containing the current history list |
QToolButton::MenuButtonPopup | 1 | In this mode the tool button displays a special arrow to indicate that a menu is present. The menu is displayed when the arrow part of the button is pressed. |
QToolButton::InstantPopup | 2 | The menu is displayed, without delay, when the tool button is pressed. In this mode, the button's own action is not triggered. |
相關文章
- UITextView定製彈出選單UITextView
- 左鍵彈出選單
- 彈彈彈,彈走魚尾紋的彈出選單(vue)Vue
- MFC彈出選單隱藏解決
- Flutter | 超實用簡單選單彈出框 PopupMenuButtonFlutter
- ios 仿android的popupwindow彈出選單iOSAndroid
- 我第一個做好的彈出選單
- Path實現常見toolbar點選彈出選單效果
- Sublime 選單設定漢化
- 長按tableViewCell彈出選單欄貼上板View
- 滑鼠觸動能自動彈出的選單
- win10右鍵選單彈出方向怎麼自定義_win10如何自定義右鍵選單彈出方向Win10
- mac選單欄設定教程Mac
- QToolButton更平滑QT
- 利用transform實現一個純CSS彈出選單ORMCSS
- js如何防止自帶右鍵選單的彈出JS
- 用VB編寫一個彈出選單類 (轉)
- 點選文字框彈出可檢索下拉選單程式碼例項
- qt 設定選單欄顏色QT
- Delphi製作帶圖示的彈出式選單 (轉)
- 金蝶雲星空——過濾介面文字框彈出選單介面
- 設定radio單選按鈕預設選中
- 設定select下拉選單的預設選中項
- 如何設定select下拉選單可以多選
- 直播原始碼網站,點選分類調起選單欄並彈出原始碼網站
- flash呼叫攝像頭彈出設定框監聽
- win 11取消鎖屏的彈出的廣告設定
- JavaScript動態設定select下拉選單預設選項JavaScript
- 如何不使用js實現滑鼠hover彈出選單效果JS
- 製作可以自動隱藏的彈出式選單 (轉)
- WPF ContentMenu控制元件 這裡也可以彈出選單控制元件
- 點選任意View彈出PickerView
- (四)選單導航及路由設定路由
- 設定CCLabelTTF,選單字型顏色
- javascript點選彈出可以關閉帶有灰色背景彈出層JavaScript
- function模式設定ALV用彈出視窗顯示Function模式
- 鴻蒙js開發7 鴻蒙分組列表和彈出menu選單鴻蒙JS
- Win8截圖工具快速擷取彈出選單的方法