From 03a6235f35ed9dee911c9fdc696fb271bf9c9eef Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 10 Dec 2008 23:58:46 +0900 Subject: [PATCH] update # of selected items in title in real time --- ankiqt/ui/cardlist.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ankiqt/ui/cardlist.py b/ankiqt/ui/cardlist.py index d3f244d71..b90358657 100644 --- a/ankiqt/ui/cardlist.py +++ b/ankiqt/ui/cardlist.py @@ -200,6 +200,9 @@ class EditDeck(QMainWindow): self.dialog.tableView.setSortingEnabled(False) self.dialog.tableView.setModel(self.model) self.dialog.tableView.selectionModel() + self.connect(self.dialog.tableView.selectionModel(), + SIGNAL("selectionChanged(QItemSelection,QItemSelection)"), + self.updateFilterLabel) self.dialog.tableView.setFont(QFont( self.config['editFontFamily'], self.config['editFontSize'])) @@ -318,9 +321,12 @@ class EditDeck(QMainWindow): def updateFilterLabel(self): self.setWindowTitle(_("Editor (%(cur)d " - "of %(tot)d cards shown)") % - {"cur": len(self.model.cards), - "tot": self.deck.cardCount}) + "of %(tot)d cards shown; %(sel)d selected)") % + { + "cur": len(self.model.cards), + "tot": self.deck.cardCount, + "sel": len(self.dialog.tableView.selectionModel().selectedRows()) + }) def onEvent(self): if self.deck.undoAvailable():