barnabyr
20th November 2006, 21:49
Hello
I am porting some code from Qt3 to Qt4.
In the Qt3 code I created a QToolBar inside the
constructor of a QMainWindow superclass.
// add actions to invisible tool bar
// toolbar is invisible because parent is 0
QToolBar * qtb = new QToolBar( 0, "qtb");
viewPan_LeftAction->addTo( qtb );
viewPan_Left10Action->addTo( qtb );
viewPan_Left100Action->addTo( qtb );
...
Then I added QActions to a QToolBar using the addTo method.
As it says in the comments the toolbar is invisible due to
a trick that hid it by setting its parent to '0'. BUT the actions
that were all added to it still work !
The reason I wanted that was because I have lots of actions that all do more
or less the same thing (panning an image in varying amounts) that I didn't want
to clutter up my menus with.
How do I get the same functionality in Qt4 ?
I am guessing that I shouldn't use a QToolBar at all but use
QToolButtons ? But how do I add a QToolButton and have it hidden
but still functional ?
Thanks for any insight.
barnaby.
I am porting some code from Qt3 to Qt4.
In the Qt3 code I created a QToolBar inside the
constructor of a QMainWindow superclass.
// add actions to invisible tool bar
// toolbar is invisible because parent is 0
QToolBar * qtb = new QToolBar( 0, "qtb");
viewPan_LeftAction->addTo( qtb );
viewPan_Left10Action->addTo( qtb );
viewPan_Left100Action->addTo( qtb );
...
Then I added QActions to a QToolBar using the addTo method.
As it says in the comments the toolbar is invisible due to
a trick that hid it by setting its parent to '0'. BUT the actions
that were all added to it still work !
The reason I wanted that was because I have lots of actions that all do more
or less the same thing (panning an image in varying amounts) that I didn't want
to clutter up my menus with.
How do I get the same functionality in Qt4 ?
I am guessing that I shouldn't use a QToolBar at all but use
QToolButtons ? But how do I add a QToolButton and have it hidden
but still functional ?
Thanks for any insight.
barnaby.