Can't resize window



  • I've got a window but I can't drag to resize it. Also, the usual 'X' close button is not there so I have to close the application through the debugger. I think these are probably related.

    I think I have used the correct Window flags but seems to have no effect.

    import QtQuick 2.9
    import QtQuick.Window 2.2
    import QtQuick.Controls 2.2
    import QtQuick.Layouts 1.3
    import QtQuick.Controls.Styles 1.4
    
    Window {
        id: window
        visible: true
        width: 900
        height: 900
        flags: Qt.Window | Qt.WindowTitleHint | Qt.WindowCloseButtonHint
        title: qsTr("SLD Quick")
    
    

    Can anyone help?


  • Moderators

    @fraz
    how exactly are you displaying this QML code? Meaning how does your main() look like?

    flags: Qt.Window | Qt.WindowTitleHint | Qt.WindowCloseButtonHint

    Also those extra provided flags are already contained in the Qt.Window flag, so actually you can leave the whole property definition out. Or do you have anything special in mind?



  • The current program is very barebones at the moment as I'm just starting to learn how to use Qt Quick. Here's what main.cpp looks like:

    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    #include <QQuickStyle>
    
    int main(int argc, char *argv[])
    {
    #if defined(Q_OS_WIN)
        QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    #endif
    
        QGuiApplication app(argc, argv);
        QQmlApplicationEngine engine;
        QQuickStyle::setStyle("Fusion");
        engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
        if (engine.rootObjects().isEmpty())
            return -1;
    
        return app.exec();
    }
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.