[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyQt] PyQt can't load a qml file wih import QtQuick.Dialogs in it
From: Fabian Sturm <f () rtfs ! org>
Date: 2015-01-29 17:40:48
Message-ID: 20150129184048.80016i3ivh51n5kw () xenon ! rtfs ! org
[Download RAW message or body]
This message is in MIME format.
Hello!
It seems I triggered another bug.
The following example hangs the program on Ubuntu 14.10 with qt 5.4.3.
The offending line is the import QtQuick.Dialogs 1.2
If I remove that line it works again. Any ideas whats wrong with the code?
Thanks, Fabian
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
["main.py" (text/x-python)]
import os
import sys
from PyQt5 import QtCore, QtQml, QtQuick, QtWidgets
# FIXME: clean this up
osname = os.name.lower()
sysplatform = sys.platform.lower()
windows = osname == "nt" and sysplatform.startswith("win")
app = QtWidgets.QApplication(sys.argv)
# Create the QML engine
engine = QtQml.QQmlEngine(app)
engine.quit.connect(app.quit)
component = QtQml.QQmlComponent(engine)
currentFilePath = os.path.dirname(os.path.abspath(__file__))
mainFilepath = os.path.join(currentFilePath, "app.qml")
if windows:
mainFilepath = mainFilepath.replace('\\', '/')
qmlFile = QtCore.QUrl("file:///" + mainFilepath)
component.loadUrl(qmlFile)
topLevelItem = component.create()
topLevelItem.show()
sys.exit(app.exec_())
["app.qml" (text/x-java)]
import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.2
ApplicationWindow {
id: mainWindow
title: "Main program"
width: 600; height: 300
Label { text: "Title" }
}
[Attachment #5 (text/plain)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic