QtSupport: Do not set visibility for items without parent

Avoids having the item popping up separately before adding it to
its respective parent.

Change-Id: I7e7d4765ebf8b1937f50670cbf04ab3bf6edbecd
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2021-03-19 15:30:54 +01:00
parent efa9d258a2
commit eda5fbd645

View File

@@ -67,7 +67,7 @@ void QmlDebuggingAspect::addToLayout(LayoutBuilder &builder)
warningLabel->setText(warningText);
setVisible(supported);
const bool warningLabelsVisible = supported && !warningText.isEmpty();
if (!warningLabel->parentWidget())
if (warningLabel->parentWidget())
warningLabel->setVisible(warningLabelsVisible);
};
connect(KitManager::instance(), &KitManager::kitsChanged, this, changeHandler);
@@ -87,6 +87,7 @@ void QtQuickCompilerAspect::addToLayout(LayoutBuilder &builder)
SelectionAspect::addToLayout(builder);
const auto warningLabel = new Utils::InfoLabel({}, Utils::InfoLabel::Warning);
warningLabel->setElideMode(Qt::ElideNone);
warningLabel->setVisible(false);
builder.addRow({{}, warningLabel});
const auto changeHandler = [this, warningLabel] {
QString warningText;
@@ -101,6 +102,7 @@ void QtQuickCompilerAspect::addToLayout(LayoutBuilder &builder)
warningLabel->setText(warningText);
setVisible(supported);
const bool warningLabelsVisible = supported && !warningText.isEmpty();
if (warningLabel->parentWidget())
warningLabel->setVisible(warningLabelsVisible);
};
connect(KitManager::instance(), &KitManager::kitsChanged, this, changeHandler);