Results 1 to 12 of 12

Thread: QLineEdit and QPushButton heights

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2013
    Posts
    34
    Thanks
    1

    Default QLineEdit and QPushButton heights

    Hello,

    I created simple QHboxLayout in Qt Creator's Design which contains QLineEdit and QPushButton as follows:

    hierarchy.png

    and which looks like:

    align.png

    Please, can someone tell me why has the button larger bounding box height than the button? Both of the widgets have the same visible height but the button keeps growing the parent layout.

    In other words, where is the button's padding coming from and how to make it to have no padding?
    Last edited by ecir.hana; 9th April 2013 at 19:38.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QLineEdit and QPushButton heights

    The height of the horizontal layout is the height given to it by the widget/layout it is in after considering size constraints that may apply (derived from its contents). In this example that is not related to the height of either the line edit or the button. The central widget does not have a layout to control the size at the moment anyway.

    If you want the line edit/button widget to occupy the top of a larger space the layout offers them then set that. In Designer you access layout alignment from the right-click context menu of the widget.

Similar Threads

  1. different row heights in QTreeView
    By Qiieha in forum Qt Programming
    Replies: 2
    Last Post: 3rd October 2012, 15:08
  2. Replies: 2
    Last Post: 2nd May 2011, 08:10
  3. Replies: 4
    Last Post: 15th September 2010, 00:22
  4. Replies: 3
    Last Post: 28th January 2007, 17:24
  5. QTableView row heights
    By Brandybuck in forum Qt Programming
    Replies: 8
    Last Post: 7th November 2006, 03:08

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.