ProjectExplorer: Move KitAspect related layout code

... from KitManagerConfigWidget to KitAspectWidget (which is not
really a widget, but...)

The modification for the alignment handling only affect this use
here. Long term I hope this can be handled centrally (e.g. always
use the special form label alignment for labels in the first column
when some LayoutBuilder bool property is set, instead of doing that
for each use), so this is not necessarily a final API.

Change-Id: I678dba45ee68ca9706569715d232f98363de8636
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2020-10-08 07:24:19 +02:00
parent a8e704bd82
commit 7527bbcf2c
6 changed files with 51 additions and 41 deletions

View File

@@ -45,6 +45,8 @@ class QTCREATOR_UTILS_EXPORT LayoutBuilder
{
public:
enum LayoutType { GridLayout, FormLayout };
enum Alignment { DefaultAlignment, AlignAsFormLabel };
explicit LayoutBuilder(QWidget *parent, LayoutType layoutType = FormLayout);
explicit LayoutBuilder(QLayout *layout); // Adds to existing layout.
@@ -54,8 +56,8 @@ public:
{
public:
LayoutItem();
LayoutItem(QLayout *layout, int span = 1, Qt::Alignment align = {});
LayoutItem(QWidget *widget, int span = 1, Qt::Alignment align = {});
LayoutItem(QLayout *layout, int span = 1, Alignment align = {});
LayoutItem(QWidget *widget, int span = 1, Alignment align = {});
LayoutItem(BaseAspect *aspect);
LayoutItem(const QString &text);
@@ -64,7 +66,7 @@ public:
BaseAspect *aspect = nullptr;
QString text;
int span = 1;
Qt::Alignment align;
Alignment align;
};
LayoutBuilder &addItem(const LayoutItem &item);