Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
None
-
5.14.0
-
None
-
-
6baed766545f1ba5c747a067bb8e324f2bb9681a (qt/qtbase/5.14)
Description
I think that PySide2-uic does not call setObjectName() properly when following instructions:
https://doc.qt.io/qtforpython/tutorials/basictutorial/uifiles.html#generating-a-python-class
Within Qt Designer I set QObject->objectName value of to NamedMainWindow.
Later, within python code I would like to access it with objectName(), but I receive empty string:
class MainWindow(QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.ui = Ui_NamedMainWindow() self.ui.setupUi(self) print(self.objectName()) # Prints empty string
I have looked at generated ui*.py_ files.
After using pyside2-uic in version 5.14.0 and 5.14.1, the resulting code fragment is:
class Ui_NamedMainWindow(object): def setupUi(self, NamedMainWindow): if NamedMainWindow.objectName(): # Here objectName() is '' NamedMainWindow.setObjectName(u"NamedMainWindow") # This line is never executed # ...
However, using version 5.13.2 of PySide2 the result is:
class Ui_NamedMainWindow(object): def setupUi(self, NamedMainWindow): NamedMainWindow.setObjectName("NamedMainWindow") # ...
which properly sets the Qt object name.
The issue seems to be a BUG to me.
I have attached all source files.
Attachments
For Gerrit Dashboard: PYSIDE-1210 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
289161,3 | uic/Python: Set form object name correctly | 5.14 | qt/qtbase | Status: MERGED | +2 | 0 |