Utils: Make Layouting::Group { .. } less weird

It had a implicit vertical layout leading to unneded layout nesting
in quite a few cases. The price is an added Column { ... } in those
places where the implicit vertical layout was sufficient before.

Change-Id: I3ae1f03f9c1d691bd0c563b0447edd03ee02bbd2
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2022-07-21 11:10:34 +02:00
parent dcb9cd9062
commit b8a6d72137
19 changed files with 147 additions and 109 deletions

View File

@@ -110,7 +110,7 @@ public:
LayoutType layoutType() const { return m_layoutType; }
void attachTo(QWidget *w, bool withMargins = true);
void attachTo(QWidget *w, bool withMargins = true) const;
QWidget *emerge(bool withMargins = true);
class QTCREATOR_UTILS_EXPORT Space : public LayoutItem
@@ -153,12 +153,11 @@ protected:
explicit LayoutBuilder(); // Adds to existing layout.
QLayout *createLayout() const;
void doLayout(QWidget *parent);
void doLayout(QWidget *parent, bool withMargins) const;
LayoutItems m_items;
LayoutType m_layoutType;
Utils::optional<int> m_spacing;
bool m_withMargins = false;
};
class QTCREATOR_UTILS_EXPORT LayoutExtender : public LayoutBuilder
@@ -176,7 +175,8 @@ namespace Layouting {
class QTCREATOR_UTILS_EXPORT Group : public LayoutBuilder::LayoutItem
{
public:
Group(std::initializer_list<LayoutBuilder::LayoutItem> items);
explicit Group(const LayoutBuilder &innerLayout);
Group(const LayoutBuilder::Title &title, const LayoutBuilder &innerLayout);
};
class QTCREATOR_UTILS_EXPORT Column : public LayoutBuilder