QPushButton* button = new QPushButton("Click Me", this); button->setMinimumSize(100, 50);
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { setMinimumSize(800, 600); // other code... }In this example, a custom QMainWindow subclass is created and its constructor sets the minimum size of the window to 800x600 pixels using the setMinimumSize function. This ensures that the window cannot be resized to a smaller size than this. Package/Library: Qt Library.