本文整理匯總了Python中qtpy.QtTest.QTest.mouseDClick方法的典型用法代碼示例。如果您正苦於以下問題:Python QTest.mouseDClick方法的具體用法?Python QTest.mouseDClick怎麽用?Python QTest.mouseDClick使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類qtpy.QtTest.QTest
的用法示例。
在下文中一共展示了QTest.mouseDClick方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_run_dialog_opens_on_double_click
# 需要導入模塊: from qtpy.QtTest import QTest [as 別名]
# 或者: from qtpy.QtTest.QTest import mouseDClick [as 別名]
def test_run_dialog_opens_on_double_click(self):
with patch(createDialogFromName_func_name) as createDialog:
widget = AlgorithmSelectorWidget()
self._select_in_tree(widget, 'Load v.1')
selected_item = widget.tree.selectedItems()[0]
item_pos = widget.tree.visualItemRect(selected_item).center()
QTest.mouseDClick(widget.tree.viewport(), Qt.LeftButton,
Qt.NoModifier, pos=item_pos)
createDialog.assert_called_once_with('Load', 1)
示例2: test_plot_name_double_clicked_calls_presenter_and_makes_plot_current
# 需要導入模塊: from qtpy.QtTest import QTest [as 別名]
# 或者: from qtpy.QtTest.QTest import mouseDClick [as 別名]
def test_plot_name_double_clicked_calls_presenter_and_makes_plot_current(self):
plot_numbers = [0, 1, 2]
self.view.set_plot_list(plot_numbers)
item = self.view.table_widget.item(1, 1)
item_center = self.view.table_widget.visualItemRect(item).center()
# This single click should not be required, but otherwise the double click is not registered
QTest.mouseClick(self.view.table_widget.viewport(), Qt.LeftButton, pos=item_center)
QTest.mouseDClick(self.view.table_widget.viewport(), Qt.LeftButton, pos=item_center)
self.assertEqual(self.presenter.show_single_selected.call_count, 1)
# Expected result: 1
# Something goes wrong in QTest here and the selection is
# always the first plot.
self.assertEqual(self.view.get_currently_selected_plot_number(), 0)