forked from qt-creator/qt-creator
Utils: Replace BaseAspect::setVisibleDynamic by setVisible
This was a workaround from a time where BaseAspect didn't know about subwidgets created by derived aspects. That's not the case anymore. Subwidgets registered with registerSubWidget() get their visibility adjusted by BaseAspect::setVisibility() nowadays. Subwidgets not registered with registerSubWidget() should not exist. Change-Id: I8cdf72e5ea1f93c519f606913e084c78afecb56f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -1401,16 +1401,6 @@ void SelectionAspect::setVolatileValue(const QVariant &val)
|
||||
}
|
||||
}
|
||||
|
||||
void SelectionAspect::setVisibleDynamic(bool visible)
|
||||
{
|
||||
if (QLabel *l = label())
|
||||
l->setVisible(visible);
|
||||
if (d->m_comboBox)
|
||||
d->m_comboBox->setVisible(visible);
|
||||
for (QRadioButton * const button : qAsConst(d->m_buttons))
|
||||
button->setVisible(visible);
|
||||
}
|
||||
|
||||
void SelectionAspect::setDisplayStyle(SelectionAspect::DisplayStyle style)
|
||||
{
|
||||
d->m_displayStyle = style;
|
||||
@@ -1521,14 +1511,6 @@ void MultiSelectionAspect::setAllValues(const QStringList &val)
|
||||
d->m_allValues = val;
|
||||
}
|
||||
|
||||
void MultiSelectionAspect::setVisibleDynamic(bool visible)
|
||||
{
|
||||
if (QLabel *l = label())
|
||||
l->setVisible(visible);
|
||||
if (d->m_listView)
|
||||
d->m_listView->setVisible(visible);
|
||||
}
|
||||
|
||||
void MultiSelectionAspect::setDisplayStyle(MultiSelectionAspect::DisplayStyle style)
|
||||
{
|
||||
d->m_displayStyle = style;
|
||||
|
@@ -142,7 +142,6 @@ protected:
|
||||
}
|
||||
|
||||
void registerSubWidget(QWidget *widget);
|
||||
virtual void setVisibleDynamic(bool visible) { Q_UNUSED(visible) } // TODO: Better name? Merge with setVisible() somehow?
|
||||
void saveToMap(QVariantMap &data, const QVariant &value,
|
||||
const QVariant &defaultValue, const QString &keyExtension = {}) const;
|
||||
|
||||
@@ -252,9 +251,6 @@ public:
|
||||
|
||||
void addOption(const QString &displayName, const QString &toolTip = {});
|
||||
|
||||
protected:
|
||||
void setVisibleDynamic(bool visible) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Internal::SelectionAspectPrivate> d;
|
||||
};
|
||||
@@ -278,9 +274,6 @@ public:
|
||||
QStringList allValues() const;
|
||||
void setAllValues(const QStringList &val);
|
||||
|
||||
protected:
|
||||
void setVisibleDynamic(bool visible) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Internal::MultiSelectionAspectPrivate> d;
|
||||
};
|
||||
|
@@ -88,7 +88,7 @@ public:
|
||||
bool isManagedByTarget() const { return m_isManagedByTarget; }
|
||||
|
||||
private:
|
||||
void setVisibleDynamic(bool visible) final;
|
||||
void setVisibleDynamic(bool visible);
|
||||
|
||||
const ProjectExplorer::Kit *m_kit = nullptr;
|
||||
QMap<QString, QString> m_abisToArchMap;
|
||||
@@ -146,7 +146,7 @@ QStringList ArchitecturesAspect::selectedArchitectures() const
|
||||
|
||||
void ArchitecturesAspect::setVisibleDynamic(bool visible)
|
||||
{
|
||||
MultiSelectionAspect::setVisibleDynamic(visible);
|
||||
MultiSelectionAspect::setVisible(visible);
|
||||
m_isManagedByTarget = visible;
|
||||
}
|
||||
|
||||
|
@@ -65,7 +65,7 @@ void QmlDebuggingAspect::addToLayout(LayoutBuilder &builder)
|
||||
"Only use in a safe environment.");
|
||||
}
|
||||
warningLabel->setText(warningText);
|
||||
setVisibleDynamic(supported);
|
||||
setVisible(supported);
|
||||
const bool warningLabelsVisible = supported && !warningText.isEmpty();
|
||||
warningLabel->setVisible(warningLabelsVisible);
|
||||
};
|
||||
@@ -98,7 +98,7 @@ void QtQuickCompilerAspect::addToLayout(LayoutBuilder &builder)
|
||||
warningText = tr("Disables QML debugging. QML profiling will still work.");
|
||||
}
|
||||
warningLabel->setText(warningText);
|
||||
setVisibleDynamic(supported);
|
||||
setVisible(supported);
|
||||
const bool warningLabelsVisible = supported && !warningText.isEmpty();
|
||||
warningLabel->setVisible(warningLabelsVisible);
|
||||
};
|
||||
|
Reference in New Issue
Block a user