1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2025-03-10 05:34:36 +00:00

[#34 state:fixed] qt base: Implemented "open on double click".

--HG--
extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%4089
This commit is contained in:
hsoft 2009-06-19 11:14:27 +00:00
parent 3f5a5687f9
commit 8946ad02ac
3 changed files with 9 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import traceback
from PyQt4.QtCore import Qt, QTimer, QObject, QCoreApplication, QUrl, SIGNAL from PyQt4.QtCore import Qt, QTimer, QObject, QCoreApplication, QUrl, SIGNAL
from PyQt4.QtGui import QProgressDialog, QDesktopServices, QFileDialog, QDialog, QMessageBox from PyQt4.QtGui import QProgressDialog, QDesktopServices, QFileDialog, QDialog, QMessageBox
import hsfs as fs
from hsutil import job from hsutil import job
from hsutil.reg import RegistrationRequired from hsutil.reg import RegistrationRequired

View File

@ -39,6 +39,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.connect(self.menuColumns, SIGNAL('triggered(QAction*)'), self.columnToggled) self.connect(self.menuColumns, SIGNAL('triggered(QAction*)'), self.columnToggled)
self.connect(QCoreApplication.instance(), SIGNAL('aboutToQuit()'), self.application_will_terminate) self.connect(QCoreApplication.instance(), SIGNAL('aboutToQuit()'), self.application_will_terminate)
self.connect(self.resultsModel, SIGNAL('modelReset()'), self.resultsReset) self.connect(self.resultsModel, SIGNAL('modelReset()'), self.resultsReset)
self.connect(self.resultsView, SIGNAL('doubleClicked()'), self.resultsDoubleClicked)
def _setupUi(self): def _setupUi(self):
self.setupUi(self) self.setupUi(self)
@ -293,6 +294,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
def resultsChanged(self): def resultsChanged(self):
self.resultsView.model().reset() self.resultsView.model().reset()
def resultsDoubleClicked(self):
self.app.open_selected()
def resultsReset(self): def resultsReset(self):
self.resultsView.expandAll() self.resultsView.expandAll()
dupe = self.app.selected_dupe dupe = self.app.selected_dupe

View File

@ -189,6 +189,10 @@ class ResultsView(QTreeView):
return return
QTreeView.keyPressEvent(self, event) QTreeView.keyPressEvent(self, event)
def mouseDoubleClickEvent(self, event):
self.emit(SIGNAL('doubleClicked()'))
# We don't call the superclass' method because the default behavior is to rename the cell.
def setModel(self, model): def setModel(self, model):
assert isinstance(model, ResultsModel) assert isinstance(model, ResultsModel)
QTreeView.setModel(self, model) QTreeView.setModel(self, model)