Results 1 to 10 of 10

Thread: How to resize pushbutton to fit text?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2012
    Posts
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to resize pushbutton to fit text?

    I'm also faced this problem. I searched over all internet and tried all possible combinations. Nothing helped. Such topics usually end with no solution or with words like MasterBLB said: "It must work automatically !" But solution proposed by MasterBLB works, oddly enough. I did some experiments trying to reproduce it and found two partial solutions:
    1. Place at least one spacer on preferred side of button in layout. (Either spacers on both sides for central alignment.) It will give space for growing but limits with parent widget boundaries finally.
    2. Place button directly in layout of topmost-level widget (i.e. QMainWindow or QDialog). Or you can place it in layout which belongs to nested layouts up to the topmost-level widget. That widget must be resizeable, of course.
    I have no explanations for them These are best I found until now. If somebody have better ones, please share your knowledge.

  2. The following user says thank you to jblackarty for this useful post:

    nikhil (22nd June 2012)

Similar Threads

  1. vertical pushbutton text
    By eric in forum Qt Programming
    Replies: 11
    Last Post: 18th April 2019, 19:17
  2. left alignment for pushbutton text
    By BalaQT in forum Qt Programming
    Replies: 7
    Last Post: 22nd September 2009, 08:41
  3. Wrap Text in PUSHBUTTON
    By BalaQT in forum Qt Programming
    Replies: 2
    Last Post: 16th September 2009, 13:54
  4. How to resize window with pushbutton
    By kaydknight in forum Newbie
    Replies: 2
    Last Post: 13th January 2007, 12:17

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
  •  
Qt is a trademark of The Qt Company.