[Qt-interest] How to set action`s position in QMenu

Justus Best just18 at gmx.de
Wed May 19 13:36:24 CEST 2010


Hi,
not really sure if this will do the trick, but as QMenu is a QWidget I 
think you may just QMenu::setLayout(new QFormLayout()).
And then add 1 4 2 5 3 6.
But this is not tested.

Greets
Justus

Am 19.05.2010 12:20, schrieb ja chen:
> i have a problem with QMenu,
> defaultly,actions will be added to QMenu if use code 
> "some_menu->addAction(some_action)"
> In my program.i did this work like follows. i want to set the special 
> action to the
> appropriate position in QMenu where this position is i wanted.
> such as I add 6 action into QMenu.
> QAction* action1=new QAction("1");
> QAction* action2=new QAction("2");
> QAction* action3=new QAction("3");
> ....
> QAction* action6=new QAction("6");
> QMenu *menu = new QMenu;
> menu->addAction(action1);
> menu->addAction(action2);
> ...
> menu->addAction(action6);
> after execute code above.menu will look like below:
> action1
> action2
> action3
> action4
> action5
> action6
> the aim i wanted is:
> action1 action4
> action2 action5
> action3 action6
> make action4,5,6 to the next column in the same menu.
> how can i make this,if anyone know about this problem, please tell me 
> how to do, i appreciate.
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100519/7878a1e4/attachment.html 


More information about the Qt-interest-old mailing list