Nominate our 2022 Qt Champions!

how to hide the horizontalLayout?

  • Hi, Guys.

    i want hide the horizontalLayout.

    i can't finding setvisible and hide.

  • A layout can not be hidden since they are not widgets and does not have a setVisible() function.

    You have to create a widget that you can hide, that contains the layout and the other widgets that should be hidden, then you hide the widget instead of the layout.

    QWidget* myWidget = new QWidget();
    QHBoxLayout * layout = new QHBoxLayout(myWidget);
    layout->addWidget(new QLabel("Label"));

Log in to reply