def _SelectAreaInView(viewWidget, selectAreaRange, keyboardModifier=QtCore.Qt.NoModifier): pressPoint = QtCore.QPoint(selectAreaRange.min[0], selectAreaRange.min[1]) releasePoint = QtCore.QPoint(selectAreaRange.max[0], selectAreaRange.max[1]) QTest.mousePress(viewWidget, QtCore.Qt.LeftButton, keyboardModifier, pressPoint) QTest.mouseRelease(viewWidget, QtCore.Qt.LeftButton, keyboardModifier, releasePoint)
def mouseRelease(self, widget, button, modifier=None, pos=None, delay=-1): """Simulate releasing a mouse button. See QTest.mouseRelease for details. """ if modifier is None: modifier = qt.Qt.KeyboardModifiers() pos = qt.QPoint(int(pos[0]), int( pos[1])) if pos is not None else qt.QPoint() QTest.mouseRelease(widget, button, modifier, pos, delay) self.qWait(20)
def _dragSelectActiveView(self): ''' Helper that drags-select (region-select) the whole viewport. ''' view = OMUI.M3dView.active3dView() viewWidget = wrapInstance(int(view.widget()), QWidget) viewWidget.update() self._processViewEvents() QTest.mousePress(viewWidget, QtCore.Qt.LeftButton, QtCore.Qt.NoModifier, viewWidget.rect().topLeft() + QtCore.QPoint(1, 1)) QTest.mouseMove(viewWidget, viewWidget.rect().bottomRight() - QtCore.QPoint(1,1)) QTest.mouseRelease(viewWidget, QtCore.Qt.LeftButton, QtCore.Qt.NoModifier, viewWidget.rect().bottomRight() - QtCore.QPoint(1, 1))