本文整理汇总了Python中qtpy.QtTest.QTest.keyPress方法的典型用法代码示例。如果您正苦于以下问题:Python QTest.keyPress方法的具体用法?Python QTest.keyPress怎么用?Python QTest.keyPress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtTest.QTest
的用法示例。
在下文中一共展示了QTest.keyPress方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_rename_finishing_editing_makes_line_uneditable_and_calls_presenter
# 需要导入模块: from qtpy.QtTest import QTest [as 别名]
# 或者: from qtpy.QtTest.QTest import keyPress [as 别名]
def test_rename_finishing_editing_makes_line_uneditable_and_calls_presenter(self):
plot_numbers = [0, 1, 2]
self.view.set_plot_list(plot_numbers)
name_widget = self.view.table_widget.cellWidget(1, Column.Name)
QTest.mouseClick(name_widget.rename_button, Qt.LeftButton)
QTest.keyPress(name_widget.line_edit, Qt.Key_Return)
self.presenter.rename_figure.assert_called_once_with(1, "Plot2")
self.assertTrue(name_widget.line_edit.isReadOnly())
self.assertFalse(name_widget.rename_button.isChecked())
示例2: test_pattern_bkg_txt_fields_change_linear_regions
# 需要导入模块: from qtpy.QtTest import QTest [as 别名]
# 或者: from qtpy.QtTest.QTest import keyPress [as 别名]
def test_pattern_bkg_txt_fields_change_linear_regions(self):
self.model.pattern_model.load_pattern(os.path.join(data_path, 'pattern_001.xy'))
self.widget.bkg_pattern_gb.setChecked(True)
self.widget.bkg_pattern_inspect_btn.toggle()
self.widget.bkg_pattern_x_min_txt.setText('5')
QTest.keyPress(self.widget.bkg_pattern_x_min_txt, QtCore.Qt.Key_Enter)
self.widget.bkg_pattern_x_max_txt.setText('11')
QTest.keyPress(self.widget.bkg_pattern_x_max_txt, QtCore.Qt.Key_Enter)
x_min, x_max = self.widget.pattern_widget.linear_region_item.getRegion()
self.assertAlmostEqual(x_min, 5, delta=0.02)
self.assertAlmostEqual(x_max, 11, delta=0.02)
示例3: enter_value_into_text_field
# 需要导入模块: from qtpy.QtTest import QTest [as 别名]
# 或者: from qtpy.QtTest.QTest import keyPress [as 别名]
def enter_value_into_text_field(text_field, value):
text_field.setText('')
QTest.keyClicks(text_field, str(value))
QTest.keyPress(text_field, QtCore.Qt.Key_Enter)
QtWidgets.QApplication.processEvents()