[Qt-interest] how to make word wraping on QPushButton, QRadioButton and QCheckBox?

Peng Shaoxi shaoxi.peng at gmail.com
Wed Dec 3 20:06:33 CET 2008


Trolltech support guy give me a work around like this:

    QPushButton button;
    QHBoxLayout layout;
    button.setLayout(&layout);
    QLabel label("LOOOOOOOOOOOOOOOOOONGGGGGGGGGGG TEXXXXXXXXXT");
    label.setWordWrap(true);
    layout.addWidget(&label);
    button.show();

I think this method is more simple than implementing paintEvent of
QPushButton or QStyle.

On Mon, Dec 1, 2008 at 11:22 PM, Ankit Agarwal <ankit17.ag at gmail.com> wrote:
> Hi Peng,
> I do not know how to do this but I think that if you have a look at the
> source of the Qxt package, then you may get some clue.
>
> On Tue, Dec 2, 2008 at 3:58 AM, Peng Shaoxi <shaoxi.peng at gmail.com> wrote:
>>
>> Hello forum,
>>
>> I want word wraped on QPushButton, QRadioButton and QCheckBox, just
>> like QLabel does. Now I combine a QLabel with QRadioButton/QCheckBox
>> (to use its indicator, QRadioButton has no text) to create a composite
>> widget, but this widget is not perfect, if I set a style sheet rule to
>> QLabel, the label inside this composite widget will be affected too. I
>> think there must be other better ways to do it, any advice is welcome.
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>
> --
> Regards,
> Ankit Agarwal
> SW Engineer
> Vegayan Systems
> email : ankit_agarwal at vegayan.com
> Blog : http://ankit17.wordpress.com
>



More information about the Qt-interest-old mailing list