QWidgetFactory in PyQt5
-
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. -
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#qwidgetfactoryQWidgetFactory
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.
-
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 ?
-
@Ay-CH
There is no such Qt class asQMainWindowFactory
, 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 asself.qobjectvariable.signal.connect(self.slot)
e.g.
self.pushbutton.clicked.connect(self.onPushbutton_click)
-
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 ?
-
@Ay-CH said in QWidgetFactory in PyQt5:
qApp.lock()
What do you need this for?
There is no such thing in Qt4/Qt5/Qt6. -
@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.
-
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.
-
See the porting recommendation for Qt 4 (doing it will make it work with Qt 5).