pyqt / python-qt5

Unofficial PyQt5 via PyPI for Python 2.7 64-bit on Windows
GNU General Public License v3.0
280 stars 78 forks source link

QQmlApplicationEngine failed to load component #3

Closed mottosso closed 9 years ago

mottosso commented 9 years ago

QML isn't being picked up.

The issue is resolved by creating a qt.conf file at c:\Python27 with this content:

[Paths]
Prefix = C:/Python27/Lib/site-packages/PyQt5

I'd ideally keep everything within the PyQt5 package, but at least there is a simple solution available. Is there an environment variable available for Prefix?

madoodia commented 9 years ago

I remember that i used this before for interact with qml folder and plugin folder, in qt.conf

[Paths] Prefix = C:/Python27/Lib/site-packages/PyQt5 Binaries = C:/Python27/Lib/site-packages/PyQt5 Plugins = C:/Python27/Lib/site-packages/PyQt5/plugins

On Mon, Sep 29, 2014 at 8:32 PM, Marcus Ottosson notifications@github.com wrote:

QML isn't being picked up.

The issue is resolved by creating a qt.conf file at c:\Python27 with this content:

[Paths] Prefix = C:/Python27/Lib/site-packages/PyQt5

I'd ideally keep everything within the PyQt5 package, but at least there is a simple solution available. Is there an environment variable available for Prefix?

— Reply to this email directly or view it on GitHub https://github.com/pyqt/python-qt5/issues/3.

Bests, madoodia

mottosso commented 9 years ago

Here it's working fine with just the Prefix variable. Can you try removing the others and see if it works for you?

madoodia commented 9 years ago

it works for me for the following example with just prefix

main.qml

import QtQuick 2.0 import QtQuick.Controls 1.0

ApplicationWindow { id: root width: 350 height: 450 title: "Pyblish" Rectangle { id: window width: parent.width height: parent.height color: "#00aa00" } }

launcher.py

import sysimport os from PyQt5.QtWidgets import QApplicationfrom PyQt5.QtQml import QQmlApplicationEngine if name == 'main': full_directory = os.path.dirname(os.path.abspath(file)) app = QApplication(sys.argv) engine = QQmlApplicationEngine() qml_file = os.path.join(full_directory, "main.qml") engine.load(str(qml_file))

window = engine.rootObjects()[0]
window.show()
sys.exit(app.exec_())

but i mention it when we need to use plugins

btw, it works fine for me

i’m testing it with pyblish-qml ​

On Mon, Sep 29, 2014 at 9:05 PM, Marcus Ottosson notifications@github.com wrote:

Here it's working fine with just the Prefix variable. Can you try removing the others and see if it works for you?

— Reply to this email directly or view it on GitHub https://github.com/pyqt/python-qt5/issues/3#issuecomment-57197867.

Bests, madoodia

madoodia commented 9 years ago

Very nice pyblish-qml works fine and show me the window without any error in a VM that just have python, VCredist2013 and python-qt5 installed as PyQt5 package.

thanks

On Mon, Sep 29, 2014 at 9:10 PM, Mahmoodreza Aarabi madoodia@gmail.com wrote:

it works for me for the following example with just prefix

main.qml

import QtQuick 2.0 import QtQuick.Controls 1.0

ApplicationWindow { id: root width: 350 height: 450 title: "Pyblish" Rectangle { id: window width: parent.width height: parent.height color: "#00aa00" } }

launcher.py

import sysimport os from PyQt5.QtWidgets import QApplicationfrom PyQt5.QtQml import QQmlApplicationEngine if name == 'main': full_directory = os.path.dirname(os.path.abspath(file)) app = QApplication(sys.argv) engine = QQmlApplicationEngine() qml_file = os.path.join(full_directory, "main.qml") engine.load(str(qml_file))

window = engine.rootObjects()[0]
window.show()
sys.exit(app.exec_())

but i mention it when we need to use plugins

btw, it works fine for me

i’m testing it with pyblish-qml ​

On Mon, Sep 29, 2014 at 9:05 PM, Marcus Ottosson <notifications@github.com

wrote:

Here it's working fine with just the Prefix variable. Can you try removing the others and see if it works for you?

— Reply to this email directly or view it on GitHub https://github.com/pyqt/python-qt5/issues/3#issuecomment-57197867.

Bests, madoodia

Bests, madoodia

mottosso commented 9 years ago

Solved with 0.1.6

QML and inner binaries - e.g. qmlscene.exe - works fine too.