diff options
author | Jerome Pasion <jerome.pasion@digia.com> | 2012-12-10 17:28:04 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-12-11 11:19:50 +0100 |
commit | 30ce8820b9777b14cba5fbbaa9e2be547dbad6bc (patch) | |
tree | 441d17d250e26a778997af41faf5083664b2fea3 /examples | |
parent | 8b99e60c03b50f354f5e33f0d5db53448130be6a (diff) | |
download | qtactiveqt-30ce8820b9777b14cba5fbbaa9e2be547dbad6bc.tar.gz |
Doc: Edited Active Qt documentation
-fixed snippets, examples
-left demos alone. Don't know if they were working.
-updated landing page
-added QAxContainer and QAxServer module pages
Task-number: QTBUG-28042
Change-Id: Ic446680319fa9cc0e917cebdb30d6a246026ac20
Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/activeqt/comapp/doc/snippets/doc_src_examples_activeqt_comapp.qdoc | 79 | ||||
-rw-r--r-- | examples/activeqt/comapp/doc/src/comapp.qdoc | 110 | ||||
-rw-r--r-- | examples/activeqt/hierarchy/doc/snippets/hierarchy-demo-snippet.qdoc | 68 | ||||
-rw-r--r-- | examples/activeqt/hierarchy/doc/src/hierarchy.qdoc | 88 | ||||
-rw-r--r-- | examples/activeqt/menus/doc/snippets/doc_src_examples_activeqt_menus.qdoc | 46 | ||||
-rw-r--r-- | examples/activeqt/menus/doc/src/menus.qdoc | 60 | ||||
-rw-r--r-- | examples/activeqt/multiple/doc/src/multiple.qdoc | 70 | ||||
-rw-r--r-- | examples/activeqt/opengl/doc/src/opengl.qdoc | 131 | ||||
-rw-r--r-- | examples/activeqt/qutlook/doc/src/qutlook.qdoc | 102 | ||||
-rw-r--r-- | examples/activeqt/simple/doc/src/simple.qdoc | 116 | ||||
-rw-r--r-- | examples/activeqt/webbrowser/doc/src/webbrowser.qdoc | 73 | ||||
-rw-r--r-- | examples/activeqt/wrapper/doc/src/wrapper.qdoc | 63 |
12 files changed, 1006 insertions, 0 deletions
diff --git a/examples/activeqt/comapp/doc/snippets/doc_src_examples_activeqt_comapp.qdoc b/examples/activeqt/comapp/doc/snippets/doc_src_examples_activeqt_comapp.qdoc new file mode 100644 index 0000000..fa6a491 --- /dev/null +++ b/examples/activeqt/comapp/doc/snippets/doc_src_examples_activeqt_comapp.qdoc @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] +Private Application As comappLib.Application +Private MyApp As Boolean + +Private Sub UpdateList() + DocumentList.Clear + DocumentsCount.Caption = Application.documents.Count + For Index = 0 To Application.documents.Count - 1 + DocumentList.AddItem (Application.documents.Item(Index).Title) + Next +End Sub + +Private Sub Form_Load() + On Error GoTo CreateNew + Set Application = GetObject(, "comapp.Application") + MyApp = False + GoTo Initialized +CreateNew: + On Error GoTo InitializeFailed + Set Application = New Application + Application.Visible = True + MyApp = True +Initialized: + Caption = Application.id + UpdateList +InitializeFailed: +End Sub + +Private Sub Form_Unload(Cancel As Integer) + If MyApp Then + Application.quit + End If +End Sub + +Private Sub NewDocument_Click() + Application.documents.addDocument + UpdateList +End Sub +//! [0] diff --git a/examples/activeqt/comapp/doc/src/comapp.qdoc b/examples/activeqt/comapp/doc/src/comapp.qdoc new file mode 100644 index 0000000..e1a773d --- /dev/null +++ b/examples/activeqt/comapp/doc/src/comapp.qdoc @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example activeqt/comapp + \title COM App Example (ActiveQt) + + \brief The COM App example shows how to use ActiveQt to develop a Qt + application that can be automated via COM. Different QObject + based classes are exposed as COM objects that communicate with the + GUI of the running Qt application. The APIs of those COM objects + has been designed to resemble the APIs of standard COM + applications; i.e. those from Microsoft Office. + + \snippet activeqt/comapp/main.cpp 2 + The first class \c Application represents the application object. It + exposes read-only properties \c documents and \c id to get access to the + list of documents, and an identifier. A read/write property \c visible + controls whether the QTabWidget-based user interface of the application + should be visible, and a slot \c quit() terminates the application. + + The \e RegisterObject attribute is set to make sure that instances of this + class are registered in COM's running object table (ROT) - this allows COM + clients to connect to an already instantiated COM object. + + \snippet activeqt/comapp/main.cpp 1 + The \c DocumentList class stores a list of documents. It provides an API + to read the number of documents, to access each document by index and to + create a new document. The \c application property returns the root object. + + \snippet activeqt/comapp/main.cpp 0 + + The \c Document class finally represents a document in the application. + Each document is represented by a page in the application's tab widget, and + has a title that is readable and writable through the document's API. + The \c application property again returns the root object. + + \snippet activeqt/comapp/main.cpp 3 + The implementation of the \c Document class creates a new page for the tab + widget, and uses the title of that page for the title property. The page + is deleted when the document is deleted. + + \snippet activeqt/comapp/main.cpp 4 + The \c DocumentList implementation is straightforward. + + \snippet activeqt/comapp/main.cpp 5 + The \c Application class initializes the user interface in the constructor, + and shows and hides it in the implementation of \c setVisible(). The object + name (accessible through the \c id property) is set to \c "From QAxFactory" + to indicate that this COM object has been created by COM. Note that there is + no destructor that would delete the QTabWidget - this is instead done in the + \c quit() slot, before calling QApplication::quit() through a single-shot-timer, + which is necessary ensure that the COM call to the slot is complete. + + \snippet activeqt/comapp/main.cpp 6 + The classes are exported from the server using the QAxFactory macros. Only + \c Application objects can be instantiated from outside - the other APIs can + only be used after accessing the respective objects throught the \c Application + API. + + \snippet activeqt/comapp/main.cpp 7 + The main() entry point function creates a QApplication, and just enters the + event loop if the application has been started by COM. If the application + has been started by the user, then the \c Application object is created and + the object name is set to "From Application". Then the COM server is started, + and the application object is registered with COM. It is now accessible to + COM clients through the client-specific APIs. + + Application exiting is controlled explicitly - if COM started the application, + then the client code has to call quit(); if the user started the application, + then the application terminates when the last window has been closed. + + Finally, the user interface is made visible, and the event loop is started. + + A simple Visual Basic application could now access this Qt application. In VB, + start a new "Standard Exe" project and add a project reference to the comappLib + type library. Create a form with a listbox "DocumentList", a static label + "DocumentsCount" and a command button "NewDocument". Finally, implement the code + for the form like this: + + \snippet activeqt/comapp/doc/snippets/doc_src_examples_activeqt_comapp.qdoc 0 + + To build the example you must first build the QAxServer library. + Then run \c qmake and your make tool in + \c{examples\activeqt\comapp}. +*/ diff --git a/examples/activeqt/hierarchy/doc/snippets/hierarchy-demo-snippet.qdoc b/examples/activeqt/hierarchy/doc/snippets/hierarchy-demo-snippet.qdoc new file mode 100644 index 0000000..9e62d2b --- /dev/null +++ b/examples/activeqt/hierarchy/doc/snippets/hierarchy-demo-snippet.qdoc @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [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://qt.nokia.com/demos/hierarchy.cab"> +[Object not available! Did you forget to build and register the server?] +</object><br /> +<form> +<input type="edit" ID="nameEdit" value="<enter object name>" /> +<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 new file mode 100644 index 0000000..de5dbf3 --- /dev/null +++ b/examples/activeqt/hierarchy/doc/src/hierarchy.qdoc @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \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 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::child() 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 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/menus/doc/snippets/doc_src_examples_activeqt_menus.qdoc b/examples/activeqt/menus/doc/snippets/doc_src_examples_activeqt_menus.qdoc new file mode 100644 index 0000000..39fd6d6 --- /dev/null +++ b/examples/activeqt/menus/doc/snippets/doc_src_examples_activeqt_menus.qdoc @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] +<object ID="QMenus" CLASSID="CLSID:4dc3f340-a6f7-44e4-a79b-3e9217695fbd" +CODEBASE="http://qt.nokia.com/demos/menusax.cab"> +[Object not available! Did you forget to build and register the server?] +</object> +//! [0] diff --git a/examples/activeqt/menus/doc/src/menus.qdoc b/examples/activeqt/menus/doc/src/menus.qdoc new file mode 100644 index 0000000..aa39019 --- /dev/null +++ b/examples/activeqt/menus/doc/src/menus.qdoc @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qaxserver-demo-menus.html + \preliminary + + \title Menubar Merging + + This example is not full functional at the moment. + + \raw HTML + <object ID="QMenus" CLASSID="CLSID:4dc3f340-a6f7-44e4-a79b-3e9217695fbd" + CODEBASE="http://qt.nokia.com/demos/menusax.cab"> + [Object not available! Did you forget to build and register the server?] + </object> + \endraw +*/ + +/*! + \example activeqt/menus + \title Menus Example (ActiveQt) + + \brief The Menus example demonstrates the use of QMenuBar and QStatusBar + in a QMainWindow to implement an in-place active control. + + To build the example you must first build the QAxServer library. + Then run \c qmake and your make tool in \c + examples/activeqt/menus. + + The \l{qaxserver-demo-menus.html}{demonstration} requires your + WebBrowser to support ActiveX controls, and scripting to be + enabled. + + \snippet activeqt/menus/doc/snippets/doc_src_examples_activeqt_menus.qdoc 0 +*/ diff --git a/examples/activeqt/multiple/doc/src/multiple.qdoc b/examples/activeqt/multiple/doc/src/multiple.qdoc new file mode 100644 index 0000000..2f17d4b --- /dev/null +++ b/examples/activeqt/multiple/doc/src/multiple.qdoc @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qaxserver-demo-multiple.html + \title Two Simple Qt Widgets + + \input examples/multiple-demo.qdocinc +*/ + +/*! + \example activeqt/multiple + \title Multiple Example (ActiveQt) + + \brief The Multiple example demonstrates the implementation of a + QAxFactory to provide multiple ActiveX controls in a single in + process ActiveX server using the \c QAXFACTORY_EXPORT() macro. + The ActiveX controls in this example are simple QWidget + subclasses that reimplement QWidget::paintEvent(). + + \snippet activeqt/multiple/ax1.h 0 + + The first control draws a filled rectangle. The fill color is exposed + as a property. \c Q_CLASSINFO() is used to specify the COM identifiers. + + \snippet activeqt/multiple/ax2.h 0 + + The second control draws a circle. The linewith is exposed as a property. + \c Q_CLASSINFO() is used to specify the COM identifiers, and to set the + attributes \e ToSuperClass and \e StockEvents to expose only the API of + the class itself, and to add COM stock events to the ActiveX control. + + \snippet activeqt/multiple/main.cpp 0 + + The classes are exported from the server using the QAxFactory macros. + + To build the example you must first build the QAxServer library. + Then run \c qmake and your make tool in \c + examples/activeqt/multiple. + + The \l{Two Simple Qt Widgets} demonstration requires your + WebBrowser to support ActiveX controls, and scripting to be + enabled. + + \snippet examples/multiple-demo.qdocinc 0 +*/ diff --git a/examples/activeqt/opengl/doc/src/opengl.qdoc b/examples/activeqt/opengl/doc/src/opengl.qdoc new file mode 100644 index 0000000..2396665 --- /dev/null +++ b/examples/activeqt/opengl/doc/src/opengl.qdoc @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \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://qt.nokia.com/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 the default factory as provided by the + QAXFACTORY_DEFAULT macro 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 QGLWidget 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 rest of the class declaration and the implementation of the OpenGL + rendering is identical to the original "box" example. + + 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). + + \snippet doc/src/examples/opengl-demo.qdocinc 0 +*/ diff --git a/examples/activeqt/qutlook/doc/src/qutlook.qdoc b/examples/activeqt/qutlook/doc/src/qutlook.qdoc new file mode 100644 index 0000000..1842e80 --- /dev/null +++ b/examples/activeqt/qutlook/doc/src/qutlook.qdoc @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example activeqt/qutlook + \title Qutlook Example (ActiveQt) + + \brief The Qutlook example demonstrates the use of ActiveQt to automate + Outlook. The example makes use of the \l dumpcpp tool to generate + a C++ namespace for the type library describing the Outlook + Object Model. + + The project file for the example looks like this: + + \snippet activeqt/qutlook/qutlook.pro 1 + \snippet activeqt/qutlook/qutlook.pro 2 + + The project file uses the \c dumpcpp tool to add an MS Outlook type library to the project. + If this fails, then the generated makefile will just print an error message, otherwise + the build step will now run the \e dumpcpp tool on the type library, and + generate a header and a cpp file (in this case, \c msoutl.h and \c msoutl.cpp) that + declares and implement an easy to use API to the Outlook objects. + + \snippet activeqt/qutlook/addressview.h 0 + + The AddressView class is a QWidget subclass for the user interface. The QTreeView widget + will display the contents of Outlook's Contact folder as provided by the \c{model}. + + \snippet activeqt/qutlook/addressview.cpp 0 + The AddressBookModel class is a QAbstractListModel subclass that communicates directly with + Outlook, using a QHash for caching. + + \snippet activeqt/qutlook/addressview.cpp 1 + The constructor initializes Outlook. The various signals Outlook provides to notify about + contents changes are connected to the \c updateOutlook() slot. + + \snippet activeqt/qutlook/addressview.cpp 2 + The destructor logs off from the session. + + \snippet activeqt/qutlook/addressview.cpp 3 + The \c rowCount() implementation returns the number of entries as reported by Outlook. \c columnCount + and \c headerData are implemented to show four columns in the tree view. + + \snippet activeqt/qutlook/addressview.cpp 4 + The \c headerData() implementation returns hardcoded strings. + + \snippet activeqt/qutlook/addressview.cpp 5 + The \c data() implementation is the core of the model. If the requested data is in the cache the + cached value is used, otherwise the data is acquired from Outlook. + + \snippet activeqt/qutlook/addressview.cpp 6 + The \c changeItem() slot is called when the user changes the current entry using the user interface. + The Outlook item is accessed using the Outlook API, and is modified using the property setters. + Finally, the item is saved to Outlook, and removed from the cache. Note that the model does not + signal the view of the data change, as Outlook will emit a signal on its own. + + \snippet activeqt/qutlook/addressview.cpp 7 + The \c addItem() slot calls the CreateItem method of Outlook to create a new contact item, + sets the properties of the new item to the values entered by the user and saves the item. + + \snippet activeqt/qutlook/addressview.cpp 8 + The \c update() slot clears the cache, and emits the reset() signal to notify the view about the + data change requiring a redraw of the contents. + + \snippet activeqt/qutlook/addressview.cpp 9 + \snippet activeqt/qutlook/addressview.cpp 10 + The rest of the file implements the user interface using only Qt APIs, i.e. without communicating + with Outlook directly. + + \snippet activeqt/qutlook/main.cpp 0 + + The \c main() entry point function finally instantiates the user interface and enters the + event loop. + + To build the example you must first build the QAxContainer + library. Then run your make tool in \c examples/activeqt/qutlook + and run the resulting \c qutlook.exe. +*/ diff --git a/examples/activeqt/simple/doc/src/simple.qdoc b/examples/activeqt/simple/doc/src/simple.qdoc new file mode 100644 index 0000000..761f8c3 --- /dev/null +++ b/examples/activeqt/simple/doc/src/simple.qdoc @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qaxserver-demo-simple.html + + \title A standard ActiveX and the "simple" ActiveQt widget + + \raw HTML + <object ID="QSimpleAX" CLASSID="CLSID:DF16845C-92CD-4AAB-A982-EB9840E74669" + CODEBASE="http://qt.nokia.com/demos/simpleax.cab"> + <PARAM NAME="text" VALUE="A simple control" /> + <PARAM NAME="value" VALUE="1" /> + [Object not available! Did you forget to build and register the server?] + </object> + + <FORM> + <INPUT TYPE="BUTTON" VALUE="About..." onClick="QSimpleAX.about()" /> + </FORM> + + <object ID="Calendar" CLASSID="CLSID:8E27C92B-1264-101C-8A2F-040224009C02"> + [Standard Calendar control not available!] + <PARAM NAME="day" VALUE="1" /> + </object> + + <FORM> + <INPUT TYPE="BUTTON" VALUE="Today" onClick="Calendar.Today()" /> + </FORM> + + <SCRIPT LANGUAGE="VBScript"> + Sub Calendar_Click() + MsgBox( "Calendar Clicked!" ) + End Sub + + Sub QSimpleAX_TextChanged( str ) + document.title = str + End Sub + </SCRIPT> + + <SCRIPT LANGUAGE="JavaScript"> + function QSimpleAX::ValueChanged( Newvalue ) + { + Calendar.Day = Newvalue; + } + </SCRIPT> + \endraw +*/ + +/*! + \example activeqt/simple + \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. + + The ActiveX control in this example is a laid out QWidget with a + QSlider, a QLCDNumber and a QLineEdit. It provides a + signal/slot/property interface to change the values of the slider + and the line edit, and to get notified of any property changes. + + + The Qt implementation of the ActiveX for this example is + \snippet activeqt/simple/main.cpp 0 + + The control is exported using the default QAxFactory + \snippet activeqt/simple/main.cpp 1 + + To build the example you must first build the QAxServer library. + Then run qmake and your make tool in \c examples/activeqt/simple. + + The \l{qaxserver-demo-simple.html}{demonstration} requires your + WebBrowser to support ActiveX controls, and scripting to be enabled. + + The simple ActiveX control is embedded using the \c <object> tag. + + \snippet doc/src/examples/simple-demo.qdocinc 0 + + A simple HTML button is connected to the ActiveQt's about() slot. + + \snippet doc/src/examples/simple-demo.qdocinc 1 + + A second ActiveX control - the standard Calendar Control - is instantiated + + \snippet doc/src/examples/simple-demo.qdocinc 2 + + Events from the ActiveX controls are handled using both Visual Basic Script + and JavaScript. + + \snippet doc/src/examples/simple-demo.qdocinc 3 +*/ diff --git a/examples/activeqt/webbrowser/doc/src/webbrowser.qdoc b/examples/activeqt/webbrowser/doc/src/webbrowser.qdoc new file mode 100644 index 0000000..7d79928 --- /dev/null +++ b/examples/activeqt/webbrowser/doc/src/webbrowser.qdoc @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example activeqt/webbrowser + \title Web Browser Example (ActiveQt) + + \brief The Web Browser example uses the Microsoft Web Browser + ActiveX control to implement a fully functional Web Browser + application. The user interface has been developed using the Qt + Designer integration of the QAxWidget class. + + The code demonstrates how the Qt application can communicate + with the embedded ActiveX controls using signals, slots and the + dynamicCall() function. + + \snippet activeqt/webbrowser/main.cpp 0 + + The \c MainWindow class declares a \c QMainWindow based user interface, + using the \c Ui::MainWindow class generated by Qt Designer. A number + of slots are implemented to handle events from the various user + interface elements, including the \c WebBrowser object, which is a + QAxWidget hosting the Microsoft Web Browser control. + + \snippet activeqt/webbrowser/main.cpp 1 + + The constructor initializes the user interface, installs a + progress bar on the status bar, and uses QAxBase::dynamicCall() + to invoke the \c GoHome() method of Internet Explorer to + navigate to the user's home page. + + \snippet activeqt/webbrowser/main.cpp 2 + Different slots handle the signals emitted by the WebBrowser object. + + Connections that don't require any coding, i.e. connecting the \c back + action to the \c GoBack() slot, have already been made in Qt Designer. + + \snippet activeqt/webbrowser/main.cpp 3 + \snippet activeqt/webbrowser/main.cpp 4 + + The rest of the implementation is not related to ActiveQt - the actions + are handled by different slots, and the entry point function starts the + application using standard Qt APIs. + + To build the example you must first build the QAxContainer + library. Then run your make tool in \c + examples/activeqt/webbrowser and run the resulting \c + webbrowser.exe. +*/ diff --git a/examples/activeqt/wrapper/doc/src/wrapper.qdoc b/examples/activeqt/wrapper/doc/src/wrapper.qdoc new file mode 100644 index 0000000..4e8eed3 --- /dev/null +++ b/examples/activeqt/wrapper/doc/src/wrapper.qdoc @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qaxserver-demo-wrapper.html + + \title Standard Qt widgets in an HTML page + + \input examples/wrapper-demo.qdocinc +*/ + +/*! + \example activeqt/wrapper + \title Wrapper Example (ActiveQt) + + \brief The Wrapper example demonstrates how to export existing QWidget + classes as ActiveX controls, and the use of QAxFactory together + with the \c QAXFACTORY_EXPORT() macro. ActiveX controls in this + example are the standard button classes QPushButton, QCheckBox + and QRadioButton as provided by Qt. + + \snippet activeqt/wrapper/main.cpp 0 + The factory implementation returns the list of supported controls, + creates controls on request and provides information about the unique + IDs of the COM classes and interfaces for each control. + + \snippet activeqt/wrapper/main.cpp 1 + The factory is exported using the QAXFACTORY_EXPORT macro. + + 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-wrapper.html}{demonstration} requires a + web browser that supports ActiveX controls, and scripting to be + enabled. + + \snippet examples/wrapper-demo.qdocinc 0 +*/ |