diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2010-11-08 04:29:34 +0300 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@nokia.com> | 2010-11-22 22:33:25 +0100 |
commit | a3130f0b4a4199316029c299b89ef5ef9c1f785e (patch) | |
tree | 925ac0b7f11025af0f007001e79cd7a29fb9535a | |
parent | 6070f9ff27c6eaf485032a84512fa97da973ce78 (diff) |
Set correct variant for current profile when it changes.
Due to incorrect order of initialization the current profile's variant was
setted to "" (empty string) while restoring from the previously saved settings.
Merge-request: 1
Reviewed-by: yoann
-rw-r--r-- | src/mainwindow.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index baffed7..8a2e2cb 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -368,19 +368,6 @@ void MainWindow::setCurrentQtRepo(const QString &repoName) setCurrentProfile(currentProfile->name()); else setCurrentProfile(""); - - QString var = currentProfile->variant(); - if(var.isEmpty()) - currentProfile->setVariant(ui->qtvariants->currentText()); - else { - int idx = ui->qtvariants->findText(var); - if(idx >= 0) - ui->qtvariants->setCurrentIndex(idx); - else { - ui->qtvariants->addItem(var); - ui->qtvariants->setCurrentIndex(ui->qtvariants->count() -1); - } - } } /************************************************************************************************** @@ -403,7 +390,7 @@ void MainWindow::setCurrentProfile(const QString &profileName) } testviews.clear(); - if (currentProfile && QString::compare(currentProfile->name(), QString("")) == 0) { + if (currentProfile && currentProfile->name().isEmpty()) { ui->profiles->setItemText(0, "<New Profile>"); delete currentProfile; currentProfile = 0; @@ -416,6 +403,19 @@ void MainWindow::setCurrentProfile(const QString &profileName) currentProfile = profile; } + QString var = currentProfile->variant(); + if (var.isEmpty()) { + currentProfile->setVariant(ui->qtvariants->currentText()); + } else { + int idx = ui->qtvariants->findText(var); + if (idx >= 0) { + ui->qtvariants->setCurrentIndex(idx); + } else { + ui->qtvariants->addItem(var); + ui->qtvariants->setCurrentIndex(ui->qtvariants->count() - 1); + } + } + QStandardItem *rootItem = currentAutoTestModel->invisibleRootItem()->child(0); // clear old selection @@ -604,7 +604,7 @@ void MainWindow::on_profiles_currentIndexChanged(int index) delete tview; } testviews.clear(); - if (currentProfile && QString::compare(currentProfile->name(), QString("")) == 0) { + if (currentProfile && currentProfile->name().isEmpty()) { delete currentProfile; } currentProfile = 0; |