Qt 6.12 LTS is out! See what's new in the release
blog
custom QLayout undeclared identifier 'margin()'
-
I tried to copy the Qt code I wrote before, but I found that there is a definition missing
int heightForWidth(int width) const override { int height = (width - 2 * margin()) / m_aspectRatio + 2 * margin(); return height; }
@ZeusFa
QLayouthas aheightForWidth()(fromQLayoutItem) which you can override, so I guess that is the method you are showing here.It has no
margin()method anywhere, hence the code above won't compile. Maybe you wrote another class. Maybe you added a method. -
Hi,
You are trying to use code that was done with an older version of Qt. The margin method was already obsoleted with Qt 5 and was removed with Qt 6.
You should use contentsMargins.