Cockatrice 2026-09-01-Development-3.1.0-beta.10
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
UrlSchemeEventFilter Class Reference

Event filter that catches QFileOpenEvent URLs matching a scheme and re-emits them as urlReceived(). More...

#include <url_scheme_event_filter.h>

Inheritance diagram for UrlSchemeEventFilter:
[legend]
Collaboration diagram for UrlSchemeEventFilter:
[legend]

Signals

void urlReceived (const QString &url)

Public Member Functions

 UrlSchemeEventFilter (const QStringList &schemes, QObject *parent=nullptr)
bool eventFilter (QObject *watched, QEvent *event) override

Private Attributes

QStringList prefixes

Detailed Description

Event filter that catches QFileOpenEvent URLs matching a scheme and re-emits them as urlReceived().

On macOS, when the application is registered as a URL scheme handler, the OS delivers incoming URLs via QFileOpenEvent on the QApplication object. Install this filter on QApplication to intercept them:

UrlSchemeEventFilter filter(QStringList{QStringLiteral("cockatrice")});
QObject::connect(&filter, &UrlSchemeEventFilter::urlReceived,
&mainWindow, &MainWindow::handleUrl);
app.installEventFilter(&filter);
void urlReceived(const QString &url)
UrlSchemeEventFilter(const QStringList &schemes, QObject *parent=nullptr)
Definition url_scheme_event_filter.h:33

Note: the strings are compared against QUrl::scheme(), so they must be written without the "://" suffix (e.g. "cockatrice", not "cockatrice://").

Constructor & Destructor Documentation

◆ UrlSchemeEventFilter()

UrlSchemeEventFilter::UrlSchemeEventFilter ( const QStringList & schemes,
QObject * parent = nullptr )
inlineexplicit

Member Function Documentation

◆ eventFilter()

bool UrlSchemeEventFilter::eventFilter ( QObject * watched,
QEvent * event )
inlineoverride
Here is the call graph for this function:

◆ urlReceived

void UrlSchemeEventFilter::urlReceived ( const QString & url)
signal
Here is the caller graph for this function:

Member Data Documentation

◆ prefixes

QStringList UrlSchemeEventFilter::prefixes
private

The documentation for this class was generated from the following file: