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


Python QApplication.postEvent方法代碼示例

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


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

示例1: eventFilter

# 需要導入模塊: from qwt.qt.QtGui import QApplication [as 別名]
# 或者: from qwt.qt.QtGui.QApplication import postEvent [as 別名]
 def eventFilter(self, object_, event):
     if object_ is self.__data.view.contentsWidget:
         if event.type() == QEvent.ChildRemoved:
             ce = event  #TODO: cast to QChildEvent
             if ce.child().isWidgetType():
                 w = ce.child()  #TODO: cast to QWidget
                 self.__data.itemMap.removeWidget(w)
         elif event.type() == QEvent.LayoutRequest:
             self.__data.view.layoutContents()
             if self.parentWidget() and self.parentWidget().layout() is None:
                 QApplication.postEvent(self.parentWidget(),
                                        QEvent(QEvent.LayoutRequest))
     return QwtAbstractLegend.eventFilter(self, object_, event)
開發者ID:petebachant,項目名稱:python-qwt,代碼行數:15,代碼來源:legend.py

示例2: eventFilter

# 需要導入模塊: from qwt.qt.QtGui import QApplication [as 別名]
# 或者: from qwt.qt.QtGui.QApplication import postEvent [as 別名]
 def eventFilter(self, object, event):
     if event.type() == QEvent.FocusIn:
         self.__showCursor(True)
     if event.type() == QEvent.FocusOut:
         self.__showCursor(False)
     if event.type() == QEvent.Paint:
         QApplication.postEvent(self, QEvent(QEvent.User))
     elif event.type() == QEvent.MouseButtonPress:
         self.__select(event.pos())
         return True
     elif event.type() == QEvent.MouseMove:
         self.__move(event.pos())
         return True
     if event.type() == QEvent.KeyPress:
         delta = 5
         key = event.key()
         if key == Qt.Key_Up:
             self.__shiftCurveCursor(True)
             return True
         elif key == Qt.Key_Down:
             self.__shiftCurveCursor(False)
             return True
         elif key == Qt.Key_Right or key == Qt.Key_Plus:
             if self.__selectedCurve:
                 self.__shiftPointCursor(True)
             else:
                 self.__shiftCurveCursor(True)
             return True
         elif key == Qt.Key_Left or key == Qt.Key_Minus:
             if self.__selectedCurve:
                 self.__shiftPointCursor(False)
             else:
                 self.__shiftCurveCursor(True)
             return True
         if key == Qt.Key_1:
             self.__moveBy(-delta, delta)
         elif key == Qt.Key_2:
             self.__moveBy(0, delta)
         elif key == Qt.Key_3:
             self.__moveBy(delta, delta)
         elif key == Qt.Key_4:
             self.__moveBy(-delta, 0)
         elif key == Qt.Key_6:
             self.__moveBy(delta, 0)
         elif key == Qt.Key_7:
             self.__moveBy(-delta, -delta)
         elif key == Qt.Key_8:
             self.__moveBy(0, -delta)
         elif key == Qt.Key_9:
             self.__moveBy(delta, -delta)
     return QwtPlot.eventFilter(self.__plot, object, event)
開發者ID:petebachant,項目名稱:python-qwt,代碼行數:53,代碼來源:EventFilterDemo.py

示例3: eventFilter

# 需要導入模塊: from qwt.qt.QtGui import QApplication [as 別名]
# 或者: from qwt.qt.QtGui.QApplication import postEvent [as 別名]
    def eventFilter(self, object_, event):
        """
        Handle QEvent.ChildRemoved andQEvent.LayoutRequest events 
        for the contentsWidget().

        :param QObject object: Object to be filtered
        :param QEvent event: Event
        :return: Forwarded to QwtAbstractLegend.eventFilter()
        """
        if object_ is self.__data.view.contentsWidget:
            if event.type() == QEvent.ChildRemoved:
                ce = event  #TODO: cast to QChildEvent
                if ce.child().isWidgetType():
                    w = ce.child()  #TODO: cast to QWidget
                    self.__data.itemMap.removeWidget(w)
            elif event.type() == QEvent.LayoutRequest:
                self.__data.view.layoutContents()
                if self.parentWidget() and self.parentWidget().layout() is None:
                    QApplication.postEvent(self.parentWidget(),
                                           QEvent(QEvent.LayoutRequest))
        return QwtAbstractLegend.eventFilter(self, object_, event)
開發者ID:gyenney,項目名稱:Tools,代碼行數:23,代碼來源:legend.py


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