Results 1 to 2 of 2

Thread: QDialog setting maximum width to content

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2012
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QDialog setting maximum width to content

    Hi,

    I have a dialog with a QTableWidget (among others). User are able to resize the dialog but i would like the maximum width to be equal to the table widget width. The best maximum width of the table widget is when the resize mode of the horizontal header is set to QHeaderView::ResizeToContents.

    A more desierable functionality would be to have QHeaderView::Stretch as the resize mode of the table but still, have the maximum width constrained to content width as if the mode where QHeaderView::ResizeToContents. So when the dialog is resized the table widget is able to shrink but the maximum size would still be constrained, as described above.

    I have no idea how to do this.

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

    Default Re: QDialog setting maximum width to content

    Calculate the width of all the columns in the table and set it (+all margins and frames) as the maximum width of the window widget.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. How to set de maximum width of a QGridLayout?
    By cstr in forum Qt Programming
    Replies: 1
    Last Post: 12th March 2012, 21:46
  2. maximum text width of interval
    By osiris81 in forum Qt Programming
    Replies: 2
    Last Post: 20th January 2010, 14:37
  3. QToolBox width fixed to maximum content width
    By ghorwin in forum Qt Programming
    Replies: 0
    Last Post: 10th July 2009, 09:58
  4. Maximum number of characters in width
    By ralphmerridew in forum Qt Programming
    Replies: 3
    Last Post: 27th May 2008, 01:55
  5. Resizing a QDialog to the content size
    By Nyphel in forum Qt Programming
    Replies: 8
    Last Post: 15th March 2007, 08: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
  •  
Qt is a trademark of The Qt Company.