當前位置: 首頁>>代碼示例>>Python>>正文


Python QMainWindow.mouseDoubleClickEvent方法代碼示例

本文整理匯總了Python中qtpy.QtWidgets.QMainWindow.mouseDoubleClickEvent方法的典型用法代碼示例。如果您正苦於以下問題:Python QMainWindow.mouseDoubleClickEvent方法的具體用法?Python QMainWindow.mouseDoubleClickEvent怎麽用?Python QMainWindow.mouseDoubleClickEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在qtpy.QtWidgets.QMainWindow的用法示例。


在下文中一共展示了QMainWindow.mouseDoubleClickEvent方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: mouseDoubleClickEvent

# 需要導入模塊: from qtpy.QtWidgets import QMainWindow [as 別名]
# 或者: from qtpy.QtWidgets.QMainWindow import mouseDoubleClickEvent [as 別名]
        def mouseDoubleClickEvent(self, *args, **kwargs):

            @long_task(self, "decorator(without cancel)", False)
            def task1a(sec):
                t = time.time()
                while time.time() - t < sec:
                    pass
                return "result of task1a"


            @long_task(self, "decorator(with cancel)", True)
            def task1b(sec, cancel_event):
                t = time.time()
                while time.time() - t < sec:
                    if cancel_event.isSet():
                        break
                return "result of task1b"

            def task2a(sec):
                t = time.time()
                while time.time() - t < sec:
                    pass
                return "result of task2a"

            def task2b(sec, cancel_event):
                t = time.time()
                while time.time() - t < sec:
                    if cancel_event.isSet():
                        break
                return "result of task2b"

            def task3a(callback, sec):
                t = time.time()
                while time.time() - t < sec:
                    callback(time.time() - t, t + sec)
                    time.sleep(.1)
                return "result of task2b"

            def task3b(callback, sec):
                try:
                    t = time.time()
                    while time.time() - t < sec:
                        callback(time.time() - t, t + sec)
                        #if cancel_event.isSet():
                        #    break
                        time.sleep(.1)
                    return "result of task2b"
                except CancelWarning:
                    return "Cancelled"
#
#            print (task1a(1))
#
#            try:
#                print (task1b(3))
#            except CancelWarning:
#                print ("task1b cancelled")
#
#
#            print (self.exec_long_task("exec_long_task(without cancel)", False, task2a, 1))
#
#            try:
#                print (self.exec_long_task("exec_long_task(with cancel", True, task2b, 5))
#            except CancelWarning:
#                print ("task2 cancelled")
#
#

            for x in self.progress_iterator(range(100), "progressbar(without cancel)", False):
                t = time.time()
                while time.time() - t < .01:
                    pass
                if x > 80:
                    raise Exception

            try:
                for _ in self.progress_iterator(range(100), "progressbar(with cancel)", True):
                    t = time.time()
                    while time.time() - t < .05:
                        pass
            except CancelWarning:
                print ("progressbar cancelled")
            return QMainWindow.mouseDoubleClickEvent(self, *args, **kwargs)
開發者ID:madsmpedersen,項目名稱:MMPE,代碼行數:84,代碼來源:qt_progress_information.py


注:本文中的qtpy.QtWidgets.QMainWindow.mouseDoubleClickEvent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。