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) ...@@ -66,39 +66,25 @@ TargetsPage::TargetsPage(QWidget *parent)
qSort(targets.begin(), targets.end()); qSort(targets.begin(), targets.end());
Qt4TargetFactory factory; Qt4TargetFactory factory;
bool hasDesktop = targets.contains(QLatin1String(DESKTOP_TARGET_ID));
bool isExpanded = false;
bool isQtVersionChecked = false;
foreach (const QString &t, targets) { foreach (const QString &t, targets) {
QTreeWidgetItem *targetItem = new QTreeWidgetItem(m_treeWidget); QTreeWidgetItem *targetItem = new QTreeWidgetItem(m_treeWidget);
targetItem->setText(0, factory.displayNameForId(t)); targetItem->setText(0, factory.displayNameForId(t));
targetItem->setFlags(Qt::ItemIsEnabled); targetItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
targetItem->setData(0, Qt::UserRole, t); targetItem->setData(0, Qt::UserRole, t);
if (!isExpanded) { targetItem->setExpanded(true);
if ((hasDesktop && t == QLatin1String(DESKTOP_TARGET_ID)) ||
!hasDesktop) {
isExpanded = true;
targetItem->setExpanded(true);
}
}
foreach (QtVersion *v, vm->versionsForTargetId(t)) { foreach (QtVersion *v, vm->versionsForTargetId(t)) {
QTreeWidgetItem *versionItem = new QTreeWidgetItem(targetItem); QTreeWidgetItem *versionItem = new QTreeWidgetItem(targetItem);
versionItem->setText(0, v->displayName()); 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()); versionItem->setData(0, Qt::UserRole, v->uniqueId());
if (isExpanded && !isQtVersionChecked) { versionItem->setCheckState(0, Qt::Unchecked);
isQtVersionChecked = true;
versionItem->setCheckState(0, Qt::Checked);
} else {
versionItem->setCheckState(0, Qt::Unchecked);
}
} }
} }
connect(m_treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), connect(m_treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
this, SLOT(itemWasClicked())); this, SLOT(itemWasChanged()));
emit completeChanged(); emit completeChanged();
} }
...@@ -164,7 +150,7 @@ QList<int> TargetsPage::selectedQtVersionIdsForTarget(const QString &t) const ...@@ -164,7 +150,7 @@ QList<int> TargetsPage::selectedQtVersionIdsForTarget(const QString &t) const
return result; return result;
} }
void TargetsPage::itemWasClicked() void TargetsPage::itemWasChanged()
{ {
emit completeChanged(); emit completeChanged();
} }
......
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
bool setupProject(Qt4Project *project) const; bool setupProject(Qt4Project *project) const;
private slots: private slots:
void itemWasClicked(); void itemWasChanged();
private: private:
QSet<QString> m_validTargets; QSet<QString> m_validTargets;
......
Markdown is supported
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