It would help if you attached source files rather of a complete example rather than an intermediate like the ui_*h file.
There's nothing in that ui*h file that would stop the main window from resizing. Using setFixedsize() on the QMainWindow certainly works here:
#include <QApplication>
#include "ui_mainwindow.h" // your file as delivered
namespace Ui {
class MainWindow;
};
{
Q_OBJECT
public:
ui->setupUi(this);
}
private:
Ui::MainWindow *ui;
};
int main(int argc, char *argv[])
{
MainWindow w;
w.show();
w.setFixedSize(463, 251);
a.exec();
}
#include "main.moc"
#include <QApplication>
#include "ui_mainwindow.h" // your file as delivered
namespace Ui {
class MainWindow;
};
class MainWindow: public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *p = 0): QMainWindow(p), ui(new Ui::MainWindow) {
ui->setupUi(this);
}
private:
Ui::MainWindow *ui;
};
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
w.setFixedSize(463, 251);
a.exec();
}
#include "main.moc"
To copy to clipboard, switch view to plain text mode
Since you have use absolute positioning and not used layouts the contents and the container are essentially independent and you forgo much control. The push buttons and edit boxes you placed with Designer are not moving with the widget that contains them as your QMainWindow is resizing it.
Bookmarks