Results 1 to 5 of 5

Thread: PushButton height problem

  1. #1
    Join Date
    Jan 2006
    Location
    Riverside, Rhode Island, USA
    Posts
    245
    Thanks
    52
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default PushButton height problem

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: PushButton height problem

    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.

  3. #3
    Join Date
    Jan 2006
    Location
    Riverside, Rhode Island, USA
    Posts
    245
    Thanks
    52
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: PushButton height problem

    Quote Originally Posted by wysota View Post
    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?

  4. #4
    Join Date
    Jan 2006
    Location
    Riverside, Rhode Island, USA
    Posts
    245
    Thanks
    52
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: PushButton height problem

    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
    Qt Code:
    1. layoutButtonBox = new QHBoxLayout();
    2. buttonGroup = new QButtonGroup( this );
    3. pb1 = new QPushButton ( "F1", this );
    4. pb1->setFont(my);
    5. pb1->setFixedHeight(28);
    6. layoutButtonBox->addWidget( pb1 );
    7.  
    8. pb2 = new QPushButton( "F2", this );
    9. pb2->setFont( pb );
    10. pb2->setFixedHeight(28);
    11. layoutButtonBox->addWidget( pb2 );
    To copy to clipboard, switch view to plain text mode 
    changing the font here "my" to "pb" did not help.
    thanks

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: PushButton height problem

    Looks like you have some font problems. size policies won't help you with that.

  6. The following user says thank you to wysota for this useful post:

    impeteperry (29th January 2007)

Similar Threads

  1. QTextEdit height using Qt3.3.5
    By vermarajeev in forum Qt Programming
    Replies: 3
    Last Post: 15th December 2006, 09:43
  2. Facing problem with Q3Canvas
    By jnana in forum Qt Programming
    Replies: 3
    Last Post: 6th May 2006, 08:00
  3. height()
    By mickey in forum Newbie
    Replies: 1
    Last Post: 22nd March 2006, 21:32
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 22:36
  5. Replies: 16
    Last Post: 7th March 2006, 16:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.