Yuya Nishihara  committed c624e91

quickop: change HeadlessQuickop to QObject and pass to qtrun as dummy QWidget

Since 3380d68b55d3, Qt's eventloop won't be executed if dlgfunc returns None.

Instead of keeping hidden widget by quickop, now returns dummy
QWidget-like object to qtrun. This also fixes temporary appearance of empty
window on drag_copy and drag_move.

  • Participants
  • Parent commits 68e8161
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/

             self.files = lfiles
-instance = None
-class HeadlessQuickop(QWidget):
+class HeadlessQuickop(QObject):
     def __init__(self, repo, cmdline):
-        QWidget.__init__(self)
+        QObject.__init__(self)
         self.files = cmdline[1:]
-        self.cmd = cmdui.Runner(True, self)
+        self.cmd = cmdui.Runner(True, None)  # parent must be QWidget or None
-        self.hide()
     def commandFinished(self, ret):
         if ret == 0:
+    # dummy methods to act as QWidget (see run.qtrun)
+    def show(self):
+        pass
+    def raise_(self):
+        pass
 def run(ui, *pats, **opts):
     pats = hglib.canonpaths(pats)
     if opts.get('canonpats'):
     imm = repo.ui.config('tortoisehg', 'immediate', '')
     if command in imm.lower():
         cmdline = [command] + pats
-        global instance
-        instance = HeadlessQuickop(repo, cmdline)
-        return None
+        return HeadlessQuickop(repo, cmdline)
         return QuickOpDialog(repo, command, pats, None)