zoukankan      html  css  js  c++  java
  • QToolButton弹出菜单

    QToolButton弹出菜单

     1 QToolButton *toolButton= new QToolButton;
     2 QMenu *menu = new QMenu();
     3 menu->addMenu(tr("菜单1"));
     4 menu->addMenu(tr("菜单2"));
     5 menu->addMenu(tr("菜单3"));
     6 toolButton->setIcon(QPixmap("images//menupic.png"));
     7 toolButton->setIconSize(QPixmap( "images//menupic.png").size());
     8 toolButton->setToolButtonStyle( Qt::ToolButtonTextUnderIcon);
     9 toolButton->setPopupMode(QToolButton::InstantPopup );
    10 toolButton->setMenu(menu);

    弹出菜单的弹出方式有3种:

    Constant Value Description
    QToolButton::DelayedPopup 0 After pressing and holding the tool button down for a certain amount of time (the timeout is style dependent, see QStyle::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.
  • 相关阅读:
    zigbee芯片
    笔记本ubuntu安装wifi驱动(未完成)
    我错了的N个学习
    《华为工作法》读书笔记
    bbblack的网络socket通信实验
    NB-IOT连接移动onenet平台流程
    移动onenet基础通信套件V1.08版本的AT指令测试
    CC3200使用MQTT的SSL加密证书可用日期修改
    利尔达NB-IOT模块烧写固件的步骤
    树莓派相机
  • 原文地址:https://www.cnblogs.com/IAMSailorMoon/p/15147546.html
Copyright © 2011-2022 走看看