Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QHBoxLayout and QTreeWidgetItem



  • Hi all,

    I have encountered this behavior which I do not understand.

    @
    QWidget *layoutWidget = new QWidget;

    QHBoxLayout *layout = new QHBoxLayout;
    layoutWidget->setLayout(layout);

    QPushButton *cancelButton = new QPushButton("Cancel");
    layout->addWidget(cancelButton);

    QPushButton *okButton = new QPushButton("Ok");
    layout->addWidget(okButton);

    QTreeWidgetItem *item = new QTreeWidgetItem(parent);
    this->setItemWidget(item,0,layoutWidget);
    @

    And the result is that the height of the row which contains two buttons is too small and buttons are not fully visible.

    Can anyone explain me what is wrong with the code above?

    Thanks,

    Tomas



  • This is a total shot in the dark, but perhaps check if your QTreeWidget has the "uniformRowHeights" flag set?


Log in to reply