Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
Sonde::anonymous_namespace{actiontools.cpp} Namespace Reference

Classes

struct  Entry
 One action_list entry: a text line and its JSON. More...

Functions

QString withoutMnemonic (QString text)
 text without mnemonic markers: "&Save" -> "Save", "R&&D" -> "R&D".
QString stringProperty (const QObject *o, const char *name)
 A property of o as a string ("" if it has none).
bool boolProperty (const QObject *o, const char *name, bool fallback)
 A boolean property of o, or fallback if it has none.
bool isAction (const QObject *o)
 Whether o is an action this tool lists: a QAction (not a separator) or a Qt Quick Controls Action (found by class name, so Quick needn't be linked).
QObjectList allObjects ()
 Every object reachable from the roots, hidden ones included, in breadth-first order.
QString location (const QAction *action)
 Where action is shown: "File > Recent" for menus (from the menus' titles), "toolbar mainToolBar" for tool bars, comma-separated if more than one.
bool isMenuEntry (const QAction *action)
 Whether action is a menu's own entry (QMenu::menuAction(), which opens the menu): QMenu creates it as its own child, with its title as the text.
QWindow * windowOf (QObject *o)
 The window o belongs to: the first of its parents that is, or is shown in, a window (a closed menu isn't, but its menu bar is), or nullptr.
Entry describeAction (QObject *o)
 The entry for o.
bool matches (QObject *o, const QWindow *window, const QString &text)
 Whether o passes the "window" and "text" filters.
ToolResult listActions (const QJsonObject &args)
 The action_list tool.

Variables

constexpr int kMaxVisited = 50000
 Most objects action_list visits (a guard against huge trees).
constexpr qsizetype kMaxListed = 500
 Most actions listed.

Function Documentation

◆ allObjects()

QObjectList Sonde::anonymous_namespace{actiontools.cpp}::allObjects ( )

Every object reachable from the roots, hidden ones included, in breadth-first order.

Follows plain QObject children as well as the object tree's: Qt Quick's tree shows only visual children (QQuickItem::childItems()), but an Action declared inside an Item is a plain child of it.

◆ isMenuEntry()

bool Sonde::anonymous_namespace{actiontools.cpp}::isMenuEntry ( const QAction * action)

Whether action is a menu's own entry (QMenu::menuAction(), which opens the menu): QMenu creates it as its own child, with its title as the text.

(Checked by class name and property, so the Gui library needn't link Widgets.)