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

Strange problem with layout



  • Hi guys,
    i have two strange problems with my layout.

    My layout is like this:

    @
    this->mainLayout = new QHBoxLayout();
    this->setLayout(this->mainLayout);
    this->itemView = new QTableView();
    this->mainLayout->addWidget(itemView);
    menuLayout = new QVBoxLayout();
    this->mainLayout->addLayout(menuLayout);
    mapsLayout = new QHBoxLayout();
    view=new QWebView(ythis)
    mapsLayout->addWidget(view);
    this->mainLayout->addLayout(mapsLayout);
    @

    Now i would to remove the mapsLayout from the mainLayout. I tried all method of the documentation but noone seems works fine.

    An other problem is that the mapsLayout is displayed vertically. Why? It 's a QHBoxLayout. I would to display it horizontally, under my QTableView.

    This is th screenshot:

    !http://imageshack.us/photo/my-images/825/screenshotkz.png/()!



  • Regarding your second question:

    I think your understanding of the layout terminology is backwards: a horizontal layout lays out items in a horizontal row, whereas a vertical layout lays out items in a vertical column. It sounds to me like you want a QVBoxLayout, if you want the widgets to be added beneath the QTableView.



  • Yes Chris i'm sorry, you're right.
    I thought the problem was that originally i would only the menuLayout displayed vertically, then i changed my mind and i am going to display all with vertical layout.

    I'm sorry.
    Thanks
    Luca


Log in to reply