7#include <QtWaylandCompositor/QWaylandShellSurface>
8#include <QGuiApplication>
19 popupItem->setShellSurface(shellSurface);
20 popupItem->setAutoCreatePopupItems(
true);
64 if (
d->m_shellIntegration) {
66 delete d->m_shellIntegration;
96 return d->m_shellSurface;
110 if (
d->m_shellIntegration) {
112 delete d->m_shellIntegration;
113 d->m_shellIntegration =
nullptr;
117 d->m_shellIntegration =
shellSurface->createIntegration(
this);
122 [
d](){
if (
d->m_shellSurface->modal())
d->raise(); });
174 return d->m_autoCreatePopupItems;
181 if (
enabled ==
d->m_autoCreatePopupItems)
184 d->m_autoCreatePopupItems =
enabled;
198 if (!self->eventFilterInstalled) {
199 qGuiApp->installEventFilter(self);
200 self->eventFilterInstalled =
true;
201 self->client = client;
202 self->closePopups = closePopups;
210 if (self->eventFilterInstalled && !self->waitForRelease)
214void QWaylandQuickShellEventFilter::stopFilter()
216 if (eventFilterInstalled) {
217 qGuiApp->removeEventFilter(
this);
218 eventFilterInstalled =
false;
223QWaylandQuickShellEventFilter::QWaylandQuickShellEventFilter(
QObject *parent)
232 if (press && !waitForRelease) {
235 mousePressTimeout.
start(0,
this);
245 bool popupClient = shellSurfaceItem && shellSurfaceItem->
surface() && shellSurfaceItem->
surface()->
client() == client;
247 if (waitForRelease) {
250 waitForRelease =
false;
256 if (finalRelease && mousePressTimeout.
isActive()) {
258 qWarning(
"Badly written autotest detected");
259 mousePressTimeout.
stop();
269 mousePressTimeout.
stop();
271 if (press && !popupClient) {
275 waitForRelease =
true;
287 mousePressTimeout.
stop();
299 if (
auto *surf = qobject_cast<QWaylandQuickShellSurfaceItem *>(moveItem))
310 return surf->staysOnTop() || surf->shellSurface()->modal();
315 return surf->staysOnBottom() && !surf->shellSurface()->modal();
328 auto *moveItem =
q->moveItem();
335 auto it =
parent->childItems().crbegin();
338 return (!putOnTop &&
onTop(surf)) || (putOnBottom && !
onBottom(surf));
347 moveItem->stackAfter(
top);
361 auto *moveItem =
q->moveItem();
368 auto it =
parent->childItems().cbegin();
371 return (!putOnBottom &&
onBottom(surf)) || (putOnTop && !
onTop(surf));
379 moveItem->stackBefore(
bottom);
390 return d->staysOnTop;
396 if (
d->staysOnTop ==
onTop)
399 if (
d->staysOnBottom) {
400 d->staysOnBottom =
false;
407 Q_ASSERT(!(
d->staysOnTop &&
d->staysOnBottom));
418 return d->staysOnBottom;
428 d->staysOnTop =
false;
435 Q_ASSERT(!(
d->staysOnTop &&
d->staysOnBottom));
440#include "moc_qwaylandquickshellsurfaceitem_p.cpp"
442#include "moc_qwaylandquickshellsurfaceitem.cpp"
void start(int msec, QObject *obj)
\obsolete Use chrono overload instead.
int timerId() const noexcept
Returns the timer's ID.
void stop()
Stops the timer.
bool isActive() const noexcept
Returns true if the timer is running and has not been stopped; otherwise returns false.
Type type() const
Returns the event type.
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
void installEventFilter(QObject *filterObj)
Installs an event filter filterObj on this object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void removeEventFilter(QObject *obj)
Removes an event filter object obj from this object.
void deleteLater()
\threadsafe
The QQmlProperty class abstracts accessing properties on objects created from QML.
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
QList< QQuickItem * > childItems() const
Returns the children of this item.
bool enabled
\qmlproperty bool QtQuick::Item::enabled
\qmltype WaylandClient \instantiates QWaylandClient \inqmlmodule QtWayland.Compositor
\qmltype WaylandQuickItem \instantiates QWaylandQuickItem \inqmlmodule QtWayland.Compositor
void surfaceDestroyed()
\qmlsignal void QtWayland.Compositor::WaylandQuickItem::surfaceDestroyed()
QWaylandSurface * surface
\qmlproperty WaylandSurface QtWayland.Compositor::WaylandQuickItem::surface
QWaylandQuickShellEventFilter implements a Wayland popup grab.
bool eventFilter(QObject *, QEvent *) override
Filters events if this object has been installed as an event filter for the watched object.
static void startFilter(QWaylandClient *client, CallbackFunction closePopupCallback)
void timerEvent(QTimerEvent *event) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
std::function< void()> CallbackFunction
static void cancelFilter()
bool m_autoCreatePopupItems
QWaylandShellSurface * m_shellSurface
QWaylandQuickShellSurfaceItem * maybeCreateAutoPopup(QWaylandShellSurface *shellSurface)
\qmltype ShellSurfaceItem \instantiates QWaylandQuickShellSurfaceItem \inherits WaylandQuickItem \inq...
QQuickItem * moveItem
\qmlproperty Item QtWayland.Compositor::ShellSurfaceItem::moveItem
bool staysOnTop
Keep this item above other Wayland surfaces.
QWaylandShellSurface * shellSurface
\qmlproperty ShellSurface QtWayland.Compositor::ShellSurfaceItem::shellSurface
void staysOnBottomChanged()
bool staysOnBottom
Keep this item above other Wayland surfaces.
void autoCreatePopupItemsChanged()
QWaylandQuickShellSurfaceItem(QQuickItem *parent=nullptr)
Constructs a QWaylandQuickWlShellSurfaceItem with the given parent.
bool autoCreatePopupItems
\qmlproperty bool QtWayland.Compositor::ShellSurfaceItem::autoCreatePopupItems
~QWaylandQuickShellSurfaceItem() override
void setStaysOnBottom(bool on)
void setStaysOnTop(bool on)
void setMoveItem(QQuickItem *moveItem)
void shellSurfaceChanged()
void setShellSurface(QWaylandShellSurface *shellSurface)
void setAutoCreatePopupItems(bool enabled)
\qmltype ShellSurface \instantiates QWaylandShellSurface \inqmlmodule QtWayland.Compositor
bool modal
\qmlproperty bool QtWayland.Compositor::ShellSurface::modal
QWaylandClient * client
\qmlproperty WaylandClient QtWayland.Compositor::WaylandSurface::client
QSet< QString >::iterator it
Combined button and popup list for selecting options.
GLdouble GLdouble GLdouble GLdouble top
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLdouble GLdouble GLdouble GLdouble q
QQuickItem * qobject_cast< QQuickItem * >(QObject *o)
#define QStringLiteral(str)
static bool onBottom(QWaylandQuickShellSurfaceItem *surf)
static QWaylandQuickShellSurfaceItem * findSurfaceItemFromMoveItem(QQuickItem *moveItem)
static bool onTop(QWaylandQuickShellSurfaceItem *surf)
myObject disconnect()
[26]