Dcow
Dcow

Reputation: 1463

QQmlApplicationEngine and WindowFlags

Since release Qt5.1, QtQuick.Controls 1.0 module required QQmlApplicationEngine to start. That class automatically load qml-file and setup View. But I cant found how to applyQt::WindowFlags` to that view. Anyone can help?

Upvotes: 0

Views: 1471

Answers (1)

koopajah
koopajah

Reputation: 25582

You can set the flags with the property flags like this for example:

import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Window 2.0

ApplicationWindow {
    title: qsTr("Hello World")
    width: 640
    height: 480

    flags: Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint

    Button {
        text: qsTr("Hello World")
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.verticalCenter: parent.verticalCenter
    }
}

You can of course use QtQuick 2.0 and the modules Controls and Window without having anything autoloading your QML files. I do it by using QQuickView, specifically the method setSource()

Upvotes: 2

Related Questions