summaryrefslogtreecommitdiffstats
path: root/examples/wayland/custom-extension/client-common/customextension.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/wayland/custom-extension/client-common/customextension.cpp')
-rw-r--r--examples/wayland/custom-extension/client-common/customextension.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/wayland/custom-extension/client-common/customextension.cpp b/examples/wayland/custom-extension/client-common/customextension.cpp
index 81f524d9d..41b4a30e9 100644
--- a/examples/wayland/custom-extension/client-common/customextension.cpp
+++ b/examples/wayland/custom-extension/client-common/customextension.cpp
@@ -109,6 +109,12 @@ void CustomExtension::registerWindow(QWindow *window)
sendWindowRegistration(window);
}
+CustomExtensionObject *CustomExtension::createCustomObject(const QString &color, const QString &text)
+{
+ auto *obj = create_local_object(color, text);
+ return new CustomExtensionObject(obj, text);
+}
+
void CustomExtension::sendBounce(QWindow *window, uint ms)
{
QtWayland::qt_example_extension::bounce(getWlSurface(window), ms);
@@ -152,4 +158,24 @@ void CustomExtension::example_extension_set_window_decoration(uint32_t state)
}
}
+CustomExtensionObject::CustomExtensionObject(struct ::qt_example_local_object *wl_object, const QString &text)
+ : QWaylandClientExtensionTemplate<CustomExtensionObject>(1)
+ , QtWayland::qt_example_local_object(wl_object)
+ , m_text(text)
+{
+
+}
+
+void CustomExtensionObject::example_local_object_clicked()
+{
+ qDebug() << "Object clicked:" << m_text;
+ emit clicked();
+}
+
+void CustomExtensionObject::setText(const QString &text)
+{
+ m_text = text;
+ set_text(text);
+}
+
QT_END_NAMESPACE