Results 1 to 3 of 3

Thread: layout for display functions

  1. #1
    Join Date
    Feb 2006
    Posts
    87
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default layout for display functions

    hey there i am making a grid layout and i have 2 QLineEdit displayboxs with 1 under the other. is there a way to make the display boxes smaller in width:

    Qt Code:
    1. display = new QLineEdit("0");
    2. display->setReadOnly(true);
    3. display->setAlignment(Qt::AlignCenter);
    4. display->setMaxLength(10);
    5. display->installEventFilter(this);
    6. QFont font = display->font();
    7. font.setPointSize(font.pointSize() + 8);
    8. display->setFont(font);
    9.  
    10. display2 = new QLineEdit("0");
    11. display2->setReadOnly(true);
    12. display2->setAlignment(Qt::AlignCenter);
    13. display2->setMaxLength(10);
    14. display2->installEventFilter(this);
    15. QFont font2 = display2->font();
    16. font2.setPointSize(font2.pointSize() + 8);
    17. display2->setFont(font2);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: layout for display functions

    Set size hints for the line edits or use spacer items to "pack" them to a certain corner.

  3. #3
    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: layout for display functions

    You can use different sizePolicy settings to manipulate the behaviour of widgets.

Similar Threads

  1. changing layout of a widget
    By mikro in forum Qt Programming
    Replies: 10
    Last Post: 4th August 2009, 20:21
  2. Qt like Layout Manager available for .NET platform
    By vkhaitan in forum Qt Programming
    Replies: 0
    Last Post: 5th November 2008, 13:36
  3. Qt layout memory issue
    By bunjee in forum Qt Programming
    Replies: 9
    Last Post: 25th August 2007, 17:11
  4. Resizing problems when applying a layout
    By JimBrown in forum Newbie
    Replies: 1
    Last Post: 21st February 2007, 22:54
  5. "dynamic" layout
    By hulk in forum Qt Programming
    Replies: 2
    Last Post: 9th May 2006, 07:16

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.