本文整理匯總了Python中AnyQt.QtTest.QTest.keyClicks方法的典型用法代碼示例。如果您正苦於以下問題:Python QTest.keyClicks方法的具體用法?Python QTest.keyClicks怎麽用?Python QTest.keyClicks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AnyQt.QtTest.QTest
的用法示例。
在下文中一共展示了QTest.keyClicks方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __set_value
# 需要導入模塊: from AnyQt.QtTest import QTest [as 別名]
# 或者: from AnyQt.QtTest.QTest import keyClicks [as 別名]
def __set_value(widget, value):
if isinstance(widget, QLineEdit):
QTest.mouseClick(widget, Qt.LeftButton)
QTest.keyClicks(widget, value, delay=0)
QTest.keyClick(widget, Qt.Key_Enter)
elif isinstance(widget, QComboBox):
simulate.combobox_activate_item(widget, value)
else:
raise ValueError("Unsupported widget {}".format(widget))
示例2: enterFilter
# 需要導入模塊: from AnyQt.QtTest import QTest [as 別名]
# 或者: from AnyQt.QtTest.QTest import keyClicks [as 別名]
def enterFilter(self, variable, filter, value=None, value2=None):
row = self.widget.cond_list.model().rowCount()
self.widget.add_button.click()
var_combo = self.widget.cond_list.cellWidget(row, 0)
simulate.combobox_activate_item(var_combo, variable.name, delay=0)
oper_combo = self.widget.cond_list.cellWidget(row, 1)
simulate.combobox_activate_item(oper_combo, filter, delay=0)
value_inputs = self._get_value_line_edits(row)
for i, value in enumerate([value, value2]):
if value is None:
continue
QTest.mouseClick(value_inputs[i], Qt.LeftButton)
QTest.keyClicks(value_inputs[i], value, delay=0)
QTest.keyClick(value_inputs[i], Qt.Key_Enter)
示例3: enter_text
# 需要導入模塊: from AnyQt.QtTest import QTest [as 別名]
# 或者: from AnyQt.QtTest.QTest import keyClicks [as 別名]
def enter_text(widget, text):
# type: (QLineEdit, str) -> None
widget.selectAll()
QTest.keyClick(widget, Qt.Key_Delete)
QTest.keyClicks(widget, text)
QTest.keyClick(widget, Qt.Key_Return)