pytest-dev / pytest-dev/pytest-qt

QtGuiTest methods exposed in Qt 6.9

Open
#580 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
455
Forks
72
Avg merge
12h 26m
Merged PRs (30d)
1

Description

Qt 6.9 will expose various QtGuiTest methods used by e.g. Squish that could be useful for us too: QtGuiTest namespace: Export symbols (610419) · Gerrit Code Review

namespace QtGuiTest
{
    Q_NAMESPACE_EXPORT(Q_GUI_EXPORT)

    Q_GUI_EXPORT void setKeyboardModifiers(Qt::KeyboardModifiers modifiers);
    Q_GUI_EXPORT void setCursorPosition(const QPoint &position);
    Q_GUI_EXPORT void synthesizeExtendedKeyEvent(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,
                                    quint32 nativeScanCode, quint32 nativeVirtualKey,
                                    const QString &text);
    Q_GUI_EXPORT bool synthesizeKeyEvent(QWindow *window, QEvent::Type t, int k, Qt::KeyboardModifiers mods,
                            const QString & text = QString(), bool autorep = false,
                            ushort count = 1);

    Q_GUI_EXPORT void synthesizeMouseEvent(const QPointF &position, Qt::MouseButtons state,
                              Qt::MouseButton button, QEvent::Type type,
                              Qt::KeyboardModifiers modifiers);

    Q_GUI_EXPORT void synthesizeWheelEvent(int rollCount, Qt::KeyboardModifiers modifiers);

    Q_GUI_EXPORT qint64 eventTimeElapsed();

    Q_GUI_EXPORT void postFakeWindowActivation(QWindow *window);

    Q_GUI_EXPORT QPoint toNativePixels(const QPoint &value, const QWindow *window);
    Q_GUI_EXPORT QRect toNativePixels(const QRect &value, const QWindow *window);
    Q_GUI_EXPORT qreal factor(const QWindow *window);

    Q_GUI_EXPORT void setEventPointId(QEventPoint &p, int arg);
    Q_GUI_EXPORT void setEventPointPressure(QEventPoint &p, qreal arg);
    Q_GUI_EXPORT void setEventPointState(QEventPoint &p, QEventPoint::State arg);
    Q_GUI_EXPORT void setEventPointPosition(QEventPoint &p, QPointF arg);
    Q_GUI_EXPORT void setEventPointGlobalPosition(QEventPoint &p, QPointF arg);
    Q_GUI_EXPORT void setEventPointScenePosition(QEventPoint &p, QPointF arg);
    Q_GUI_EXPORT void setEventPointEllipseDiameters(QEventPoint &p, QSizeF arg);
} // namespace QtGuiTest

Obviously not something actionable right now, but something we should keep in mind once Qt 6.9 is out (scheduled for March 2025). Hopefully PyQt/PySide will expose them too.

Corresponding docs: https://github.com/qt/qtbase/blob/2bdce97480ed66f0e8e9528fbc8f4f9c3d8487bf/src/gui/kernel/qtestsupport_gui.cpp#L203-L499

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the QtGuiTest declarations in qtestsupport_gui.cpp and checking whether Qt 6.9 exposes them through PyQt6 or PySide6. Done means the relevant QtGuiTest methods are available to pytest-qt users through the supported Python bindings, with coverage for the exposed behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.