Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. PySide2 with Qt Design Studio

PySide2 with Qt Design Studio

Scheduled Pinned Locked Moved Unsolved Qt for Python
9 Posts 4 Posters 2.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pratik Tayshete
    wrote on last edited by
    #1

    I am trying to use the widgets made within Qt Design Studio inside PySide2. For eg, I made a simple button using Qt Design studio and I want to execute some function based on the clicked event triggered by the button. Is there a specific method by which we can use the UI generated in Qt Design Studio with PySide2.

    Demo Project Structure in Qt DS:

    Demo.qml
    Demo.qmlproject
    Demo.qmlproject.qtds
    imports
    qtquickcontrols2.conf
    Screen01.ui.qml

    PySide2 project structure:

    Demo.qml
    Demo.qmlproject
    Demo.qmlproject.qtds
    imports
    qtquickcontrols2.conf
    Screen01.ui.qml
    main.py

    main.py file:

    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_()

    Screen01.ui.qml file:

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

    }

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by SGaist
      #2

      @Denni-0 Qt Design Studio has nothing to do with the old Designer application.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • P Offline
        P Offline
        Pratik Tayshete
        wrote on last edited by
        #3

        I was just trying to create a UI (eg: button) in Qt Design Studio and was looking for a way to integrate the UI with PySide2. So should I make the UI in QML and then use it in PySide2 or is there a way to access the widgets made with Qt Design Studio in PySide2. I would really appreciate any suggestion as I am completely new to PySide2 and Qt.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          Pratik Tayshete
          wrote on last edited by
          #4

          Thanks a lot. Is there a way where we can create widgets or the UI in QtDS and use it in PySide2? I want to use Qt DS to design the UI for a desktop application.

          1 Reply Last reply
          0
          • P Offline
            P Offline
            Pratik Tayshete
            wrote on last edited by
            #5

            Is it possible to use Material design components inside Qt Designer to create UI for a desktop application?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Denni-0 said in PySide2 with Qt Design Studio:

              Okay I am going to assume that you can export your GUI from QtDS much like you can from the Designer but then you will still need to run a conversion (which produces garbate code) that translates it into a version of python-qt that then gets rendered.

              Still again creating something in straight PySide2 is fairly simple and easy so why do you need to complicate things and try to reinvent the wheel so-to-speak

              Don't assume, these are unrelated technologies. QtDS creates QtQuick interfaces which has nothing to do with widgets.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              5
              • B Offline
                B Offline
                BrookCronin
                wrote on last edited by
                #7

                @Denni-0 re - "or does it produce black-box untouchable code as well?" - It produces QML that you can edit as code if you prefer, or use the designer tooling if that's more your thing. Perhaps you should have checked this before writing your post?

                1 Reply Last reply
                3
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Denni-0 said in PySide2 with Qt Design Studio:

                  @BrookCronin said in PySide2 with Qt Design Studio:

                  @Denni-0 re - "or does it produce black-box untouchable code as well?" - It produces QML that you can edit as code if you prefer, or use the designer tooling if that's more your thing. Perhaps you should have checked this before writing your post?

                  Oooo aren't you the snarky one. Perhaps you should not have posted at all since your comment adds nothing to the original post just all negative criticism of someone who does answer questions. Heck if you actually knew more than I did you could have answered the OPs question but you did not. So all I can say is why don't you just crawl back under that useless rock you just poked your head out from under no one cares about this kind of junk.

                  Please stay polite.

                  It is a fact that every time the words Design/Designers appears in a Python related question, you first answer by saying that it is wrong to use that tool and that it generates crap code.

                  In the case of this thread, you did not even tried to check what exactly Qt Design Studio is and what it produces. You assumed something entirely wrong while at the same time criticizing what it produces without doing any verification.

                  Basically, in this thread, you are completely out of context and not helping the OP at all since he would like to run a QtQuick GUI with PySide2 and not one widget based.

                  Everybody can be wrong, so let's stay civilized and constructive.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  4
                  • P Offline
                    P Offline
                    Pratik Tayshete
                    wrote on last edited by
                    #9

                    Thank you @SGaist and @Denni-0 for your advice. I really appreciate it. Can we include material design components for the widgets in PySide2?

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved