Utils: Remove AspectContainer ctor's parent parameter

Instead use setParent in the two cases that use it. The parent gets
in the way when attempting to derive AspectContainer from BaseAspect.

Change-Id: I6079beb0e00334133da115b714bc5186064c6722
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2023-07-27 15:13:31 +02:00
parent 9d9e84296a
commit 7d08f96da5
6 changed files with 10 additions and 14 deletions

View File

@@ -2399,9 +2399,7 @@ void TextDisplay::setText(const QString &message)
Sub-aspects ownership can be declared using \a setOwnsSubAspects. Sub-aspects ownership can be declared using \a setOwnsSubAspects.
*/ */
namespace Internal { class Internal::AspectContainerPrivate
class AspectContainerPrivate
{ {
public: public:
QList<BaseAspect *> m_items; // Both owned and non-owned. QList<BaseAspect *> m_items; // Both owned and non-owned.
@@ -2411,10 +2409,8 @@ public:
std::function<Layouting::LayoutItem ()> m_layouter; std::function<Layouting::LayoutItem ()> m_layouter;
}; };
} // Internal AspectContainer::AspectContainer()
: d(new Internal::AspectContainerPrivate)
AspectContainer::AspectContainer(QObject *parent)
: QObject(parent), d(new Internal::AspectContainerPrivate)
{} {}
/*! /*!

View File

@@ -830,7 +830,7 @@ class QTCREATOR_UTILS_EXPORT AspectContainer : public QObject
Q_OBJECT Q_OBJECT
public: public:
AspectContainer(QObject *parent = nullptr); AspectContainer();
~AspectContainer(); ~AspectContainer();
AspectContainer(const AspectContainer &) = delete; AspectContainer(const AspectContainer &) = delete;

View File

@@ -32,7 +32,8 @@ ProjectSettingsWidget *createCopilotProjectPanel(Project *project)
using namespace ProjectExplorer; using namespace ProjectExplorer;
auto widget = new CopilotProjectSettingsWidget; auto widget = new CopilotProjectSettingsWidget;
auto settings = new CopilotProjectSettings(project, widget); auto settings = new CopilotProjectSettings(project);
settings->setParent(widget);
QObject::connect(widget, QObject::connect(widget,
&ProjectSettingsWidget::useGlobalSettingsChanged, &ProjectSettingsWidget::useGlobalSettingsChanged,

View File

@@ -91,8 +91,7 @@ CopilotSettings::CopilotSettings()
readSettings(); readSettings();
} }
CopilotProjectSettings::CopilotProjectSettings(ProjectExplorer::Project *project, QObject *parent) CopilotProjectSettings::CopilotProjectSettings(ProjectExplorer::Project *project)
: AspectContainer(parent)
{ {
setAutoApply(true); setAutoApply(true);

View File

@@ -25,7 +25,7 @@ CopilotSettings &settings();
class CopilotProjectSettings : public Utils::AspectContainer class CopilotProjectSettings : public Utils::AspectContainer
{ {
public: public:
CopilotProjectSettings(ProjectExplorer::Project *project, QObject *parent = nullptr); explicit CopilotProjectSettings(ProjectExplorer::Project *project);
void save(ProjectExplorer::Project *project); void save(ProjectExplorer::Project *project);
void setUseGlobalSettings(bool useGlobalSettings); void setUseGlobalSettings(bool useGlobalSettings);

View File

@@ -17,11 +17,11 @@ const char DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DisplayNam
// ProjectConfiguration // ProjectConfiguration
ProjectConfiguration::ProjectConfiguration(QObject *parent, Target *target, Utils::Id id) ProjectConfiguration::ProjectConfiguration(QObject *parent, Target *target, Utils::Id id)
: AspectContainer(parent) : m_target(target)
, m_target(target)
, m_id(id) , m_id(id)
{ {
QTC_CHECK(parent); QTC_CHECK(parent);
setParent(parent);
QTC_CHECK(target); QTC_CHECK(target);
QTC_CHECK(id.isValid()); QTC_CHECK(id.isValid());
setObjectName(id.toString()); setObjectName(id.toString());