Set pixels of RowWrapPolicy::WrapLongRows



  • I've got a QFormLayout, and I would like to wrap the rows.
    I'm sorry, I'm not that familiar with the layouts.

    Is it possible to set a fixed size for the first row of the QFormLayout? E.g. that the labels should not get wider than 100 pixels?

    Or is it possible to set the pixels of the RowWrapPolicy::WrapLongRows, so that it wraps the row when the text is wider than 100 pixels?



  • Something like this?:
    @
    QFormLayout *formLayout = new QFormLayout;
    formLayout->addRow(tr("&Name:"), nameLineEdit);
    ...
    formLayout->setRowWrapPolicy(QFormLayout::WrapLongRows);
    setLayout(formLayout);
    @
    or:

    You have to use sizeHint() with QSizePolicy::Maximum.
    Probably this is better, because you can set it to max 100px.

    [edit, please use @ tags, Eddy]



  • Thank you for your answer!
    I have tried @formLayout->setRowWrapPolicy(QFormLayout::WrapLongRows);@ already, but then it only wraps when the whole row is filled by text.

    I'm sorry, but how can I set the sizeHint()? I would like the first column to be fixed and the second column should expand. Or for example set the ratio of the width of the columns (e.g. 1:2).


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.