当前位置: 首页>>代码示例>>Python>>正文


Python Testing.findQObjectsByType方法代码示例

本文整理汇总了Python中Testing.findQObjectsByType方法的典型用法代码示例。如果您正苦于以下问题:Python Testing.findQObjectsByType方法的具体用法?Python Testing.findQObjectsByType怎么用?Python Testing.findQObjectsByType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Testing的用法示例。


在下文中一共展示了Testing.findQObjectsByType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: changeParamTypeCombo

# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import findQObjectsByType [as 别名]
 def changeParamTypeCombo(self, w, path, new_type, old_path=None):
     node_widget = self.getNodeWidget(w, path, old_path)
     self.assertNotEqual(node_widget, None)
     type_combo = Testing.findQObjectsByName(node_widget, "type_combo")
     self.assertEqual(len(type_combo), 1)
     target = type_combo[0]
     QTest.mouseMove(target)
     QTest.mouseClick(target, Qt.LeftButton, delay=100)
     # Now the selector should pop up which is a QListView
     list_views = Testing.findQObjectsByType(target, "PyQt5.QtWidgets.QListView")
     self.assertEqual(len(list_views), 1)
     lv = list_views[0]
     model = lv.model()
     matches = model.findItems(new_type)
     self.assertEqual(len(matches), 1)
     model_idx = model.indexFromItem(matches[0])
     rect = lv.visualRect(model_idx)
     QTest.mouseMove(lv, pos=rect.center())
     Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
     QTest.mouseClick(lv.viewport(), Qt.LeftButton, pos=rect.center(), delay=100)
     Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
开发者ID:aeslaughter,项目名称:moose,代码行数:23,代码来源:InputTesting.py

示例2: changeParamCombo

# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import findQObjectsByType [as 别名]
 def changeParamCombo(self, w, path, value_name, new_value, old_path=None):
     param_widget = self.getParamWidget(w, path, value_name, old_path)
     self.assertNotEqual(param_widget, None)
     pos = param_widget.valueTestPosition()
     widget = param_widget.valueTestWidget()
     QTest.mouseMove(widget, pos)
     Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
     QTest.mouseClick(widget, Qt.LeftButton, pos=pos)
     # Now the selector should pop up which is a QListView
     list_views = Testing.findQObjectsByType(widget, "PyQt5.QtWidgets.QListView")
     self.assertEqual(len(list_views), 1)
     lv = list_views[0]
     model = lv.model()
     matches = model.findItems(new_value)
     self.assertEqual(len(matches), 1)
     model_idx = model.indexFromItem(matches[0])
     rect = lv.visualRect(model_idx)
     QTest.mouseMove(lv, pos=rect.center())
     Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
     QTest.mouseClick(lv.viewport(), Qt.LeftButton, pos=rect.center(), delay=100)
     Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
开发者ID:aeslaughter,项目名称:moose,代码行数:23,代码来源:InputTesting.py

示例3: changeParamValueText

# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import findQObjectsByType [as 别名]
 def changeParamValueText(self, w, path, value_name, new_text, old_path=None):
     param_widget = self.getParamWidget(w, path, value_name, old_path)
     self.assertNotEqual(param_widget, None)
     pos = param_widget.valueTestPosition()
     widget = param_widget.valueTestWidget()
     QTest.mouseMove(widget, pos)
     Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
     QTest.mouseClick(widget, Qt.LeftButton, pos=pos)
     QTest.mouseDClick(widget, Qt.LeftButton, pos=pos)
     # The default editing widget on a QTreeWidgetItem is a QLineEdit.
     # But it doesn't seem to show up until the item has focus.
     # This is pretty brittle but seems to work OK for now.
     line_edit = Testing.findQObjectsByType(widget, "PyQt5.QtWidgets.QLineEdit")
     for obj in line_edit:
         if obj.objectName() == "":
             widget = obj
             break
     Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
     QTest.keyClick(widget, Qt.Key_Backspace)
     QTest.keyClicks(widget, new_text)
     QTest.keyClick(widget, Qt.Key_Return)
     Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
开发者ID:aeslaughter,项目名称:moose,代码行数:24,代码来源:InputTesting.py

示例4: getTreeWidget

# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import findQObjectsByType [as 别名]
 def getTreeWidget(self, w):
     objects = Testing.findQObjectsByType(w, "peacock.Input.InputPathTreeWidget.InputPathTreeWidget")
     self.assertEqual(len(objects), 1)
     return objects[0]
开发者ID:aeslaughter,项目名称:moose,代码行数:6,代码来源:InputTesting.py


注:本文中的Testing.findQObjectsByType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。