From bfcb2cd0e0168e1f740678a626a5d5077cf6e677 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 24 Jul 2010 18:11:28 +0200 Subject: Fix selected items in statusbar for archive Show number of selected items of FilesTreeView in statusbar when selecting files. --- TODOS | 5 ----- filestreewidget.cpp | 5 +++++ filestreewidget.h | 2 +- shemov.cpp | 6 ++++++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/TODOS b/TODOS index efd3ac9..8f37176 100644 --- a/TODOS +++ b/TODOS @@ -21,13 +21,8 @@ SheMov (MainWindow) TODOS: --updateSelectionCount for TreeView --tabChanged for TreeView (done) -File properties for TreeView --Fix database access for good! (done) -Fix statistics menu! --rename "Tree" (done) --act on doubleclick in TreeView (done) -Finish this file -Fix Unable to free statement on exit diff --git a/filestreewidget.cpp b/filestreewidget.cpp index 2d41e34..d27a22e 100644 --- a/filestreewidget.cpp +++ b/filestreewidget.cpp @@ -51,6 +51,11 @@ FilesTreeWidget::FilesTreeWidget(QWidget *parent) : QWidget(parent), mSelectedSi mPictureViewer = SmGlobals::instance()->pictureViewer(); } +void FilesTreeWidget::resetSize(){ + mSelectedSize = 0; + emit sizeChanged(mSelectedSize); +} + void FilesTreeWidget::moveToBurn(){ QModelIndexList selected = mView->selectionModel()->selectedRows(); if(selected.isEmpty()){ diff --git a/filestreewidget.h b/filestreewidget.h index 6f87e62..ae723e3 100644 --- a/filestreewidget.h +++ b/filestreewidget.h @@ -27,7 +27,7 @@ class FilesTreeWidget : public QWidget { public: explicit FilesTreeWidget(QWidget *parent = 0); FilesTreeView *filesTree() { return mView; } - void resetSize() { mSelectedSize = 0; } + void resetSize(); public slots: void moveToBurn(); diff --git a/shemov.cpp b/shemov.cpp index 8b3e82b..03b9271 100644 --- a/shemov.cpp +++ b/shemov.cpp @@ -58,6 +58,8 @@ SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, fla connect(mATree->filesWidget(), SIGNAL(statusMessage(QString)), this, SLOT(statusbarMessage(QString))); connect(mATree->filesWidget(), SIGNAL(sizeChanged(qint64)), this, SLOT(setSize(qint64))); connect(mATree, SIGNAL(needWindowTitleChange(QString)), this, SLOT(setWindowTitle(QString))); + connect(mATree->filesWidget()->filesTree()->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), this, SLOT(updateSelectionCount(const QItemSelection &, const QItemSelection &))); + connect(mATree->seriesWidget()->seriesTree()->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(updateSelectionCount(QItemSelection,QItemSelection))); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(mTab); @@ -113,6 +115,10 @@ void SheMov::updateSelectionCount(const QItemSelection & /* sel */, const QItemS mSelectedSize->setText(QString(tr("%1")).arg(l.toString((selSize)))); break; } + case 1: { + int selCount = mATree->filesWidget()->filesTree()->selectionModel()->selectedRows().count(); + mSelectedItems->setText(QString::number(selCount)); + } } } -- cgit v1.2.3-70-g09d2