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. QWidgetFactory in PyQt5

QWidgetFactory in PyQt5

Scheduled Pinned Locked Moved Unsolved Qt for Python
15 Posts 5 Posters 1.4k Views 1 Watching
  • 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.
  • ? This user is from outside of this forum
    ? This user is from outside of this forum
    Guest
    wrote on last edited by
    #1

    Hi, I'm working on a project for which I'm supposed to port the scripts from python2 and Qt3 to python3 and Qt5, and i'v come to the last point where i need to have the classe "QWidgetFactory" in Qt5 in order to throw my GUI but the problem is that i didn't found it anywhere.
    In python2 it was called like that " from qtui import QWidgetFactory " so i hope if someone can help me to find its equivalent in python3 and Qt5.

    JonBJ 1 Reply Last reply
    0
    • ? Guest

      Hi, I'm working on a project for which I'm supposed to port the scripts from python2 and Qt3 to python3 and Qt5, and i'v come to the last point where i need to have the classe "QWidgetFactory" in Qt5 in order to throw my GUI but the problem is that i didn't found it anywhere.
      In python2 it was called like that " from qtui import QWidgetFactory " so i hope if someone can help me to find its equivalent in python3 and Qt5.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      Guest said in QWidgetFactory in PyQt5:

      QWidgetFactory

      Google for Qt5 QWidgetFactory.
      You will see at Qt4.8 https://doc.qt.io/archives/qt-4.8/porting4.html#qwidgetfactory

      QWidgetFactory

      The QWidgetFactory class has been replaced by QFormBuilder in Qt 4.

      and QFormBuilder is still in Qt5 at https://doc.qt.io/qt-5/qformbuilder.html.

      You might also want to read through e.g. Saving and loading a form in PyQt5 with QFormBuilder.

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Ay CH
        wrote on last edited by
        #3

        I have this problem now : AttributeError: 'QFormBuilder' object has no attribute 'create'

        JonBJ 1 Reply Last reply
        0
        • A Ay CH

          I have this problem now : AttributeError: 'QFormBuilder' object has no attribute 'create'

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @Ay-CH
          Well there is no QFormBuilder::create() method.
          Nobody said the code from QWidgetFactory to QFormBuilder would be identical, you have to port/upgrade from Qt3 to later....

          1 Reply Last reply
          1
          • A Offline
            A Offline
            Ay CH
            wrote on last edited by
            #5

            fen = loadMainWidget(default_conf.path.ui+"clickme.ui")

            fen.connect(fen.children("quit"), pyqtSignal(), qApp.quit)
            fen.connect(fen.child("startICT"), pyqtSignal("clicked()"), onTest_1)
            fen.connect(fen.child("goldenICT"), pyqtSignal("clicked()"), onMasterICT)
            fen.connect(fen.child("R_R_ICT"), pyqtSignal("clicked()"), onTestRR)

            AttributeError: 'QMainWindowFactory' object has no attribute 'connect' ?

            how can i fixe that please i'm blocked here for a long time ?

            JonBJ 1 Reply Last reply
            0
            • A Ay CH

              fen = loadMainWidget(default_conf.path.ui+"clickme.ui")

              fen.connect(fen.children("quit"), pyqtSignal(), qApp.quit)
              fen.connect(fen.child("startICT"), pyqtSignal("clicked()"), onTest_1)
              fen.connect(fen.child("goldenICT"), pyqtSignal("clicked()"), onMasterICT)
              fen.connect(fen.child("R_R_ICT"), pyqtSignal("clicked()"), onTestRR)

              AttributeError: 'QMainWindowFactory' object has no attribute 'connect' ?

              how can i fixe that please i'm blocked here for a long time ?

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #6

              @Ay-CH
              There is no such Qt class as QMainWindowFactory, and never has been.

              Separately, I have no idea what your syntax for connect() is. I have never used Qt3. In PyQt5 connects are done as

              self.qobjectvariable.signal.connect(self.slot)
              

              e.g.

              self.pushbutton.clicked.connect(self.onPushbutton_click)
              
              1 Reply Last reply
              1
              • A Offline
                A Offline
                Ay CH
                wrote on last edited by
                #7

                I replaced it with mainWindow, is there a way to associate the QmainWindow with the signals? If so can you show me how? because the compiler shows me that Qmainwindow object has no attribute 'connect' without using the self because i'm working out of the classe ?

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

                  Hi,

                  Because with PyQt or PySide, it's the signal objects that have the connect method as shown by the examples of @JonB.

                  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
                  0
                  • A Offline
                    A Offline
                    Ay CH
                    wrote on last edited by
                    #9

                    qApp.lock()
                    AttributeError: 'QApplication' object has no attribute 'lock' ? what's the solution in Qt5 please ?
                    @JonB @SGaist ?

                    jsulmJ 1 Reply Last reply
                    0
                    • A Ay CH

                      qApp.lock()
                      AttributeError: 'QApplication' object has no attribute 'lock' ? what's the solution in Qt5 please ?
                      @JonB @SGaist ?

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @Ay-CH said in QWidgetFactory in PyQt5:

                      qApp.lock()

                      What do you need this for?
                      There is no such thing in Qt4/Qt5/Qt6.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        Ay CH
                        wrote on last edited by
                        #11

                        As i said in my fist message, i'm working in a project that was wirtten in python2 and i should write with python3, qApp.lock() was written in the last project

                        jsulmJ 1 Reply Last reply
                        0
                        • A Ay CH

                          As i said in my fist message, i'm working in a project that was wirtten in python2 and i should write with python3, qApp.lock() was written in the last project

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          @Ay-CH There is no such thing in newer Qt versions - they do not have global lock. Simply remove qApp.lock() or replace it with https://doc.qt.io/qt-5/qmutexlocker.html depending on the needs of you app.

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          2
                          • A Offline
                            A Offline
                            Ay CH
                            wrote on last edited by
                            #13

                            Hello,

                            Here, I would like to be able to load an interface from a ui file in the same window by clicking on a button for example.

                            I have searched the Web and I have not found any help on this yet it is something recurring in many applications.

                            I would like to know if anyone has succeeded and how they did it...

                            Thank you very much for taking the time to read.

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              Ay CH
                              wrote on last edited by
                              #14

                              hello,

                              What's the equivalent of QCustomEvent in PyQt5 ?

                              Thank you very much for taking the time to read.
                              @JonB @SGaist @jsulm

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

                                See the porting recommendation for Qt 4 (doing it will make it work with Qt 5).

                                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
                                1

                                • Login

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