summaryrefslogtreecommitdiffstats
path: root/examples/wayland/custom-extension/client-common
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2023-02-08 13:38:22 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2023-03-02 11:44:51 +0000
commitdfe0f9740620ef2267225eeef445bfd7e3cb3348 (patch)
treed709048fd51050c6942030c5166ea425fbd00134 /examples/wayland/custom-extension/client-common
parentee92c05f34e96431e22b5735d3b864d08e2e4ad3 (diff)
Revamp/document custom-extension example
This is a very useful example which was unfortunately undocumented. It also needed some clean-up in the code, and as part of writing the documentation, it became clear that it would be an easier demonstration to follow if the QML client was more similar to the C++ client, so that they were simply two implementations of the same spec. Fixes: QTBUG-110919 Change-Id: Ia4476cda34056e28722af6639f95d8c87819681a Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'examples/wayland/custom-extension/client-common')
-rw-r--r--examples/wayland/custom-extension/client-common/customextension.cpp2
-rw-r--r--examples/wayland/custom-extension/client-common/customextension.h6
2 files changed, 7 insertions, 1 deletions
diff --git a/examples/wayland/custom-extension/client-common/customextension.cpp b/examples/wayland/custom-extension/client-common/customextension.cpp
index 3c585af3a..4f898ea9b 100644
--- a/examples/wayland/custom-extension/client-common/customextension.cpp
+++ b/examples/wayland/custom-extension/client-common/customextension.cpp
@@ -68,10 +68,12 @@ CustomExtensionObject *CustomExtension::createCustomObject(const QString &color,
return new CustomExtensionObject(obj, text);
}
+//! [sendBounce]
void CustomExtension::sendBounce(QWindow *window, uint ms)
{
QtWayland::qt_example_extension::bounce(getWlSurface(window), ms);
}
+//! [sendBounce]
void CustomExtension::sendSpin(QWindow *window, uint ms)
{
diff --git a/examples/wayland/custom-extension/client-common/customextension.h b/examples/wayland/custom-extension/client-common/customextension.h
index c3a9a4939..5dd770199 100644
--- a/examples/wayland/custom-extension/client-common/customextension.h
+++ b/examples/wayland/custom-extension/client-common/customextension.h
@@ -6,16 +6,21 @@
#include <QtWaylandClient/QWaylandClientExtension>
#include <QtGui/QWindow>
+#include <QtQml/QQmlEngine>
+
#include "qwayland-custom.h"
QT_BEGIN_NAMESPACE
class CustomExtensionObject;
+//! [CustomExtension]
class CustomExtension : public QWaylandClientExtensionTemplate<CustomExtension>
, public QtWayland::qt_example_extension
+//! [CustomExtension]
{
Q_OBJECT
+ QML_ELEMENT
public:
CustomExtension();
Q_INVOKABLE void registerWindow(QWindow *window);
@@ -67,7 +72,6 @@ protected:
public slots:
void setText(const QString &text);
-
signals:
void textChanged(const QString &text);
void clicked();