Qt Convenience API

Note: The Qt Convenience API is only available in Squish for Qt editions.

Qt Convenience Functions

activateItem

Activates an item from a list or menu.

activateLink

Activates a link in a QTextBrowser or QLabel.

castToQObject

Downcast a QObject* to its most specific type.

clickButton

Clicks the specified button.

clickItem

Click an item inside a list, table, or tree.

clickTab

Clicks on a Tab in a QTabWidget.

doubleClick

Double-clicks the mouse.

doubleClickItem

Double-click an item in a View widget.

doubleTap

Double-taps on an object.

dragAndDrop

Performs a Drag and Drop operation

dragItemBy

Performs a drag operation.

dropOn

Performs a drop of an operation started by startDrag

flick

Performs a gesture on a QML Flickable.

gesture

Plays a gesture on a window or widget

hideKeyboard

Hides the on-screen keyboard when it is showing.

installEventHandler

Installs a Qt Event Handler.

installLazySignalHandler

Handles signals by objects that are looked up by name (lazily) whenever a signal is emitted.

installSignalHandler

Installs a Qt Signal Handler.

longMouseClick

Long Press with a mouse or tap-gesture.

longMouseDrag

Performs a mouse drag operation with a fixed delay after the initial press.

mouseClick

Clicks the mouse on the specified object.

mouseDrag

Performs a mouse drag operation.

mouseWheel

Performs a mouse wheel operation.

openContextMenu

Simulates the user opening a context menu.

openItemContextMenu

Simulates opening a context menu in an Item of a View.

pressAndHold

Performs a press and hold operation on a QDeclarativeItem.

qmlContext

Returns the QQmlContext for a given object.

qmlEngine

Returns the QQmlEngine associated with an object.

readGesture

Opens a gesture file and returns a GestureBuilder object.

scrollTo

Scrolls a widget to a position.

sendEvent

Sends a Qt Event to an object.

setFocus

Changes the keyboard input focus to a specified object.

setMouseTracking

Enables the recording of mouseMove events for QWidget classes.

setRecordMouseDrag

Enable or disable recording of mouse drag operations on QWidgets.

setWindowState

For top-level windows: Maximize, Minimize, FullScreen, or Normal.

spinDown

Clicks "down" on a QSpinBox.

spinUp

Clicks "up" on a QSpinBox.

startDrag

Initiates a drag operation on a given object.

tapObject

Tap on a Widget or an Item.

touchAndDrag

Performs a touch-based drag operation.

touchPress

Performs a touch-based press operation.

touchRelease

Performs a touch-based release operation.

type

Types text into an editable input widget/item.

uninstallEventHandler

Uninstalls a Qt Event Handler.

uninstallLazySignalHandler

Uninstalls a "lazy" Qt signal handler.

uninstallSignalHandler

Uninstalls a Qt Signal Handler.

waitForSignal

Waits for a Qt signal to be emitted by a QObject.

Qt Helper Classes/APIs

GestureBuilder Class

Class for representing touch gestures.

QML Extension API

API for customizing how Squish handles QML types.

QWeb(Engine)View Support

Helper methods added to QWebView and QWebEngineView classes.

Qt Convenience Function Parameters

Some of Qt's convenience functions can take a modifierState argument which indicates which special keys are pressed at the time of a mouse click. And some of the functions can also take a button argument which indicates which mouse button was clicked.

The modifierState can be one or more of the following: Qt.NoModifier, Qt.AltModifier, Qt.ControlModifier, Qt.KeypadModifier, Qt.MetaModifier, Qt.ShiftModifier. If more than one is used they must be OR-d together, for example, Qt.AltModifier|Qt.ShiftModifier. The form shown here works for Python and JavaScript. For Perl and Ruby replace the period with two colons, e.g., Qt::ControlModifier, and for Tcl use the enum function, e.g., enum Qt ControlModifier.

The button can be any one of: Qt.NoButton, Qt.LeftButton, Qt.MidButton, Qt.RightButton.

  • For Perl use the following syntax: Qt::LeftButton.
  • For Ruby use the following syntax: Qt::LEFT_BUTTON.
  • For Tcl use the following syntax: enum Qt LeftButton.

Native Dialogs on KDE

To ensure the most reliable recording and replaying of tests, Squish uses Qt's own dialogs (e.g., for choosing colors, files, and fonts), rather than the underlying platform's native dialogs.

Unfortunately, on KDE, Qt uses the KDE dialogs and this can cause problems when developing cross-platform test scripts. The solution is to set the QT_PLATFORM_PLUGIN environment variable to an invalid value, such as QT_PLATFORM_PLUGIN=nonesuch. This can be done, for instance, in the squishide's Test Suite Settings view's Environment section.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.

Search Results