diff options
Diffstat (limited to 'examples/activeqt')
-rw-r--r-- | examples/activeqt/CMakeLists.txt | 3 | ||||
-rw-r--r-- | examples/activeqt/activeqt.pro | 1 | ||||
-rw-r--r-- | examples/activeqt/opengl/CMakeLists.txt | 37 | ||||
-rw-r--r-- | examples/activeqt/opengl/doc/src/opengl.qdoc | 105 | ||||
-rw-r--r-- | examples/activeqt/opengl/glbox.cpp | 218 | ||||
-rw-r--r-- | examples/activeqt/opengl/glbox.h | 53 | ||||
-rw-r--r-- | examples/activeqt/opengl/globjwin.cpp | 72 | ||||
-rw-r--r-- | examples/activeqt/opengl/globjwin.h | 24 | ||||
-rw-r--r-- | examples/activeqt/opengl/main.cpp | 49 | ||||
-rw-r--r-- | examples/activeqt/opengl/opengl.def | 6 | ||||
-rw-r--r-- | examples/activeqt/opengl/opengl.ico | bin | 766 -> 0 bytes | |||
-rw-r--r-- | examples/activeqt/opengl/opengl.inf | 9 | ||||
-rw-r--r-- | examples/activeqt/opengl/opengl.pro | 18 | ||||
-rw-r--r-- | examples/activeqt/opengl/opengl.rc | 2 |
14 files changed, 0 insertions, 597 deletions
diff --git a/examples/activeqt/CMakeLists.txt b/examples/activeqt/CMakeLists.txt index f63a35a..5604df2 100644 --- a/examples/activeqt/CMakeLists.txt +++ b/examples/activeqt/CMakeLists.txt @@ -5,9 +5,6 @@ if(MSVC) qt_internal_add_example(comapp) qt_internal_add_example(simple) qt_internal_add_example(wrapper) - if(TARGET Qt6::OpenGLWidgets AND QT_FEATURE_opengl AND NOT QT_FEATURE_opengles2) - qt_internal_add_example(opengl) - endif() if(TARGET Qt::QuickControls2) qt_internal_add_example(simpleqml) endif() diff --git a/examples/activeqt/activeqt.pro b/examples/activeqt/activeqt.pro index c42a2aa..ee5a663 100644 --- a/examples/activeqt/activeqt.pro +++ b/examples/activeqt/activeqt.pro @@ -3,5 +3,4 @@ SUBDIRS += comapp \ simple \ wrapper -contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2): SUBDIRS += opengl qtHaveModule(quickcontrols2):SUBDIRS += simpleqml diff --git a/examples/activeqt/opengl/CMakeLists.txt b/examples/activeqt/opengl/CMakeLists.txt deleted file mode 100644 index 7627048..0000000 --- a/examples/activeqt/opengl/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: BSD-3-Clause - -cmake_minimum_required(VERSION 3.16) -project(openglax LANGUAGES CXX) - -set(CMAKE_AUTOMOC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/activeqt/opengl") - -find_package(Qt6 REQUIRED COMPONENTS AxServer Core Gui OpenGL OpenGLWidgets Widgets) - -qt6_add_axserver_executable(openglax - glbox.cpp glbox.h - globjwin.cpp globjwin.h - main.cpp - opengl.def - opengl.rc -) - -target_link_libraries(openglax PUBLIC - Qt::Core - Qt::Gui - Qt::OpenGL - Qt::OpenGLWidgets - Qt::Widgets -) - -install(TARGETS openglax - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff --git a/examples/activeqt/opengl/doc/src/opengl.qdoc b/examples/activeqt/opengl/doc/src/opengl.qdoc deleted file mode 100644 index 2558363..0000000 --- a/examples/activeqt/opengl/doc/src/opengl.qdoc +++ /dev/null @@ -1,105 +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-opengl.html - - \title OpenGL in an HTML page - - \raw HTML - <SCRIPT LANGUAGE="JavaScript"> - function setRot( form ) - { - GLBox.setXRotation( form.XEdit.value ); - GLBox.setYRotation( form.YEdit.value ); - GLBox.setZRotation( form.ZEdit.value ); - } - </SCRIPT> - - <p /> - An OpenGL scene:<br /> - <object ID="GLBox" CLASSID="CLSID:5fd9c22e-ed45-43fa-ba13-1530bb6b03e0" - CODEBASE="http://www.qt-project.org/demos/openglax.cab"> - [Object not available! Did you forget to build and register the server?] - </object><br /> - - <form> - Rotate the scene:<br /> - X:<input type="edit" ID="XEdit" value="0" /><br /> - Y:<input type="edit" name="YEdit" value="0" /><br /> - Z:<input type="edit" name="ZEdit" value="0" /><br /> - <input type="button" value="Set" onClick="setRot(this.form)" /> - </form> - \endraw -*/ - -/*! - \example activeqt/opengl - \title OpenGL Example (ActiveQt) - - \brief The OpenGL example demonstrates the use of the default factory - and QAxFactory::isServer(), and the implementation of an - additional COM interface using QAxBindable and QAxAggregated. - The server executable can run both as an ActiveX server and as a - stand-alone application. - - The ActiveX control in this example uses the QGlWidget class in - Qt to render an OpenGL scene in an ActiveX. The control exposes a few - methods to change the scene. - - 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 - appropriate to create and show the application interface. - \snippet activeqt/opengl/main.cpp 1 - \snippet activeqt/opengl/main.cpp 2 - \snippet activeqt/opengl/main.cpp 3 - - The \c GLBox class inherits from both the \l QOpenGLWidget class to be able - to render OpenGL, and from \l QAxBindable. - \snippet activeqt/opengl/glbox.h 0 - The class reimplements the \l QAxBindable::createAggregate() function from QAxBindable - to return the pointer to a \l QAxAggregated object. - \snippet activeqt/opengl/glbox.h 1 - - The implementation file of the \c GLBox class includes the \c objsafe.h - system header, in which the \c IObjectSafety COM interface is defined. - \snippet activeqt/opengl/glbox.cpp 0 - A class \c ObjectSafetyImpl is declared using multiple inheritance - to subclass the QAxAggregated class, and to implement the IObjectSafety - interface. - \snippet activeqt/opengl/glbox.cpp 1 - The class declares a default constructor, and implements the queryInterface - function to support the IObjectSafety interface. - \snippet activeqt/opengl/glbox.cpp 2 - Since every COM interface inherits \c IUnknown the \c QAXAGG_IUNKNOWN macro - is used to provide the default implementation of the \c IUnknown interface. - The macro is defined to delegate all calls to \c QueryInterface, \c AddRef - and \c Release to the interface returned by the controllingUnknown() function. - \snippet activeqt/opengl/glbox.cpp 3 - The implementation of the \c IObjectSafety interface provides the caller - with information about supported and enabled safety options, and returns - \c S_OK for all calls to indicate that the ActiveX control is safe. - \snippet activeqt/opengl/glbox.cpp 4 - The implementation of the \c createAggregate() function just returns a new - \c ObjectSafetyImpl object. - \snippet activeqt/opengl/glbox.cpp 5 - - To build the example you must first build the QAxServer library. - Then run \c qmake and your make tool in \c - examples/activeqt/wrapper. - - The \l{qaxserver-demo-opengl.html}{demonstration} requires your - WebBrowser to support ActiveX controls, and scripting to be - enabled. - - In contrast to the other QAxServer examples Internet Explorer will not - open a dialog box to ask the user whether or not the scripting of the GLBox - control should be allowed (the exact browser behaviour depends on the security - settings in the Internet Options dialog). - - \input doc/src/examples/opengl-demo.qdocinc -*/ diff --git a/examples/activeqt/opengl/glbox.cpp b/examples/activeqt/opengl/glbox.cpp deleted file mode 100644 index 3388670..0000000 --- a/examples/activeqt/opengl/glbox.cpp +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (C) 2015 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -/**************************************************************************** -** -** This is a simple QGLWidget displaying an openGL wireframe box -** -** The OpenGL code is mostly borrowed from Brian Pauls "spin" example -** in the Mesa distribution -** -****************************************************************************/ - -#include "glbox.h" -#include <QAxAggregated> -#include <QUuid> -//! [0] -#include <objsafe.h> -//! [0] - -/*! - Create a GLBox widget -*/ - -GLBox::GLBox(QWidget *parent, const char *name) - : QOpenGLWidget(parent) -{ - setObjectName(name); - - QSurfaceFormat format; - format.setVersion(1, 1); - format.setProfile(QSurfaceFormat::CompatibilityProfile); - setFormat(format); -} - - -/*! - Release allocated resources -*/ - -GLBox::~GLBox() -{ - makeCurrent(); - - if (m_object) - glDeleteLists(m_object, 1); -} - - -/*! - Paint the box. The actual openGL commands for drawing the box are - performed here. -*/ - -void GLBox::paintGL() -{ - glClear(GL_COLOR_BUFFER_BIT); - - glLoadIdentity(); - glTranslated(0, 0, -10); - glScaled(m_scale, m_scale, m_scale); - - glRotated(m_xRot, 1, 0, 0); - glRotated(m_yRot, 0, 1, 0); - glRotated(m_zRot, 0, 0, 1); - - glCallList(m_object); -} - - -/*! - Set up the OpenGL rendering state, and define display list -*/ - -void GLBox::initializeGL() -{ - initializeOpenGLFunctions(); - glClearColor(0, 0, 0, 1); // Let OpenGL clear to black - m_object = makeObject(); // Generate an OpenGL display list - glShadeModel(GL_FLAT); -} - - - -/*! - Set up the OpenGL view port, matrix mode, etc. -*/ - -void GLBox::resizeGL(int w, int h) -{ - glViewport(0, 0, (GLint)w, (GLint)h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1, 1, -1, 1, 5, 15); - glMatrixMode(GL_MODELVIEW); -} - - -/*! - Generate an OpenGL display list for the object to be shown, i.e. the box -*/ - -GLuint GLBox::makeObject() -{ - GLuint list; - - list = glGenLists(1); - - glNewList(list, GL_COMPILE); - - glColor3d(1, 1, 1); // Shorthand for glColor3f or glIndex - - glLineWidth(2); - - glBegin(GL_LINE_LOOP); - glVertex3d( 1, 0.5, -0.4); - glVertex3d( 1, -0.5, -0.4); - glVertex3d(-1, -0.5, -0.4); - glVertex3d(-1, 0.5, -0.4); - glEnd(); - - glBegin(GL_LINE_LOOP); - glVertex3d( 1, 0.5, 0.4); - glVertex3d( 1, -0.5, 0.4); - glVertex3d(-1, -0.5, 0.4); - glVertex3d(-1, 0.5, 0.4); - glEnd(); - - glBegin(GL_LINES); - glVertex3d( 1, 0.5, -0.4); glVertex3d( 1, 0.5, 0.4); - glVertex3d( 1, -0.5, -0.4); glVertex3d( 1, -0.5, 0.4); - glVertex3d(-1, -0.5, -0.4); glVertex3d(-1, -0.5, 0.4); - glVertex3d(-1, 0.5, -0.4); glVertex3d(-1, 0.5, 0.4); - glEnd(); - - glEndList(); - - return list; -} - - -/*! - Set the rotation angle of the object to \e degrees around the X axis. -*/ - -void GLBox::setXRotation(int degrees) -{ - m_xRot = GLdouble(degrees % 360); - update(); -} - - -/*! - Set the rotation angle of the object to \e degrees around the Y axis. -*/ - -void GLBox::setYRotation(int degrees) -{ - m_yRot = GLdouble(degrees % 360); - update(); -} - - -/*! - Set the rotation angle of the object to \e degrees around the Z axis. -*/ - -void GLBox::setZRotation(int degrees) -{ - m_zRot = GLdouble(degrees % 360); - update(); -} - -//! [1] -class ObjectSafetyImpl : public QAxAggregated, - public IObjectSafety -{ -public: -//! [1] //! [2] - explicit ObjectSafetyImpl() = default; - - long queryInterface(const QUuid &iid, void **iface) override - { - *iface = nullptr; - if (iid != IID_IObjectSafety) - return E_NOINTERFACE; - - *iface = static_cast<IObjectSafety*>(this); - AddRef(); - return S_OK; - } - -//! [2] //! [3] - QAXAGG_IUNKNOWN; - -//! [3] //! [4] - HRESULT WINAPI GetInterfaceSafetyOptions(REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions) override - { - Q_UNUSED(riid); - *pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACESAFE_FOR_UNTRUSTED_CALLER; - *pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACESAFE_FOR_UNTRUSTED_CALLER; - return S_OK; - } - - HRESULT WINAPI SetInterfaceSafetyOptions(REFIID riid, DWORD pdwSupportedOptions, DWORD pdwEnabledOptions) override - { - Q_UNUSED(riid); - Q_UNUSED(pdwSupportedOptions); - Q_UNUSED(pdwEnabledOptions); - return S_OK; - } -}; -//! [4] //! [5] - -QAxAggregated *GLBox::createAggregate() -{ - return new ObjectSafetyImpl(); -} -//! [5] diff --git a/examples/activeqt/opengl/glbox.h b/examples/activeqt/opengl/glbox.h deleted file mode 100644 index a1b58da..0000000 --- a/examples/activeqt/opengl/glbox.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (C) 2015 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -/**************************************************************************** -** -** This is a simple QGLWidget displaying an openGL wireframe box -** -****************************************************************************/ - -#ifndef GLBOX_H -#define GLBOX_H - -#include <QOpenGLWidget> -#include <QOpenGLFunctions_1_1> -//! [0] -#include <QAxBindable> - -class GLBox : public QOpenGLWidget, - public QOpenGLFunctions_1_1, - public QAxBindable -{ - Q_OBJECT - 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: - explicit GLBox(QWidget *parent, const char *name = nullptr); - virtual ~GLBox(); - QAxAggregated *createAggregate() override; - -public slots: - void setXRotation(int degrees); -//! [1] - void setYRotation(int degrees); - void setZRotation(int degrees); - -protected: - void initializeGL() override; - void paintGL() override; - void resizeGL(int w, int h) override; - virtual GLuint makeObject(); - -private: - GLuint m_object = 0; - GLdouble m_xRot = 0; - GLdouble m_yRot = 0; - GLdouble m_zRot = 0; - GLdouble m_scale = 1.25; -}; - -#endif // GLBOX_H diff --git a/examples/activeqt/opengl/globjwin.cpp b/examples/activeqt/opengl/globjwin.cpp deleted file mode 100644 index 0b9cea1..0000000 --- a/examples/activeqt/opengl/globjwin.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (C) 2015 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -#include "globjwin.h" -#include "glbox.h" -#include <QPushButton> -#include <QSlider> -#include <QLayout> -#include <QFrame> -#include <QMenuBar> -#include <QMenu> -#include <QApplication> - - -GLObjectWindow::GLObjectWindow(QWidget *parent) - : QWidget(parent) -{ - // Create a menu - QMenu *file = new QMenu(this); - file->addAction(tr("Exit"), qApp, &QApplication::quit); - - // Create a menu bar - QMenuBar *m = new QMenuBar(this); - m->addMenu(file)->setText(tr("&File")); - - // Create a nice frame to put around the OpenGL widget - QFrame *f = new QFrame(this); - f->setFrameStyle(QFrame::Sunken | QFrame::Panel); - f->setLineWidth(2); - - // Create our OpenGL widget - GLBox *c = new GLBox(f, "glbox"); - - // Create the three sliders; one for each rotation axis - QSlider *x = new QSlider(Qt::Vertical, this); - x->setMaximum(360); - x->setPageStep(60); - x->setTickPosition(QSlider::TicksLeft); - connect(x, &QSlider::valueChanged, c, &GLBox::setXRotation); - - QSlider *y = new QSlider(Qt::Vertical, this); - y->setMaximum(360); - y->setPageStep(60); - y->setTickPosition(QSlider::TicksLeft); - connect(y, &QSlider::valueChanged, c, &GLBox::setYRotation); - - QSlider *z = new QSlider(Qt::Vertical, this); - z->setMaximum(360); - z->setPageStep(60); - z->setTickPosition(QSlider::TicksLeft); - connect(z, &QSlider::valueChanged, c, &GLBox::setZRotation); - - // Now that we have all the widgets, put them into a nice layout - - // Top level layout, puts the sliders to the left of the frame/GL widget - QHBoxLayout *hlayout = new QHBoxLayout(this); - - // Put the sliders on top of each other - QVBoxLayout *vlayout = new QVBoxLayout(); - vlayout->addWidget(x); - vlayout->addWidget(y); - vlayout->addWidget(z); - - // Put the GL widget inside the frame - QHBoxLayout *flayout = new QHBoxLayout(f); - flayout->setContentsMargins(0, 0, 0, 0); - flayout->addWidget(c, 1); - - hlayout->setMenuBar(m); - hlayout->addLayout(vlayout); - hlayout->addWidget(f, 1); -} diff --git a/examples/activeqt/opengl/globjwin.h b/examples/activeqt/opengl/globjwin.h deleted file mode 100644 index 58ff614..0000000 --- a/examples/activeqt/opengl/globjwin.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2015 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -/**************************************************************************** -** -** The GLObjectWindow contains a GLBox and three sliders connected to -** the GLBox's rotation slots. -** -****************************************************************************/ - -#ifndef GLOBJWIN_H -#define GLOBJWIN_H - -#include <qwidget.h> - -class GLObjectWindow : public QWidget -{ - Q_OBJECT - -public: - explicit GLObjectWindow(QWidget *parent = nullptr); -}; - -#endif diff --git a/examples/activeqt/opengl/main.cpp b/examples/activeqt/opengl/main.cpp deleted file mode 100644 index 2f78324..0000000 --- a/examples/activeqt/opengl/main.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2015 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -// -// Qt OpenGL example: Box -// -// A small example showing how a GLWidget can be used just as any Qt widget -// -// File: main.cpp -// -// The main() function -// - -#include "globjwin.h" -#include "glbox.h" -#include <QApplication> -//! [0] -#include <QAxFactory> - -QAXFACTORY_BEGIN( - "{2c3c183a-eeda-41a4-896e-3d9c12c3577d}", // type library ID - "{83e16271-6480-45d5-aaf1-3f40b7661ae4}") // application ID - QAXCLASS(GLBox) -QAXFACTORY_END() - -//! [0] //! [1] -/* - The main program is here. -*/ - -int main(int argc, char *argv[]) -{ - QApplication a(argc,argv); - - if (QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL) { - qWarning("This system does not support OpenGL. Exiting."); - return -1; - } - - if (!QAxFactory::isServer()) { - GLObjectWindow w; - w.resize(400, 350); - w.show(); - return a.exec(); -//! [1] //! [2] - } - return a.exec(); -//! [2] //! [3] -} -//! [3] diff --git a/examples/activeqt/opengl/opengl.def b/examples/activeqt/opengl/opengl.def deleted file mode 100644 index bc82a03..0000000 --- a/examples/activeqt/opengl/opengl.def +++ /dev/null @@ -1,6 +0,0 @@ -EXPORTS - DllCanUnloadNow PRIVATE - DllGetClassObject PRIVATE - DllRegisterServer PRIVATE - DllUnregisterServer PRIVATE - DumpIDL PRIVATE diff --git a/examples/activeqt/opengl/opengl.ico b/examples/activeqt/opengl/opengl.ico Binary files differdeleted file mode 100644 index c80d36a..0000000 --- a/examples/activeqt/opengl/opengl.ico +++ /dev/null diff --git a/examples/activeqt/opengl/opengl.inf b/examples/activeqt/opengl/opengl.inf deleted file mode 100644 index 4a79e67..0000000 --- a/examples/activeqt/opengl/opengl.inf +++ /dev/null @@ -1,9 +0,0 @@ -[version] - signature="$CHICAGO$" - AdvancedINF=2.0 - [Add.Code] - openglax.exe=openglax.exe - [openglax.exe] - file-win32-x86=thiscab - clsid={5fd9c22e-ed45-43fa-ba13-1530bb6b03e0} - RegisterServer=yes diff --git a/examples/activeqt/opengl/opengl.pro b/examples/activeqt/opengl/opengl.pro deleted file mode 100644 index 1ece9b9..0000000 --- a/examples/activeqt/opengl/opengl.pro +++ /dev/null @@ -1,18 +0,0 @@ -TEMPLATE = app -TARGET = openglax - -CONFIG += warn_off -QT += widgets axserver opengl openglwidgets - -HEADERS = glbox.h \ - globjwin.h -SOURCES = glbox.cpp \ - globjwin.cpp \ - main.cpp - -RC_FILE = opengl.rc -DEF_FILE = opengl.def - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/opengl -INSTALLS += target diff --git a/examples/activeqt/opengl/opengl.rc b/examples/activeqt/opengl/opengl.rc deleted file mode 100644 index 02c0898..0000000 --- a/examples/activeqt/opengl/opengl.rc +++ /dev/null @@ -1,2 +0,0 @@ -1 TYPELIB "opengl.rc" -1 ICON "opengl.ico" |