forked from qt-creator/qt-creator
Utils: Use 'hr' for horizontal rule in layouts
More HTML-ish. Change-Id: I45d2e474b2810f00422a03603aac125c6f845b81 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -142,6 +142,8 @@ static void addItemToBoxLayout(QBoxLayout *layout, const LayoutBuilder::LayoutIt
|
|||||||
layout->addStretch(item.specialValue.toInt());
|
layout->addStretch(item.specialValue.toInt());
|
||||||
} else if (item.specialType == LayoutBuilder::SpecialType::Space) {
|
} else if (item.specialType == LayoutBuilder::SpecialType::Space) {
|
||||||
layout->addSpacing(item.specialValue.toInt());
|
layout->addSpacing(item.specialValue.toInt());
|
||||||
|
} else if (item.specialType == LayoutBuilder::SpecialType::HorizontalRule) {
|
||||||
|
layout->addWidget(Layouting::createHr());
|
||||||
} else if (!item.text.isEmpty()) {
|
} else if (!item.text.isEmpty()) {
|
||||||
layout->addWidget(new QLabel(item.text));
|
layout->addWidget(new QLabel(item.text));
|
||||||
} else {
|
} else {
|
||||||
@@ -441,6 +443,11 @@ LayoutBuilder::Span::Span(int span_, const LayoutItem &item)
|
|||||||
span = span_;
|
span = span_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LayoutBuilder::HorizontalRule::HorizontalRule()
|
||||||
|
{
|
||||||
|
specialType = SpecialType::HorizontalRule;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Layouting {
|
namespace Layouting {
|
||||||
|
|
||||||
// "Widgets"
|
// "Widgets"
|
||||||
@@ -472,12 +479,6 @@ PushButton::PushButton(std::initializer_list<LayoutBuilder::LayoutItem> items)
|
|||||||
applyItems(widget, items);
|
applyItems(widget, items);
|
||||||
}
|
}
|
||||||
|
|
||||||
HorizontalRule::HorizontalRule(std::initializer_list<LayoutItem> items)
|
|
||||||
{
|
|
||||||
widget = createHr();
|
|
||||||
applyItems(widget, items);
|
|
||||||
}
|
|
||||||
|
|
||||||
// "Properties"
|
// "Properties"
|
||||||
|
|
||||||
LayoutBuilder::Setter title(const QString &title, BoolAspect *checker)
|
LayoutBuilder::Setter title(const QString &title, BoolAspect *checker)
|
||||||
@@ -541,6 +542,7 @@ QWidget *createHr(QWidget *parent)
|
|||||||
LayoutBuilder::Break br;
|
LayoutBuilder::Break br;
|
||||||
LayoutBuilder::Stretch st;
|
LayoutBuilder::Stretch st;
|
||||||
LayoutBuilder::Space empty(0);
|
LayoutBuilder::Space empty(0);
|
||||||
|
LayoutBuilder::HorizontalRule hr;
|
||||||
|
|
||||||
} // Layouting
|
} // Layouting
|
||||||
} // Utils
|
} // Utils
|
||||||
|
@@ -51,6 +51,7 @@ public:
|
|||||||
Space,
|
Space,
|
||||||
Stretch,
|
Stretch,
|
||||||
Break,
|
Break,
|
||||||
|
HorizontalRule,
|
||||||
};
|
};
|
||||||
|
|
||||||
using Setter = std::function<void(QObject *target)>;
|
using Setter = std::function<void(QObject *target)>;
|
||||||
@@ -128,6 +129,12 @@ public:
|
|||||||
Break();
|
Break();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class QTCREATOR_UTILS_EXPORT HorizontalRule : public LayoutItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HorizontalRule();
|
||||||
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit LayoutBuilder(); // Adds to existing layout.
|
explicit LayoutBuilder(); // Adds to existing layout.
|
||||||
|
|
||||||
@@ -173,12 +180,6 @@ public:
|
|||||||
PushButton(std::initializer_list<LayoutItem> items);
|
PushButton(std::initializer_list<LayoutItem> items);
|
||||||
};
|
};
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT HorizontalRule : public LayoutBuilder::LayoutItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
HorizontalRule(std::initializer_list<LayoutItem> items);
|
|
||||||
};
|
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT Column : public LayoutBuilder
|
class QTCREATOR_UTILS_EXPORT Column : public LayoutBuilder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -213,6 +214,7 @@ using Span = LayoutBuilder::Span;
|
|||||||
QTCREATOR_UTILS_EXPORT extern LayoutBuilder::Break br;
|
QTCREATOR_UTILS_EXPORT extern LayoutBuilder::Break br;
|
||||||
QTCREATOR_UTILS_EXPORT extern LayoutBuilder::Stretch st;
|
QTCREATOR_UTILS_EXPORT extern LayoutBuilder::Stretch st;
|
||||||
QTCREATOR_UTILS_EXPORT extern LayoutBuilder::Space empty;
|
QTCREATOR_UTILS_EXPORT extern LayoutBuilder::Space empty;
|
||||||
|
QTCREATOR_UTILS_EXPORT extern LayoutBuilder::HorizontalRule hr;
|
||||||
|
|
||||||
} // Layouting
|
} // Layouting
|
||||||
} // Utils
|
} // Utils
|
||||||
|
@@ -137,7 +137,7 @@ AndroidSdkManagerWidget::AndroidSdkManagerWidget(AndroidConfig &config,
|
|||||||
Column {
|
Column {
|
||||||
Row { tr("Channel:"), channelCheckbox },
|
Row { tr("Channel:"), channelCheckbox },
|
||||||
obsoleteCheckBox,
|
obsoleteCheckBox,
|
||||||
HorizontalRule {},
|
hr,
|
||||||
showAvailableRadio,
|
showAvailableRadio,
|
||||||
showInstalledRadio,
|
showInstalledRadio,
|
||||||
showAllRadio,
|
showAllRadio,
|
||||||
|
@@ -116,7 +116,7 @@ IosSettingsWidget::IosSettingsWidget()
|
|||||||
st
|
st
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
HorizontalRule {},
|
hr,
|
||||||
Row { tr("Screenshot directory:"), m_pathWidget }
|
Row { tr("Screenshot directory:"), m_pathWidget }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -57,7 +57,7 @@ PerfLoadDialog::PerfLoadDialog(QWidget *parent)
|
|||||||
label3, Span(2, m_kitChooser)
|
label3, Span(2, m_kitChooser)
|
||||||
},
|
},
|
||||||
st,
|
st,
|
||||||
HorizontalRule {},
|
hr,
|
||||||
buttonBox
|
buttonBox
|
||||||
}.attachTo(this);
|
}.attachTo(this);
|
||||||
|
|
||||||
|
@@ -152,7 +152,7 @@ SessionDialog::SessionDialog(QWidget *parent) : QDialog(parent)
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
m_autoLoadCheckBox,
|
m_autoLoadCheckBox,
|
||||||
HorizontalRule {},
|
hr,
|
||||||
Row { whatsASessionLabel, buttonBox },
|
Row { whatsASessionLabel, buttonBox },
|
||||||
}.attachTo(this);
|
}.attachTo(this);
|
||||||
|
|
||||||
|
@@ -140,7 +140,7 @@ QbsProfilesSettingsWidget::QbsProfilesSettingsWidget()
|
|||||||
tr("Kit:"), m_kitsComboBox, br,
|
tr("Kit:"), m_kitsComboBox, br,
|
||||||
tr("Associated profile:"), m_profileValueLabel, br,
|
tr("Associated profile:"), m_profileValueLabel, br,
|
||||||
},
|
},
|
||||||
HorizontalRule {},
|
hr,
|
||||||
tr("Profile properties:"),
|
tr("Profile properties:"),
|
||||||
Row {
|
Row {
|
||||||
m_propertiesView,
|
m_propertiesView,
|
||||||
|
@@ -79,7 +79,7 @@ BookmarkDialog::BookmarkDialog(BookmarkManager *manager, const QString &title,
|
|||||||
tr("Bookmark:"), m_bookmarkEdit, br,
|
tr("Bookmark:"), m_bookmarkEdit, br,
|
||||||
tr("Add in folder:"), m_bookmarkFolders, br,
|
tr("Add in folder:"), m_bookmarkFolders, br,
|
||||||
},
|
},
|
||||||
Row { m_toolButton, HorizontalRule {}, },
|
Row { m_toolButton, hr },
|
||||||
m_treeView,
|
m_treeView,
|
||||||
Row { m_newFolderButton, m_buttonBox, }
|
Row { m_newFolderButton, m_buttonBox, }
|
||||||
}.attachTo(this);
|
}.attachTo(this);
|
||||||
|
Reference in New Issue
Block a user