summaryrefslogtreecommitdiff
path: root/examples/activeqt/comapp/doc/src/comapp.qdoc
diff options
context:
space:
mode:
authorJerome Pasion <jerome.pasion@digia.com>2012-12-10 17:28:04 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-12-11 11:19:50 +0100
commit30ce8820b9777b14cba5fbbaa9e2be547dbad6bc (patch)
tree441d17d250e26a778997af41faf5083664b2fea3 /examples/activeqt/comapp/doc/src/comapp.qdoc
parent8b99e60c03b50f354f5e33f0d5db53448130be6a (diff)
downloadqtactiveqt-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/activeqt/comapp/doc/src/comapp.qdoc')
-rw-r--r--examples/activeqt/comapp/doc/src/comapp.qdoc110
1 files changed, 110 insertions, 0 deletions
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}.
+*/