Reputation: 25391
I want to change the size of the MainWindow. If I change the geometry of my Mainwindow to for instance 947 x 504, it is still smaller. Even if I change it a few more times and save the ui data file, it won't change. I am using Qt 5.1.0.
XML Code from mainwindow.ui
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>947</width>
<height>504</height>
</rect>
</property>
<property name="windowTitle">
<string>SpeedReader [BETA]</string>
</property>
<widget class="QWidget" name="centralWidget"/>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>947</width>
<height>21</height>
</rect>
</property>
Upvotes: 2
Views: 4110
Reputation: 6125
You can use the resize() function. As an example, suppose that you want to apply a 1280x1024 resolution to the main window, as your application starts. You can do something like this:
int main( int argc, char **argv )
{
QApplication app( argc, argv );
MainWindow w;
w.resize(1280, 1024);
w.show();
return app.exec();
}
Upvotes: 2