PDA

View Full Version : PushButton height problem



impeteperry
28th January 2007, 16:23
I have a string of "PushButtons" along the bottom of tha screen.
I set the "minimum height" to 28 and the "maximum height" to 28 as the default height is to small. (I am using 1280x1024 resolution.)
In the "Form>Preview" it comes out fine, but when running the program, the button text is half out of the button at the top.
I am writing a parallel progrom, not using designer, and have the same problem.
Help would be appreciated.

wysota
28th January 2007, 17:36
I don't quite understand what does "half out of the button at the top" mean in this context, but maybe you could overcome the problem by changing the size policy? The button should adapt itself to the font used, so if you use a font suited for your resolution, it should force an appropriate button size.

impeteperry
28th January 2007, 18:46
I don't quite understand what does "half out of the button at the top" mean in this context, but maybe you could overcome the problem by changing the size policy? The button should adapt itself to the font used, so if you use a font suited for your resolution, it should force an appropriate button size.
I only get the botton half of the text.

I will look at the size policy as you suggest, but why the preview in designer works but outside of designer it doesn't?

impeteperry
28th January 2007, 20:17
Looking at "sizePolicy" did not help in designer, but changing the font to "Century Schoolbook L" did. ?????????

I have not had any success with the program that doesn't use designer. I don't understand how or where I should use "setSizePolicy(??)" .

A lot of Qt's documentation is beyond my capability to decipher, particularly Qt-4's.

This is my code
layoutButtonBox = new QHBoxLayout();
buttonGroup = new QButtonGroup( this );
pb1 = new QPushButton ( "F1", this );
pb1->setFont(my);
pb1->setFixedHeight(28);
layoutButtonBox->addWidget( pb1 );

pb2 = new QPushButton( "F2", this );
pb2->setFont( pb );
pb2->setFixedHeight(28);
layoutButtonBox->addWidget( pb2 );
changing the font here "my" to "pb" did not help.
thanks

wysota
28th January 2007, 21:36
Looks like you have some font problems. size policies won't help you with that.