diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2023-04-03 09:04:48 +0200 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@qt.io> | 2023-04-06 10:36:08 +0200 |
commit | e7b67edeefcf01a7155c8b6adeffb1304d4d22e4 (patch) | |
tree | c62ddcea9806808171e7eb9cf49560d190de7d2f /tests/manual/hierarchy/objects.h | |
parent | 2ee58af673cc26b2a05feb1041217bb8c334d130 (diff) | |
download | qtactiveqt-e7b67edeefcf01a7155c8b6adeffb1304d4d22e4.tar.gz |
examples: Remove hierarchy example
Functionality is also covered in other examples so that hierarchy is no
longer needed.
In order to keep the use case's code in source, the example was moved to
tests/manual.
Pick-to: 6.5
Change-Id: I6b3e46d402877b93cfa4dc555328e1e115ec4fc6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/manual/hierarchy/objects.h')
-rw-r--r-- | tests/manual/hierarchy/objects.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/manual/hierarchy/objects.h b/tests/manual/hierarchy/objects.h new file mode 100644 index 0000000..6b8bea6 --- /dev/null +++ b/tests/manual/hierarchy/objects.h @@ -0,0 +1,62 @@ +// Copyright (C) 2015 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#ifndef OBJECTS_H +#define OBJECTS_H + +#include <QWidget> + +QT_BEGIN_NAMESPACE +class QVBoxLayout; +QT_END_NAMESPACE +class QSubWidget; + +//! [0] +class QParentWidget : public QWidget +{ + Q_OBJECT + Q_CLASSINFO("ClassID", "{d574a747-8016-46db-a07c-b2b4854ee75c}"); + Q_CLASSINFO("InterfaceID", "{4a30719d-d9c2-4659-9d16-67378209f822}"); + Q_CLASSINFO("EventsID", "{4a30719d-d9c2-4659-9d16-67378209f823}"); +public: + explicit QParentWidget(QWidget *parent = nullptr); + + QSize sizeHint() const override; + +public slots: + void createSubWidget(const QString &name); + + QSubWidget *subWidget(const QString &name); + +private: + QVBoxLayout *m_vbox; +}; +//! [0] + +//! [1] +class QSubWidget : public QWidget +{ + Q_OBJECT + Q_PROPERTY(QString label READ label WRITE setLabel) + + Q_CLASSINFO("ClassID", "{850652f4-8f71-4f69-b745-bce241ccdc30}"); + Q_CLASSINFO("InterfaceID", "{2d76cc2f-3488-417a-83d6-debff88b3c3f}"); + Q_CLASSINFO("ToSuperClass", "QSubWidget"); + +public: + QSubWidget(QWidget *parent = nullptr, const QString &name = QString()); + + void setLabel(const QString &text); + QString label() const; + + QSize sizeHint() const override; + +protected: + void paintEvent(QPaintEvent *e) override; + +private: + QString m_label; +}; +//! [1] + +#endif // OBJECTS_H |