本文整理汇总了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)
示例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)
示例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)