Uploaded image for project: 'Qt Design Studio'
  1. Qt Design Studio
  2. QDS-1656

Using Qt Design Studio UI with PySide2

    XMLWordPrintable

Details

    • Linux/Other display system

    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")
          }
      }
      
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thohartm Thomas Hartmann
            pratik.tayshete pratik.tayshete
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes