summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2023-04-03 09:04:48 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-04-06 08:50:24 +0000
commit8e9f9c27ac6fc194829ba364ebf9ae2989cba476 (patch)
treeed5975cf5226d9fe698217070a980080df963941 /examples
parent7d79bc656f03abd407fe5abb55a11323c9a12678 (diff)
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. Change-Id: I6b3e46d402877b93cfa4dc555328e1e115ec4fc6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit e7b67edeefcf01a7155c8b6adeffb1304d4d22e4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/activeqt/CMakeLists.txt1
-rw-r--r--examples/activeqt/activeqt.pro1
-rw-r--r--examples/activeqt/hierarchy/CMakeLists.txt34
-rw-r--r--examples/activeqt/hierarchy/doc/snippets/hierarchy-demo-snippet.qdoc44
-rw-r--r--examples/activeqt/hierarchy/doc/src/hierarchy.qdoc64
-rw-r--r--examples/activeqt/hierarchy/hierarchy.def6
-rw-r--r--examples/activeqt/hierarchy/hierarchy.icobin766 -> 0 bytes
-rw-r--r--examples/activeqt/hierarchy/hierarchy.inf9
-rw-r--r--examples/activeqt/hierarchy/hierarchy.pro16
-rw-r--r--examples/activeqt/hierarchy/hierarchy.rc2
-rw-r--r--examples/activeqt/hierarchy/main.cpp12
-rw-r--r--examples/activeqt/hierarchy/objects.cpp70
-rw-r--r--examples/activeqt/hierarchy/objects.h62
13 files changed, 0 insertions, 321 deletions
diff --git a/examples/activeqt/CMakeLists.txt b/examples/activeqt/CMakeLists.txt
index de0a97b..b64c0d0 100644
--- a/examples/activeqt/CMakeLists.txt
+++ b/examples/activeqt/CMakeLists.txt
@@ -3,7 +3,6 @@
if(MSVC)
qt_internal_add_example(comapp)
- qt_internal_add_example(hierarchy)
qt_internal_add_example(menus)
qt_internal_add_example(multiple)
qt_internal_add_example(simple)
diff --git a/examples/activeqt/activeqt.pro b/examples/activeqt/activeqt.pro
index 6f189bc..8dcceff 100644
--- a/examples/activeqt/activeqt.pro
+++ b/examples/activeqt/activeqt.pro
@@ -1,6 +1,5 @@
TEMPLATE = subdirs
SUBDIRS += comapp \
- hierarchy \
menus \
multiple \
simple \
diff --git a/examples/activeqt/hierarchy/CMakeLists.txt b/examples/activeqt/hierarchy/CMakeLists.txt
deleted file mode 100644
index 6f3466e..0000000
--- a/examples/activeqt/hierarchy/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
-
-cmake_minimum_required(VERSION 3.16)
-project(hierarchyax LANGUAGES CXX)
-
-set(CMAKE_AUTOMOC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/activeqt/hierarchy")
-
-find_package(Qt6 REQUIRED COMPONENTS AxServer Core Gui Widgets)
-
-qt6_add_axserver_library(hierarchyax
- main.cpp
- objects.cpp objects.h
- hierarchy.def
- hierarchy.rc
-)
-
-target_link_libraries(hierarchyax PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS hierarchyax
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/activeqt/hierarchy/doc/snippets/hierarchy-demo-snippet.qdoc b/examples/activeqt/hierarchy/doc/snippets/hierarchy-demo-snippet.qdoc
deleted file mode 100644
index 9b14316..0000000
--- a/examples/activeqt/hierarchy/doc/snippets/hierarchy-demo-snippet.qdoc
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-//! [script]
-<script language="javascript">
-function createSubWidget( form )
-{
- ParentWidget.createSubWidget( form.nameEdit.value );
-}
-
-function renameSubWidget( form )
-{
- var SubWidget = ParentWidget.subWidget( form.nameEdit.value );
- if ( !SubWidget ) {
- alert( "No such widget " + form.nameEdit.value + "!" );
- return;
- }
- SubWidget.label = form.labelEdit.value;
- form.nameEdit.value = SubWidget.label;
-}
-
-function setFont( form )
-{
- ParentWidget.font = form.fontEdit.value;
-}
-</script>
-
-<p>
-This widget can have many children!
-</p>
-<object ID="ParentWidget" CLASSID="CLSID:d574a747-8016-46db-a07c-b2b4854ee75c"
-CODEBASE="http://www.qt-project.org/demos/hierarchy.cab">
-[Object not available! Did you forget to build and register the server?]
-</object><br />
-<form>
-<input type="edit" ID="nameEdit" value="&lt;enter object name&gt;" />
-<input type="button" value="Create" onClick="createSubWidget(this.form)" />
-<input type="edit" ID="labelEdit" />
-<input type="button" value="Rename" onClick="renameSubWidget(this.form)" />
-<br />
-<input type="edit" ID="fontEdit" value="MS Sans Serif" />
-<input type="button" value = "Set Font" onClick="setFont(this.form)" />
-</form>
-//! [script]
diff --git a/examples/activeqt/hierarchy/doc/src/hierarchy.qdoc b/examples/activeqt/hierarchy/doc/src/hierarchy.qdoc
deleted file mode 100644
index bc1c6e5..0000000
--- a/examples/activeqt/hierarchy/doc/src/hierarchy.qdoc
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \page qaxserver-demo-hierarchy.html
- \title Qt Widget Hierarchy
-
- \input examples/hierarchy-demo.qdocinc
-*/
-
-/*!
- \example activeqt/hierarchy
- \title Hierarchy Example (ActiveQt)
-
- \brief The Hierarchy example is shows how to write an in-process ActiveX
- control. The control is a QWidget subclass with child widgets
- that are accessible as sub-types.
-
- \snippet activeqt/hierarchy/objects.h 0
- The \c QParentWidget class provides slots to create a widget
- with a name, and to return a pointer to a named widget. The class
- declaration uses \c Q_CLASSINFO() to provide the COM identifiers for
- this class.
-
- \snippet activeqt/hierarchy/objects.cpp 0
- The constructor of \c QParentWidget creates a vertical box layout.
- New child widgets are automatically added to the layout.
-
- \snippet activeqt/hierarchy/objects.cpp 1
- The \c createSubWidget slot creates a new \c QSubWidget with
- the name provided in the parameter, and sets the label to that
- name. The widget is also shown explicitly.
-
- \snippet activeqt/hierarchy/objects.cpp 2
- The \c subWidget slot uses the \c QObject::findChild() function and
- returns the first child of type \c QSubWidget that has the requested
- name.
-
- \snippet activeqt/hierarchy/objects.h 1
- The \c QSubWidget class has a single string-property \c label,
- and implements the paintEvent to draw the label. The class uses
- again \c Q_CLASSINFO to provide the COM identifiers, and also sets
- the \e ToSuperClass attribute to \e QSubWidget, to ensure that only
- no slots of any superclasses (i.e. QWidget) are exposed.
-
- \snippet activeqt/hierarchy/objects.cpp 3
- \snippet activeqt/hierarchy/objects.cpp 4
- The implementation of the \c QSubWidget class is self-explanatory.
-
- \snippet activeqt/hierarchy/main.cpp 0
- The classes are then exported using a QAxFactory. \c QParentWidget is
- exported as a full class (which can be created ), while \c QSubWidget is
- only exported as a type, which can only be created indirectly through
- APIs of \c QParentWidget.
-
- To build the example you must first build the QAxServer library.
- Then run qmake and your make tool in \c activeqt/hierarchy.
-
- The \l{qaxserver-demo-hierarchy.html}{demonstration} requires
- your WebBrowser to support ActiveX controls, and scripting to be
- enabled.
-
- \snippet activeqt/hierarchy/doc/snippets/hierarchy-demo-snippet.qdoc script
-*/
diff --git a/examples/activeqt/hierarchy/hierarchy.def b/examples/activeqt/hierarchy/hierarchy.def
deleted file mode 100644
index bc82a03..0000000
--- a/examples/activeqt/hierarchy/hierarchy.def
+++ /dev/null
@@ -1,6 +0,0 @@
-EXPORTS
- DllCanUnloadNow PRIVATE
- DllGetClassObject PRIVATE
- DllRegisterServer PRIVATE
- DllUnregisterServer PRIVATE
- DumpIDL PRIVATE
diff --git a/examples/activeqt/hierarchy/hierarchy.ico b/examples/activeqt/hierarchy/hierarchy.ico
deleted file mode 100644
index c80d36a..0000000
--- a/examples/activeqt/hierarchy/hierarchy.ico
+++ /dev/null
Binary files differ
diff --git a/examples/activeqt/hierarchy/hierarchy.inf b/examples/activeqt/hierarchy/hierarchy.inf
deleted file mode 100644
index cb7e90f..0000000
--- a/examples/activeqt/hierarchy/hierarchy.inf
+++ /dev/null
@@ -1,9 +0,0 @@
-[version]
- signature="$CHICAGO$"
- AdvancedINF=2.0
- [Add.Code]
- hierarchyax.dll=hierarchyax.dll
- [hierarchyax.dll]
- file-win32-x86=thiscab
- clsid={d574a747-8016-46db-a07c-b2b4854ee75c}
- RegisterServer=yes
diff --git a/examples/activeqt/hierarchy/hierarchy.pro b/examples/activeqt/hierarchy/hierarchy.pro
deleted file mode 100644
index acc108a..0000000
--- a/examples/activeqt/hierarchy/hierarchy.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-include(../shared.pri)
-
-TEMPLATE = lib
-TARGET = hierarchyax
-
-CONFIG += warn_off dll
-QT += widgets axserver
-
-SOURCES = objects.cpp main.cpp
-HEADERS = objects.h
-RC_FILE = hierarchy.rc
-DEF_FILE = hierarchy.def
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/hierarchy
-INSTALLS += target
diff --git a/examples/activeqt/hierarchy/hierarchy.rc b/examples/activeqt/hierarchy/hierarchy.rc
deleted file mode 100644
index 70eb503..0000000
--- a/examples/activeqt/hierarchy/hierarchy.rc
+++ /dev/null
@@ -1,2 +0,0 @@
-1 TYPELIB "hierarchy.rc"
-1 ICON "hierarchy.ico"
diff --git a/examples/activeqt/hierarchy/main.cpp b/examples/activeqt/hierarchy/main.cpp
deleted file mode 100644
index 5ebe6e8..0000000
--- a/examples/activeqt/hierarchy/main.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (C) 2015 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-//! [0]
-#include "objects.h"
-#include <QAxFactory>
-
-QAXFACTORY_BEGIN("{9e626211-be62-4d18-9483-9419358fbb03}", "{75c276de-1df5-451f-a004-e4fa1a587df1}")
- QAXCLASS(QParentWidget)
- QAXTYPE(QSubWidget)
-QAXFACTORY_END()
-//! [0]
diff --git a/examples/activeqt/hierarchy/objects.cpp b/examples/activeqt/hierarchy/objects.cpp
deleted file mode 100644
index 6dfda44..0000000
--- a/examples/activeqt/hierarchy/objects.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (C) 2015 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "objects.h"
-#include <QLayout>
-#include <QPainter>
-
-/* Implementation of QParentWidget */
-//! [0]
-QParentWidget::QParentWidget(QWidget *parent)
-: QWidget(parent),
- m_vbox(new QVBoxLayout(this))
-{
-}
-
-//! [0] //! [1]
-void QParentWidget::createSubWidget(const QString &name)
-{
- QSubWidget *sw = new QSubWidget(this, name);
- m_vbox->addWidget(sw);
- sw->setLabel(name);
- sw->show();
-}
-
-//! [1] //! [2]
-QSubWidget *QParentWidget::subWidget(const QString &name)
-{
- return findChild<QSubWidget *>(name);
-}
-
-//! [2]
-QSize QParentWidget::sizeHint() const
-{
- return QWidget::sizeHint().expandedTo(QSize(100, 100));
-}
-
-/* Implementation of QSubWidget */
-//! [3]
-QSubWidget::QSubWidget(QWidget *parent, const QString &name)
-: QWidget(parent)
-{
- setObjectName(name);
-}
-
-void QSubWidget::setLabel(const QString &text)
-{
- m_label = text;
- setObjectName(text);
- update();
-}
-
-QString QSubWidget::label() const
-{
- return m_label;
-}
-
-QSize QSubWidget::sizeHint() const
-{
- QFontMetrics fm(font());
- return QSize(fm.horizontalAdvance(m_label), fm.height());
-}
-
-void QSubWidget::paintEvent(QPaintEvent *)
-{
- QPainter painter(this);
- painter.setPen(palette().text().color());
- painter.drawText(rect(), Qt::AlignCenter, m_label);
-//! [3] //! [4]
-}
-//! [4]
diff --git a/examples/activeqt/hierarchy/objects.h b/examples/activeqt/hierarchy/objects.h
deleted file mode 100644
index 6b8bea6..0000000
--- a/examples/activeqt/hierarchy/objects.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// 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