Details
-
Suggestion
-
Resolution: Won't Do
-
Not Evaluated
-
None
-
QDS 1.2.0
Description
Hi,
I am new to Qt Design Studio. I am trying to use the user interface made in Qt Design Studio with PySide2 to work on a desktop application. To start with, I just created a simple button in Qt DS and tried implementing it in PySide2 and got a couple of import errors. I looked for some good tutorials to help me with using Qt DS with PySide2 but could not find any. I also want to learn how to access different elements (eg: Button) within PySide2 that were created using Qt DS. I would really appreciate it if anyone could help me out with this or suggest any good tutorials or any resources to start with.
The directory structure of the Qt DS (Demo) project:
Demo.qml
Demo.qmlproject
Demo.qmlproject.qtds
imports
qtquickcontrols2.conf
Screen01.ui.qml
The directory structure of the PySide2 project (main.py):
Demo.qml
Demo.qmlproject
Demo.qmlproject.qtds
imports
qtquickcontrols2.conf
Screen01.ui.qml
main.py
main.py:
// from PySide2.QtWidgets import QApplication, QMainWindow from PySide2.QtQuick import QQuickView from PySide2.QtCore import QUrl from imports import QtQuick app = QApplication([]) view = QQuickView() url = QUrl("Screen01.ui.qml") view.engine().addImportPath("imports") view.setSource(url) view.show() app.exec_()
Error:
// module "QtStudio3D" is not installed module "Qt.SafeRenderer" is not installed
Screen01.ui.qml
// import QtQuick 2.12 import Demo 1.0 import QtQuick.Controls 2.3 Rectangle { width: Constants.width height: Constants.height color: Constants.backgroundColor Button { id: nameButton x: 136 y: 227 text: qsTr("Button") } }