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.
  • 相关阅读:
    栈和堆的区别【个人总结】
    理解堆与栈
    javacript属性
    Reapeater CommandName ,CommandArgument
    FormsAuthentication.HashPasswordForStoringInConfigFile(str1, str2);
    文件上传处理
    GetJson
    js内置对象
    Debug
    [转]关于一些SPFA的标程
  • 原文地址:https://www.cnblogs.com/IAMSailorMoon/p/15147546.html
Copyright © 2011-2022 走看看