Results 1 to 4 of 4

Thread: stretch label of QCheckBox

  1. #1
    Join Date
    Jul 2012
    Posts
    248
    Thanks
    29
    Thanked 15 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default stretch label of QCheckBox

    I ave several checkboxed with short (2 chars) labels. There would be enough space for longer text, but that doesnt make sense.
    However, it would be convenient for the user to have a longer checkbox label, even if it is empty.


    For example, see the attached screenshot (not my program):

    cursorcheck.png

    Even though the cursor is at the arrow way off the checkbox label, the checkbox is highlighted and will be un.checked when the user clicks.

    I was unable to create such behavior using Qt layouts. Even though the labels appear to stretch in the dsigner, they snap to the smallest possible length when executed.

  2. #2
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Thanks
    15
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: stretch label of QCheckBox

    You need to customize QCheckBox mouse press event to fit your own.
    http://qt-project.org/doc/qt-4.8/eventsandfilters.html

  3. #3
    Join Date
    Jul 2012
    Posts
    248
    Thanks
    29
    Thanked 15 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: stretch label of QCheckBox

    there is no way to just make the label grow like a textbox?

  4. #4
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Thanks
    15
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: stretch label of QCheckBox

    Quote Originally Posted by tuli View Post
    there is no way to just make the label grow like a textbox?
    It is, just stretch it. but you also need to define press event for it.

Similar Threads

  1. QCheckBox with long text label
    By Ferdous in forum Newbie
    Replies: 5
    Last Post: 29th October 2011, 19:05
  2. Stretch Last Section
    By skizzik in forum Qt Programming
    Replies: 1
    Last Post: 10th January 2011, 14:45
  3. Can Layouts Stretch to Fit?
    By kylemhall in forum Newbie
    Replies: 2
    Last Post: 17th December 2009, 15:37
  4. QCheckbox label
    By drkbkr in forum Qt Programming
    Replies: 1
    Last Post: 19th January 2009, 19:58
  5. stretch QTableWodgetItem
    By Shawn in forum Qt Programming
    Replies: 5
    Last Post: 5th September 2007, 09:49

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.