Commit bbbe0f2c authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Improve target selection page

 * Expand all targets
 * Do not check any Qt flavour by default
parent 33a54c81
......@@ -66,39 +66,25 @@ TargetsPage::TargetsPage(QWidget *parent)
qSort(targets.begin(), targets.end());
Qt4TargetFactory factory;
bool hasDesktop = targets.contains(QLatin1String(DESKTOP_TARGET_ID));
bool isExpanded = false;
bool isQtVersionChecked = false;
foreach (const QString &t, targets) {
QTreeWidgetItem *targetItem = new QTreeWidgetItem(m_treeWidget);
targetItem->setText(0, factory.displayNameForId(t));
targetItem->setFlags(Qt::ItemIsEnabled);
targetItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
targetItem->setData(0, Qt::UserRole, t);
if (!isExpanded) {
if ((hasDesktop && t == QLatin1String(DESKTOP_TARGET_ID)) ||
!hasDesktop) {
isExpanded = true;
targetItem->setExpanded(true);
}
}
foreach (QtVersion *v, vm->versionsForTargetId(t)) {
QTreeWidgetItem *versionItem = new QTreeWidgetItem(targetItem);
versionItem->setText(0, v->displayName());
versionItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
versionItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
versionItem->setData(0, Qt::UserRole, v->uniqueId());
if (isExpanded && !isQtVersionChecked) {
isQtVersionChecked = true;
versionItem->setCheckState(0, Qt::Checked);
} else {
versionItem->setCheckState(0, Qt::Unchecked);
}
}
}
connect(m_treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
this, SLOT(itemWasClicked()));
connect(m_treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
this, SLOT(itemWasChanged()));
emit completeChanged();
}
......@@ -164,7 +150,7 @@ QList<int> TargetsPage::selectedQtVersionIdsForTarget(const QString &t) const
return result;
}
void TargetsPage::itemWasClicked()
void TargetsPage::itemWasChanged()
{
emit completeChanged();
}
......
......@@ -65,7 +65,7 @@ public:
bool setupProject(Qt4Project *project) const;
private slots:
void itemWasClicked();
void itemWasChanged();
private:
QSet<QString> m_validTargets;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment