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

Resizing widgets in the window having minimumsize



  • Hi All,

    I want to arrange my widgets in the window row-wise with a minimum size so that when the outer window is dragged, the widgets take up the space of the window row-wise (not lower than the minimum dimension).

        int n=4;
        QWidget *myWidget = new QWidget();
        QGridLayout *tableLayout = new QGridLayout();
        QMap<int, QTableWidget *>myTables;
        for (int ii=0;ii<n;ii++)
        { myTables[ii]=new QTableWidget();
          //myTables[ii]->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
          tableLayout->addWidget(myTables[ii],0,ii);
        }
            myWidget->setLayout(tableLayout);
            QMainWindow::setCentralWidget(myWidget);
            myWidget->adjustSize();
    
    

    The following code seems not to be working in this case.

      //myTables[ii]->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
    
    

    Can anyone suggest me how to achieve it?