Results 1 to 8 of 8

Thread: QDialog and resizing problem...

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDialog and resizing problem...

    Could u please post the relevant code..its really hard to guess the problem, although i think it will be a really trivial one

  2. #2
    Join Date
    Feb 2009
    Posts
    29
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDialog and resizing problem...

    Quote Originally Posted by talk2amulya View Post
    Could u please post the relevant code..its really hard to guess the problem, although i think it will be a really trivial one
    I'll see what I can do. The program is already complete aside from this issue, and I don't think they'd let me just post it. So I'll see if I can create another one that I can post and exhibits the same issue.

  3. #3
    Join Date
    Feb 2009
    Posts
    29
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDialog and resizing problem...

    Ok...found the issue.

    Essentially, I had setup a call to adjustSize() when inserting a row. The call would then shrink the dialog to its _minimum_ size. However, my expectation was that the layout would inquire of the table its minimum size and the table would consider the contents and make an appropriate adjustment so the dialog would not be extremely out of proportion with its data up to the screen resolution available. However, none of that seems to happen, so it just goes it minimum size.

    Eliminating the adjustSize() call fixes the issue. Is there any way to do what I was expecting it to do?

    Then again, thinking about it now...that's probably something undesirable from the user's pov...one of those things that has a good intention but a bad effect...

    TIA,

    Ben

  4. #4
    Join Date
    Feb 2009
    Posts
    29
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDialog and resizing problem...

    I figured out how to reproduce it now. Below is a link to some sample code. Note the code around 'table->insert(...)'. The 'adjustSize()' doesn't seem to bother it, but the calls to adjusting the table size information do. I tested this project on Windows using Qt 4.4.3, but I'm sure it would work the same under Linux too.

    http://tinyurl.com/cfa5w4

    Essentially, what I wanted was to be able to adjust the table cells to the contents, and let the user decide about the size of the dialog. However, doing so seems to adversely affect the size of the dialog itself.

  5. #5
    Join Date
    Feb 2009
    Posts
    29
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDialog and resizing problem...

    Sorry, should have done this as part of the last post...occurred to me just as I hit the 'quick reply' button...

    For completeness - as I'm not going to keep that tarball online forever - here's the specific code that I added to cause the problem again:

    Qt Code:
    1. void testTable::doInsertRow()
    2. {
    3. if (table != NULL)
    4. {
    5. table->insertRow(table->rowCount());
    6. table->resizeColumnsToContents();
    7. table->resizeRowsToContents();
    8. table->adjustSize();
    9. }
    10. adjustSize();
    11. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Resizing a QDialog to the content size
    By Nyphel in forum Qt Programming
    Replies: 8
    Last Post: 15th March 2007, 08:16

Tags for this Thread

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.