Qt World Summit: Register Today!

Is it possible to make the two widgets in a QSplitter of fixed size

  • I have a layout and QWidget and I have QSplitter with Vertical Orientation

    QVBoxLayout *container_layout = new QVBoxLayout;

    QWidget     *container =        new QWidget;

    I want to make container and bottomWidget of fixed size . Is it possible to make to widgets addWidgets in QSplitter as fixed size

  • Yes it is, as you probably already know by now, because adding the fixed size to your already existing widgets is a one-liner.

  • Lifetime Qt Champion


    Out of curiosity, why use a splitter if you want to fixe the size of your widgets ?

  • It is requirement from our marketing and could you let me know what is that one liner code . because I do not know yet

  • Lifetime Qt Champion

    So they basically want an unusable splitter ?

    You would already have that answer by searching fixed in the documentation.

  • @SGaist said:

    searching setWindowTitle(title);

    //creating two splitters
    d_horSplitter =   new QSplitter;
    d_verSplitter =   new QSplitter;
    /* creating the refresh button at the bottom*/
    QWidget *bottomWidget = new QWidget;
    /* to make the refresh button as of fixed size*/

    and it is working .

    <My question is that the correct way to do the same or is there a better to make the vertical splitter locked

  • Lifetime Qt Champion

    setFixedHeight would be cleaner.

    It's the only solution I know but like I wrote: having a locked splitter is counter intuitive and will make your users pretty angry.

Log in to reply