forked from qt-creator/qt-creator
Layouting: Drop compile dependency on BoolAspect
Change-Id: I4068048f470db126a2583d6b1b90245205cfd601 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -1423,6 +1423,16 @@ void BoolAspect::addToLayout(Layouting::LayoutBuilder &builder)
|
||||
this, &BoolAspect::volatileValueChanged);
|
||||
}
|
||||
|
||||
std::function<void (QObject *)> BoolAspect::groupChecker()
|
||||
{
|
||||
return [this](QObject *target) {
|
||||
auto groupBox = qobject_cast<QGroupBox *>(target);
|
||||
QTC_ASSERT(groupBox, return);
|
||||
registerSubWidget(groupBox);
|
||||
d->m_groupBox = d->m_groupBox;
|
||||
};
|
||||
}
|
||||
|
||||
QAction *BoolAspect::action()
|
||||
{
|
||||
if (hasAction())
|
||||
@@ -1515,12 +1525,6 @@ void BoolAspect::setLabelPlacement(BoolAspect::LabelPlacement labelPlacement)
|
||||
d->m_labelPlacement = labelPlacement;
|
||||
}
|
||||
|
||||
void BoolAspect::setHandlesGroup(QGroupBox *box)
|
||||
{
|
||||
registerSubWidget(box);
|
||||
d->m_groupBox = box;
|
||||
}
|
||||
|
||||
/*!
|
||||
\class Utils::SelectionAspect
|
||||
\inmodule QtCreator
|
||||
|
||||
@@ -9,22 +9,16 @@
|
||||
#include "macroexpander.h"
|
||||
#include "pathchooser.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
class QGroupBox;
|
||||
class QSettings;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Layouting {
|
||||
class LayoutBuilder;
|
||||
class LayoutItem;
|
||||
} // Layouting
|
||||
namespace Layouting { class LayoutBuilder; }
|
||||
|
||||
namespace Utils {
|
||||
|
||||
@@ -226,6 +220,7 @@ public:
|
||||
};
|
||||
|
||||
void addToLayout(Layouting::LayoutBuilder &builder) override;
|
||||
std::function<void(QObject *)> groupChecker();
|
||||
|
||||
QAction *action() override;
|
||||
|
||||
@@ -242,7 +237,6 @@ public:
|
||||
void setLabel(const QString &labelText,
|
||||
LabelPlacement labelPlacement = LabelPlacement::InExtraLabel);
|
||||
void setLabelPlacement(LabelPlacement labelPlacement);
|
||||
void setHandlesGroup(QGroupBox *box);
|
||||
|
||||
signals:
|
||||
void valueChanged(bool newValue);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include "layoutbuilder.h"
|
||||
|
||||
#include "aspects.h"
|
||||
#include "qtcassert.h"
|
||||
|
||||
#include <QFormLayout>
|
||||
@@ -471,17 +470,12 @@ TabWidget::TabWidget(QTabWidget *tabWidget, std::initializer_list<Tab> tabs)
|
||||
|
||||
// "Properties"
|
||||
|
||||
LayoutItem::Setter title(const QString &title, Utils::BoolAspect *checker)
|
||||
LayoutItem::Setter title(const QString &title)
|
||||
{
|
||||
return [title, checker](QObject *target) {
|
||||
return [title](QObject *target) {
|
||||
if (auto groupBox = qobject_cast<QGroupBox *>(target)) {
|
||||
groupBox->setTitle(title);
|
||||
groupBox->setObjectName(title);
|
||||
if (checker) {
|
||||
groupBox->setCheckable(true);
|
||||
groupBox->setChecked(checker->value());
|
||||
checker->setHandlesGroup(groupBox);
|
||||
}
|
||||
} else {
|
||||
QTC_CHECK(false);
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@ class QTextEdit;
|
||||
class QWidget;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils { class BoolAspect; }
|
||||
|
||||
namespace Layouting {
|
||||
|
||||
enum AttachType {
|
||||
@@ -191,9 +189,7 @@ QTCREATOR_UTILS_EXPORT extern HorizontalRule hr;
|
||||
|
||||
// "Properties"
|
||||
|
||||
QTCREATOR_UTILS_EXPORT LayoutItem::Setter title(const QString &title,
|
||||
Utils::BoolAspect *checker = nullptr);
|
||||
|
||||
QTCREATOR_UTILS_EXPORT LayoutItem::Setter title(const QString &title);
|
||||
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,
|
||||
|
||||
@@ -133,11 +133,13 @@ CTestSettingsPage::CTestSettingsPage(CTestSettings *settings, Utils::Id settings
|
||||
Row {s.stopOnFailure}, br,
|
||||
Row {s.outputMode}, br,
|
||||
Group {
|
||||
title(Tr::tr("Repeat tests"), &s.repeat),
|
||||
title(Tr::tr("Repeat tests")),
|
||||
s.repeat.groupChecker(),
|
||||
Row {s.repetitionMode, s.repetitionCount},
|
||||
}, br,
|
||||
Group {
|
||||
title(Tr::tr("Run in parallel"), &s.parallel),
|
||||
title(Tr::tr("Run in parallel")),
|
||||
s.parallel.groupChecker(),
|
||||
Column {
|
||||
Row {s.jobs}, br,
|
||||
Row {s.testLoad, s.threshold}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
#include <QPushButton>
|
||||
#include <QWidget>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
using namespace ClangFormat;
|
||||
|
||||
ClangFormatChecks::ClangFormatChecks(QWidget *parent)
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#include <QSpinBox>
|
||||
#include <QtDebug>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace CppEditor::Internal {
|
||||
|
||||
class LineCountSpinBox : public QWidget
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
#include <QLineEdit>
|
||||
#include <QRegularExpressionValidator>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Macros::Internal {
|
||||
|
||||
SaveDialog::SaveDialog(QWidget *parent) :
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
#include <QGroupBox>
|
||||
#include <QLineEdit>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Mercurial::Internal {
|
||||
|
||||
RevertDialog::RevertDialog(QWidget *parent)
|
||||
|
||||
@@ -243,7 +243,8 @@ PerforceSettingsPage::PerforceSettingsPage(PerforceSettings *settings)
|
||||
};
|
||||
|
||||
Group environment {
|
||||
title(Tr::tr("Environment Variables"), &s.customEnv),
|
||||
title(Tr::tr("Environment Variables")),
|
||||
s.customEnv.groupChecker(),
|
||||
Row { s.p4Port, s.p4Client, s.p4User }
|
||||
};
|
||||
|
||||
|
||||
@@ -96,7 +96,8 @@ SubversionSettingsPage::SubversionSettingsPage(SubversionSettings *settings)
|
||||
},
|
||||
|
||||
Group {
|
||||
title(Tr::tr("Authentication"), &s.useAuthentication),
|
||||
title(Tr::tr("Authentication")),
|
||||
s.useAuthentication.groupChecker(),
|
||||
Form {
|
||||
s.userName,
|
||||
s.password,
|
||||
|
||||
Reference in New Issue
Block a user