Created
August 23, 2017 19:53
-
-
Save spooky/d494bfcfd9ef74587d0261fc39ea83be to your computer and use it in GitHub Desktop.
qml crash after close
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PyQt5.QtCore import QUrl | |
from PyQt5.QtGui import QGuiApplication | |
from PyQt5.QtQml import QQmlApplicationEngine | |
def run(): | |
app = QGuiApplication(sys.argv) | |
engine = QQmlApplicationEngine() | |
engine.load(QUrl('main.qml')) | |
if not engine.rootObjects(): | |
return -1 | |
return app.exec_() | |
if __name__ == '__main__': | |
sys.exit(run()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import QtQuick 2.7 | |
import QtQuick.Controls 2.0 | |
import QtQuick.Layouts 1.3 | |
import QtQuick.Dialogs 1.2 | |
ApplicationWindow { | |
visible: true | |
width: 640 | |
height: 480 | |
title: qsTr("Hello World") | |
FileDialog { | |
id: fileDialog | |
selectFolder: true | |
onAccepted: { | |
console.log('activated') | |
} | |
} | |
Button { | |
anchors.centerIn: parent | |
text: "Open" | |
onClicked: { | |
fileDialog.open() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment