summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc
diff options
context:
space:
mode:
authorAlbert Astals Cid <albert.astals@canonical.com>2015-09-10 17:34:56 +0200
committerAlbert Astals Cid <albert.astals@canonical.com>2015-09-23 15:59:39 +0000
commit0396c7a7d89b0813b997076a52c3f29fb3a0e919 (patch)
treec9f6480700517425915b152b3fced2477b5f7648 /src/corelib/doc
parent867fc30c7c9be51b4b3813d2cc558b5a9df0256d (diff)
Doc: Mention that calling parent class event() is important
If you don't deleteLater and more won't work Change-Id: I47cbb24f8e22a7f269a0297410e4163878819f82 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/doc')
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp b/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp
index 8ff44c9dca..8846437b7c 100644
--- a/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp
@@ -486,6 +486,33 @@ QObject::connect(socket, &QTcpSocket::connected, this, [=] () {
}, Qt::AutoConnection);
//! [51]
+//! [52]
+class MyClass : public QWidget
+{
+ Q_OBJECT
+
+public:
+ MyClass(QWidget *parent = 0);
+ ~MyClass();
+
+ bool event(QEvent* ev)
+ {
+ if (ev->type() == QEvent::PolishRequest) {
+ // overwrite handling of PolishRequest if any
+ doThings();
+ return true;
+ } else if (ev->type() == QEvent::Show) {
+ // complement handling of Show if any
+ doThings2();
+ QWidget::event(ev);
+ return true;
+ }
+ // Make sure the rest of events are handled
+ return QWidget::event(ev);
+ }
+};
+//! [52]
+
//! [meta data]
//: This is a comment for the translator.
//= qtn_foo_bar