forked from qt-creator/qt-creator
Core: Fix "Show All Kits" button appears after configure project
"Show All Kits" now button appears when project has been just configured. Change-Id: I68c61aa56aca27c98afb60ada4a4d900db404a6c Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -30,7 +30,8 @@ enum {
|
||||
ItemUpdatedFromBelowRole, // A subitem got updated, re-expansion is necessary.
|
||||
ActiveItemRole, // The index of the currently selected item in the tree view
|
||||
KitIdRole, // The kit id in case the item is associated with a kit.
|
||||
PanelWidgetRole // This item's widget to be shown as central widget.
|
||||
PanelWidgetRole, // This item's widget to be shown as central widget.
|
||||
IsShowMoreRole // This item is a "show more" item.
|
||||
};
|
||||
|
||||
class ProjectWindowPrivate;
|
||||
|
@@ -170,6 +170,7 @@ public:
|
||||
|
||||
void ensureWidget();
|
||||
void rebuildContents();
|
||||
void ensureShowMoreItem();
|
||||
|
||||
void setShowAllKits(bool showAllKits)
|
||||
{
|
||||
@@ -206,6 +207,10 @@ public:
|
||||
if (role == Qt::DisplayRole) {
|
||||
return !m_p->showAllKits() ? Tr::tr("Show All Kits") : Tr::tr("Hide Inactive Kits");
|
||||
}
|
||||
|
||||
if (role == IsShowMoreRole)
|
||||
return true;
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -814,6 +819,14 @@ void TargetItem::updateSubItems()
|
||||
}
|
||||
}
|
||||
|
||||
void TargetGroupItemPrivate::ensureShowMoreItem()
|
||||
{
|
||||
if (q->findAnyChild([](TreeItem *item) { return item->data(0, IsShowMoreRole).toBool(); }))
|
||||
return;
|
||||
|
||||
q->appendChild(new ShowMoreItem(this));
|
||||
}
|
||||
|
||||
void TargetGroupItemPrivate::rebuildContents()
|
||||
{
|
||||
QGuiApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
@@ -829,7 +842,7 @@ void TargetGroupItemPrivate::rebuildContents()
|
||||
}
|
||||
|
||||
if (isAnyKitNotEnabled)
|
||||
q->appendChild(new ShowMoreItem(this));
|
||||
ensureShowMoreItem();
|
||||
|
||||
if (q->parent()) {
|
||||
q->parent()
|
||||
@@ -843,6 +856,7 @@ void TargetGroupItemPrivate::handleTargetAdded(Target *target)
|
||||
{
|
||||
if (TargetItem *item = q->targetItem(target))
|
||||
item->updateSubItems();
|
||||
ensureShowMoreItem();
|
||||
q->update();
|
||||
}
|
||||
|
||||
@@ -850,6 +864,7 @@ void TargetGroupItemPrivate::handleTargetRemoved(Target *target)
|
||||
{
|
||||
if (TargetItem *item = q->targetItem(target))
|
||||
item->updateSubItems();
|
||||
ensureShowMoreItem();
|
||||
q->parent()->setData(0, QVariant::fromValue(static_cast<TreeItem *>(q)),
|
||||
ItemDeactivatedFromBelowRole);
|
||||
}
|
||||
@@ -858,6 +873,7 @@ void TargetGroupItemPrivate::handleTargetChanged(Target *target)
|
||||
{
|
||||
if (TargetItem *item = q->targetItem(target))
|
||||
item->updateSubItems();
|
||||
ensureShowMoreItem();
|
||||
q->setData(0, QVariant(), ItemActivatedFromBelowRole);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user