[PySide] QtDesigner ???
Paolo De Stefani
paolo at paolodestefani.it
Sun Apr 24 17:25:22 CEST 2022
Hi
My system is Windows 11 21H2 Build SO 22000.613 (upgraded from Windows
10)
Python 3.10.4 from python.org
PySide6 6.3.0 from pip
the strange thig is that if i run the script importing the 'bad' file i
get:
File "c:\PyWare\pyDBManager\Bug\DBManagerMainWindowBad.py", line 171, in
setupUi
self.tab_widget_new_database.addTab(self.tab, "")
AttributeError: 'PySide6.QtWidgets.QHBoxLayout' object has no attribute
'isEmpty'
if i remove the vertical spacer i get:
File "c:\PyWare\pyDBManager\Bug\DBManagerMainWindowBad.py", line 131,
in setupUi
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
AttributeError: 'PySide6.QtWidgets.QHBoxLayout' object has no attribute
'setContentsMargins'. Did you mean: 'getContentsMargins'?
if i remove the layout of the user/password/database labels and lineedit
but keeping the widgets the script works
if i now add some other widgets (one push button and one checkbox
without a layout i get:
File "c:\PyWare\pyDBManager\Bug\pyDBManager.py", line 56, in __init__
self.ui.setupUi(self)
File "c:\PyWare\pyDBManager\Bug\DBManagerMainWindowBad.py", line 219,
in setupUi
self.tab_widget.setCurrentIndex(3)
AttributeError: 'PySide6.QtWidgets.QSpacerItem' object has no attribute
'hasHeightForWidth'. Did you mean: 'heightForWidth'?
if i put all the widgets in the group_box_create_database in a grid
layout i get
File "c:\PyWare\pyDBManager\Bug\pyDBManager.py", line 56, in __init__
self.ui.setupUi(self)
File "c:\PyWare\pyDBManager\Bug\DBManagerMainWindowBad.py", line 132,
in setupUi
self.gridLayout.setContentsMargins(0, 0, 0, 0)
AttributeError: 'PySide6.QtWidgets.QGridLayout' object has no attribute
'setContentsMargins'. Did you mean: 'getContentsMargins'?
So it looks like i can't use a H/V/Grid layout and spacer too ...
What's wrong ???
I need to add much more widgets as in the pictures attached
How can i do ???
Il 24/04/2022 16:38 David Ching ha scritto:
> Hi Paolo,
>
> I could not reproduce. Either:
>
> [pyDBManager.py]
> #from Ui.DBManagerMainWindowGood import Ui_DBManagerMainWindow
> from Ui.DBManagerMainWindowBad import Ui_DBManagerMainWindow
>
> Or:
> [pyDBManager.py]
> from Ui.DBManagerMainWindowGood import Ui_DBManagerMainWindow
> #from Ui.DBManagerMainWindowBad import Ui_DBManagerMainWindow
>
> Ran without error. The first added the Label and LineEdit as expected.
>
> I ran your batch file after modifying it to work on my system (removed
> hard-coded paths, etc.) So I re-ran pyside6-uic and pyside6-rcc and
> ensured
> the generated files were the same as yours. They were, except for the
> tooling version in the comments. Mine is slightly older:
>
> My system:
> * Windows 10
> * Python 3.9.6 (from https://python.org)
> * PySide6 6.2.3
>
> In short, the (essentially) exact .py code works flawlessly here.
>
> Let me know if I can help more,
> David
>
>> Date: Sun, 24 Apr 2022 09:58:55 +0200
>> From: Paolo De Stefani <paolo at paolodestefani.it>
>> To: Cristi?n Maureira-Fredes <Cristian.Maureira-Fredes at qt.io>
>> Cc: pyside at qt-project.org
>> Subject: Re: [PySide] QtDesigner ???
>> Message-ID: <4d55f5618bf932a303e1207d1ea3a12b at paolodestefani.it>
>> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>>
>> Hi
>>
>> I shrinked more all of my ui file so now everything is in 5 ui/py
>> files
>>
>> To create py files from ui i use this command in a windows batch file:
>>
>> cd c:\PyWare\pyDBManager\Bug
>> REM create lib ui modules
>> "c:\windows\system32\forfiles.exe" /P "C:\PyWare\pyDBManager\Bug" /M
>> *.ui
> /c "cmd /c c:\Python310\Scripts\pyside6-uic -o @fname.py @file"
>> pause
>>
>> If i import from DBManagerMainWindowBad (line 33/34) running
> pyDBManager.py i get:
>>
>> Traceback (most recent call last):
>> File "c:\PyWare\pyDBManager\Bug\pyDBManager.py", line 161, in
>> <module>
>> window = MainWindow()
>> File "c:\PyWare\pyDBManager\Bug\pyDBManager.py", line 56, in
>> __init__
>> self.ui.setupUi(self)
>> File "c:\PyWare\pyDBManager\Bug\DBManagerMainWindowBad.py", line
>> 171,
> in setupUi
>> self.tab_widget_new_database.addTab(self.tab, "")
>> AttributeError: 'PySide6.QtWidgets.QHBoxLayout' object has no
>> attribute
> 'isEmpty'
>>
>> If i import from DBManagerMainWindowGood everything is working
>>
>> So what's wrong in DBManagerMainWindowBad.ui ???
--
Paolo De Stefani
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1.png
Type: image/png
Size: 34347 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20220424/4de182b5/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2.png
Type: image/png
Size: 47037 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20220424/4de182b5/attachment-0003.png>
More information about the PySide
mailing list