![]() Separators at the beginning or the end of the menu are also hidden.īy default, this property is true. This property specifies whether consecutive separators in the menu should be visually collapsed to a single one. This property holds whether consecutive separators should be collapsed. setSeparatorsCollapsible ( collapse ) ¶ Parameters : īy default, if no icon is explicitly set, this property contains a null icon. ![]() This is equivalent to the icon property of the menuAction(). This property holds The icon of the menu. If the QWidgetAction fires the triggered() signal, the menu will close.ĭefaultAction(). Instances of this class are used to hold widgets, and are inserted into menus with the addAction() overload that takes a QAction. ![]() Widgets can be inserted into menus with the QWidgetAction class. When using tear-off menus, bear in mind that the concept isn’t typically used on Microsoft Windows so some users may not be familiar with it. If you want this functionality for a particular menu, insert a tear-off handle with setTearOffEnabled(). This makes it possible for the user to “tear off” frequently used menus and position them in a convenient place on the screen. A tear-off menu is a top-level window that contains a copy of the menu. Ī QMenu can also provide a tear-off menu. You clear a menu with clear() and remove individual action items with removeAction(). In addition, QMenu provides two signals, triggered() and hovered(), which signal the QAction that was triggered from the menu. The receiver will be notified whenever the item is triggered(). When inserting action items you usually specify a receiver and a slot. Separators are inserted with addSeparator(), submenus with addMenu(), and all other items are considered action items. There are four kinds of action items: separators, actions that show a submenu, widgets, and actions that perform an action. The existing actions held by a menu can be found with actions(). In addition, actions can have a text label, an optional icon drawn on the very left side, and shortcut key sequence such as “Ctrl+X”. An action is represented vertically and rendered by QStyle. Actions are added with the addAction(), addActions() and insertAction() functions.
0 Comments
Leave a Reply. |