Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
Sonde::Gui Namespace Reference

Window lookup, grabbing and geometry, dispatched to the registered GuiIntegration objects. More...

Functions

void registerIntegration (std::unique_ptr< GuiIntegration > integration)
 Registers integration, replacing one with the same name().
QList< QWindow * > visibleWindows ()
 All visible top-level windows.
QObject * objectForWindow (QWindow *window)
 The object representing window in the object tree: what an integration reports (its QWidget, say), else the window itself.
Expected< ScreenRect > objectGeometry (QObject *object)
 Where object is on screen (see GuiIntegration::objectGeometry()).
QObject * objectAt (QWindow *window, const QPointF &pos)
 The deepest object at pos in window, or nullptr if there is none.
Expected< QImage > grabWindow (QWindow *window)
 Renders window (device pixels).
QString describeWindow (QWindow *window)
 One-line summary: @id Class "Title".
Expected< QWindow * > findWindow (const QString &spec)
 Finds a window.
QAbstractItemModel * modelFor (QObject *object)
 The item model object is or shows, or nullptr if none.
Expected< ScreenRect > cellGeometry (QObject *view, const QModelIndex &index, ScrollToCell scroll)
 Where cell index of view is (see GuiIntegration::cellGeometry()).
Expected< QJsonObject > layoutInfo (QObject *object)
 Layout facts about object (see GuiIntegration::layoutInfo()), or a failure if no integration knows its layout.
Expected< OverflowFacts > overflowFacts (QObject *object)
 Overflow facts about object (see GuiIntegration::overflowFacts()), or a failure if no integration knows about it.
QList< OpenPopup > openPopups (QObject *root)
 The open popups below root, from every integration (see GuiIntegration::openPopups()).
QObjectList movingViews (QWindow *window)
 The views in window still scrolling, from every integration (see GuiIntegration::movingViews()).
QJsonObject appInfo ()
 The fields every integration adds to app_info (see GuiIntegration::appInfo()).

Detailed Description

Window lookup, grabbing and geometry, dispatched to the registered GuiIntegration objects.

Use from the GUI thread.

Function Documentation

◆ cellGeometry()

Expected< ScreenRect > Sonde::Gui::cellGeometry ( QObject * view,
const QModelIndex & index,
ScrollToCell scroll )

Where cell index of view is (see GuiIntegration::cellGeometry()).

Returns
Its window and rectangle, or a failure that says why it isn't shown.

◆ findWindow()

Expected< QWindow * > Sonde::Gui::findWindow ( const QString & spec)

Finds a window.

An empty spec picks the focus window, then a modal window, then the first visible normal window. Otherwise the spec may be a window id ("@0x..."), an exact or partial title (case-insensitive), an objectName, or an object spec for anything inside a window.

Returns
The window, or a failure that lists the visible windows.

◆ grabWindow()

Expected< QImage > Sonde::Gui::grabWindow ( QWindow * window)

Renders window (device pixels).

Returns
The image, or a failure that says why it couldn't be grabbed.

◆ modelFor()

QAbstractItemModel * Sonde::Gui::modelFor ( QObject * object)

The item model object is or shows, or nullptr if none.

Unlike GuiIntegration::model(), which only answers for views, it also accepts a model itself, and falls back to the object's "model" property.

◆ objectGeometry()

Expected< ScreenRect > Sonde::Gui::objectGeometry ( QObject * object)

Where object is on screen (see GuiIntegration::objectGeometry()).

A QWindow is its own window with its full rectangle.

Returns
Its window and rectangle, or a failure that says why it isn't shown.