forked from qt-creator/qt-creator
Utils: Add an 'If' LayoutItem
Change-Id: I700e28d03b6dc39e96fa969152f236760989bdb7 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -819,6 +819,13 @@ Tab::Tab(const QString &tabName, const LayoutItem &item)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Special If
|
||||||
|
|
||||||
|
If::If(bool condition, const LayoutItems &items, const LayoutItems &other)
|
||||||
|
{
|
||||||
|
subItems.append(condition ? items : other);
|
||||||
|
}
|
||||||
|
|
||||||
// Special Application
|
// Special Application
|
||||||
|
|
||||||
Application::Application(std::initializer_list<LayoutItem> items)
|
Application::Application(std::initializer_list<LayoutItem> items)
|
||||||
|
|||||||
@@ -141,6 +141,12 @@ public:
|
|||||||
Tab(const QString &tabName, const LayoutItem &item);
|
Tab(const QString &tabName, const LayoutItem &item);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class QTCREATOR_UTILS_EXPORT If : public LayoutItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
If(bool condition, const LayoutItems &item, const LayoutItems &other = {});
|
||||||
|
};
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT Group : public LayoutItem
|
class QTCREATOR_UTILS_EXPORT Group : public LayoutItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -17,9 +17,17 @@ int main(int argc, char *argv[])
|
|||||||
title("Hello World"),
|
title("Hello World"),
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
TextEdit {
|
If { false, {
|
||||||
id(textId),
|
TextEdit {
|
||||||
text("Hallo")
|
id(textId),
|
||||||
|
text("Hallo")
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
TextEdit {
|
||||||
|
id(textId),
|
||||||
|
text("Och noe")
|
||||||
|
},
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
|
|||||||
Reference in New Issue
Block a user