aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/referenceexamples/default
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qml/referenceexamples/default')
-rw-r--r--examples/qml/referenceexamples/default/CMakeLists.txt43
-rw-r--r--examples/qml/referenceexamples/default/birthdayparty.cpp30
-rw-r--r--examples/qml/referenceexamples/default/birthdayparty.h35
-rw-r--r--examples/qml/referenceexamples/default/default.pro15
-rw-r--r--examples/qml/referenceexamples/default/default.qrc5
-rw-r--r--examples/qml/referenceexamples/default/example.qml17
-rw-r--r--examples/qml/referenceexamples/default/main.cpp34
-rw-r--r--examples/qml/referenceexamples/default/person.cpp24
-rw-r--r--examples/qml/referenceexamples/default/person.h45
9 files changed, 0 insertions, 248 deletions
diff --git a/examples/qml/referenceexamples/default/CMakeLists.txt b/examples/qml/referenceexamples/default/CMakeLists.txt
deleted file mode 100644
index 681085f386..0000000000
--- a/examples/qml/referenceexamples/default/CMakeLists.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
-
-cmake_minimum_required(VERSION 3.16)
-project(default LANGUAGES CXX)
-
-set(CMAKE_AUTOMOC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qml/referenceexamples/default")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Qml)
-
-qt_add_executable(default
- birthdayparty.cpp birthdayparty.h
- main.cpp
- person.cpp person.h
-)
-
-set_target_properties(default PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-
-target_link_libraries(default PUBLIC
- Qt::Core
- Qt::Qml
-)
-
-qt_add_qml_module(default
- URI People
- QML_FILES example.qml
- NO_RESOURCE_TARGET_PATH
-)
-
-install(TARGETS default
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/qml/referenceexamples/default/birthdayparty.cpp b/examples/qml/referenceexamples/default/birthdayparty.cpp
deleted file mode 100644
index 5a9f38d9f3..0000000000
--- a/examples/qml/referenceexamples/default/birthdayparty.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "birthdayparty.h"
-
-Person *BirthdayParty::host() const
-{
- return m_host;
-}
-
-void BirthdayParty::setHost(Person *c)
-{
- m_host = c;
-}
-
-QQmlListProperty<Person> BirthdayParty::guests()
-{
- return {this, &m_guests};
-}
-
-qsizetype BirthdayParty::guestCount() const
-{
- return m_guests.count();
-}
-
-Person *BirthdayParty::guest(qsizetype index) const
-{
- return m_guests.at(index);
-}
-
diff --git a/examples/qml/referenceexamples/default/birthdayparty.h b/examples/qml/referenceexamples/default/birthdayparty.h
deleted file mode 100644
index ce5106ef99..0000000000
--- a/examples/qml/referenceexamples/default/birthdayparty.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#ifndef BIRTHDAYPARTY_H
-#define BIRTHDAYPARTY_H
-
-#include <QObject>
-#include <QQmlListProperty>
-#include "person.h"
-
-// ![0]
-class BirthdayParty : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(Person *host READ host WRITE setHost)
- Q_PROPERTY(QQmlListProperty<Person> guests READ guests)
- Q_CLASSINFO("DefaultProperty", "guests")
- QML_ELEMENT
-public:
- using QObject::QObject;
-
- Person *host() const;
- void setHost(Person *);
-
- QQmlListProperty<Person> guests();
- qsizetype guestCount() const;
- Person *guest(qsizetype) const;
-
-private:
- Person *m_host = nullptr;
- QList<Person *> m_guests;
-};
-// ![0]
-
-#endif // BIRTHDAYPARTY_H
diff --git a/examples/qml/referenceexamples/default/default.pro b/examples/qml/referenceexamples/default/default.pro
deleted file mode 100644
index f52f749ddd..0000000000
--- a/examples/qml/referenceexamples/default/default.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-QT = core qml
-
-CONFIG += qmltypes
-QML_IMPORT_NAME = People
-QML_IMPORT_MAJOR_VERSION = 1
-
-SOURCES += main.cpp \
- person.cpp \
- birthdayparty.cpp
-HEADERS += person.h \
- birthdayparty.h
-RESOURCES += default.qrc
-
-target.path = $$[QT_INSTALL_EXAMPLES]/qml/referenceexamples/default
-INSTALLS += target
diff --git a/examples/qml/referenceexamples/default/default.qrc b/examples/qml/referenceexamples/default/default.qrc
deleted file mode 100644
index e2fa01d5e7..0000000000
--- a/examples/qml/referenceexamples/default/default.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>example.qml</file>
-</qresource>
-</RCC>
diff --git a/examples/qml/referenceexamples/default/example.qml b/examples/qml/referenceexamples/default/example.qml
deleted file mode 100644
index addc74dfb5..0000000000
--- a/examples/qml/referenceexamples/default/example.qml
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import People
-
-// ![0]
-BirthdayParty {
- host: Boy {
- name: "Bob Jones"
- shoeSize: 12
- }
-
- Boy { name: "Leo Hodges" }
- Boy { name: "Jack Smith" }
- Girl { name: "Anne Brown" }
-}
-// ![0]
diff --git a/examples/qml/referenceexamples/default/main.cpp b/examples/qml/referenceexamples/default/main.cpp
deleted file mode 100644
index 5e7e711ada..0000000000
--- a/examples/qml/referenceexamples/default/main.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-#include <QCoreApplication>
-#include <QQmlEngine>
-#include <QQmlComponent>
-#include <QDebug>
-#include "birthdayparty.h"
-#include "person.h"
-
-int main(int argc, char ** argv)
-{
- QCoreApplication app(argc, argv);
-
- QQmlEngine engine;
- QQmlComponent component(&engine, QUrl("qrc:example.qml"));
- auto *party = qobject_cast<BirthdayParty *>(component.create());
-
- if (party && party->host()) {
- qInfo() << party->host()->name() << "is having a birthday!";
-
- if (qobject_cast<Boy *>(party->host()))
- qInfo() << "He is inviting:";
- else
- qInfo() << "She is inviting:";
-
- for (qsizetype ii = 0; ii < party->guestCount(); ++ii)
- qInfo() << " " << party->guest(ii)->name();
-
- return EXIT_SUCCESS;
- }
-
- qWarning() << component.errors();
- return EXIT_FAILURE;
-}
diff --git a/examples/qml/referenceexamples/default/person.cpp b/examples/qml/referenceexamples/default/person.cpp
deleted file mode 100644
index ab7aefcbee..0000000000
--- a/examples/qml/referenceexamples/default/person.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "person.h"
-
-QString Person::name() const
-{
- return m_name;
-}
-
-void Person::setName(const QString &n)
-{
- m_name = n;
-}
-
-int Person::shoeSize() const
-{
- return m_shoeSize;
-}
-
-void Person::setShoeSize(int s)
-{
- m_shoeSize = s;
-}
diff --git a/examples/qml/referenceexamples/default/person.h b/examples/qml/referenceexamples/default/person.h
deleted file mode 100644
index 04ab53696d..0000000000
--- a/examples/qml/referenceexamples/default/person.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#ifndef PERSON_H
-#define PERSON_H
-
-#include <QObject>
-#include <QtQml/qqml.h>
-
-class Person : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName)
- Q_PROPERTY(int shoeSize READ shoeSize WRITE setShoeSize)
- QML_ANONYMOUS
-public:
- using QObject::QObject;
-
- QString name() const;
- void setName(const QString &);
-
- int shoeSize() const;
- void setShoeSize(int);
-private:
- QString m_name;
- int m_shoeSize = 0;
-};
-
-class Boy : public Person
-{
- Q_OBJECT
- QML_ELEMENT
-public:
- using Person::Person;
-};
-
-class Girl : public Person
-{
- Q_OBJECT
- QML_ELEMENT
-public:
- using Person::Person;
-};
-
-#endif // PERSON_H