forked from qt-creator/qt-creator
Utils: Flatten LayoutBuilder related hierarchies
Originally the idea was to only expose LayoutBuilder, but we are getting more and more related items. Be consequent now, and have everything in Utils::Layouting, but not in nested classes. Change-Id: Ic0f98595882e5c60a25c30ec52df4a0ea79bc0ca Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -28,6 +28,8 @@
|
|||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
|
|
||||||
|
using namespace Utils::Layouting;
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -206,17 +208,17 @@ void BaseAspect::setupLabel()
|
|||||||
registerSubWidget(d->m_label);
|
registerSubWidget(d->m_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseAspect::addLabeledItem(LayoutBuilder &builder, QWidget *widget)
|
void BaseAspect::addLabeledItem(Layouting::LayoutBuilder &builder, QWidget *widget)
|
||||||
{
|
{
|
||||||
setupLabel();
|
setupLabel();
|
||||||
if (QLabel *l = label()) {
|
if (QLabel *l = label()) {
|
||||||
l->setBuddy(widget);
|
l->setBuddy(widget);
|
||||||
builder.addItem(l);
|
builder.addItem(l);
|
||||||
LayoutBuilder::LayoutItem item(widget);
|
LayoutItem item(widget);
|
||||||
item.span = std::max(d->m_spanX - 1, 1);
|
item.span = std::max(d->m_spanX - 1, 1);
|
||||||
builder.addItem(item);
|
builder.addItem(item);
|
||||||
} else {
|
} else {
|
||||||
builder.addItem(LayoutBuilder::LayoutItem(widget));
|
builder.addItem(LayoutItem(widget));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,7 +419,7 @@ QAction *BaseAspect::action()
|
|||||||
Adds the visual representation of this aspect to a layout using
|
Adds the visual representation of this aspect to a layout using
|
||||||
a layout builder.
|
a layout builder.
|
||||||
*/
|
*/
|
||||||
void BaseAspect::addToLayout(LayoutBuilder &)
|
void BaseAspect::addToLayout(Layouting::LayoutBuilder &)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1042,7 +1044,7 @@ void StringAspect::setUncheckedSemantics(StringAspect::UncheckedSemantics semant
|
|||||||
d->m_uncheckedSemantics = semantics;
|
d->m_uncheckedSemantics = semantics;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringAspect::addToLayout(LayoutBuilder &builder)
|
void StringAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
if (d->m_checker && d->m_checkBoxPlacement == CheckBoxPlacement::Top) {
|
if (d->m_checker && d->m_checkBoxPlacement == CheckBoxPlacement::Top) {
|
||||||
d->m_checker->addToLayout(builder);
|
d->m_checker->addToLayout(builder);
|
||||||
@@ -1312,7 +1314,7 @@ BoolAspect::~BoolAspect() = default;
|
|||||||
/*!
|
/*!
|
||||||
\reimp
|
\reimp
|
||||||
*/
|
*/
|
||||||
void BoolAspect::addToLayout(LayoutBuilder &builder)
|
void BoolAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
QTC_CHECK(!d->m_checkBox);
|
QTC_CHECK(!d->m_checkBox);
|
||||||
d->m_checkBox = createSubWidget<QCheckBox>();
|
d->m_checkBox = createSubWidget<QCheckBox>();
|
||||||
@@ -1323,7 +1325,7 @@ void BoolAspect::addToLayout(LayoutBuilder &builder)
|
|||||||
break;
|
break;
|
||||||
case LabelPlacement::AtCheckBox: {
|
case LabelPlacement::AtCheckBox: {
|
||||||
d->m_checkBox->setText(labelText());
|
d->m_checkBox->setText(labelText());
|
||||||
LayoutBuilder::LayoutType type = builder.layoutType();
|
Layouting::LayoutBuilder::LayoutType type = builder.layoutType();
|
||||||
if (type == LayoutBuilder::FormLayout)
|
if (type == LayoutBuilder::FormLayout)
|
||||||
builder.addItem(createSubWidget<QLabel>());
|
builder.addItem(createSubWidget<QLabel>());
|
||||||
builder.addItem(d->m_checkBox.data());
|
builder.addItem(d->m_checkBox.data());
|
||||||
@@ -1465,7 +1467,7 @@ SelectionAspect::~SelectionAspect() = default;
|
|||||||
/*!
|
/*!
|
||||||
\reimp
|
\reimp
|
||||||
*/
|
*/
|
||||||
void SelectionAspect::addToLayout(LayoutBuilder &builder)
|
void SelectionAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
QTC_CHECK(d->m_buttonGroup == nullptr);
|
QTC_CHECK(d->m_buttonGroup == nullptr);
|
||||||
QTC_CHECK(!d->m_comboBox);
|
QTC_CHECK(!d->m_comboBox);
|
||||||
@@ -1669,7 +1671,7 @@ MultiSelectionAspect::~MultiSelectionAspect() = default;
|
|||||||
/*!
|
/*!
|
||||||
\reimp
|
\reimp
|
||||||
*/
|
*/
|
||||||
void MultiSelectionAspect::addToLayout(LayoutBuilder &builder)
|
void MultiSelectionAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
QTC_CHECK(d->m_listView == nullptr);
|
QTC_CHECK(d->m_listView == nullptr);
|
||||||
if (d->m_allValues.isEmpty())
|
if (d->m_allValues.isEmpty())
|
||||||
@@ -1778,7 +1780,7 @@ IntegerAspect::~IntegerAspect() = default;
|
|||||||
/*!
|
/*!
|
||||||
\reimp
|
\reimp
|
||||||
*/
|
*/
|
||||||
void IntegerAspect::addToLayout(LayoutBuilder &builder)
|
void IntegerAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
QTC_CHECK(!d->m_spinBox);
|
QTC_CHECK(!d->m_spinBox);
|
||||||
d->m_spinBox = createSubWidget<QSpinBox>();
|
d->m_spinBox = createSubWidget<QSpinBox>();
|
||||||
@@ -1912,7 +1914,7 @@ DoubleAspect::~DoubleAspect() = default;
|
|||||||
/*!
|
/*!
|
||||||
\reimp
|
\reimp
|
||||||
*/
|
*/
|
||||||
void DoubleAspect::addToLayout(LayoutBuilder &builder)
|
void DoubleAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
QTC_CHECK(!d->m_spinBox);
|
QTC_CHECK(!d->m_spinBox);
|
||||||
d->m_spinBox = createSubWidget<QDoubleSpinBox>();
|
d->m_spinBox = createSubWidget<QDoubleSpinBox>();
|
||||||
@@ -2066,7 +2068,7 @@ StringListAspect::~StringListAspect() = default;
|
|||||||
/*!
|
/*!
|
||||||
\reimp
|
\reimp
|
||||||
*/
|
*/
|
||||||
void StringListAspect::addToLayout(LayoutBuilder &builder)
|
void StringListAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
Q_UNUSED(builder)
|
Q_UNUSED(builder)
|
||||||
// TODO - when needed.
|
// TODO - when needed.
|
||||||
@@ -2136,7 +2138,7 @@ IntegersAspect::~IntegersAspect() = default;
|
|||||||
/*!
|
/*!
|
||||||
\reimp
|
\reimp
|
||||||
*/
|
*/
|
||||||
void IntegersAspect::addToLayout(LayoutBuilder &builder)
|
void IntegersAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
Q_UNUSED(builder)
|
Q_UNUSED(builder)
|
||||||
// TODO - when needed.
|
// TODO - when needed.
|
||||||
|
@@ -23,7 +23,7 @@ namespace Utils {
|
|||||||
|
|
||||||
class AspectContainer;
|
class AspectContainer;
|
||||||
class BoolAspect;
|
class BoolAspect;
|
||||||
class LayoutBuilder;
|
namespace Layouting { class LayoutBuilder; }
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class AspectContainerPrivate;
|
class AspectContainerPrivate;
|
||||||
@@ -96,7 +96,7 @@ public:
|
|||||||
virtual void toMap(QVariantMap &map) const;
|
virtual void toMap(QVariantMap &map) const;
|
||||||
virtual void toActiveMap(QVariantMap &map) const { toMap(map); }
|
virtual void toActiveMap(QVariantMap &map) const { toMap(map); }
|
||||||
|
|
||||||
virtual void addToLayout(LayoutBuilder &builder);
|
virtual void addToLayout(Layouting::LayoutBuilder &builder);
|
||||||
|
|
||||||
virtual QVariant volatileValue() const;
|
virtual QVariant volatileValue() const;
|
||||||
virtual void setVolatileValue(const QVariant &val);
|
virtual void setVolatileValue(const QVariant &val);
|
||||||
@@ -167,7 +167,7 @@ signals:
|
|||||||
protected:
|
protected:
|
||||||
QLabel *label() const;
|
QLabel *label() const;
|
||||||
void setupLabel();
|
void setupLabel();
|
||||||
void addLabeledItem(LayoutBuilder &builder, QWidget *widget);
|
void addLabeledItem(Layouting::LayoutBuilder &builder, QWidget *widget);
|
||||||
|
|
||||||
void setDataCreatorHelper(const DataCreator &creator) const;
|
void setDataCreatorHelper(const DataCreator &creator) const;
|
||||||
void setDataClonerHelper(const DataCloner &cloner) const;
|
void setDataClonerHelper(const DataCloner &cloner) const;
|
||||||
@@ -216,7 +216,7 @@ public:
|
|||||||
bool value;
|
bool value;
|
||||||
};
|
};
|
||||||
|
|
||||||
void addToLayout(LayoutBuilder &builder) override;
|
void addToLayout(Layouting::LayoutBuilder &builder) override;
|
||||||
|
|
||||||
QAction *action() override;
|
QAction *action() override;
|
||||||
|
|
||||||
@@ -251,7 +251,7 @@ public:
|
|||||||
SelectionAspect();
|
SelectionAspect();
|
||||||
~SelectionAspect() override;
|
~SelectionAspect() override;
|
||||||
|
|
||||||
void addToLayout(LayoutBuilder &builder) override;
|
void addToLayout(Layouting::LayoutBuilder &builder) override;
|
||||||
QVariant volatileValue() const override;
|
QVariant volatileValue() const override;
|
||||||
void setVolatileValue(const QVariant &val) override;
|
void setVolatileValue(const QVariant &val) override;
|
||||||
void finish() override;
|
void finish() override;
|
||||||
@@ -305,7 +305,7 @@ public:
|
|||||||
MultiSelectionAspect();
|
MultiSelectionAspect();
|
||||||
~MultiSelectionAspect() override;
|
~MultiSelectionAspect() override;
|
||||||
|
|
||||||
void addToLayout(LayoutBuilder &builder) override;
|
void addToLayout(Layouting::LayoutBuilder &builder) override;
|
||||||
|
|
||||||
enum class DisplayStyle { ListView };
|
enum class DisplayStyle { ListView };
|
||||||
void setDisplayStyle(DisplayStyle style);
|
void setDisplayStyle(DisplayStyle style);
|
||||||
@@ -334,7 +334,7 @@ public:
|
|||||||
FilePath filePath;
|
FilePath filePath;
|
||||||
};
|
};
|
||||||
|
|
||||||
void addToLayout(LayoutBuilder &builder) override;
|
void addToLayout(Layouting::LayoutBuilder &builder) override;
|
||||||
|
|
||||||
QVariant volatileValue() const override;
|
QVariant volatileValue() const override;
|
||||||
void setVolatileValue(const QVariant &val) override;
|
void setVolatileValue(const QVariant &val) override;
|
||||||
@@ -412,7 +412,7 @@ public:
|
|||||||
IntegerAspect();
|
IntegerAspect();
|
||||||
~IntegerAspect() override;
|
~IntegerAspect() override;
|
||||||
|
|
||||||
void addToLayout(LayoutBuilder &builder) override;
|
void addToLayout(Layouting::LayoutBuilder &builder) override;
|
||||||
|
|
||||||
QVariant volatileValue() const override;
|
QVariant volatileValue() const override;
|
||||||
void setVolatileValue(const QVariant &val) override;
|
void setVolatileValue(const QVariant &val) override;
|
||||||
@@ -449,7 +449,7 @@ public:
|
|||||||
DoubleAspect();
|
DoubleAspect();
|
||||||
~DoubleAspect() override;
|
~DoubleAspect() override;
|
||||||
|
|
||||||
void addToLayout(LayoutBuilder &builder) override;
|
void addToLayout(Layouting::LayoutBuilder &builder) override;
|
||||||
|
|
||||||
QVariant volatileValue() const override;
|
QVariant volatileValue() const override;
|
||||||
void setVolatileValue(const QVariant &val) override;
|
void setVolatileValue(const QVariant &val) override;
|
||||||
@@ -517,7 +517,7 @@ public:
|
|||||||
StringListAspect();
|
StringListAspect();
|
||||||
~StringListAspect() override;
|
~StringListAspect() override;
|
||||||
|
|
||||||
void addToLayout(LayoutBuilder &builder) override;
|
void addToLayout(Layouting::LayoutBuilder &builder) override;
|
||||||
|
|
||||||
QStringList value() const;
|
QStringList value() const;
|
||||||
void setValue(const QStringList &val);
|
void setValue(const QStringList &val);
|
||||||
@@ -539,7 +539,7 @@ public:
|
|||||||
IntegersAspect();
|
IntegersAspect();
|
||||||
~IntegersAspect() override;
|
~IntegersAspect() override;
|
||||||
|
|
||||||
void addToLayout(LayoutBuilder &builder) override;
|
void addToLayout(Layouting::LayoutBuilder &builder) override;
|
||||||
void emitChangedValue() override;
|
void emitChangedValue() override;
|
||||||
|
|
||||||
QList<int> value() const;
|
QList<int> value() const;
|
||||||
@@ -561,7 +561,7 @@ public:
|
|||||||
InfoLabel::InfoType type = InfoLabel::None);
|
InfoLabel::InfoType type = InfoLabel::None);
|
||||||
~TextDisplay() override;
|
~TextDisplay() override;
|
||||||
|
|
||||||
void addToLayout(LayoutBuilder &builder) override;
|
void addToLayout(Layouting::LayoutBuilder &builder) override;
|
||||||
|
|
||||||
void setIconType(InfoLabel::InfoType t);
|
void setIconType(InfoLabel::InfoType t);
|
||||||
void setText(const QString &message);
|
void setText(const QString &message);
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils::Layouting {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\enum Utils::LayoutBuilder::LayoutType
|
\enum Utils::LayoutBuilder::LayoutType
|
||||||
@@ -46,21 +46,21 @@ namespace Utils {
|
|||||||
/*!
|
/*!
|
||||||
Constructs a layout item instance representing an empty cell.
|
Constructs a layout item instance representing an empty cell.
|
||||||
*/
|
*/
|
||||||
LayoutBuilder::LayoutItem::LayoutItem()
|
LayoutItem::LayoutItem()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Constructs a layout item proxy for \a layout.
|
Constructs a layout item proxy for \a layout.
|
||||||
*/
|
*/
|
||||||
LayoutBuilder::LayoutItem::LayoutItem(QLayout *layout)
|
LayoutItem::LayoutItem(QLayout *layout)
|
||||||
: layout(layout)
|
: layout(layout)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Constructs a layout item proxy for \a widget.
|
Constructs a layout item proxy for \a widget.
|
||||||
*/
|
*/
|
||||||
LayoutBuilder::LayoutItem::LayoutItem(QWidget *widget)
|
LayoutItem::LayoutItem(QWidget *widget)
|
||||||
: widget(widget)
|
: widget(widget)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@@ -72,18 +72,18 @@ LayoutBuilder::LayoutItem::LayoutItem(QWidget *widget)
|
|||||||
|
|
||||||
\sa BaseAspect::addToLayout()
|
\sa BaseAspect::addToLayout()
|
||||||
*/
|
*/
|
||||||
LayoutBuilder::LayoutItem::LayoutItem(BaseAspect &aspect)
|
LayoutItem::LayoutItem(BaseAspect &aspect)
|
||||||
: aspect(&aspect)
|
: aspect(&aspect)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
LayoutBuilder::LayoutItem::LayoutItem(BaseAspect *aspect)
|
LayoutItem::LayoutItem(BaseAspect *aspect)
|
||||||
: aspect(aspect)
|
: aspect(aspect)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Constructs a layout item containing some static \a text.
|
Constructs a layout item containing some static \a text.
|
||||||
*/
|
*/
|
||||||
LayoutBuilder::LayoutItem::LayoutItem(const QString &text)
|
LayoutItem::LayoutItem(const QString &text)
|
||||||
: text(text)
|
: text(text)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@@ -147,17 +147,17 @@ static QLabel *createLabel(const QString &text)
|
|||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addItemToBoxLayout(QBoxLayout *layout, const LayoutBuilder::LayoutItem &item)
|
static void addItemToBoxLayout(QBoxLayout *layout, const LayoutItem &item)
|
||||||
{
|
{
|
||||||
if (QWidget *w = item.widget) {
|
if (QWidget *w = item.widget) {
|
||||||
layout->addWidget(w);
|
layout->addWidget(w);
|
||||||
} else if (QLayout *l = item.layout) {
|
} else if (QLayout *l = item.layout) {
|
||||||
layout->addLayout(l);
|
layout->addLayout(l);
|
||||||
} else if (item.specialType == LayoutBuilder::SpecialType::Stretch) {
|
} else if (item.specialType == LayoutItem::SpecialType::Stretch) {
|
||||||
layout->addStretch(item.specialValue.toInt());
|
layout->addStretch(item.specialValue.toInt());
|
||||||
} else if (item.specialType == LayoutBuilder::SpecialType::Space) {
|
} else if (item.specialType == LayoutItem::SpecialType::Space) {
|
||||||
layout->addSpacing(item.specialValue.toInt());
|
layout->addSpacing(item.specialValue.toInt());
|
||||||
} else if (item.specialType == LayoutBuilder::SpecialType::HorizontalRule) {
|
} else if (item.specialType == LayoutItem::SpecialType::HorizontalRule) {
|
||||||
layout->addWidget(Layouting::createHr());
|
layout->addWidget(Layouting::createHr());
|
||||||
} else if (!item.text.isEmpty()) {
|
} else if (!item.text.isEmpty()) {
|
||||||
layout->addWidget(createLabel(item.text));
|
layout->addWidget(createLabel(item.text));
|
||||||
@@ -182,7 +182,7 @@ static void flushPendingFormItems(QFormLayout *formLayout,
|
|||||||
addItemToBoxLayout(hbox, pendingFormItems.at(i));
|
addItemToBoxLayout(hbox, pendingFormItems.at(i));
|
||||||
while (pendingFormItems.size() >= 2)
|
while (pendingFormItems.size() >= 2)
|
||||||
pendingFormItems.pop_back();
|
pendingFormItems.pop_back();
|
||||||
pendingFormItems.append(LayoutBuilder::LayoutItem(hbox));
|
pendingFormItems.append(LayoutItem(hbox));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pendingFormItems.size() == 1) { // One one item given, so this spans both columns.
|
if (pendingFormItems.size() == 1) { // One one item given, so this spans both columns.
|
||||||
@@ -233,8 +233,8 @@ static void doLayoutHelper(QLayout *layout,
|
|||||||
auto boxLayout = qobject_cast<QBoxLayout *>(layout);
|
auto boxLayout = qobject_cast<QBoxLayout *>(layout);
|
||||||
auto stackLayout = qobject_cast<QStackedLayout *>(layout);
|
auto stackLayout = qobject_cast<QStackedLayout *>(layout);
|
||||||
|
|
||||||
for (const LayoutBuilder::LayoutItem &item : items) {
|
for (const LayoutItem &item : items) {
|
||||||
if (item.specialType == LayoutBuilder::SpecialType::Break) {
|
if (item.specialType == LayoutItem::SpecialType::Break) {
|
||||||
if (formLayout)
|
if (formLayout)
|
||||||
flushPendingFormItems(formLayout, pendingFormItems);
|
flushPendingFormItems(formLayout, pendingFormItems);
|
||||||
else if (gridLayout) {
|
else if (gridLayout) {
|
||||||
@@ -276,7 +276,7 @@ static void doLayoutHelper(QLayout *layout,
|
|||||||
/*!
|
/*!
|
||||||
Constructs a layout item from the contents of another LayoutBuilder
|
Constructs a layout item from the contents of another LayoutBuilder
|
||||||
*/
|
*/
|
||||||
LayoutBuilder::LayoutItem::LayoutItem(const LayoutBuilder &builder)
|
LayoutItem::LayoutItem(const LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
layout = builder.createLayout();
|
layout = builder.createLayout();
|
||||||
doLayoutHelper(layout, builder.m_items, Layouting::WithoutMargins);
|
doLayoutHelper(layout, builder.m_items, Layouting::WithoutMargins);
|
||||||
@@ -369,7 +369,7 @@ LayoutBuilder &LayoutBuilder::addRow(const LayoutItems &items)
|
|||||||
LayoutBuilder &LayoutBuilder::addItem(const LayoutItem &item)
|
LayoutBuilder &LayoutBuilder::addItem(const LayoutItem &item)
|
||||||
{
|
{
|
||||||
if (item.aspect) {
|
if (item.aspect) {
|
||||||
item.aspect->addToLayout(*this);
|
// item.aspect->addToLayout(*this);
|
||||||
if (m_layoutType == FormLayout || m_layoutType == VBoxLayout)
|
if (m_layoutType == FormLayout || m_layoutType == VBoxLayout)
|
||||||
finishRow();
|
finishRow();
|
||||||
} else {
|
} else {
|
||||||
@@ -438,49 +438,47 @@ LayoutExtender::~LayoutExtender()
|
|||||||
|
|
||||||
// Special items
|
// Special items
|
||||||
|
|
||||||
LayoutBuilder::Break::Break()
|
Break::Break()
|
||||||
{
|
{
|
||||||
specialType = SpecialType::Break;
|
specialType = SpecialType::Break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutBuilder::Stretch::Stretch(int stretch)
|
Stretch::Stretch(int stretch)
|
||||||
{
|
{
|
||||||
specialType = SpecialType::Stretch;
|
specialType = SpecialType::Stretch;
|
||||||
specialValue = stretch;
|
specialValue = stretch;
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutBuilder::Space::Space(int space)
|
Space::Space(int space)
|
||||||
{
|
{
|
||||||
specialType = SpecialType::Space;
|
specialType = SpecialType::Space;
|
||||||
specialValue = space;
|
specialValue = space;
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutBuilder::Span::Span(int span_, const LayoutItem &item)
|
Span::Span(int span_, const LayoutItem &item)
|
||||||
{
|
{
|
||||||
LayoutBuilder::LayoutItem::operator=(item);
|
LayoutItem::operator=(item);
|
||||||
span = span_;
|
span = span_;
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutBuilder::Tab::Tab(const QString &tabName, const LayoutBuilder &item)
|
Tab::Tab(const QString &tabName, const LayoutBuilder &item)
|
||||||
{
|
{
|
||||||
text = tabName;
|
text = tabName;
|
||||||
widget = new QWidget;
|
widget = new QWidget;
|
||||||
item.attachTo(widget);
|
item.attachTo(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutBuilder::HorizontalRule::HorizontalRule()
|
HorizontalRule::HorizontalRule()
|
||||||
{
|
{
|
||||||
specialType = SpecialType::HorizontalRule;
|
specialType = SpecialType::HorizontalRule;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Layouting {
|
|
||||||
|
|
||||||
// "Widgets"
|
// "Widgets"
|
||||||
|
|
||||||
static void applyItems(QWidget *widget, const QList<LayoutBuilder::LayoutItem> &items)
|
static void applyItems(QWidget *widget, const QList<LayoutItem> &items)
|
||||||
{
|
{
|
||||||
bool hadLayout = false;
|
bool hadLayout = false;
|
||||||
for (const LayoutBuilder::LayoutItem &item : items) {
|
for (const LayoutItem &item : items) {
|
||||||
if (item.setter) {
|
if (item.setter) {
|
||||||
item.setter(widget);
|
item.setter(widget);
|
||||||
} else if (item.layout && !hadLayout) {
|
} else if (item.layout && !hadLayout) {
|
||||||
@@ -526,7 +524,7 @@ TabWidget::TabWidget(QTabWidget *tabWidget, std::initializer_list<Tab> tabs)
|
|||||||
|
|
||||||
// "Properties"
|
// "Properties"
|
||||||
|
|
||||||
LayoutBuilder::Setter title(const QString &title, BoolAspect *checker)
|
LayoutItem::Setter title(const QString &title, BoolAspect *checker)
|
||||||
{
|
{
|
||||||
return [title, checker](QObject *target) {
|
return [title, checker](QObject *target) {
|
||||||
if (auto groupBox = qobject_cast<QGroupBox *>(target)) {
|
if (auto groupBox = qobject_cast<QGroupBox *>(target)) {
|
||||||
@@ -543,7 +541,7 @@ LayoutBuilder::Setter title(const QString &title, BoolAspect *checker)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutBuilder::Setter onClicked(const std::function<void ()> &func, QObject *guard)
|
LayoutItem::Setter onClicked(const std::function<void ()> &func, QObject *guard)
|
||||||
{
|
{
|
||||||
return [func, guard](QObject *target) {
|
return [func, guard](QObject *target) {
|
||||||
if (auto button = qobject_cast<QAbstractButton *>(target)) {
|
if (auto button = qobject_cast<QAbstractButton *>(target)) {
|
||||||
@@ -554,7 +552,7 @@ LayoutBuilder::Setter onClicked(const std::function<void ()> &func, QObject *gua
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutBuilder::Setter text(const QString &text)
|
LayoutItem::Setter text(const QString &text)
|
||||||
{
|
{
|
||||||
return [text](QObject *target) {
|
return [text](QObject *target) {
|
||||||
if (auto button = qobject_cast<QAbstractButton *>(target)) {
|
if (auto button = qobject_cast<QAbstractButton *>(target)) {
|
||||||
@@ -565,7 +563,7 @@ LayoutBuilder::Setter text(const QString &text)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutBuilder::Setter tooltip(const QString &toolTip)
|
LayoutItem::Setter tooltip(const QString &toolTip)
|
||||||
{
|
{
|
||||||
return [toolTip](QObject *target) {
|
return [toolTip](QObject *target) {
|
||||||
if (auto widget = qobject_cast<QWidget *>(target)) {
|
if (auto widget = qobject_cast<QWidget *>(target)) {
|
||||||
@@ -584,10 +582,10 @@ QWidget *createHr(QWidget *parent)
|
|||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutBuilder::Break br;
|
// Singletons.
|
||||||
LayoutBuilder::Stretch st;
|
Break br;
|
||||||
LayoutBuilder::Space empty(0);
|
Stretch st;
|
||||||
LayoutBuilder::HorizontalRule hr;
|
Space empty(0);
|
||||||
|
HorizontalRule hr;
|
||||||
|
|
||||||
} // Layouting
|
} // Utils::Layouting
|
||||||
} // Utils
|
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "utils_global.h"
|
#include "utils_global.h"
|
||||||
|
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
@@ -20,11 +19,11 @@ class QWidget;
|
|||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
class BaseAspect;
|
class BaseAspect;
|
||||||
class BoolAspect;
|
class BoolAspect;
|
||||||
|
} // Utils
|
||||||
|
|
||||||
namespace Layouting {
|
namespace Utils::Layouting {
|
||||||
|
|
||||||
enum AttachType {
|
enum AttachType {
|
||||||
WithMargins,
|
WithMargins,
|
||||||
@@ -32,19 +31,13 @@ enum AttachType {
|
|||||||
WithFormAlignment, // Handle Grid similar to QFormLayout, i.e. use special alignment for the first column on Mac
|
WithFormAlignment, // Handle Grid similar to QFormLayout, i.e. use special alignment for the first column on Mac
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Layouting
|
class LayoutBuilder;
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT LayoutBuilder
|
// LayoutItem
|
||||||
|
|
||||||
|
class QTCREATOR_UTILS_EXPORT LayoutItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum LayoutType {
|
|
||||||
HBoxLayout,
|
|
||||||
VBoxLayout,
|
|
||||||
FormLayout,
|
|
||||||
GridLayout,
|
|
||||||
StackLayout,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class AlignmentType {
|
enum class AlignmentType {
|
||||||
DefaultAlignment,
|
DefaultAlignment,
|
||||||
AlignAsFormLabel,
|
AlignAsFormLabel,
|
||||||
@@ -59,10 +52,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
using Setter = std::function<void(QObject *target)>;
|
using Setter = std::function<void(QObject *target)>;
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT LayoutItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
LayoutItem();
|
LayoutItem();
|
||||||
LayoutItem(QLayout *layout);
|
LayoutItem(QLayout *layout);
|
||||||
LayoutItem(QWidget *widget);
|
LayoutItem(QWidget *widget);
|
||||||
@@ -82,6 +71,104 @@ public:
|
|||||||
Setter setter;
|
Setter setter;
|
||||||
SpecialType specialType = SpecialType::NotSpecial;
|
SpecialType specialType = SpecialType::NotSpecial;
|
||||||
QVariant specialValue;
|
QVariant specialValue;
|
||||||
|
};
|
||||||
|
|
||||||
|
class QTCREATOR_UTILS_EXPORT Space : public LayoutItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit Space(int space);
|
||||||
|
};
|
||||||
|
|
||||||
|
class QTCREATOR_UTILS_EXPORT Span : public LayoutItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Span(int span, const LayoutItem &item);
|
||||||
|
};
|
||||||
|
|
||||||
|
class QTCREATOR_UTILS_EXPORT Stretch : public LayoutItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit Stretch(int stretch = 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
class QTCREATOR_UTILS_EXPORT Tab : public LayoutItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Tab(const QString &tabName, const LayoutBuilder &item);
|
||||||
|
};
|
||||||
|
|
||||||
|
class QTCREATOR_UTILS_EXPORT Break : public LayoutItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Break();
|
||||||
|
};
|
||||||
|
|
||||||
|
class QTCREATOR_UTILS_EXPORT HorizontalRule : public LayoutItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HorizontalRule();
|
||||||
|
};
|
||||||
|
|
||||||
|
class QTCREATOR_UTILS_EXPORT Group : public LayoutItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Group(std::initializer_list<LayoutItem> items);
|
||||||
|
};
|
||||||
|
|
||||||
|
class QTCREATOR_UTILS_EXPORT PushButton : public LayoutItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PushButton(std::initializer_list<LayoutItem> items);
|
||||||
|
};
|
||||||
|
|
||||||
|
class QTCREATOR_UTILS_EXPORT Splitter : public LayoutItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Splitter(std::initializer_list<LayoutItem> items);
|
||||||
|
Splitter(QSplitter *splitter, std::initializer_list<LayoutItem> items);
|
||||||
|
};
|
||||||
|
|
||||||
|
class QTCREATOR_UTILS_EXPORT TabWidget : public LayoutItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TabWidget(std::initializer_list<Tab> tabs);
|
||||||
|
TabWidget(QTabWidget *tabWidget, std::initializer_list<Tab> tabs);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Singleton items.
|
||||||
|
|
||||||
|
QTCREATOR_UTILS_EXPORT extern Break br;
|
||||||
|
QTCREATOR_UTILS_EXPORT extern Stretch st;
|
||||||
|
QTCREATOR_UTILS_EXPORT extern Space empty;
|
||||||
|
QTCREATOR_UTILS_EXPORT extern HorizontalRule hr;
|
||||||
|
|
||||||
|
// "Properties"
|
||||||
|
|
||||||
|
QTCREATOR_UTILS_EXPORT LayoutItem::Setter title(const QString &title,
|
||||||
|
BoolAspect *checker = nullptr);
|
||||||
|
|
||||||
|
QTCREATOR_UTILS_EXPORT LayoutItem::Setter text(const QString &text);
|
||||||
|
QTCREATOR_UTILS_EXPORT LayoutItem::Setter tooltip(const QString &toolTip);
|
||||||
|
QTCREATOR_UTILS_EXPORT LayoutItem::Setter onClicked(const std::function<void()> &func,
|
||||||
|
QObject *guard = nullptr);
|
||||||
|
|
||||||
|
|
||||||
|
// Convenience
|
||||||
|
|
||||||
|
QTCREATOR_UTILS_EXPORT QWidget *createHr(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
|
||||||
|
// LayoutBuilder
|
||||||
|
|
||||||
|
class QTCREATOR_UTILS_EXPORT LayoutBuilder
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum LayoutType {
|
||||||
|
HBoxLayout,
|
||||||
|
VBoxLayout,
|
||||||
|
FormLayout,
|
||||||
|
GridLayout,
|
||||||
|
StackLayout,
|
||||||
};
|
};
|
||||||
|
|
||||||
using LayoutItems = QList<LayoutItem>;
|
using LayoutItems = QList<LayoutItem>;
|
||||||
@@ -109,43 +196,9 @@ public:
|
|||||||
void attachTo(QWidget *w, Layouting::AttachType attachType = Layouting::WithMargins) const;
|
void attachTo(QWidget *w, Layouting::AttachType attachType = Layouting::WithMargins) const;
|
||||||
QWidget *emerge(Layouting::AttachType attachType = Layouting::WithMargins);
|
QWidget *emerge(Layouting::AttachType attachType = Layouting::WithMargins);
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT Space : public LayoutItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit Space(int space);
|
|
||||||
};
|
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT Span : public LayoutItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Span(int span, const LayoutItem &item);
|
|
||||||
};
|
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT Stretch : public LayoutItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit Stretch(int stretch = 1);
|
|
||||||
};
|
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT Tab : public LayoutItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Tab(const QString &tabName, const LayoutBuilder &item);
|
|
||||||
};
|
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT Break : public LayoutItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Break();
|
|
||||||
};
|
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT HorizontalRule : public LayoutItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
HorizontalRule();
|
|
||||||
};
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
friend class LayoutItem;
|
||||||
|
|
||||||
explicit LayoutBuilder(); // Adds to existing layout.
|
explicit LayoutBuilder(); // Adds to existing layout.
|
||||||
|
|
||||||
QLayout *createLayout() const;
|
QLayout *createLayout() const;
|
||||||
@@ -167,47 +220,6 @@ private:
|
|||||||
Layouting::AttachType m_attachType = {};
|
Layouting::AttachType m_attachType = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Layouting {
|
|
||||||
|
|
||||||
using Space = LayoutBuilder::Space;
|
|
||||||
using Span = LayoutBuilder::Span;
|
|
||||||
using Tab = LayoutBuilder::Tab;
|
|
||||||
|
|
||||||
QTCREATOR_UTILS_EXPORT LayoutBuilder::Setter title(const QString &title,
|
|
||||||
BoolAspect *checker = nullptr);
|
|
||||||
|
|
||||||
QTCREATOR_UTILS_EXPORT LayoutBuilder::Setter text(const QString &text);
|
|
||||||
QTCREATOR_UTILS_EXPORT LayoutBuilder::Setter tooltip(const QString &toolTip);
|
|
||||||
QTCREATOR_UTILS_EXPORT LayoutBuilder::Setter onClicked(const std::function<void()> &func,
|
|
||||||
QObject *guard = nullptr);
|
|
||||||
QTCREATOR_UTILS_EXPORT QWidget *createHr(QWidget *parent = nullptr);
|
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT Group : public LayoutBuilder::LayoutItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Group(std::initializer_list<LayoutItem> items);
|
|
||||||
};
|
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT PushButton : public LayoutBuilder::LayoutItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
PushButton(std::initializer_list<LayoutItem> items);
|
|
||||||
};
|
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT Splitter : public LayoutBuilder::LayoutItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Splitter(std::initializer_list<LayoutItem> items);
|
|
||||||
Splitter(QSplitter *splitter, std::initializer_list<LayoutItem> items);
|
|
||||||
};
|
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT TabWidget : public LayoutBuilder::LayoutItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
TabWidget(std::initializer_list<Tab> tabs);
|
|
||||||
TabWidget(QTabWidget *tabWidget, std::initializer_list<Tab> tabs);
|
|
||||||
};
|
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT Column : public LayoutBuilder
|
class QTCREATOR_UTILS_EXPORT Column : public LayoutBuilder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -243,10 +255,4 @@ public:
|
|||||||
Stack(std::initializer_list<LayoutItem> items) : LayoutBuilder(StackLayout, items) {}
|
Stack(std::initializer_list<LayoutItem> items) : LayoutBuilder(StackLayout, items) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
QTCREATOR_UTILS_EXPORT extern LayoutBuilder::Break br;
|
} // Utils::Layouting
|
||||||
QTCREATOR_UTILS_EXPORT extern LayoutBuilder::Stretch st;
|
|
||||||
QTCREATOR_UTILS_EXPORT extern LayoutBuilder::Space empty;
|
|
||||||
QTCREATOR_UTILS_EXPORT extern LayoutBuilder::HorizontalRule hr;
|
|
||||||
|
|
||||||
} // Layouting
|
|
||||||
} // Utils
|
|
||||||
|
@@ -50,6 +50,7 @@
|
|||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
using namespace Utils::Layouting;
|
||||||
|
|
||||||
namespace CMakeProjectManager {
|
namespace CMakeProjectManager {
|
||||||
|
|
||||||
|
@@ -30,7 +30,7 @@ public:
|
|||||||
void fromMap(const QVariantMap &map) override;
|
void fromMap(const QVariantMap &map) override;
|
||||||
void toMap(QVariantMap &map) const override;
|
void toMap(QVariantMap &map) const override;
|
||||||
|
|
||||||
void addToLayout(Utils::LayoutBuilder &builder) override;
|
void addToLayout(Utils::Layouting::LayoutBuilder &builder) override;
|
||||||
|
|
||||||
QVariant volatileValue() const override;
|
QVariant volatileValue() const override;
|
||||||
void setVolatileValue(const QVariant &val) override;
|
void setVolatileValue(const QVariant &val) override;
|
||||||
|
@@ -60,7 +60,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addToLayout(Utils::LayoutBuilder &builder) override
|
void addToLayout(Utils::Layouting::LayoutBuilder &builder) override
|
||||||
{
|
{
|
||||||
addMutableAction(m_comboBox);
|
addMutableAction(m_comboBox);
|
||||||
builder.addItem(m_comboBox);
|
builder.addItem(m_comboBox);
|
||||||
|
@@ -46,7 +46,7 @@ class DebuggerLanguageAspect : public BaseAspect
|
|||||||
public:
|
public:
|
||||||
DebuggerLanguageAspect() = default;
|
DebuggerLanguageAspect() = default;
|
||||||
|
|
||||||
void addToLayout(LayoutBuilder &builder) override;
|
void addToLayout(Layouting::LayoutBuilder &builder) override;
|
||||||
|
|
||||||
bool value() const;
|
bool value() const;
|
||||||
void setValue(bool val);
|
void setValue(bool val);
|
||||||
@@ -75,7 +75,7 @@ public:
|
|||||||
std::function<void(bool)> m_clickCallBack;
|
std::function<void(bool)> m_clickCallBack;
|
||||||
};
|
};
|
||||||
|
|
||||||
void DebuggerLanguageAspect::addToLayout(LayoutBuilder &builder)
|
void DebuggerLanguageAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
QTC_CHECK(!m_checkBox);
|
QTC_CHECK(!m_checkBox);
|
||||||
m_checkBox = new QCheckBox(m_label);
|
m_checkBox = new QCheckBox(m_label);
|
||||||
|
@@ -491,7 +491,7 @@ void SourcePathMapAspect::toMap(QVariantMap &) const
|
|||||||
QTC_CHECK(false);
|
QTC_CHECK(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SourcePathMapAspect::addToLayout(LayoutBuilder &builder)
|
void SourcePathMapAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
QTC_CHECK(!d->m_widget);
|
QTC_CHECK(!d->m_widget);
|
||||||
d->m_widget = createSubWidget<DebuggerSourcePathMappingWidget>();
|
d->m_widget = createSubWidget<DebuggerSourcePathMappingWidget>();
|
||||||
|
@@ -110,7 +110,7 @@ void CommandBuilderAspectPrivate::tryToMigrate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandBuilderAspect::addToLayout(LayoutBuilder &builder)
|
void CommandBuilderAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
if (!d->commandBuilder) {
|
if (!d->commandBuilder) {
|
||||||
d->commandBuilder = new QComboBox;
|
d->commandBuilder = new QComboBox;
|
||||||
|
@@ -23,7 +23,7 @@ public:
|
|||||||
QString fullCommandFlag(bool keepJobNum) const;
|
QString fullCommandFlag(bool keepJobNum) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addToLayout(Utils::LayoutBuilder &builder) final;
|
void addToLayout(Utils::Layouting::LayoutBuilder &builder) final;
|
||||||
void fromMap(const QVariantMap &map) final;
|
void fromMap(const QVariantMap &map) final;
|
||||||
void toMap(QVariantMap &map) const final;
|
void toMap(QVariantMap &map) const final;
|
||||||
|
|
||||||
|
@@ -324,7 +324,7 @@ IosDeviceTypeAspect::IosDeviceTypeAspect(IosRunConfiguration *runConfiguration)
|
|||||||
this, &IosDeviceTypeAspect::deviceChanges);
|
this, &IosDeviceTypeAspect::deviceChanges);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IosDeviceTypeAspect::addToLayout(LayoutBuilder &builder)
|
void IosDeviceTypeAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
m_deviceTypeComboBox = new QComboBox;
|
m_deviceTypeComboBox = new QComboBox;
|
||||||
m_deviceTypeComboBox->setModel(&m_deviceTypeModel);
|
m_deviceTypeComboBox->setModel(&m_deviceTypeModel);
|
||||||
|
@@ -27,7 +27,7 @@ public:
|
|||||||
|
|
||||||
void fromMap(const QVariantMap &map) override;
|
void fromMap(const QVariantMap &map) override;
|
||||||
void toMap(QVariantMap &map) const override;
|
void toMap(QVariantMap &map) const override;
|
||||||
void addToLayout(Utils::LayoutBuilder &builder) override;
|
void addToLayout(Utils::Layouting::LayoutBuilder &builder) override;
|
||||||
|
|
||||||
IosDeviceType deviceType() const;
|
IosDeviceType deviceType() const;
|
||||||
void setDeviceType(const IosDeviceType &deviceType);
|
void setDeviceType(const IosDeviceType &deviceType);
|
||||||
|
@@ -21,7 +21,7 @@ public:
|
|||||||
|
|
||||||
void makeReadOnly() override {}
|
void makeReadOnly() override {}
|
||||||
void refresh() override {}
|
void refresh() override {}
|
||||||
void addToLayout(Utils::LayoutBuilder &) override {}
|
void addToLayout(Utils::Layouting::LayoutBuilder &) override {}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
@@ -36,7 +36,7 @@ private:
|
|||||||
|
|
||||||
void makeReadOnly() override { m_toolsComboBox->setEnabled(false); }
|
void makeReadOnly() override { m_toolsComboBox->setEnabled(false); }
|
||||||
|
|
||||||
void addToLayout(Utils::LayoutBuilder &builder) override
|
void addToLayout(Utils::Layouting::LayoutBuilder &builder) override
|
||||||
{
|
{
|
||||||
addMutableAction(m_toolsComboBox);
|
addMutableAction(m_toolsComboBox);
|
||||||
builder.addItem(m_toolsComboBox);
|
builder.addItem(m_toolsComboBox);
|
||||||
|
@@ -108,7 +108,7 @@ void BuildDirectoryAspect::fromMap(const QVariantMap &map)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildDirectoryAspect::addToLayout(LayoutBuilder &builder)
|
void BuildDirectoryAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
StringAspect::addToLayout(builder);
|
StringAspect::addToLayout(builder);
|
||||||
d->problemLabel = new InfoLabel({}, InfoLabel::Warning);
|
d->problemLabel = new InfoLabel({}, InfoLabel::Warning);
|
||||||
|
@@ -23,7 +23,7 @@ public:
|
|||||||
bool isShadowBuild() const;
|
bool isShadowBuild() const;
|
||||||
void setProblem(const QString &description);
|
void setProblem(const QString &description);
|
||||||
|
|
||||||
void addToLayout(Utils::LayoutBuilder &builder) override;
|
void addToLayout(Utils::Layouting::LayoutBuilder &builder) override;
|
||||||
|
|
||||||
static Utils::FilePath fixupDir(const Utils::FilePath &dir);
|
static Utils::FilePath fixupDir(const Utils::FilePath &dir);
|
||||||
|
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
using namespace Utils::Layouting;
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
|
@@ -750,7 +750,7 @@ void KitAspectWidget::addToLayoutWithLabel(QWidget *parent)
|
|||||||
emit labelLinkActivated(link);
|
emit labelLinkActivated(link);
|
||||||
});
|
});
|
||||||
|
|
||||||
LayoutExtender builder(parent->layout(), Layouting::WithFormAlignment);
|
Layouting::LayoutExtender builder(parent->layout(), Layouting::WithFormAlignment);
|
||||||
builder.finishRow();
|
builder.finishRow();
|
||||||
builder.addItem(label);
|
builder.addItem(label);
|
||||||
addToLayout(builder);
|
addToLayout(builder);
|
||||||
|
@@ -24,7 +24,6 @@ QT_END_NAMESPACE
|
|||||||
namespace Utils {
|
namespace Utils {
|
||||||
class Environment;
|
class Environment;
|
||||||
class FilePath;
|
class FilePath;
|
||||||
class LayoutBuilder;
|
|
||||||
class MacroExpander;
|
class MacroExpander;
|
||||||
class OutputLineParser;
|
class OutputLineParser;
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
@@ -573,7 +573,7 @@ public:
|
|||||||
|
|
||||||
delete layout();
|
delete layout();
|
||||||
|
|
||||||
LayoutBuilder builder(LayoutBuilder::GridLayout);
|
Layouting::LayoutBuilder builder(Layouting::LayoutBuilder::GridLayout);
|
||||||
for (KitAspect *aspect : KitManager::kitAspects()) {
|
for (KitAspect *aspect : KitManager::kitAspects()) {
|
||||||
if (k && k->isMutable(aspect->id())) {
|
if (k && k->isMutable(aspect->id())) {
|
||||||
KitAspectWidget *widget = aspect->createConfigWidget(k);
|
KitAspectWidget *widget = aspect->createConfigWidget(k);
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
using namespace Utils::Layouting;
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@ class PROJECTEXPLORER_EXPORT TerminalAspect : public Utils::BaseAspect
|
|||||||
public:
|
public:
|
||||||
TerminalAspect();
|
TerminalAspect();
|
||||||
|
|
||||||
void addToLayout(Utils::LayoutBuilder &builder) override;
|
void addToLayout(Utils::Layouting::LayoutBuilder &builder) override;
|
||||||
|
|
||||||
bool useTerminal() const;
|
bool useTerminal() const;
|
||||||
void setUseTerminalHint(bool useTerminal);
|
void setUseTerminalHint(bool useTerminal);
|
||||||
@@ -62,7 +62,7 @@ public:
|
|||||||
explicit WorkingDirectoryAspect(const Utils::MacroExpander *expander,
|
explicit WorkingDirectoryAspect(const Utils::MacroExpander *expander,
|
||||||
EnvironmentAspect *envAspect);
|
EnvironmentAspect *envAspect);
|
||||||
|
|
||||||
void addToLayout(Utils::LayoutBuilder &builder) override;
|
void addToLayout(Utils::Layouting::LayoutBuilder &builder) override;
|
||||||
|
|
||||||
Utils::FilePath workingDirectory() const;
|
Utils::FilePath workingDirectory() const;
|
||||||
Utils::FilePath defaultWorkingDirectory() const;
|
Utils::FilePath defaultWorkingDirectory() const;
|
||||||
@@ -91,7 +91,7 @@ class PROJECTEXPLORER_EXPORT ArgumentsAspect : public Utils::BaseAspect
|
|||||||
public:
|
public:
|
||||||
explicit ArgumentsAspect(const Utils::MacroExpander *macroExpander);
|
explicit ArgumentsAspect(const Utils::MacroExpander *macroExpander);
|
||||||
|
|
||||||
void addToLayout(Utils::LayoutBuilder &builder) override;
|
void addToLayout(Utils::Layouting::LayoutBuilder &builder) override;
|
||||||
|
|
||||||
QString arguments() const;
|
QString arguments() const;
|
||||||
QString unexpandedArguments() const;
|
QString unexpandedArguments() const;
|
||||||
@@ -163,7 +163,7 @@ public:
|
|||||||
|
|
||||||
void setSettingsKey(const QString &key);
|
void setSettingsKey(const QString &key);
|
||||||
void makeOverridable(const QString &overridingKey, const QString &useOverridableKey);
|
void makeOverridable(const QString &overridingKey, const QString &useOverridableKey);
|
||||||
void addToLayout(Utils::LayoutBuilder &builder) override;
|
void addToLayout(Utils::Layouting::LayoutBuilder &builder) override;
|
||||||
void setLabelText(const QString &labelText);
|
void setLabelText(const QString &labelText);
|
||||||
void setPlaceHolderText(const QString &placeHolderText);
|
void setPlaceHolderText(const QString &placeHolderText);
|
||||||
void setHistoryCompleter(const QString &historyCompleterKey);
|
void setHistoryCompleter(const QString &historyCompleterKey);
|
||||||
@@ -235,7 +235,7 @@ public:
|
|||||||
|
|
||||||
void fromMap(const QVariantMap &) override;
|
void fromMap(const QVariantMap &) override;
|
||||||
void toMap(QVariantMap &) const override;
|
void toMap(QVariantMap &) const override;
|
||||||
void addToLayout(Utils::LayoutBuilder &builder) override;
|
void addToLayout(Utils::Layouting::LayoutBuilder &builder) override;
|
||||||
|
|
||||||
struct Data : Utils::BaseAspect::Data { Interpreter interpreter; };
|
struct Data : Utils::BaseAspect::Data { Interpreter interpreter; };
|
||||||
|
|
||||||
|
@@ -63,7 +63,7 @@ public:
|
|||||||
ArchitecturesAspect();
|
ArchitecturesAspect();
|
||||||
|
|
||||||
void setKit(const ProjectExplorer::Kit *kit) { m_kit = kit; }
|
void setKit(const ProjectExplorer::Kit *kit) { m_kit = kit; }
|
||||||
void addToLayout(Utils::LayoutBuilder &builder) override;
|
void addToLayout(Layouting::LayoutBuilder &builder) override;
|
||||||
QStringList selectedArchitectures() const;
|
QStringList selectedArchitectures() const;
|
||||||
void setSelectedArchitectures(const QStringList& architectures);
|
void setSelectedArchitectures(const QStringList& architectures);
|
||||||
bool isManagedByTarget() const { return m_isManagedByTarget; }
|
bool isManagedByTarget() const { return m_isManagedByTarget; }
|
||||||
@@ -86,7 +86,7 @@ ArchitecturesAspect::ArchitecturesAspect()
|
|||||||
setAllValues(m_abisToArchMap.keys());
|
setAllValues(m_abisToArchMap.keys());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArchitecturesAspect::addToLayout(LayoutBuilder &builder)
|
void ArchitecturesAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
MultiSelectionAspect::addToLayout(builder);
|
MultiSelectionAspect::addToLayout(builder);
|
||||||
const auto changeHandler = [this] {
|
const auto changeHandler = [this] {
|
||||||
|
@@ -35,7 +35,7 @@ private:
|
|||||||
void makeReadOnly() override { m_changeButton->setEnabled(false); }
|
void makeReadOnly() override { m_changeButton->setEnabled(false); }
|
||||||
void refresh() override { m_contentLabel->setText(QbsKitAspect::representation(kit())); }
|
void refresh() override { m_contentLabel->setText(QbsKitAspect::representation(kit())); }
|
||||||
|
|
||||||
void addToLayout(Utils::LayoutBuilder &builder) override
|
void addToLayout(Utils::Layouting::LayoutBuilder &builder) override
|
||||||
{
|
{
|
||||||
addMutableAction(m_contentLabel);
|
addMutableAction(m_contentLabel);
|
||||||
builder.addItem(m_contentLabel);
|
builder.addItem(m_contentLabel);
|
||||||
|
@@ -40,7 +40,7 @@ public:
|
|||||||
~QmakeKitAspectWidget() override { delete m_lineEdit; }
|
~QmakeKitAspectWidget() override { delete m_lineEdit; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addToLayout(LayoutBuilder &builder) override
|
void addToLayout(Layouting::LayoutBuilder &builder) override
|
||||||
{
|
{
|
||||||
addMutableAction(m_lineEdit);
|
addMutableAction(m_lineEdit);
|
||||||
builder.addItem(m_lineEdit);
|
builder.addItem(m_lineEdit);
|
||||||
|
@@ -55,7 +55,7 @@ QmlMainFileAspect::~QmlMainFileAspect()
|
|||||||
delete m_fileListCombo;
|
delete m_fileListCombo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlMainFileAspect::addToLayout(LayoutBuilder &builder)
|
void QmlMainFileAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(!m_fileListCombo, delete m_fileListCombo);
|
QTC_ASSERT(!m_fileListCombo, delete m_fileListCombo);
|
||||||
m_fileListCombo = new QComboBox;
|
m_fileListCombo = new QComboBox;
|
||||||
|
@@ -42,7 +42,7 @@ public:
|
|||||||
QString currentFile;
|
QString currentFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
void addToLayout(Utils::LayoutBuilder &builder) final;
|
void addToLayout(Utils::Layouting::LayoutBuilder &builder) final;
|
||||||
void toMap(QVariantMap &map) const final;
|
void toMap(QVariantMap &map) const final;
|
||||||
void fromMap(const QVariantMap &map) final;
|
void fromMap(const QVariantMap &map) final;
|
||||||
|
|
||||||
|
@@ -30,7 +30,7 @@ QmlDebuggingAspect::QmlDebuggingAspect(BuildConfiguration *buildConfig)
|
|||||||
setValue(ProjectExplorerPlugin::buildPropertiesSettings().qmlDebugging.value());
|
setValue(ProjectExplorerPlugin::buildPropertiesSettings().qmlDebugging.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlDebuggingAspect::addToLayout(LayoutBuilder &builder)
|
void QmlDebuggingAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
SelectionAspect::addToLayout(builder);
|
SelectionAspect::addToLayout(builder);
|
||||||
const auto warningLabel = createSubWidget<InfoLabel>(QString(), InfoLabel::Warning);
|
const auto warningLabel = createSubWidget<InfoLabel>(QString(), InfoLabel::Warning);
|
||||||
@@ -67,7 +67,7 @@ QtQuickCompilerAspect::QtQuickCompilerAspect(BuildConfiguration *buildConfig)
|
|||||||
setValue(ProjectExplorerPlugin::buildPropertiesSettings().qtQuickCompiler.value());
|
setValue(ProjectExplorerPlugin::buildPropertiesSettings().qtQuickCompiler.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtQuickCompilerAspect::addToLayout(LayoutBuilder &builder)
|
void QtQuickCompilerAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
SelectionAspect::addToLayout(builder);
|
SelectionAspect::addToLayout(builder);
|
||||||
const auto warningLabel = createSubWidget<InfoLabel>(QString(), InfoLabel::Warning);
|
const auto warningLabel = createSubWidget<InfoLabel>(QString(), InfoLabel::Warning);
|
||||||
|
@@ -18,7 +18,7 @@ class QTSUPPORT_EXPORT QmlDebuggingAspect : public Utils::TriStateAspect
|
|||||||
public:
|
public:
|
||||||
explicit QmlDebuggingAspect(ProjectExplorer::BuildConfiguration *buildConfig);
|
explicit QmlDebuggingAspect(ProjectExplorer::BuildConfiguration *buildConfig);
|
||||||
|
|
||||||
void addToLayout(Utils::LayoutBuilder &builder) override;
|
void addToLayout(Utils::Layouting::LayoutBuilder &builder) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const ProjectExplorer::BuildConfiguration *m_buildConfig = nullptr;
|
const ProjectExplorer::BuildConfiguration *m_buildConfig = nullptr;
|
||||||
@@ -32,7 +32,7 @@ public:
|
|||||||
QtQuickCompilerAspect(ProjectExplorer::BuildConfiguration *buildConfig);
|
QtQuickCompilerAspect(ProjectExplorer::BuildConfiguration *buildConfig);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addToLayout(Utils::LayoutBuilder &builder) override;
|
void addToLayout(Utils::Layouting::LayoutBuilder &builder) override;
|
||||||
|
|
||||||
const ProjectExplorer::BuildConfiguration *m_buildConfig = nullptr;
|
const ProjectExplorer::BuildConfiguration *m_buildConfig = nullptr;
|
||||||
};
|
};
|
||||||
|
@@ -60,7 +60,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
void makeReadOnly() final { m_combo->setEnabled(false); }
|
void makeReadOnly() final { m_combo->setEnabled(false); }
|
||||||
|
|
||||||
void addToLayout(LayoutBuilder &builder)
|
void addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
addMutableAction(m_combo);
|
addMutableAction(m_combo);
|
||||||
builder.addItem(m_combo);
|
builder.addItem(m_combo);
|
||||||
|
@@ -128,7 +128,7 @@ void SuppressionAspect::setValue(const FilePaths &val)
|
|||||||
BaseAspect::setValue(Utils::transform<QStringList>(val, &FilePath::toString));
|
BaseAspect::setValue(Utils::transform<QStringList>(val, &FilePath::toString));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SuppressionAspect::addToLayout(LayoutBuilder &builder)
|
void SuppressionAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
QTC_CHECK(!d->addEntry);
|
QTC_CHECK(!d->addEntry);
|
||||||
QTC_CHECK(!d->removeEntry);
|
QTC_CHECK(!d->removeEntry);
|
||||||
|
@@ -23,7 +23,7 @@ public:
|
|||||||
Utils::FilePaths value() const;
|
Utils::FilePaths value() const;
|
||||||
void setValue(const Utils::FilePaths &val);
|
void setValue(const Utils::FilePaths &val);
|
||||||
|
|
||||||
void addToLayout(Utils::LayoutBuilder &builder) final;
|
void addToLayout(Utils::Layouting::LayoutBuilder &builder) final;
|
||||||
|
|
||||||
void fromMap(const QVariantMap &map) final;
|
void fromMap(const QVariantMap &map) final;
|
||||||
void toMap(QVariantMap &map) const final;
|
void toMap(QVariantMap &map) const final;
|
||||||
|
@@ -73,7 +73,7 @@ WebBrowserSelectionAspect::WebBrowserSelectionAspect(ProjectExplorer::Target *ta
|
|||||||
addDataExtractor(this, &WebBrowserSelectionAspect::currentBrowser, &Data::currentBrowser);
|
addDataExtractor(this, &WebBrowserSelectionAspect::currentBrowser, &Data::currentBrowser);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebBrowserSelectionAspect::addToLayout(LayoutBuilder &builder)
|
void WebBrowserSelectionAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||||
{
|
{
|
||||||
QTC_CHECK(!m_webBrowserComboBox);
|
QTC_CHECK(!m_webBrowserComboBox);
|
||||||
m_webBrowserComboBox = new QComboBox;
|
m_webBrowserComboBox = new QComboBox;
|
||||||
|
@@ -20,7 +20,7 @@ class WebBrowserSelectionAspect : public Utils::BaseAspect
|
|||||||
public:
|
public:
|
||||||
WebBrowserSelectionAspect(ProjectExplorer::Target *target);
|
WebBrowserSelectionAspect(ProjectExplorer::Target *target);
|
||||||
|
|
||||||
void addToLayout(Utils::LayoutBuilder &builder) override;
|
void addToLayout(Utils::Layouting::LayoutBuilder &builder) override;
|
||||||
|
|
||||||
void fromMap(const QVariantMap &map) override;
|
void fromMap(const QVariantMap &map) override;
|
||||||
void toMap(QVariantMap &map) const override;
|
void toMap(QVariantMap &map) const override;
|
||||||
|
@@ -184,6 +184,7 @@ Tasking::WorkflowPolicy GroupWidget::workflowPolicy() const
|
|||||||
return m_workflowPolicy;
|
return m_workflowPolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskGroup::TaskGroup(QWidget *group, std::initializer_list<LayoutBuilder::LayoutItem> items)
|
TaskGroup::TaskGroup(QWidget *group, std::initializer_list<LayoutItem> items)
|
||||||
: Row({ group, Group { Column { items } } }) {}
|
: Row({ group, Group { Column { items } } })
|
||||||
|
{}
|
||||||
|
|
||||||
|
@@ -79,5 +79,5 @@ private:
|
|||||||
class TaskGroup : public Utils::Layouting::Row
|
class TaskGroup : public Utils::Layouting::Row
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TaskGroup(QWidget *group, std::initializer_list<Utils::LayoutBuilder::LayoutItem> items);
|
TaskGroup(QWidget *group, std::initializer_list<Utils::Layouting::LayoutItem> items);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user