Utils: Make the second parameter to LayoutBuilder::attach() an enum

More explicit and more potential options (e.g. "treat grid as form")
than a bool.

Change-Id: I89413efe30410160c38b0e524ba64288dde2332e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2022-07-26 11:35:19 +02:00
parent b883a096ff
commit b97c495d2b
21 changed files with 42 additions and 37 deletions

View File

@@ -43,6 +43,15 @@ namespace Utils {
class BaseAspect;
class BoolAspect;
namespace Layouting {
enum AttachType {
WithMargins,
WithoutMargins,
};
} // Layouting
class QTCREATOR_UTILS_EXPORT LayoutBuilder
{
public:
@@ -111,8 +120,8 @@ public:
LayoutType layoutType() const { return m_layoutType; }
void attachTo(QWidget *w, bool withMargins = true) const;
QWidget *emerge(bool withMargins = true);
void attachTo(QWidget *w, Layouting::AttachType attachType = Layouting::WithMargins) const;
QWidget *emerge(Layouting::AttachType attachType = Layouting::WithMargins);
class QTCREATOR_UTILS_EXPORT Space : public LayoutItem
{
@@ -157,7 +166,7 @@ protected:
explicit LayoutBuilder(); // Adds to existing layout.
QLayout *createLayout() const;
void doLayout(QWidget *parent, bool withMargins) const;
void doLayout(QWidget *parent, Layouting::AttachType attachType) const;
LayoutItems m_items;
LayoutType m_layoutType;