Qt Designer, layouts with setSpacing(0()); why?
-
Hi, i don't understand why designer generates these statements for many layouts:
verticalLayout->setSpacing(0());
verticalLayout->setMargin(0());I'm now trying Qt Creator for the first time and i get this:
error: expression cannot be used as a functionI changed the margins and spacings in designer but it only shows the specific fields (like horizontal and vertical).
Any suggestions? -
Hi
That i have never seen before.
What Qt version ?
What Creator version ?
What platform. linux/win/macHow exactly did you do to get this ?
First you use standalone designer and then later in
open the UI file in Creator?Please tell step, by step.
-
Hi
That i have never seen before.
What Qt version ?
What Creator version ?
What platform. linux/win/macHow exactly did you do to get this ?
First you use standalone designer and then later in
open the UI file in Creator?Please tell step, by step.
Arch-Linux, Qt 5.13
I'm using a UI that was created in Designer which i used before with PyQt. From within designer i can already see this weird setSpacing(0()) by using the menu: Form -> View Code... So far i haven't been able to recreate this behavior in a new UI. -
Arch-Linux, Qt 5.13
I'm using a UI that was created in Designer which i used before with PyQt. From within designer i can already see this weird setSpacing(0()) by using the menu: Form -> View Code... So far i haven't been able to recreate this behavior in a new UI. -
@mrjj
I have no indication of such a problem. I can open, save as, copy etc.Whatever goes wrong manifests in the stage of compiling the Qt User Interface.
-
@tink
But if you make new UI , such code is not generated?
I assume its the pythons version of uic you are using ?
Did you look in the UI file if anything that look odd ?@mrjj
So far i haven't seen this code being generated in a new UI.I have uic and pyuic. If i generate a python version the code is normal.
self.gridLayout_1.setSpacing(0)
But if i use uic then i get this:
gridLayout_1->setSpacing(0());I looked at the UI file and didn't see strange things. Though it's a lot of lines (3k+) and have not checked them all.
-
@mrjj
So far i haven't seen this code being generated in a new UI.I have uic and pyuic. If i generate a python version the code is normal.
self.gridLayout_1.setSpacing(0)
But if i use uic then i get this:
gridLayout_1->setSpacing(0());I looked at the UI file and didn't see strange things. Though it's a lot of lines (3k+) and have not checked them all.
-
@tink
ok so its only with c++ code gen, something odd happens.
Any chance we can have the UI file to play with ? -
@mrjj
Thanks for trying to help me fix this but i'm not comfortable with sharing the UI file. Hope you understand.I will try to find the problem by eliminating code step by step. If i find something i will post the result.
-
@tink
Yes, i understand.
Its not always an option to share.Please update if you find something.
OK here is what i found:
<layoutdefault spacing="0" margin="0"/>
<layoutfunction spacing="0" margin="0"/>After removing these 2 lines all the errors are gone.
I have no idea why those lines were generated. They were near the bottom of the file and not inside other tags.
Would be nice to know what caused this. -
Found out where they come from. Designer menu: form settings.
edit:
I had the layout function enabled and both fields set to zero. Instead of giving it a function name. Of course i don't even need (or understand) this functionality and should have left it alone. But this was many months ago when i first started with Qt. So today i found out i must think more before i click on something that seems harmless ;)