From fcbf51697529688fd6233afc2f518f1723537ff7 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 7 Jan 2016 17:56:44 +0100 Subject: Fix selection of last session if session was a VM --- src/dialog.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/dialog.cpp') diff --git a/src/dialog.cpp b/src/dialog.cpp index 4179afd..fdf3d78 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -284,7 +284,6 @@ void Dialog::setTheme() { backgroundColor.prepend("\\1").append("\\2"); label_l_style.replace(QRegExp("(.*background-color:)#[^;]*(;.*)"), backgroundColor); label_r_style.replace(QRegExp("(.*background-color:)#[^;]*(;.*)"), backgroundColor); - //qDebug() << label_r_style << label_l_style; ui->label_l->setStyleSheet(label_l_style); ui->label_r->setStyleSheet(label_r_style); } @@ -359,7 +358,8 @@ void Dialog::addSessionsAfterDownload(QNetworkReply* reply) { userInteracted_ = true; } -void Dialog::on_treeView_clicked(const QModelIndex&) { +void Dialog::mousePressEvent(QMouseEvent * event) { + QDialog::mousePressEvent(event); userInteracted_ = true; } @@ -370,9 +370,7 @@ void Dialog::treeView_selectionChanged(const QModelIndex& current, const QModelI const Session* s(item->session()); if (!s) { - if (debugMode) { - qDebug() << "invalid selection"; - } + qDebug() << "invalid selection"; // no valid session has been selected, do nothing return; } @@ -453,10 +451,13 @@ void Dialog::onTabButtonChanged(int tab) { ui->treeView->selectionModel()->setCurrentIndex(ui->treeView->model()->index(0, 0, ui->treeView->rootIndex()), QItemSelectionModel::Select); } +void Dialog::on_filterEdit_textEdited() { + userInteracted_ = true; +} + void Dialog::on_filterEdit_textChanged() { if (activeTab_ < 0 || activeTab_ >= TAB_COUNT) return; SessionTreeModel *newModel = NULL; - userInteracted_ = true; // filter the current model if (!ui->filterEdit->text().isEmpty() && ui->filterEdit->text().replace(" ", "").length() > 2) { @@ -634,7 +635,9 @@ void Dialog::keyPressEvent(QKeyEvent* event) { } void Dialog::iconDownloaded(const QUrl& url, const QIcon&) { - qDebug() << "Icon downloaded... (" << url << ")"; - // TODO: Check which model(s) contain an entry with this icon - model_[2]->updateView(); + qDebug() << "Icon downloaded... (" << url << ")"; + // TODO: Check which model(s) contain an entry with this icon + model_[TAB_MY_COURSES]->updateView(); + model_[TAB_ALL_VMS]->updateView(); } + -- cgit v1.2.3-55-g7522