本文整理汇总了Python中AnyQt.QtTest.QTest.qWait方法的典型用法代码示例。如果您正苦于以下问题:Python QTest.qWait方法的具体用法?Python QTest.qWait怎么用?Python QTest.qWait使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtTest.QTest
的用法示例。
在下文中一共展示了QTest.qWait方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: combobox_activate_index
# 需要导入模块: from AnyQt.QtTest import QTest [as 别名]
# 或者: from AnyQt.QtTest.QTest import qWait [as 别名]
def combobox_activate_index(cbox, index, delay=-1):
"""
Activate an item at `index` in a given combo box.
The item at index **must** be enabled and selectable.
Parameters
----------
cbox : QComboBox
index : int
delay : int
Run the event loop after the signals are emitted for `delay`
milliseconds (-1, the default, means no delay).
"""
assert 0 <= index < cbox.count()
model = cbox.model()
column = cbox.modelColumn()
root = cbox.rootModelIndex()
mindex = model.index(index, column, root)
assert mindex.flags() & Qt.ItemIsEnabled
cbox.setCurrentIndex(index)
text = cbox.currentText()
# QComboBox does not have an interface which would allow selecting
# the current item as if a user would. Only setCurrentIndex which
# does not emit the activated signals.
cbox.activated[int].emit(index)
cbox.activated[str].emit(text)
if delay >= 0:
QTest.qWait(delay)
示例2: test_label_overlap
# 需要导入模块: from AnyQt.QtTest import QTest [as 别名]
# 或者: from AnyQt.QtTest.QTest import qWait [as 别名]
def test_label_overlap(self):
self.send_signal(self.widget.Inputs.data, self.heart)
self.widget.stretched = False
self.__select_variable("chest pain")
self.__select_group("gender")
self.widget.show()
QTest.qWait(3000)
self.widget.hide()
示例3: mouseMove
# 需要导入模块: from AnyQt.QtTest import QTest [as 别名]
# 或者: from AnyQt.QtTest.QTest import qWait [as 别名]
def mouseMove(widget, pos=QPoint(), delay=-1): # pragma: no-cover
# Like QTest.mouseMove, but functional without QCursor.setPos
if pos.isNull():
pos = widget.rect().center()
me = QMouseEvent(QMouseEvent.MouseMove, pos, widget.mapToGlobal(pos),
Qt.NoButton, Qt.MouseButtons(0), Qt.NoModifier)
if delay > 0:
QTest.qWait(delay)
QApplication.sendEvent(widget, me)
示例4: test_zoom_rect
# 需要导入模块: from AnyQt.QtTest import QTest [as 别名]
# 或者: from AnyQt.QtTest.QTest import qWait [as 别名]
def test_zoom_rect(self):
""" Test zooming with two clicks. """
self.widget.show()
qWaitForWindow(self.widget)
self.send_signal("Data", self.iris)
vb = self.widget.curveplot.plot.vb
vb.set_mode_zooming()
vr = vb.viewRect()
QTest.qWait(100)
tls = vr.bottomRight() if self.widget.curveplot.invertX else vr.bottomLeft()
tl = vb.mapViewToScene(tls).toPoint() + QPoint(2, 2)
br = vb.mapViewToScene(vr.center()).toPoint()
tlw = vb.mapSceneToView(tl)
brw = vb.mapSceneToView(br)
ca = self.widget.curveplot.childAt(tl)
QTest.mouseClick(ca, Qt.LeftButton, pos=tl)
QTest.qWait(1)
QTest.mouseMove(self.widget.curveplot, pos=tl)
QTest.qWait(1)
QTest.mouseMove(self.widget.curveplot)
QTest.qWait(1)
QTest.mouseClick(ca, Qt.LeftButton, pos=br)
vr = vb.viewRect()
self.assertAlmostEqual(vr.bottom(), tlw.y())
self.assertAlmostEqual(vr.top(), brw.y())
if self.widget.curveplot.invertX:
self.assertAlmostEqual(vr.right(), tlw.x())
self.assertAlmostEqual(vr.left(), brw.x())
else:
self.assertAlmostEqual(vr.left(), tlw.x())
self.assertAlmostEqual(vr.right(), brw.x())
self.widget.hide()
示例5: select_diagonal
# 需要导入模块: from AnyQt.QtTest import QTest [as 别名]
# 或者: from AnyQt.QtTest.QTest import qWait [as 别名]
def select_diagonal(self):
vb = self.widget.curveplot.plot.vb
vb.set_mode_select()
vr = vb.viewRect()
tls = vr.bottomRight() if self.widget.curveplot.invertX else vr.bottomLeft()
brs = vr.topLeft() if self.widget.curveplot.invertX else vr.topRight()
tl = vb.mapViewToScene(tls).toPoint() + QPoint(2, 100) # avoid menu button
br = vb.mapViewToScene(brs).toPoint() - QPoint(2, 2)
ca = self.widget.curveplot.childAt(tl)
QTest.mouseClick(ca, Qt.LeftButton, pos=tl)
self.widget.curveplot.plot.scene().sigMouseMoved.emit(tl)
self.widget.curveplot.plot.scene().sigMouseMoved.emit(tl + QPoint(10, 10))
QTest.qWait(1)
QTest.mouseClick(ca, Qt.LeftButton, pos=br)
示例6: _update_integration_type
# 需要导入模块: from AnyQt.QtTest import QTest [as 别名]
# 或者: from AnyQt.QtTest.QTest import qWait [as 别名]
def _update_integration_type(self):
self.line1.hide()
self.line2.hide()
self.line3.hide()
if self.value_type == 0:
self.box_values_spectra.setDisabled(False)
self.box_values_feature.setDisabled(True)
if self.integration_methods[self.integration_method] != Integrate.PeakAt:
self.line1.show()
self.line2.show()
else:
self.line3.show()
elif self.value_type == 1:
self.box_values_spectra.setDisabled(True)
self.box_values_feature.setDisabled(False)
QTest.qWait(1) # first update the interface
示例7: do_zoom_rect
# 需要导入模块: from AnyQt.QtTest import QTest [as 别名]
# 或者: from AnyQt.QtTest.QTest import qWait [as 别名]
def do_zoom_rect(self, invertX):
""" Test zooming with two clicks. """
self.send_signal("Data", self.iris)
vb = self.widget.curveplot.plot.vb
self.widget.curveplot.invertX = invertX
self.widget.curveplot.invertX_apply()
vb.set_mode_zooming()
vr = vb.viewRect()
tls = vr.bottomRight() if self.widget.curveplot.invertX else vr.bottomLeft()
# move down to avoid clicking on the menu button
tl = vb.mapViewToScene(tls).toPoint() + QPoint(0, 100)
br = vb.mapViewToScene(vr.center()).toPoint()
tlw = vb.mapSceneToView(tl)
brw = vb.mapSceneToView(br)
ca = self.widget.curveplot.childAt(tl)
QTest.mouseClick(ca, Qt.LeftButton, pos=tl)
QTest.qWait(1)
self.widget.curveplot.plot.scene().sigMouseMoved.emit(tl)
QTest.qWait(1)
self.widget.curveplot.plot.scene().sigMouseMoved.emit(tl + QPoint(10, 10))
QTest.qWait(1)
QTest.mouseClick(ca, Qt.LeftButton, pos=br)
vr = vb.viewRect()
self.assertAlmostEqual(vr.bottom(), tlw.y())
self.assertAlmostEqual(vr.top(), brw.y())
if self.widget.curveplot.invertX:
self.assertAlmostEqual(vr.right(), tlw.x())
self.assertAlmostEqual(vr.left(), brw.x())
else:
self.assertAlmostEqual(vr.left(), tlw.x())
self.assertAlmostEqual(vr.right(), brw.x())
示例8: test_search
# 需要导入模块: from AnyQt.QtTest import QTest [as 别名]
# 或者: from AnyQt.QtTest.QTest import qWait [as 别名]
def test_search(self):
registry = QtWidgetRegistry(small_testing_registry())
menu = SuggestMenuPage()
menu.setModel(registry.model())
menu.show()
menu.setFilterFixedString("o")
QTest.qWait(10)
menu.setFilterFixedString("z")
QTest.qWait(10)
menu.setFilterFixedString("m")
QTest.qWait(10)
示例9: tearDownClass
# 需要导入模块: from AnyQt.QtTest import QTest [as 别名]
# 或者: from AnyQt.QtTest.QTest import qWait [as 别名]
def tearDownClass(cls):
QTest.qWait(40)
cls.app = None
示例10: tearDown
# 需要导入模块: from AnyQt.QtTest import QTest [as 别名]
# 或者: from AnyQt.QtTest.QTest import qWait [as 别名]
def tearDown(self):
QTest.qWait(10)
super(QAppTestCase, self).tearDown()