Well since I've been searching for a clear answer on this and didn't find it easy to figure out how to do it, anyway, I hope this will help someone in the future.
So if you want to prevent the window from being resized, let it be QWidget or QDialog or QMainWindow, well for me this worked:
Just type in this line in the constructor:
this->setFixedSize(this->size().width(), this->size().height());
Or you can just specify a different size obtained from variables... But that's how it perfectly worked for me, for all my dialogs.
Just another example of how to use it:
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setFixedSize(this->size().width(), this->size().height());
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setFixedSize(this->size().width(), this->size().height());
}
To copy to clipboard, switch view to plain text mode
Hope this is going to be useful for people searching for this in the future.
Bookmarks