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 ++++++++++++--------- src/dialog.h | 3 ++- 2 files changed, 14 insertions(+), 10 deletions(-) (limited to 'src') 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(); } + diff --git a/src/dialog.h b/src/dialog.h index 04ee40f..17d5cd4 100644 --- a/src/dialog.h +++ b/src/dialog.h @@ -41,6 +41,7 @@ class Dialog : public QDialog { protected: // Overrides void changeEvent(QEvent *e); + void mousePressEvent(QMouseEvent *event); private: // Private vars n methods Ui::Dialog *ui; @@ -61,11 +62,11 @@ class Dialog : public QDialog { private slots: void on_pushButtonStart_clicked(); void on_pushButtonAbort_clicked(); - void on_treeView_clicked(const QModelIndex& index); void on_treeView_doubleClicked(const QModelIndex& index); void on_tabButtonLocal_clicked(); void on_tabButtonMyClasses_clicked(); void on_tabButtonAllClasses_clicked(); + void on_filterEdit_textEdited(); void on_filterEdit_textChanged(); void treeView_selectionChanged(const QModelIndex& current, const QModelIndex&); void on_helpNewsButton_clicked(); -- cgit v1.2.3-55-g7522