qt - How to enable a down arrow on QPushButton? -


By using (with you) method will add a menu and then draw down arrow button style settings).

Is it possible to enable the drawing of the same arrow by any other method? When I click, I would like to use this style button to show a custom popup widget.

You QToolButton instead of QPushButton Use Can and add actions on QToolButton. # include & lt; QWidgetAction & gt; Category myCustomWidgetAction: Public QWidgetAction {Q_OBJECT Public: Clear myCustomWidgetAction (QWidget * parent); Protected: QWidget * createWidget (QWidget * parent); }; myCustomWidgetAction :: myCustomWidgetAction (QWidget * parent): QWidgetAction (parent) {} QWidget * myCustomWidgetAction :: createWidget (QWidget * parent) {myCustomWidget * widget = new myCustomWidget (parent); Return widget; }

You can add it to appear in a pop-up menu to your widget toolButton are:

  myCustomWidgetAction * widgetAction = new myCustomWidgetAction (this ); UI- & gt; ToolButton- & gt; AddAction (widgetAction);   

Your custom widget can be a list of different elements or it may be other widget you can add multiple instances of myCustomWidgetAction toolButton.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -