Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
guiintegration.cpp File Reference

GuiIntegration registry and the Gui window helpers. More...

#include <sonde/guiintegration.h>
#include <sonde/objecttree.h>
#include "threadcheck_p.h"
#include <QtCore/QAbstractItemModel>
#include <QtGui/QGuiApplication>
#include <QtGui/QPixmap>
#include <QtGui/QScreen>
#include <QtGui/QWindow>
#include <algorithm>
#include <vector>

Namespaces

namespace  Sonde
 Embeddable Model Context Protocol server for Qt applications.
namespace  Sonde::Gui
 Window lookup, grabbing and geometry, dispatched to the registered GuiIntegration objects.

Functions

std::vector< std::unique_ptr< GuiIntegration > > & Sonde::Gui::anonymous_namespace{guiintegration.cpp}::integrations ()
 The registered integrations, in registration order.
template<typename T>
bool Sonde::Gui::anonymous_namespace{guiintegration.cpp}::answered (const Expected< T > &result)
 Whether result is an answer (a value or a failure), not "not handled".
template<typename Hook>
auto Sonde::Gui::anonymous_namespace{guiintegration.cpp}::ask (Hook hook) -> decltype(hook(std::declval< GuiIntegration & >()))
 Asks every integration, in order, with hook, and returns the first answer: a value or a failure.
bool Sonde::Gui::anonymous_namespace{guiintegration.cpp}::isNormalWindow (const QWindow *w)
 Whether w is an ordinary window (not a popup, tooltip, ...).
void Sonde::Gui::anonymous_namespace{guiintegration.cpp}::ensureObjectTreeProviders ()
 Registers the GUI roots/children providers with ObjectTree once.
void Sonde::Gui::registerIntegration (std::unique_ptr< GuiIntegration > integration)
 Registers integration, replacing one with the same name().
QList< QWindow * > Sonde::Gui::visibleWindows ()
 All visible top-level windows.
QObject * Sonde::Gui::objectForWindow (QWindow *window)
 The object representing window in the object tree: what an integration reports (its QWidget, say), else the window itself.
Expected< ScreenRect > Sonde::Gui::objectGeometry (QObject *object)
 Where object is on screen (see GuiIntegration::objectGeometry()).
QObject * Sonde::Gui::objectAt (QWindow *window, const QPointF &pos)
 The deepest object at pos in window, or nullptr if there is none.
Expected< QImage > Sonde::Gui::grabWindow (QWindow *window)
 Renders window (device pixels).
QString Sonde::Gui::describeWindow (QWindow *window)
 One-line summary: @id Class "Title".
QWindow * Sonde::Gui::anonymous_namespace{guiintegration.cpp}::defaultWindow (const QList< QWindow * > &visible)
 The window to use when none is named: focus window, modal window, first visible normal window, or any visible window.
template<typename Predicate>
QWindow * Sonde::Gui::anonymous_namespace{guiintegration.cpp}::firstWindow (const QList< QWindow * > &windows, Predicate matches)
 The first of windows for which matches is true, or nullptr.
QWindow * Sonde::Gui::anonymous_namespace{guiintegration.cpp}::windowByName (const QString &s, const QList< QWindow * > &visible)
 A window named by id, exact title, objectName or partial title (in that order).
Expected< QWindow * > Sonde::Gui::anonymous_namespace{guiintegration.cpp}::windowOfObject (const QString &s)
 The window that shows the object named by object spec s.
Expected< QWindow * > Sonde::Gui::findWindow (const QString &spec)
 Finds a window.
QAbstractItemModel * Sonde::Gui::modelFor (QObject *object)
 The item model object is or shows, or nullptr if none.
Expected< ScreenRect > Sonde::Gui::cellGeometry (QObject *view, const QModelIndex &index, ScrollToCell scroll)
 Where cell index of view is (see GuiIntegration::cellGeometry()).
Expected< QJsonObject > Sonde::Gui::layoutInfo (QObject *object)
 Layout facts about object (see GuiIntegration::layoutInfo()), or a failure if no integration knows its layout.
Expected< OverflowFacts > Sonde::Gui::overflowFacts (QObject *object)
 Overflow facts about object (see GuiIntegration::overflowFacts()), or a failure if no integration knows about it.
QList< OpenPopup > Sonde::Gui::openPopups (QObject *root)
 The open popups below root, from every integration (see GuiIntegration::openPopups()).
QObjectList Sonde::Gui::movingViews (QWindow *window)
 The views in window still scrolling, from every integration (see GuiIntegration::movingViews()).
QJsonObject Sonde::Gui::appInfo ()
 The fields every integration adds to app_info (see GuiIntegration::appInfo()).

Detailed Description

GuiIntegration registry and the Gui window helpers.