[Qt-interest] QPushButton width problems / layout issues
Kustaa Nyholm
Kustaa.Nyholm at planmeca.com
Thu Jun 24 15:54:59 CEST 2010
> You say that the Designer preview shows the buttons correctly but your
> code does not. Does this mean that you are not using the Designer
> generated .ui files in your application? Are you trying to do everything
> in code? It has been a while since I went through this so I don't
> remember the details, but I have had problems trying to duplicate
> Designer generated code in my own code, so I use the .ui files generated
> by Designer in my applications.
To give you the background we are using Qt in an embedded environment
(touch screen, no mouse) so we need (or want) a slight different
menubar from what QMenuBar provides. To do that we simply create
a QWidget with horizontal layout and add buttons to it and a spacer
at the end (or actually before the last button, as we want to have
a help menu at the right end of the menubar).
This should be very simple, and it works except for the button width issue.
If we do this in QtDesigner it works as advertised. But if we do this
in QtDesigner it is not re-usable. Everytime we need a new menu bar
we need to re-create it in the QtDesigner. Also it is difficult to
add features to that menubar. So we want to turn the above described
menubar into a CustomMenuBar widget which contains all the necessary code
and knowledge of the menubar and which we can then use in Designer as
a custom component.
Hope this clarifies the background. Now if I could only get
the buttons to behave, I'd be home early...
br Kusti
More information about the Qt-interest-old
mailing list