From 6a135e239af4ad38928d5504d6ac176930ff9d68 Mon Sep 17 00:00:00 2001 From: Fredrik Orderud Date: Sat, 5 Sep 2015 17:15:56 +0200 Subject: Convert examples from QAXFACTORY_DEFAULT to Q_CLASSINFO. Move class ID, interface ID and events ID COM metadata into C++ classes with Q_CLASSINFO for improved readability and maintainability. QAXFACTORY_DEFAULT is still documented with an example as part of the QAxFactory class documentation. Also, it is still used in the "testcon" ActiveX test container. Change-Id: I48f5502809081804dc86f1d6b862da281c4cc441 Reviewed-by: Friedemann Kleint --- examples/activeqt/menus/main.cpp | 11 +++++------ examples/activeqt/menus/menus.h | 3 +++ examples/activeqt/opengl/doc/src/opengl.qdoc | 6 +++--- examples/activeqt/opengl/glbox.h | 5 ++++- examples/activeqt/opengl/main.cpp | 12 +++++------- examples/activeqt/simple/doc/src/simple.qdoc | 6 +++--- examples/activeqt/simple/main.cpp | 14 ++++++++------ 7 files changed, 31 insertions(+), 26 deletions(-) (limited to 'examples') diff --git a/examples/activeqt/menus/main.cpp b/examples/activeqt/menus/main.cpp index a610903..0a4867c 100644 --- a/examples/activeqt/menus/main.cpp +++ b/examples/activeqt/menus/main.cpp @@ -42,12 +42,11 @@ #include #include -QAXFACTORY_DEFAULT(QMenus, - "{4dc3f340-a6f7-44e4-a79b-3e9217695fbd}", - "{9ee49617-7d5c-441a-b833-4b068d40d751}", - "{13eca64b-ee2a-4f3c-aa04-5d9d975979a7}", - "{ce947ee3-0403-4fdc-895a-4fe779394b46}", - "{8de435ce-8d2a-46ac-b3b3-cb800d0847c7}"); +QAXFACTORY_BEGIN( + "{ce947ee3-0403-4fdc-895a-4fe779394b46}", // type library ID + "{8de435ce-8d2a-46ac-b3b3-cb800d0847c7}") // application ID + QAXCLASS(QMenus) +QAXFACTORY_END() int main( int argc, char **argv ) { diff --git a/examples/activeqt/menus/menus.h b/examples/activeqt/menus/menus.h index 515e9f8..480a367 100644 --- a/examples/activeqt/menus/menus.h +++ b/examples/activeqt/menus/menus.h @@ -50,6 +50,9 @@ QT_END_NAMESPACE class QMenus : public QMainWindow { Q_OBJECT + Q_CLASSINFO("ClassID", "{4dc3f340-a6f7-44e4-a79b-3e9217695fbd}") + Q_CLASSINFO("InterfaceID", "{9ee49617-7d5c-441a-b833-4b068d40d751}") + Q_CLASSINFO("EventsID", "{13eca64b-ee2a-4f3c-aa04-5d9d975979a7}") public: QMenus(QWidget *parent = 0); diff --git a/examples/activeqt/opengl/doc/src/opengl.qdoc b/examples/activeqt/opengl/doc/src/opengl.qdoc index 8d37853..f33af78 100644 --- a/examples/activeqt/opengl/doc/src/opengl.qdoc +++ b/examples/activeqt/opengl/doc/src/opengl.qdoc @@ -71,9 +71,9 @@ Qt to render an OpenGL scene in an ActiveX. The control exposes a few methods to change the scene. - The application uses the default factory as provided by the - QAXFACTORY_DEFAULT macro to expose the \c GLBox widget as an ActiveX - control. + The application uses QAxFactory through the \c QAXFACTORY_BEGIN(), + \c QAXCLASS() and \c QAXFACTORY_END() macros to expose the + \c GLBox widget as an ActiveX control. \snippet activeqt/opengl/main.cpp 0 The implementation of \c main initializes the QApplication object, and uses \c QAxFactory::isServer() to determine whether or not it is diff --git a/examples/activeqt/opengl/glbox.h b/examples/activeqt/opengl/glbox.h index eb68c39..5c09912 100644 --- a/examples/activeqt/opengl/glbox.h +++ b/examples/activeqt/opengl/glbox.h @@ -57,7 +57,10 @@ class GLBox : public QGLWidget, public QAxBindable { Q_OBJECT -//! [0] //! [1] + Q_CLASSINFO("ClassID", "{5fd9c22e-ed45-43fa-ba13-1530bb6b03e0}") + Q_CLASSINFO("InterfaceID", "{33b051af-bb25-47cf-a390-5cfd2987d26a}") + Q_CLASSINFO("EventsID", "{8c996c29-eafa-46ac-a6f9-901951e765b5}") + //! [0] //! [1] public: diff --git a/examples/activeqt/opengl/main.cpp b/examples/activeqt/opengl/main.cpp index 0596b2b..1c8a79b 100644 --- a/examples/activeqt/opengl/main.cpp +++ b/examples/activeqt/opengl/main.cpp @@ -54,13 +54,11 @@ //! [0] #include -QAXFACTORY_DEFAULT( GLBox, - "{5fd9c22e-ed45-43fa-ba13-1530bb6b03e0}", - "{33b051af-bb25-47cf-a390-5cfd2987d26a}", - "{8c996c29-eafa-46ac-a6f9-901951e765b5}", - "{2c3c183a-eeda-41a4-896e-3d9c12c3577d}", - "{83e16271-6480-45d5-aaf1-3f40b7661ae4}" - ) +QAXFACTORY_BEGIN( + "{2c3c183a-eeda-41a4-896e-3d9c12c3577d}", // type library ID + "{83e16271-6480-45d5-aaf1-3f40b7661ae4}") // application ID + QAXCLASS(GLBox) +QAXFACTORY_END() //! [0] //! [1] /* diff --git a/examples/activeqt/simple/doc/src/simple.qdoc b/examples/activeqt/simple/doc/src/simple.qdoc index 02e68d8..f72123a 100644 --- a/examples/activeqt/simple/doc/src/simple.qdoc +++ b/examples/activeqt/simple/doc/src/simple.qdoc @@ -75,9 +75,9 @@ \title Simple Example (ActiveQt) The Simple example demonstrates the use of - QAxBindable::requestPropertyChange() and - QAxBindable::propertyChanged(), and the use of the default - QAxFactory through the \c QAXFACTORY_DEFAULT() macro. + QAxBindable::requestPropertyChange() and QAxBindable::propertyChanged(), + and the use of QAxFactory through the \c QAXFACTORY_BEGIN(), + \c QAXCLASS() and \c QAXFACTORY_END() macros. The ActiveX control in this example is a laid out QWidget with a QSlider, a QLCDNumber and a QLineEdit. It provides a diff --git a/examples/activeqt/simple/main.cpp b/examples/activeqt/simple/main.cpp index 2c86d97..49d7b2a 100644 --- a/examples/activeqt/simple/main.cpp +++ b/examples/activeqt/simple/main.cpp @@ -51,6 +51,9 @@ class QSimpleAX : public QWidget, public QAxBindable { Q_OBJECT + Q_CLASSINFO("ClassID", "{DF16845C-92CD-4AAB-A982-EB9840E74669}") + Q_CLASSINFO("InterfaceID", "{616F620B-91C5-4410-A74E-6B81C76FFFE0}") + Q_CLASSINFO("EventsID", "{E1816BBA-BF5D-4A31-9855-D6BA432055FF}") Q_PROPERTY( QString text READ text WRITE setText ) Q_PROPERTY( int value READ value WRITE setValue ) public: @@ -127,10 +130,9 @@ private: #include "main.moc" //! [1] -QAXFACTORY_DEFAULT(QSimpleAX, - "{DF16845C-92CD-4AAB-A982-EB9840E74669}", - "{616F620B-91C5-4410-A74E-6B81C76FFFE0}", - "{E1816BBA-BF5D-4A31-9855-D6BA432055FF}", - "{EC08F8FC-2754-47AB-8EFE-56A54057F34E}", - "{A095BA0C-224F-4933-A458-2DD7F6B85D8F}") +QAXFACTORY_BEGIN( + "{EC08F8FC-2754-47AB-8EFE-56A54057F34E}", // type library ID + "{A095BA0C-224F-4933-A458-2DD7F6B85D8F}") // application ID + QAXCLASS(QSimpleAX) +QAXFACTORY_END() //! [1] -- cgit v1.2.1