I have a QtQuick2.0/QtQuick2.1 application with following default codes on main.cpp
:
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QtQuick2ApplicationViewer viewer;
viewer.setMainQmlFile(QStringLiteral("qml/WikiTransferor2/mainMode3.qml"));
viewer.showExpanded();
return app.exec();
}
How can i make this window not resizable?
On (at least) KDE the other answers don't work. The following QtQuick solution worked for me:
ApplicationWindow{
width: ...
height: ...
maximumHeight: height
maximumWidth: width
minimumHeight: height
minimumWidth: width
}
For those coming here from google like me, searching for a QML/QtQuick solution, because they are using the ApplicationWindow
Item, I add this answer.
Simply set the maximum height/width to the minimum height/width:
ApplicationWindow {
visible: true
maximumHeight: minimumHeight
maximumWidth: minimumWidth
[...]
}
Please note that you should not deactivate the window resizing if there are other possibilities (like resizing the content). The users don't like unresizable windows. For instance, in my case, I only locked the height - because I had the possibility to resize some elements in their width: My QML Slider uses as much space as there is available thanks to QtQuick Layouts. However, resizing a few Buttons and a slider in their height would not make sense. TableViews, TextFields etc., however, are predestinated for being resized.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With