Results 1 to 7 of 7

Thread: Qt layouting + QLabel's word wrap = bug?

  1. #1
    Join Date
    Aug 2007
    Posts
    16
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Qt layouting + QLabel's word wrap = bug?

    Hi! I'm having an issue with qt layouting system.

    I noticed that if my layout contains qlabel with wordwrap turned on and if text in this label is long enough to become splitted to several lines, then all sizehints of child widgets start to be ignored (it seems) - I can resize widget to be as small as i want - up to having it to disappear (with only window caption left)!

    Is this a bug or something I am missing?

    To reproduce simply do the following:

    1. Create a widget in designer
    2. Put QLabel and QLineEdit to it. Turn word wrap on in QLabel props.
    3. Put them in vertical layout (widget wide)
    4. Enter some space separated words in QLabel so they make new line appear
    5. Press Ctrl-R (preview) and try to resize widget to be small - size hints are ignored!

    Note that this bug appears only while previewing widget in designer or running actual code using it - when you're just editing it in designer - it handles all resizing correctly and doesn't allow you to resize widget less than it's minimumSizeHint().

    What do you think? is this a bug?
    I'm seeing this in qt 4.3.1

  2. #2
    Join Date
    Aug 2007
    Posts
    16
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt layouting + QLabel's word wrap = bug?

    So, no ideas, guys?

  3. #3
    Join Date
    Apr 2006
    Location
    San Francisco, CA
    Posts
    186
    Thanks
    55
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Qt layouting + QLabel's word wrap = bug?

    perhaps a screenshot (or 2) would make it clearer to people what is going on? the steps to reproduce seem a bit ambiguous.
    Software Engineer



  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt layouting + QLabel's word wrap = bug?

    You should be more worried about minimum sizes, not size hints, if you want the widget not to be resized below a given size.

    maybe setMinimumSize(sizeHint()) can help you( it should ). but you have to write some code to do that.

    Regards

  5. #5
    Join Date
    Aug 2007
    Posts
    16
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt layouting + QLabel's word wrap = bug?

    Thanks.
    It helps on Linux & Windows, but doesn't help on Mac - there are a lot of empty space above and beyond label's text.
    And it seems to help only occasionally - in several dialogs it works, in another - doesn't
    Arggg

  6. #6
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt layouting + QLabel's word wrap = bug?

    You must have layouts in the parents widgets in order to have the minimum sizes respected. So probably you don't have layouts set for some widgets.

    Regards

  7. #7
    Join Date
    Aug 2007
    Posts
    16
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt layouting + QLabel's word wrap = bug?

    Nope, I have them
    This makes me mad. For some reason all works in a designer, but breaks in the program run. And all because I *must* have word-wrap turned on in labels. If i turn word wrap off, things immediately start to work like they should.

    qt support team told me that this is a known issue, and it cant be fixed because heightForWidth() was invented for this case. But seems like heightForWidth isn't respected too... I'm lost

Similar Threads

  1. Word wrap in QListView
    By jiveaxe in forum Qt Programming
    Replies: 33
    Last Post: 1st September 2007, 21:06
  2. QListView word wrap
    By serega in forum Qt Programming
    Replies: 17
    Last Post: 30th August 2007, 03:13

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.