PDA

View Full Version : stretch label of QCheckBox



tuli
28th April 2013, 10:30
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):

8998

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.

saman_artorious
28th April 2013, 13:55
You need to customize QCheckBox mouse press event to fit your own.
http://qt-project.org/doc/qt-4.8/eventsandfilters.html

tuli
28th April 2013, 22:18
there is no way to just make the label grow like a textbox?

saman_artorious
29th April 2013, 07:37
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.