KhamisiKibet / 24-Modern-Desktop-GUI

Modern desktop GUI with dark and light theme. Created using Qt and the Custom Widgets
MIT License
50 stars 11 forks source link

the AlignmentFlag is being referenced incorrectly in my generated ui_interface.py file #2

Open ImTomDaDude opened 3 weeks ago

ImTomDaDude commented 3 weeks ago

Traceback (most recent call last): File "C:\Users\TomDaDude\Desktop\FYP\main.py", line 67, in window = MainWindow() ^^^^^^^^^^^^ File "C:\Users\TomDaDude\Desktop\FYP\main.py", line 28, in init self.ui.setupUi(self) File "C:\Users\TomDaDude\Desktop\FYP\src\ui_interface.py", line 38, in setupUi self.verticalLayout.addWidget(self.label, 0, Qt.AlignmentFlag.Qt.AlignmentFlag.AlignTop) ^^^^^^^^^^^^^^^^^^^ AttributeError: type object 'AlignmentFlag' has no attribute 'Qt'

The error I'am encountering indicates that the AlignmentFlag is being referenced incorrectly in my generated ui_interface.py file. The correct way to use alignment flags in PySide6 is to directly reference them from the Qt module, rather than through AlignmentFlag.

everytimes I update the .ui file, the .py file will generate the incorrect code, it only happens when I add vertical alignment

how to fix this.

DigiTuneLtd commented 4 days ago

I am also having the same issue. Did you find a solution? I'm having to edit the code manually every time it's generated.

Code generated: self.verticalLayout.addWidget(self.label, 0, Qt.AlignmentFlag.Qt.AlignmentFlag.AlignTop) Presumably should be: self.verticalLayout.addWidget(self.label, 0, Qt.AlignmentFlag.AlignTop)

ImTomDaDude commented 7 hours ago

no.