本文整理匯總了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()