diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2009-04-17 14:06:06 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2009-04-17 14:06:06 (GMT) |
commit | f15b8a83e2e51955776a3f07cb85ebfc342dd8ef (patch) | |
tree | c5dc684986051654898db11ce73e03b9fec8db99 /examples/activeqt | |
download | Qt-f15b8a83e2e51955776a3f07cb85ebfc342dd8ef.zip Qt-f15b8a83e2e51955776a3f07cb85ebfc342dd8ef.tar.gz Qt-f15b8a83e2e51955776a3f07cb85ebfc342dd8ef.tar.bz2 |
Initial import of statemachine branch from the old kinetic repository
Diffstat (limited to 'examples/activeqt')
64 files changed, 5033 insertions, 0 deletions
diff --git a/examples/activeqt/README b/examples/activeqt/README new file mode 100644 index 0000000..24be2de --- /dev/null +++ b/examples/activeqt/README @@ -0,0 +1,39 @@ +Qt is supplied with a number of example applications and demonstrations that +have been written to provide developers with examples of the Qt API in use, +highlight good programming practice, and showcase features found in each of +Qt's core technologies. + +The example and demo launcher can be used to explore the different categories +available. It provides an overview of each example, lets you view the +documentation in Qt Assistant, and is able to launch examples and demos. + +Documentation for examples can be found in the Tutorial and Examples section +of the Qt documentation. + + +Finding the Qt Examples and Demos launcher +========================================== + +On Windows: + +The launcher can be accessed via the Windows Start menu. Select the menu +entry entitled "Qt Examples and Demos" entry in the submenu containing +the Qt tools. + +On Mac OS X: + +For the binary distribution, the qtdemo executable is installed in the +/Developer/Applications/Qt directory. For the source distribution, it is +installed alongside the other Qt tools on the path specified when Qt is +configured. + +On Unix/Linux: + +The qtdemo executable is installed alongside the other Qt tools on the path +specified when Qt is configured. + +On all platforms: + +The source code for the launcher can be found in the demos/qtdemo directory +in the Qt package. This example is built at the same time as the Qt libraries, +tools, examples, and demonstrations. diff --git a/examples/activeqt/activeqt.pro b/examples/activeqt/activeqt.pro new file mode 100644 index 0000000..262e1a1 --- /dev/null +++ b/examples/activeqt/activeqt.pro @@ -0,0 +1,20 @@ +TEMPLATE = subdirs +SUBDIRS += comapp \ + hierarchy \ + menus \ + multiple \ + simple \ + webbrowser \ + wrapper + +contains(QT_CONFIG, opengl):SUBDIRS += opengl + +# For now only the contain examples with mingw, for the others you need +# an IDL compiler +win32-g++|wince*:SUBDIRS = webbrowser + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/activeqt +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS activeqt.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt +INSTALLS += target sources diff --git a/examples/activeqt/comapp/comapp.pro b/examples/activeqt/comapp/comapp.pro new file mode 100644 index 0000000..84ce072 --- /dev/null +++ b/examples/activeqt/comapp/comapp.pro @@ -0,0 +1,13 @@ +TEMPLATE = app +CONFIG += qaxserver + +# Input +SOURCES += main.cpp + +RC_FILE = comapp.rc + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/comapp +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS comapp.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt/comapp +INSTALLS += target sources diff --git a/examples/activeqt/comapp/comapp.rc b/examples/activeqt/comapp/comapp.rc new file mode 100644 index 0000000..24e339a --- /dev/null +++ b/examples/activeqt/comapp/comapp.rc @@ -0,0 +1 @@ +1 TYPELIB "comapp.rc" diff --git a/examples/activeqt/comapp/main.cpp b/examples/activeqt/comapp/main.cpp new file mode 100644 index 0000000..95caaa3 --- /dev/null +++ b/examples/activeqt/comapp/main.cpp @@ -0,0 +1,272 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include <QAxFactory> +#include <QTabWidget> +#include <QTimer> + +class Application; +class DocumentList; + +//! [0] +class Document : public QObject +{ + Q_OBJECT + + Q_CLASSINFO("ClassID", "{2b5775cd-72c2-43da-bc3b-b0e8d1e1c4f7}") + Q_CLASSINFO("InterfaceID", "{2ce1761e-07a3-415c-bd11-0eab2c7283de}") + + Q_PROPERTY(Application *application READ application) + Q_PROPERTY(QString title READ title WRITE setTitle) + +public: + Document(DocumentList *list); + ~Document(); + + Application *application() const; + + QString title() const; + void setTitle(const QString &title); + +private: + QWidget *page; +}; +//! [0] + +//! [1] +class DocumentList : public QObject +{ + Q_OBJECT + + Q_CLASSINFO("ClassID", "{496b761d-924b-4554-a18a-8f3704d2a9a6}") + Q_CLASSINFO("InterfaceID", "{6c9e30e8-3ff6-4e6a-9edc-d219d074a148}") + + Q_PROPERTY(Application* application READ application) + Q_PROPERTY(int count READ count) + +public: + DocumentList(Application *application); + + int count() const; + Application *application() const; + +public slots: + Document *addDocument(); + Document *item(int index) const; + +private: + QList<Document*> list; +}; +//! [1] + +//! [2] +class Application : public QObject +{ + Q_OBJECT + + Q_CLASSINFO("ClassID", "{b50a71db-c4a7-4551-8d14-49983566afee}") + Q_CLASSINFO("InterfaceID", "{4a427759-16ef-4ed8-be79-59ffe5789042}") + Q_CLASSINFO("RegisterObject", "yes") + + Q_PROPERTY(DocumentList* documents READ documents) + Q_PROPERTY(QString id READ id) + Q_PROPERTY(bool visible READ isVisible WRITE setVisible) + +public: + Application(QObject *parent = 0); + DocumentList *documents() const; + + QString id() const { return objectName(); } + + void setVisible(bool on); + bool isVisible() const; + + QTabWidget *window() const { return ui; } + +public slots: + void quit(); + +private: + DocumentList *docs; + + QTabWidget *ui; +}; +//! [2] + +//! [3] +Document::Document(DocumentList *list) +: QObject(list) +{ + QTabWidget *tabs = list->application()->window(); + page = new QWidget(tabs); + page->setWindowTitle("Unnamed"); + tabs->addTab(page, page->windowTitle()); + + page->show(); +} + +Document::~Document() +{ + delete page; +} + +Application *Document::application() const +{ + return qobject_cast<DocumentList*>(parent())->application(); +} + +QString Document::title() const +{ + return page->windowTitle(); +} + +void Document::setTitle(const QString &t) +{ + page->setWindowTitle(t); + + QTabWidget *tabs = application()->window(); + int index = tabs->indexOf(page); + tabs->setTabText(index, page->windowTitle()); +} + +//! [3] //! [4] +DocumentList::DocumentList(Application *application) +: QObject(application) +{ +} + +Application *DocumentList::application() const +{ + return qobject_cast<Application*>(parent()); +} + +int DocumentList::count() const +{ + return list.count(); +} + +Document *DocumentList::item(int index) const +{ + if (index >= list.count()) + return 0; + + return list.at(index); +} + +Document *DocumentList::addDocument() +{ + Document *document = new Document(this); + list.append(document); + + return document; +} + + +//! [4] //! [5] +Application::Application(QObject *parent) +: QObject(parent), ui(0) +{ + ui = new QTabWidget; + + setObjectName("From QAxFactory"); + docs = new DocumentList(this); +} + +DocumentList *Application::documents() const +{ + return docs; +} + +void Application::setVisible(bool on) +{ + ui->setShown(on); +} + +bool Application::isVisible() const +{ + return ui->isVisible(); +} + +void Application::quit() +{ + delete docs; + docs = 0; + + delete ui; + ui = 0; + QTimer::singleShot(0, qApp, SLOT(quit())); +} + +#include "main.moc" +//! [5] //! [6] + + +QAXFACTORY_BEGIN("{edd3e836-f537-4c6f-be7d-6014c155cc7a}", "{b7da3de8-83bb-4bbe-9ab7-99a05819e201}") + QAXCLASS(Application) + QAXTYPE(Document) + QAXTYPE(DocumentList) +QAXFACTORY_END() + +//! [6] //! [7] +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + app.setQuitOnLastWindowClosed(false); + + // started by COM - don't do anything + if (QAxFactory::isServer()) + return app.exec(); + + // started by user + Application appobject(0); + appobject.setObjectName("From Application"); + + QAxFactory::startServer(); + QAxFactory::registerActiveObject(&appobject); + + appobject.setVisible(true); + + QObject::connect(qApp, SIGNAL(lastWindowClosed()), &appobject, SLOT(quit())); + + return app.exec(); +} +//! [7] diff --git a/examples/activeqt/dotnet/walkthrough/Form1.cs b/examples/activeqt/dotnet/walkthrough/Form1.cs new file mode 100644 index 0000000..9fb572a --- /dev/null +++ b/examples/activeqt/dotnet/walkthrough/Form1.cs @@ -0,0 +1,127 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; + +namespace csharp +{ + /// <summary> + /// Summary description for Form1. + /// </summary> + public class Form1 : System.Windows.Forms.Form + { + private AxwrapperaxLib.AxQPushButton resetButton; + private AxmultipleaxLib.AxQAxWidget2 circleWidget; + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.Container components = null; + + public Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + /// <summary> + /// Clean up any resources being used. + /// </summary> + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); + this.resetButton = new AxwrapperaxLib.AxQPushButton(); + this.circleWidget = new AxmultipleaxLib.AxQAxWidget2(); + ((System.ComponentModel.ISupportInitialize)(this.resetButton)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.circleWidget)).BeginInit(); + this.SuspendLayout(); + // + // resetButton + // + this.resetButton.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right); + this.resetButton.Enabled = true; + this.resetButton.Location = new System.Drawing.Point(160, 296); + this.resetButton.Name = "resetButton"; + this.resetButton.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("resetButton.OcxState"))); + this.resetButton.Size = new System.Drawing.Size(168, 32); + this.resetButton.TabIndex = 1; + this.resetButton.clicked += new System.EventHandler(this.resetLineWidth); + // + // circleWidget + // + this.circleWidget.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right); + this.circleWidget.Enabled = true; + this.circleWidget.Location = new System.Drawing.Point(8, 8); + this.circleWidget.Name = "circleWidget"; + this.circleWidget.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("circleWidget.OcxState"))); + this.circleWidget.Size = new System.Drawing.Size(320, 264); + this.circleWidget.TabIndex = 2; + this.circleWidget.ClickEvent += new System.EventHandler(this.circleClicked); + // + // Form1 + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(336, 333); + this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.circleWidget, + this.resetButton}); + this.Name = "Form1"; + this.Text = "Form1"; + ((System.ComponentModel.ISupportInitialize)(this.resetButton)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.circleWidget)).EndInit(); + this.ResumeLayout(false); + + } + #endregion + + /// <summary> + /// The main entry point for the application. + /// </summary> + [STAThread] + static void Main() + { + Application.Run(new Form1()); + } + +//! [0] + private void circleClicked(object sender, System.EventArgs e) + { + this.circleWidget.lineWidth++; + } +//! [0] + +//! [1] + private void resetLineWidth(object sender, System.EventArgs e) + { + this.circleWidget.lineWidth = 1; + this.resetButton.setFocus(); + } +//! [1] + } +} diff --git a/examples/activeqt/dotnet/walkthrough/Form1.resx b/examples/activeqt/dotnet/walkthrough/Form1.resx new file mode 100644 index 0000000..6353f82 --- /dev/null +++ b/examples/activeqt/dotnet/walkthrough/Form1.resx @@ -0,0 +1,131 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 1.3 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">1.3</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1">this is my long string</data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + [base64 mime encoded serialized .NET Framework object] + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + [base64 mime encoded string representing a byte array form of the .NET Framework object] + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>1.3</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <data name="resetButton.OcxState" mimetype="application/x-microsoft.net.object.binary.base64"> + <value> + AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0xLjAuMzMw + MC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFT + eXN0ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAGwMA + AAIBAAAAAQAAAAAAAAAAAAAAAAYDAAAAAAAFAAAACGVuYWJsZWQAAAAAEgEAAAACeAAAAAAQAAAAAAAA + AAJ5AAAAABAAAAAAAAAABndpZHRoAAAAABAAAACoAAAAB2hlaWdodAAAAAAQAAAAGgAAAA1taW5pbXVt + V2lkdGgAAAAAEAAAAAAAAAAObWluaW11bUhlaWdodAAAAAAQAAAAAAAAAA1tYXhpbXVtV2lkdGgAAAAA + EAAAf/8AAAAObWF4aW11bUhlaWdodAAAAAAQAAB//wAAAA9iYWNrZ3JvdW5kTW9kZQAAAAAQAAAABAAA + ABdwYWxldHRlRm9yZWdyb3VuZENvbG9yAAAAAAr/AAAAAAAAF3BhbGV0dGVCYWNrZ3JvdW5kQ29sb3IA + AAAACv/U0MgAAAARYmFja2dyb3VuZE9yaWdpbgAAAAAQAAAAAAAAAAVmb250AAAAAAUAAAAYAE0AUwAg + AFMAaABlAGwAbAAgAEQAbABnAFP//wUBADIAAAAACGNhcHRpb24AAAAAA/////8AAAAJaWNvblRleHQA + AAAAA/////8AAAAObW91c2VUcmFja2luZwAAAAASAAAAAAxmb2N1c1BvbGljeQAAAAAQAAAAAQAAAA91 + cGRhdGVzRW5hYmxlZAAAAAASAQAAAAptYXhpbWl6ZWQAAAAAEgAAAAALZnVsbFNjcmVlbgAAAAASAAAA + AAxhY2NlcHREcm9wcwAAAAASAAAAABNpbnB1dE1ldGhvZEVuYWJsZWQAAAAAEgAAAAAFdGV4dAAAAAAD + AAAADAAmAFIAZQBzAGUAdAAAAAt0b2dnbGVUeXBlAAAAABAAAAAAAAAABWRvd24AAAAAEgAAAAAMdG9n + Z2xlU3RhdGUAAAAAEAAAAAAAAAALYXV0b1Jlc2l6ZQAAAAASAAAAAAthdXRvUmVwZWF0AAAAABIAAAAA + EGV4Y2x1c2l2ZVRvZ2dsZQAAAAASAAAAAAxhdXRvRGVmYXVsdAAAAAASAQAAAAttZW51QnV0dG9uAAAA + ABIAAAAABWZsYXQAAAAAEgAL +</value> + </data> + <data name="circleWidget.OcxState" mimetype="application/x-microsoft.net.object.binary.base64"> + <value> + AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0xLjAuMzMw + MC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFT + eXN0ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAALwAA + AAIBAAAAAQAAAAAAAAAAAAAAABoAAAAAAAAFAAAACmxpbmVXaWR0aAAAAAAQAAAAAAs= +</value> + </data> + <data name="$this.Name"> + <value>Form1</value> + </data> +</root>
\ No newline at end of file diff --git a/examples/activeqt/dotnet/walkthrough/Form1.vb b/examples/activeqt/dotnet/walkthrough/Form1.vb new file mode 100644 index 0000000..f5f241b --- /dev/null +++ b/examples/activeqt/dotnet/walkthrough/Form1.vb @@ -0,0 +1,88 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents circleWidget As AxmultipleaxLib.AxQAxWidget2 + Friend WithEvents resetButton As AxwrapperaxLib.AxQPushButton + <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() + Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1)) + Me.circleWidget = New AxmultipleaxLib.AxQAxWidget2() + Me.resetButton = New AxwrapperaxLib.AxQPushButton() + CType(Me.circleWidget, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.resetButton, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'circleWidget + ' + Me.circleWidget.Anchor = (((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right) + Me.circleWidget.Enabled = True + Me.circleWidget.Location = New System.Drawing.Point(8, 8) + Me.circleWidget.Name = "circleWidget" + Me.circleWidget.OcxState = CType(resources.GetObject("circleWidget.OcxState"), System.Windows.Forms.AxHost.State) + Me.circleWidget.Size = New System.Drawing.Size(280, 216) + Me.circleWidget.TabIndex = 0 + ' + 'resetButton + ' + Me.resetButton.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right) + ' VB is case insensitive, but our C++ controls are not. + ' Me.resetButton.enabled = True + Me.resetButton.Location = New System.Drawing.Point(184, 240) + Me.resetButton.Name = "resetButton" + Me.resetButton.OcxState = CType(resources.GetObject("resetButton.OcxState"), System.Windows.Forms.AxHost.State) + Me.resetButton.Size = New System.Drawing.Size(104, 24) + Me.resetButton.TabIndex = 1 + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(292, 273) + Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.resetButton, Me.circleWidget}) + Me.Name = "Form1" + Me.Text = "Form1" + CType(Me.circleWidget, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.resetButton, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub circleWidget_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles circleWidget.ClickEvent + Me.circleWidget.lineWidth = Me.circleWidget.lineWidth + 1 + End Sub + + Private Sub resetButton_clicked(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles resetButton.clicked + Me.circleWidget.lineWidth = 1 + Me.resetButton.setFocus() + End Sub +End Class diff --git a/examples/activeqt/dotnet/walkthrough/csharp.csproj b/examples/activeqt/dotnet/walkthrough/csharp.csproj new file mode 100644 index 0000000..4c5502b --- /dev/null +++ b/examples/activeqt/dotnet/walkthrough/csharp.csproj @@ -0,0 +1,143 @@ +<VisualStudioProject> + <CSHARP + ProjectType = "Local" + ProductVersion = "7.0.9466" + SchemaVersion = "1.0" + ProjectGuid = "{F15600FD-7677-4C01-B98A-6776CE500617}" + > + <Build> + <Settings + ApplicationIcon = "" + AssemblyKeyContainerName = "" + AssemblyName = "csharp" + AssemblyOriginatorKeyFile = "" + DefaultClientScript = "JScript" + DefaultHTMLPageLayout = "Grid" + DefaultTargetSchema = "IE50" + DelaySign = "false" + OutputType = "WinExe" + RootNamespace = "csharp" + StartupObject = "" + > + <Config + Name = "Debug" + AllowUnsafeBlocks = "false" + BaseAddress = "285212672" + CheckForOverflowUnderflow = "false" + ConfigurationOverrideFile = "" + DefineConstants = "DEBUG;TRACE" + DocumentationFile = "" + DebugSymbols = "true" + FileAlignment = "4096" + IncrementalBuild = "true" + Optimize = "false" + OutputPath = "bin\Debug\" + RegisterForComInterop = "false" + RemoveIntegerChecks = "false" + TreatWarningsAsErrors = "false" + WarningLevel = "4" + /> + <Config + Name = "Release" + AllowUnsafeBlocks = "false" + BaseAddress = "285212672" + CheckForOverflowUnderflow = "false" + ConfigurationOverrideFile = "" + DefineConstants = "TRACE" + DocumentationFile = "" + DebugSymbols = "false" + FileAlignment = "4096" + IncrementalBuild = "false" + Optimize = "true" + OutputPath = "bin\Release\" + RegisterForComInterop = "false" + RemoveIntegerChecks = "false" + TreatWarningsAsErrors = "false" + WarningLevel = "4" + /> + </Settings> + <References> + <Reference + Name = "System" + AssemblyName = "System" + HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll" + /> + <Reference + Name = "System.Data" + AssemblyName = "System.Data" + HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll" + /> + <Reference + Name = "System.Drawing" + AssemblyName = "System.Drawing" + HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll" + /> + <Reference + Name = "System.Windows.Forms" + AssemblyName = "System.Windows.Forms" + HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll" + /> + <Reference + Name = "System.XML" + AssemblyName = "System.Xml" + HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll" + /> + <Reference + Name = "stdole" + Guid = "{00020430-0000-0000-C000-000000000046}" + VersionMajor = "2" + VersionMinor = "0" + Lcid = "0" + WrapperTool = "primary" + /> + <Reference + Name = "wrapperaxLib" + Guid = "{3B756301-0075-4E40-8BE8-5A81DE2426B7}" + VersionMajor = "1" + VersionMinor = "0" + Lcid = "0" + WrapperTool = "tlbimp" + /> + <Reference + Name = "AxwrapperaxLib" + Guid = "{3B756301-0075-4E40-8BE8-5A81DE2426B7}" + VersionMajor = "1" + VersionMinor = "0" + Lcid = "0" + WrapperTool = "aximp" + /> + <Reference + Name = "multipleaxLib" + Guid = "{05828915-AD1C-47AB-AB96-D6AD1E25F0E2}" + VersionMajor = "1" + VersionMinor = "0" + Lcid = "0" + WrapperTool = "tlbimp" + /> + <Reference + Name = "AxmultipleaxLib" + Guid = "{05828915-AD1C-47AB-AB96-D6AD1E25F0E2}" + VersionMajor = "1" + VersionMinor = "0" + Lcid = "0" + WrapperTool = "aximp" + /> + </References> + </Build> + <Files> + <Include> + <File + RelPath = "Form1.cs" + SubType = "Form" + BuildAction = "Compile" + /> + <File + RelPath = "Form1.resx" + DependentUpon = "Form1.cs" + BuildAction = "EmbeddedResource" + /> + </Include> + </Files> + </CSHARP> +</VisualStudioProject> + diff --git a/examples/activeqt/dotnet/walkthrough/vb.vbproj b/examples/activeqt/dotnet/walkthrough/vb.vbproj new file mode 100644 index 0000000..eb0a9d6 --- /dev/null +++ b/examples/activeqt/dotnet/walkthrough/vb.vbproj @@ -0,0 +1,147 @@ +<VisualStudioProject> + <VisualBasic + ProjectType = "Local" + ProductVersion = "7.0.9466" + SchemaVersion = "1.0" + ProjectGuid = "{BFF242A6-967C-4F73-BEBE-DED2D9C395C6}" + > + <Build> + <Settings + ApplicationIcon = "" + AssemblyKeyContainerName = "" + AssemblyName = "vb" + AssemblyOriginatorKeyFile = "" + AssemblyOriginatorKeyMode = "None" + DefaultClientScript = "JScript" + DefaultHTMLPageLayout = "Grid" + DefaultTargetSchema = "IE50" + DelaySign = "false" + OutputType = "WinExe" + OptionCompare = "Binary" + OptionExplicit = "On" + OptionStrict = "Off" + RootNamespace = "vb" + StartupObject = "vb.Form1" + > + <Config + Name = "Debug" + BaseAddress = "285212672" + ConfigurationOverrideFile = "" + DefineConstants = "" + DefineDebug = "true" + DefineTrace = "true" + DebugSymbols = "true" + IncrementalBuild = "true" + Optimize = "false" + OutputPath = "bin\" + RegisterForComInterop = "false" + RemoveIntegerChecks = "false" + TreatWarningsAsErrors = "false" + WarningLevel = "1" + /> + <Config + Name = "Release" + BaseAddress = "285212672" + ConfigurationOverrideFile = "" + DefineConstants = "" + DefineDebug = "false" + DefineTrace = "true" + DebugSymbols = "false" + IncrementalBuild = "false" + Optimize = "true" + OutputPath = "bin\" + RegisterForComInterop = "false" + RemoveIntegerChecks = "false" + TreatWarningsAsErrors = "false" + WarningLevel = "1" + /> + </Settings> + <References> + <Reference + Name = "System" + AssemblyName = "System" + /> + <Reference + Name = "System.Data" + AssemblyName = "System.Data" + /> + <Reference + Name = "System.Drawing" + AssemblyName = "System.Drawing" + /> + <Reference + Name = "System.Windows.Forms" + AssemblyName = "System.Windows.Forms" + /> + <Reference + Name = "System.XML" + AssemblyName = "System.Xml" + /> + <Reference + Name = "stdole" + Guid = "{00020430-0000-0000-C000-000000000046}" + VersionMajor = "2" + VersionMinor = "0" + Lcid = "0" + WrapperTool = "primary" + /> + <Reference + Name = "wrapperaxLib" + Guid = "{3B756301-0075-4E40-8BE8-5A81DE2426B7}" + VersionMajor = "1" + VersionMinor = "0" + Lcid = "0" + WrapperTool = "tlbimp" + /> + <Reference + Name = "multipleaxLib" + Guid = "{05828915-AD1C-47AB-AB96-D6AD1E25F0E2}" + VersionMajor = "1" + VersionMinor = "0" + Lcid = "0" + WrapperTool = "tlbimp" + /> + <Reference + Name = "AxwrapperaxLib" + Guid = "{3B756301-0075-4E40-8BE8-5A81DE2426B7}" + VersionMajor = "1" + VersionMinor = "0" + Lcid = "0" + WrapperTool = "aximp" + /> + <Reference + Name = "AxmultipleaxLib" + Guid = "{05828915-AD1C-47AB-AB96-D6AD1E25F0E2}" + VersionMajor = "1" + VersionMinor = "0" + Lcid = "0" + WrapperTool = "aximp" + /> + </References> + <Imports> + <Import Namespace = "Microsoft.VisualBasic" /> + <Import Namespace = "System" /> + <Import Namespace = "System.Collections" /> + <Import Namespace = "System.Data" /> + <Import Namespace = "System.Drawing" /> + <Import Namespace = "System.Diagnostics" /> + <Import Namespace = "System.Windows.Forms" /> + </Imports> + </Build> + <Files> + <Include> + <File + RelPath = "Form1.vb" + SubType = "Form" + BuildAction = "Compile" + /> + <File + RelPath = "Form1.resx" + DependentUpon = "Form1.vb" + BuildAction = "EmbeddedResource" + /> + </Include> + </Files> + </VisualBasic> +</VisualStudioProject> + diff --git a/examples/activeqt/dotnet/wrapper/app.csproj b/examples/activeqt/dotnet/wrapper/app.csproj new file mode 100644 index 0000000..dce4bf0 --- /dev/null +++ b/examples/activeqt/dotnet/wrapper/app.csproj @@ -0,0 +1,93 @@ +<VisualStudioProject> + <CSHARP + ProjectType = "Local" + ProductVersion = "7.0.9466" + SchemaVersion = "1.0" + ProjectGuid = "{334C8F04-E034-4082-9380-43906DDE71AB}" + > + <Build> + <Settings + ApplicationIcon = "" + AssemblyKeyContainerName = "" + AssemblyName = "wrapper" + AssemblyOriginatorKeyFile = "" + DefaultClientScript = "JScript" + DefaultHTMLPageLayout = "Grid" + DefaultTargetSchema = "IE50" + DelaySign = "false" + OutputType = "Exe" + RootNamespace = "wrapper" + StartupObject = "" + > + <Config + Name = "Debug" + AllowUnsafeBlocks = "false" + BaseAddress = "285212672" + CheckForOverflowUnderflow = "false" + ConfigurationOverrideFile = "" + DefineConstants = "DEBUG;TRACE" + DocumentationFile = "" + DebugSymbols = "true" + FileAlignment = "4096" + IncrementalBuild = "true" + Optimize = "false" + OutputPath = "bin\Debug\" + RegisterForComInterop = "false" + RemoveIntegerChecks = "false" + TreatWarningsAsErrors = "false" + WarningLevel = "4" + /> + <Config + Name = "Release" + AllowUnsafeBlocks = "false" + BaseAddress = "285212672" + CheckForOverflowUnderflow = "false" + ConfigurationOverrideFile = "" + DefineConstants = "TRACE" + DocumentationFile = "" + DebugSymbols = "false" + FileAlignment = "4096" + IncrementalBuild = "false" + Optimize = "true" + OutputPath = "bin\Release\" + RegisterForComInterop = "false" + RemoveIntegerChecks = "false" + TreatWarningsAsErrors = "false" + WarningLevel = "4" + /> + </Settings> + <References> + <Reference + Name = "System" + AssemblyName = "System" + HintPath = "D:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll" + /> + <Reference + Name = "System.Data" + AssemblyName = "System.Data" + HintPath = "D:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll" + /> + <Reference + Name = "System.XML" + AssemblyName = "System.Xml" + HintPath = "D:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll" + /> + <Reference + Name = "lib" + AssemblyName = "lib" + HintPath = "lib\lib.dll" + /> + </References> + </Build> + <Files> + <Include> + <File + RelPath = "main.cs" + SubType = "Code" + BuildAction = "Compile" + /> + </Include> + </Files> + </CSHARP> +</VisualStudioProject> + diff --git a/examples/activeqt/dotnet/wrapper/lib/lib.vcproj b/examples/activeqt/dotnet/wrapper/lib/lib.vcproj new file mode 100644 index 0000000..f49c35d --- /dev/null +++ b/examples/activeqt/dotnet/wrapper/lib/lib.vcproj @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding = "Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.00" + Name="lib" + ProjectGUID="{2E94A303-45A2-47AC-B87A-7C3519E9D6D8}" + Keyword="ManagedCProj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="2" + CharacterSet="2" + ManagedExtensions="TRUE"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories=""$(QTDIR)\include";"$(QTDIR)\include\QtCore"" + PreprocessorDefinitions="WIN32;_DEBUG" + IgnoreStandardIncludePath="FALSE" + MinimalRebuild="FALSE" + BasicRuntimeChecks="0" + RuntimeLibrary="1" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="QtCored4.lib" + OutputFile="lib.dll" + LinkIncremental="2" + AdditionalLibraryDirectories="$(QTDIR)/lib" + GenerateDebugInformation="TRUE"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="2" + CharacterSet="2" + ManagedExtensions="TRUE"> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + AdditionalIncludeDirectories=""$(QTDIR)\include";"$(QTDIR)\include\QtCore"" + InlineFunctionExpansion="1" + PreprocessorDefinitions="WIN32;NDEBUG" + MinimalRebuild="FALSE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="QtCore4.lib" + OutputFile="$(OutDir)/lib.dll" + LinkIncremental="1" + AdditionalLibraryDirectories="$(QTDIR)/lib" + GenerateDebugInformation="TRUE"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + </Configuration> + </Configurations> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> + <File + RelativePath="networker.cpp"> + </File> + <File + RelativePath="tools.cpp"> + </File> + <File + RelativePath="worker.cpp"> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc"> + <File + RelativePath="networker.h"> + </File> + <File + RelativePath="tools.h"> + </File> + <File + RelativePath="worker.h"> + <FileConfiguration + Name="Debug|Win32"> + <Tool + Name="VCCustomBuildTool" + CommandLine="$(QTDIR)\bin\moc.exe $(InputName).h -o moc_$(InputName).cpp" + Outputs="moc_$(InputName).cpp"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCustomBuildTool" + CommandLine="$(QTDIR)\bin\moc.exe $(InputName).h -o moc_$(InputName).cpp" + Outputs="moc_$(InputName).cpp"/> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Generated MOC" + Filter=""> + <File + RelativePath="moc_worker.cpp"> + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/examples/activeqt/dotnet/wrapper/lib/networker.cpp b/examples/activeqt/dotnet/wrapper/lib/networker.cpp new file mode 100644 index 0000000..54e862b --- /dev/null +++ b/examples/activeqt/dotnet/wrapper/lib/networker.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] +#include "networker.h" +#include "worker.h" +#include "tools.h" + +netWorker::netWorker() +{ + workerObject = new Worker(); +} +//! [0] //! [1] + +netWorker::~netWorker() +{ + delete workerObject; +} +//! [1] //! [2] + +String *netWorker::get_StatusString() +{ + return QStringToString(workerObject->statusString()); +} +//! [2] //! [3] + +void netWorker::set_StatusString(String *string) +{ + workerObject->setStatusString(StringToQString(string)); + __raise statusStringChanged(string); +} +//! [3] diff --git a/examples/activeqt/dotnet/wrapper/lib/networker.h b/examples/activeqt/dotnet/wrapper/lib/networker.h new file mode 100644 index 0000000..583c6c4 --- /dev/null +++ b/examples/activeqt/dotnet/wrapper/lib/networker.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// lib.h + +#pragma once + +#using <mscorlib.dll> +using namespace System; + +//! [0] +class Worker; + +// .NET class +public __gc class netWorker +{ +public: + netWorker(); + ~netWorker(); + + __property String *get_StatusString(); + __property void set_StatusString(String *string); + + __event void statusStringChanged(String *args); + +private: + Worker *workerObject; +}; +//! [0] diff --git a/examples/activeqt/dotnet/wrapper/lib/tools.cpp b/examples/activeqt/dotnet/wrapper/lib/tools.cpp new file mode 100644 index 0000000..aa67aea --- /dev/null +++ b/examples/activeqt/dotnet/wrapper/lib/tools.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] +#include <QString> + +#using <mscorlib.dll> +#include <vcclr.h> + +using namespace System; + +String *QStringToString(const QString &qstring) +{ + return new String((const wchar_t *)qstring.utf16()); +} +//! [0] //! [1] + +QString StringToQString(String *string) +{ + const wchar_t __pin *chars = PtrToStringChars(string); + return QString::fromUtf16((const ushort *)chars); +} +//! [1] diff --git a/examples/activeqt/dotnet/wrapper/lib/tools.h b/examples/activeqt/dotnet/wrapper/lib/tools.h new file mode 100644 index 0000000..8569eca --- /dev/null +++ b/examples/activeqt/dotnet/wrapper/lib/tools.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef TOOLS_H +#define TOOLS_H + +#using <mscorlib.dll> + +QT_BEGIN_NAMESPACE +class QString; +QT_END_NAMESPACE + +System::String *QStringToString(const QString &qstring); +QString StringToQString(System::String *string); + +#endif // TOOLS_H diff --git a/examples/activeqt/dotnet/wrapper/lib/worker.cpp b/examples/activeqt/dotnet/wrapper/lib/worker.cpp new file mode 100644 index 0000000..695db57 --- /dev/null +++ b/examples/activeqt/dotnet/wrapper/lib/worker.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "worker.h" +#include "tools.h" + +Worker::Worker() +{ + status = "Idle"; +} + +void Worker::setStatusString(const QString &string) +{ + status = string; + emit statusStringChanged(status); +} + +QString Worker::statusString() const +{ + return status; +} diff --git a/examples/activeqt/dotnet/wrapper/lib/worker.h b/examples/activeqt/dotnet/wrapper/lib/worker.h new file mode 100644 index 0000000..8bab9ed --- /dev/null +++ b/examples/activeqt/dotnet/wrapper/lib/worker.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef WORKER_H +#define WORKER_H + +#include <QObject> + +// native Qt/C++ class +//! [0] +class Worker : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString statusString READ statusString WRITE setStatusString) +public: + Worker(); + + QString statusString() const; + +public slots: + void setStatusString(const QString &string); + +signals: + void statusStringChanged(const QString &string); + +private: + QString status; +}; +//! [0] + +#endif // WORKER_H diff --git a/examples/activeqt/dotnet/wrapper/main.cs b/examples/activeqt/dotnet/wrapper/main.cs new file mode 100644 index 0000000..1d43029 --- /dev/null +++ b/examples/activeqt/dotnet/wrapper/main.cs @@ -0,0 +1,40 @@ +//! [0] +using System; + +namespace WrapperApp +{ + class App + { + void Run() + { + netWorker worker = new netWorker(); + + worker.statusStringChanged += new netWorker.__Delegate_statusStringChanged(onStatusStringChanged); + + System.Console.Out.WriteLine(worker.StatusString); + + System.Console.Out.WriteLine("Working cycle begins..."); + worker.StatusString = "Working"; + worker.StatusString = "Lunch Break"; + worker.StatusString = "Working"; + worker.StatusString = "Idle"; + System.Console.Out.WriteLine("Working cycle ends..."); + } + + private void onStatusStringChanged(string str) + { + System.Console.Out.WriteLine(str); + } + + [STAThread] +//! [0] //! [1] + static void Main(string[] args) + { + App app = new App(); + app.Run(); + } +//! [1] //! [2] + } +//! [2] //! [3] +} +//! [3] diff --git a/examples/activeqt/dotnet/wrapper/wrapper.sln b/examples/activeqt/dotnet/wrapper/wrapper.sln new file mode 100644 index 0000000..e25e6bd --- /dev/null +++ b/examples/activeqt/dotnet/wrapper/wrapper.sln @@ -0,0 +1,28 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "app", "app.csproj", "{334C8F04-E034-4082-9380-43906DDE71AB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib", "lib\lib.vcproj", "{2E94A303-45A2-47AC-B87A-7C3519E9D6D8}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + {334C8F04-E034-4082-9380-43906DDE71AB}.0 = {2E94A303-45A2-47AC-B87A-7C3519E9D6D8} + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {334C8F04-E034-4082-9380-43906DDE71AB}.Debug.ActiveCfg = Debug|.NET + {334C8F04-E034-4082-9380-43906DDE71AB}.Debug.Build.0 = Debug|.NET + {334C8F04-E034-4082-9380-43906DDE71AB}.Release.ActiveCfg = Release|.NET + {334C8F04-E034-4082-9380-43906DDE71AB}.Release.Build.0 = Release|.NET + {2E94A303-45A2-47AC-B87A-7C3519E9D6D8}.Debug.ActiveCfg = Debug|Win32 + {2E94A303-45A2-47AC-B87A-7C3519E9D6D8}.Debug.Build.0 = Debug|Win32 + {2E94A303-45A2-47AC-B87A-7C3519E9D6D8}.Release.ActiveCfg = Release|Win32 + {2E94A303-45A2-47AC-B87A-7C3519E9D6D8}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/examples/activeqt/hierarchy/hierarchy.inf b/examples/activeqt/hierarchy/hierarchy.inf new file mode 100644 index 0000000..cb7e90f --- /dev/null +++ b/examples/activeqt/hierarchy/hierarchy.inf @@ -0,0 +1,9 @@ +[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 new file mode 100644 index 0000000..abe5f1b --- /dev/null +++ b/examples/activeqt/hierarchy/hierarchy.pro @@ -0,0 +1,16 @@ +TEMPLATE = lib +TARGET = hierarchyax + +CONFIG += qt warn_off qaxserver dll +contains(CONFIG, static):DEFINES += QT_NODLL + +SOURCES = objects.cpp main.cpp +HEADERS = objects.h +RC_FILE = $$QT_SOURCE_TREE/src/activeqt/control/qaxserver.rc +DEF_FILE = $$QT_SOURCE_TREE/src/activeqt/control/qaxserver.def + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/hierarchy +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS hierarchy.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt/hierarchy +INSTALLS += target sources diff --git a/examples/activeqt/hierarchy/main.cpp b/examples/activeqt/hierarchy/main.cpp new file mode 100644 index 0000000..e817635 --- /dev/null +++ b/examples/activeqt/hierarchy/main.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [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 new file mode 100644 index 0000000..c3928b5 --- /dev/null +++ b/examples/activeqt/hierarchy/objects.cpp @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "objects.h" +#include <QLayout> +#include <QPainter> + +/* Implementation of QParentWidget */ +//! [0] +QParentWidget::QParentWidget(QWidget *parent) +: QWidget(parent) +{ + vbox = new QVBoxLayout(this); +} + +//! [0] //! [1] +void QParentWidget::createSubWidget(const QString &name) +{ + QSubWidget *sw = new QSubWidget(this, name); + vbox->addWidget(sw); + sw->setLabel(name); + sw->show(); +} + +//! [1] //! [2] +QSubWidget *QParentWidget::subWidget(const QString &name) +{ + return qFindChild<QSubWidget*>(this, 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) +{ + lbl = text; + setObjectName(text); + update(); +} + +QString QSubWidget::label() const +{ + return lbl; +} + +QSize QSubWidget::sizeHint() const +{ + QFontMetrics fm(font()); + return QSize(fm.width(lbl), fm.height()); +} + +void QSubWidget::paintEvent(QPaintEvent *) +{ + QPainter painter(this); + painter.setPen(palette().text().color()); + painter.drawText(rect(), Qt::AlignCenter, lbl); +//! [3] //! [4] +} +//! [4] diff --git a/examples/activeqt/hierarchy/objects.h b/examples/activeqt/hierarchy/objects.h new file mode 100644 index 0000000..e719e6d --- /dev/null +++ b/examples/activeqt/hierarchy/objects.h @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#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: + QParentWidget(QWidget *parent = 0); + + QSize sizeHint() const; + +public slots: + void createSubWidget( const QString &name ); + + QSubWidget *subWidget( const QString &name ); + +private: + QVBoxLayout *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 = 0, const QString &name = QString()); + + void setLabel( const QString &text ); + QString label() const; + + QSize sizeHint() const; + +protected: + void paintEvent( QPaintEvent *e ); + +private: + QString lbl; +}; +//! [1] + +#endif // OBJECTS_H diff --git a/examples/activeqt/menus/fileopen.xpm b/examples/activeqt/menus/fileopen.xpm new file mode 100644 index 0000000..880417e --- /dev/null +++ b/examples/activeqt/menus/fileopen.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static const char *fileopen[] = { +" 16 13 5 1", +". c #040404", +"# c #808304", +"a c None", +"b c #f3f704", +"c c #f3f7f3", +"aaaaaaaaa...aaaa", +"aaaaaaaa.aaa.a.a", +"aaaaaaaaaaaaa..a", +"a...aaaaaaaa...a", +".bcb.......aaaaa", +".cbcbcbcbc.aaaaa", +".bcbcbcbcb.aaaaa", +".cbcb...........", +".bcb.#########.a", +".cb.#########.aa", +".b.#########.aaa", +"..#########.aaaa", +"...........aaaaa" +}; diff --git a/examples/activeqt/menus/filesave.xpm b/examples/activeqt/menus/filesave.xpm new file mode 100644 index 0000000..bd6870f --- /dev/null +++ b/examples/activeqt/menus/filesave.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static const char *filesave[] = { +" 14 14 4 1", +". c #040404", +"# c #808304", +"a c #bfc2bf", +"b c None", +"..............", +".#.aaaaaaaa.a.", +".#.aaaaaaaa...", +".#.aaaaaaaa.#.", +".#.aaaaaaaa.#.", +".#.aaaaaaaa.#.", +".#.aaaaaaaa.#.", +".##........##.", +".############.", +".##.........#.", +".##......aa.#.", +".##......aa.#.", +".##......aa.#.", +"b............." +}; diff --git a/examples/activeqt/menus/main.cpp b/examples/activeqt/menus/main.cpp new file mode 100644 index 0000000..56f8a9f --- /dev/null +++ b/examples/activeqt/menus/main.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "menus.h" +#include <QApplication> +#include <QAxFactory> + +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}"); + +int main( int argc, char **argv ) +{ + QApplication a( argc, argv ); + + QWidget *window = 0; + if ( !QAxFactory::isServer() ) { + window = new QMenus(); + window->show(); + } + + return a.exec(); +} diff --git a/examples/activeqt/menus/menus.cpp b/examples/activeqt/menus/menus.cpp new file mode 100644 index 0000000..27f064e --- /dev/null +++ b/examples/activeqt/menus/menus.cpp @@ -0,0 +1,178 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "menus.h" +#include <QAction> +#include <QAxFactory> +#include <QMenuBar> +#include <QMessageBox> +#include <QTextEdit> +#include <QPixmap> + +#include "fileopen.xpm" +#include "filesave.xpm" + +QMenus::QMenus(QWidget *parent) + : QMainWindow(parent, 0) // QMainWindow's default flag is WType_TopLevel +{ + QAction *action; + + QMenu *file = new QMenu(this); + + action = new QAction(QPixmap((const char**)fileopen), "&Open", this); + action->setShortcut(tr("CTRL+O")); + connect(action, SIGNAL(triggered()), this, SLOT(fileOpen())); + file->addAction(action); + + action = new QAction(QPixmap((const char**)filesave),"&Save", this); + action->setShortcut(tr("CTRL+S")); + connect(action, SIGNAL(triggered()), this, SLOT(fileSave())); + file->addAction(action); + + QMenu *edit = new QMenu(this); + + action = new QAction("&Normal", this); + action->setShortcut(tr("CTRL+N")); + action->setToolTip("Normal"); + action->setStatusTip("Toggles Normal"); + action->setCheckable(true); + connect(action, SIGNAL(triggered()), this, SLOT(editNormal())); + edit->addAction(action); + + action = new QAction("&Bold", this); + action->setShortcut(tr("CTRL+B")); + action->setCheckable(true); + connect(action, SIGNAL(triggered()), this, SLOT(editBold())); + edit->addAction(action); + + action = new QAction("&Underline", this); + action->setShortcut(tr("CTRL+U")); + action->setCheckable(true); + connect(action, SIGNAL(triggered()), this, SLOT(editUnderline())); + edit->addAction(action); + + QMenu *advanced = new QMenu(this); + action = new QAction("&Font...", this); + connect(action, SIGNAL(triggered()), this, SLOT(editAdvancedFont())); + advanced->addAction(action); + + action = new QAction("&Style...", this); + connect(action, SIGNAL(triggered()), this, SLOT(editAdvancedStyle())); + advanced->addAction(action); + + edit->addMenu(advanced)->setText("&Advanced"); + + edit->addSeparator(); + + action = new QAction("Una&vailable", this); + action->setShortcut(tr("CTRL+V")); + action->setCheckable(true); + action->setEnabled(false); + connect(action, SIGNAL(triggered()), this, SLOT(editUnderline())); + edit->addAction(action); + + QMenu *help = new QMenu(this); + + action = new QAction("&About...", this); + action->setShortcut(tr("F1")); + connect(action, SIGNAL(triggered()), this, SLOT(helpAbout())); + help->addAction(action); + + action = new QAction("&About Qt...", this); + connect(action, SIGNAL(triggered()), this, SLOT(helpAboutQt())); + help->addAction(action); + + if (!QAxFactory::isServer()) + menuBar()->addMenu(file)->setText("&File"); + menuBar()->addMenu(edit)->setText("&Edit"); + menuBar()->addMenu(help)->setText("&Help"); + + editor = new QTextEdit(this); + setCentralWidget(editor); + + statusBar(); +} + +void QMenus::fileOpen() +{ + editor->append("File Open selected."); +} + +void QMenus::fileSave() +{ + editor->append("File Save selected."); +} + +void QMenus::editNormal() +{ + editor->append("Edit Normal selected."); +} + +void QMenus::editBold() +{ + editor->append("Edit Bold selected."); +} + +void QMenus::editUnderline() +{ + editor->append("Edit Underline selected."); +} + +void QMenus::editAdvancedFont() +{ + editor->append("Edit Advanced Font selected."); +} + +void QMenus::editAdvancedStyle() +{ + editor->append("Edit Advanced Style selected."); +} + +void QMenus::helpAbout() +{ + QMessageBox::about(this, "About QMenus", + "This example implements an in-place ActiveX control with menus and status messages."); +} + +void QMenus::helpAboutQt() +{ + QMessageBox::aboutQt(this); +} diff --git a/examples/activeqt/menus/menus.h b/examples/activeqt/menus/menus.h new file mode 100644 index 0000000..c961cd5 --- /dev/null +++ b/examples/activeqt/menus/menus.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MENUS_H +#define MENUS_H + +#include <QMainWindow> + +QT_BEGIN_NAMESPACE +class QTextEdit; +QT_END_NAMESPACE + +class QMenus : public QMainWindow +{ + Q_OBJECT + +public: + QMenus(QWidget *parent = 0); + +public slots: + void fileOpen(); + void fileSave(); + + void editNormal(); + void editBold(); + void editUnderline(); + + void editAdvancedFont(); + void editAdvancedStyle(); + + void helpAbout(); + void helpAboutQt(); + +private: + QTextEdit *editor; +}; + +#endif // MENUS_H diff --git a/examples/activeqt/menus/menus.inf b/examples/activeqt/menus/menus.inf new file mode 100644 index 0000000..f97efe8 --- /dev/null +++ b/examples/activeqt/menus/menus.inf @@ -0,0 +1,9 @@ +[version] + signature="$CHICAGO$" + AdvancedINF=2.0 + [Add.Code] + menusax.exe=menusax.exe + [menusax.exe] + file-win32-x86=thiscab + clsid={4dc3f340-a6f7-44e4-a79b-3e9217695fbd} + RegisterServer=yes diff --git a/examples/activeqt/menus/menus.pro b/examples/activeqt/menus/menus.pro new file mode 100644 index 0000000..c962b6b --- /dev/null +++ b/examples/activeqt/menus/menus.pro @@ -0,0 +1,14 @@ +TEMPLATE = app +TARGET = menusax + +CONFIG += qt warn_off qaxserver + +SOURCES = main.cpp menus.cpp +HEADERS = menus.h +RC_FILE = $$QT_SOURCE_TREE/src/activeqt/control/qaxserver.rc + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/menus +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS menus.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt/menus +INSTALLS += target sources diff --git a/examples/activeqt/multiple/ax1.h b/examples/activeqt/multiple/ax1.h new file mode 100644 index 0000000..a53e4f4 --- /dev/null +++ b/examples/activeqt/multiple/ax1.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef AX1_H +#define AX1_H + +#include <QWidget> +#include <QPainter> + +//! [0] +class QAxWidget1 : public QWidget +{ + Q_OBJECT + Q_CLASSINFO("ClassID", "{1D9928BD-4453-4bdd-903D-E525ED17FDE5}") + Q_CLASSINFO("InterfaceID", "{99F6860E-2C5A-42ec-87F2-43396F4BE389}") + Q_CLASSINFO("EventsID", "{0A3E9F27-E4F1-45bb-9E47-63099BCCD0E3}") + + Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor) +public: + QAxWidget1(QWidget *parent = 0) + : QWidget(parent), fill_color(Qt::red) + { + } + + QColor fillColor() const + { + return fill_color; + } + void setFillColor(const QColor &fc) + { + fill_color = fc; + repaint(); + } + +protected: + void paintEvent(QPaintEvent *e) + { + QPainter paint(this); + QRect r = rect(); + r.adjust(10, 10, -10, -10); + paint.fillRect(r, fill_color); + } + +private: + QColor fill_color; +}; +//! [0] + +#endif // AX1_H diff --git a/examples/activeqt/multiple/ax2.h b/examples/activeqt/multiple/ax2.h new file mode 100644 index 0000000..b6b50f3 --- /dev/null +++ b/examples/activeqt/multiple/ax2.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef AX2_H +#define AX2_H + +#include <QWidget> +#include <QPainter> + +//! [0] +class QAxWidget2 : public QWidget +{ + Q_OBJECT + Q_CLASSINFO("ClassID", "{58139D56-6BE9-4b17-937D-1B1EDEDD5B71}") + Q_CLASSINFO("InterfaceID", "{B66280AB-08CC-4dcc-924F-58E6D7975B7D}") + Q_CLASSINFO("EventsID", "{D72BACBA-03C4-4480-B4BB-DE4FE3AA14A0}") + Q_CLASSINFO("ToSuperClass", "QAxWidget2") + Q_CLASSINFO("StockEvents", "yes") + Q_CLASSINFO("Insertable", "yes") + + Q_PROPERTY( int lineWidth READ lineWidth WRITE setLineWidth ) +public: + QAxWidget2(QWidget *parent = 0) + : QWidget(parent), line_width( 1 ) + { + } + + int lineWidth() const + { + return line_width; + } + void setLineWidth( int lw ) + { + line_width = lw; + repaint(); + } + +protected: + void paintEvent( QPaintEvent *e ) + { + QPainter paint( this ); + QPen pen = paint.pen(); + pen.setWidth( line_width ); + paint.setPen( pen ); + + QRect r = rect(); + r.adjust( 10, 10, -10, -10 ); + paint.drawEllipse( r ); + } + +private: + int line_width; +}; +//! [0] + +#endif // AX2_H diff --git a/examples/activeqt/multiple/main.cpp b/examples/activeqt/multiple/main.cpp new file mode 100644 index 0000000..612292e --- /dev/null +++ b/examples/activeqt/multiple/main.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] +#include "ax1.h" +#include "ax2.h" +#include <QAxFactory> + +QT_USE_NAMESPACE + +QAXFACTORY_BEGIN("{98DE28B6-6CD3-4e08-B9FA-3D1DB43F1D2F}", "{05828915-AD1C-47ab-AB96-D6AD1E25F0E2}") + QAXCLASS(QAxWidget1) + QAXCLASS(QAxWidget2) +QAXFACTORY_END() +//! [0] diff --git a/examples/activeqt/multiple/multiple.inf b/examples/activeqt/multiple/multiple.inf new file mode 100644 index 0000000..7f6be76 --- /dev/null +++ b/examples/activeqt/multiple/multiple.inf @@ -0,0 +1,9 @@ +[version] + signature="$CHICAGO$" + AdvancedINF=2.0 + [Add.Code] + multipleax.dll=multipleax.dll + [multipleax.dll] + file-win32-x86=thiscab + clsid={1D9928BD-4453-4bdd-903D-E525ED17FDE5} + RegisterServer=yes diff --git a/examples/activeqt/multiple/multiple.pro b/examples/activeqt/multiple/multiple.pro new file mode 100644 index 0000000..7b86950 --- /dev/null +++ b/examples/activeqt/multiple/multiple.pro @@ -0,0 +1,16 @@ +TEMPLATE = lib +TARGET = multipleax + +CONFIG += qt warn_off qaxserver dll +contains(CONFIG, static):DEFINES += QT_NODLL + +SOURCES = main.cpp +HEADERS = ax1.h ax2.h +RC_FILE = multipleax.rc +DEF_FILE = $$QT_SOURCE_TREE/src/activeqt/control/qaxserver.def + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/multiple +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS multiple.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt/multiple +INSTALLS += target sources diff --git a/examples/activeqt/multiple/multipleax.rc b/examples/activeqt/multiple/multipleax.rc new file mode 100644 index 0000000..1809e0d --- /dev/null +++ b/examples/activeqt/multiple/multipleax.rc @@ -0,0 +1,32 @@ +#include "winver.h" + +1 TYPELIB "multipleax.rc" +1 ICON DISCARDABLE "..\\..\\..\\src\\activeqt\\control\\qaxserver.ico" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 + FILEFLAGSMASK 0x3fL + FILEOS 0x00040000L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "Nokia Corporation and/or its subsidiary(-ies)" + VALUE "FileDescription", "Multiple Example (ActiveQt)" + VALUE "FileVersion", "1.0.0.0" + VALUE "LegalCopyright", "Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)." + VALUE "InternalName", "multipleax.dll" + VALUE "OriginalFilename", "multipleax.dll" + VALUE "ProductName", "Multiple Example (ActiveQt)" + VALUE "ProductVersion", "1.0.0.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END diff --git a/examples/activeqt/opengl/glbox.cpp b/examples/activeqt/opengl/glbox.cpp new file mode 100644 index 0000000..4cb015b --- /dev/null +++ b/examples/activeqt/opengl/glbox.cpp @@ -0,0 +1,250 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/**************************************************************************** +** +** 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] + +#if defined(Q_CC_MSVC) +#pragma warning(disable:4305) // init: truncation from const double to float +#endif + +/*! + Create a GLBox widget +*/ + +GLBox::GLBox( QWidget* parent, const char* name ) + : QGLWidget( parent ) +{ + xRot = yRot = zRot = 0.0; // default object rotation + scale = 1.25; // default object scale + object = 0; +} + + +/*! + Release allocated resources +*/ + +GLBox::~GLBox() +{ + makeCurrent(); + glDeleteLists( 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(); + glTranslatef( 0.0, 0.0, -10.0 ); + glScalef( scale, scale, scale ); + + glRotatef( xRot, 1.0, 0.0, 0.0 ); + glRotatef( yRot, 0.0, 1.0, 0.0 ); + glRotatef( zRot, 0.0, 0.0, 1.0 ); + + glCallList( object ); +} + + +/*! + Set up the OpenGL rendering state, and define display list +*/ + +void GLBox::initializeGL() +{ + qglClearColor(Qt::black); // Let OpenGL clear to black + 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.0, 1.0, -1.0, 1.0, 5.0, 15.0 ); + 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 ); + + qglColor(Qt::white); // Shorthand for glColor3f or glIndex + + glLineWidth( 2.0 ); + + glBegin( GL_LINE_LOOP ); + glVertex3f( 1.0, 0.5, -0.4 ); + glVertex3f( 1.0, -0.5, -0.4 ); + glVertex3f( -1.0, -0.5, -0.4 ); + glVertex3f( -1.0, 0.5, -0.4 ); + glEnd(); + + glBegin( GL_LINE_LOOP ); + glVertex3f( 1.0, 0.5, 0.4 ); + glVertex3f( 1.0, -0.5, 0.4 ); + glVertex3f( -1.0, -0.5, 0.4 ); + glVertex3f( -1.0, 0.5, 0.4 ); + glEnd(); + + glBegin( GL_LINES ); + glVertex3f( 1.0, 0.5, -0.4 ); glVertex3f( 1.0, 0.5, 0.4 ); + glVertex3f( 1.0, -0.5, -0.4 ); glVertex3f( 1.0, -0.5, 0.4 ); + glVertex3f( -1.0, -0.5, -0.4 ); glVertex3f( -1.0, -0.5, 0.4 ); + glVertex3f( -1.0, 0.5, -0.4 ); glVertex3f( -1.0, 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 ) +{ + xRot = (GLfloat)(degrees % 360); + updateGL(); +} + + +/*! + Set the rotation angle of the object to \e degrees around the Y axis. +*/ + +void GLBox::setYRotation( int degrees ) +{ + yRot = (GLfloat)(degrees % 360); + updateGL(); +} + + +/*! + Set the rotation angle of the object to \e degrees around the Z axis. +*/ + +void GLBox::setZRotation( int degrees ) +{ + zRot = (GLfloat)(degrees % 360); + updateGL(); +} + +//! [1] +class ObjectSafetyImpl : public QAxAggregated, + public IObjectSafety +{ +public: +//! [1] //! [2] + ObjectSafetyImpl() {} + + long queryInterface( const QUuid &iid, void **iface ) + { + *iface = 0; + if ( iid == IID_IObjectSafety ) + *iface = (IObjectSafety*)this; + else + return E_NOINTERFACE; + + AddRef(); + return S_OK; + } + +//! [2] //! [3] + QAXAGG_IUNKNOWN; + +//! [3] //! [4] + HRESULT WINAPI GetInterfaceSafetyOptions( REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions ) + { + *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 ) + { + 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 new file mode 100644 index 0000000..3ebf818 --- /dev/null +++ b/examples/activeqt/opengl/glbox.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/**************************************************************************** +** +** This is a simple QGLWidget displaying an openGL wireframe box +** +****************************************************************************/ + +#ifndef GLBOX_H +#define GLBOX_H + +#include <QtOpenGL> +//! [0] +#include <QAxBindable> + +class GLBox : public QGLWidget, + public QAxBindable +{ + Q_OBJECT +//! [0] //! [1] + +public: + + GLBox( QWidget* parent, const char* name = 0 ); + ~GLBox(); + + QAxAggregated *createAggregate(); + +public slots: + + void setXRotation( int degrees ); +//! [1] + void setYRotation( int degrees ); + void setZRotation( int degrees ); + +protected: + + void initializeGL(); + void paintGL(); + void resizeGL( int w, int h ); + + virtual GLuint makeObject(); + +private: + + GLuint object; + GLfloat xRot, yRot, zRot, scale; + +}; + +#endif // GLBOX_H diff --git a/examples/activeqt/opengl/globjwin.cpp b/examples/activeqt/opengl/globjwin.cpp new file mode 100644 index 0000000..3ac5d78 --- /dev/null +++ b/examples/activeqt/opengl/globjwin.cpp @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#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( "Exit", qApp, SLOT(quit())/*, CTRL+Key_Q*/); + + // Create a menu bar + QMenuBar *m = new QMenuBar( this ); + m->addMenu(file)->setText("&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 ); + QObject::connect( x, SIGNAL(valueChanged(int)),c,SLOT(setXRotation(int)) ); + + QSlider* y = new QSlider(Qt::Vertical, this); + y->setMaximum(360); + y->setPageStep(60); + y->setTickPosition( QSlider::TicksLeft ); + QObject::connect( y, SIGNAL(valueChanged(int)),c,SLOT(setYRotation(int)) ); + + QSlider* z = new QSlider(Qt::Vertical, this); + z->setMaximum(360); + z->setPageStep(60); + z->setTickPosition( QSlider::TicksLeft ); + QObject::connect( z, SIGNAL(valueChanged(int)),c,SLOT(setZRotation(int)) ); + + // 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->setMargin(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 new file mode 100644 index 0000000..d707aa6 --- /dev/null +++ b/examples/activeqt/opengl/globjwin.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/**************************************************************************** +** +** 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: + GLObjectWindow(QWidget *parent = 0); +}; + +#endif diff --git a/examples/activeqt/opengl/main.cpp b/examples/activeqt/opengl/main.cpp new file mode 100644 index 0000000..469bdfb --- /dev/null +++ b/examples/activeqt/opengl/main.cpp @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ +// +// 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> +#include <QtOpenGL> +//! [0] +#include <QAxFactory> + +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}" + ) + +//! [0] //! [1] +/* + The main program is here. +*/ + +int main( int argc, char **argv ) +{ + QApplication::setColorSpec( QApplication::CustomColor ); + QApplication a(argc,argv); + + if ( !QGLFormat::hasOpenGL() ) { + qWarning( "This system has no OpenGL support. 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.inf b/examples/activeqt/opengl/opengl.inf new file mode 100644 index 0000000..4a79e67 --- /dev/null +++ b/examples/activeqt/opengl/opengl.inf @@ -0,0 +1,9 @@ +[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 new file mode 100644 index 0000000..8eb81be --- /dev/null +++ b/examples/activeqt/opengl/opengl.pro @@ -0,0 +1,19 @@ +TEMPLATE = app +TARGET = openglax + +CONFIG += qt warn_off qaxserver + +QT += opengl + +HEADERS = glbox.h \ + globjwin.h +SOURCES = glbox.cpp \ + globjwin.cpp \ + main.cpp +RC_FILE = $$QT_SOURCE_TREE/src/activeqt/control/qaxserver.rc + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/opengl +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS opengl.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt/opengl +INSTALLS += target sources diff --git a/examples/activeqt/qutlook/addressview.cpp b/examples/activeqt/qutlook/addressview.cpp new file mode 100644 index 0000000..281fe6a --- /dev/null +++ b/examples/activeqt/qutlook/addressview.cpp @@ -0,0 +1,289 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] +#include "addressview.h" +#include "msoutl.h" +#include <QtGui> + +class AddressBookModel : public QAbstractListModel +{ +public: + AddressBookModel(AddressView *parent); + ~AddressBookModel(); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent) const; + QVariant headerData(int section, Qt::Orientation orientation, int role) const; + QVariant data(const QModelIndex &index, int role) const; + + void changeItem(const QModelIndex &index, const QString &firstName, const QString &lastName, const QString &address, const QString &email); + void addItem(const QString &firstName, const QString &lastName, const QString &address, const QString &email); + void update(); + +private: + Outlook::Application outlook; + Outlook::Items * contactItems; + + mutable QHash<QModelIndex, QStringList> cache; +}; +//! [0] //! [1] + +AddressBookModel::AddressBookModel(AddressView *parent) +: QAbstractListModel(parent) +{ + if (!outlook.isNull()) { + Outlook::NameSpace session(outlook.Session()); + session.Logon(); + Outlook::MAPIFolder *folder = session.GetDefaultFolder(Outlook::olFolderContacts); + contactItems = new Outlook::Items(folder->Items()); + connect(contactItems, SIGNAL(ItemAdd(IDispatch*)), parent, SLOT(updateOutlook())); + connect(contactItems, SIGNAL(ItemChange(IDispatch*)), parent, SLOT(updateOutlook())); + connect(contactItems, SIGNAL(ItemRemove()), parent, SLOT(updateOutlook())); + + delete folder; + } +} + +//! [1] //! [2] +AddressBookModel::~AddressBookModel() +{ + delete contactItems; + + if (!outlook.isNull()) + Outlook::NameSpace(outlook.Session()).Logoff(); +} + +//! [2] //! [3] +int AddressBookModel::rowCount(const QModelIndex &) const +{ + return contactItems ? contactItems->Count() : 0; +} + +int AddressBookModel::columnCount(const QModelIndex &parent) const +{ + return 4; +} + +//! [3] //! [4] +QVariant AddressBookModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + if (role != Qt::DisplayRole) + return QVariant(); + + switch (section) { + case 0: + return tr("First Name"); + case 1: + return tr("Last Name"); + case 2: + return tr("Address"); + case 3: + return tr("Email"); + default: + break; + } + + return QVariant(); +} + +//! [4] //! [5] +QVariant AddressBookModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid() || role != Qt::DisplayRole) + return QVariant(); + + QStringList data; + if (cache.contains(index)) { + data = cache.value(index); + } else { + Outlook::ContactItem contact(contactItems->Item(index.row() + 1)); + data << contact.FirstName() << contact.LastName() << contact.HomeAddress() << contact.Email1Address(); + cache.insert(index, data); + } + + if (index.column() < data.count()) + return data.at(index.column()); + + return QVariant(); +} + +//! [5] //! [6] +void AddressBookModel::changeItem(const QModelIndex &index, const QString &firstName, const QString &lastName, const QString &address, const QString &email) +{ + Outlook::ContactItem item(contactItems->Item(index.row() + 1)); + + item.SetFirstName(firstName); + item.SetLastName(lastName); + item.SetHomeAddress(address); + item.SetEmail1Address(email); + + item.Save(); + + cache.take(index); +} + +//! [6] //! [7] +void AddressBookModel::addItem(const QString &firstName, const QString &lastName, const QString &address, const QString &email) +{ + Outlook::ContactItem item(outlook.CreateItem(Outlook::olContactItem)); + if (!item.isNull()) { + item.SetFirstName(firstName); + item.SetLastName(lastName); + item.SetHomeAddress(address); + item.SetEmail1Address(email); + + item.Save(); + } +} + +//! [7] //! [8] +void AddressBookModel::update() +{ + cache.clear(); + + emit reset(); +} + + +//! [8] //! [9] +AddressView::AddressView(QWidget *parent) +: QWidget(parent) +{ + QGridLayout *mainGrid = new QGridLayout(this); + + QLabel *liFirstName = new QLabel("First &Name", this); + liFirstName->resize(liFirstName->sizeHint()); + mainGrid->addWidget(liFirstName, 0, 0); + + QLabel *liLastName = new QLabel("&Last Name", this); + liLastName->resize(liLastName->sizeHint()); + mainGrid->addWidget(liLastName, 0, 1); + + QLabel *liAddress = new QLabel("Add&ress", this); + liAddress->resize(liAddress->sizeHint()); + mainGrid->addWidget(liAddress, 0, 2); + + QLabel *liEMail = new QLabel("&E-Mail", this); + liEMail->resize(liEMail->sizeHint()); + mainGrid->addWidget(liEMail, 0, 3); + + add = new QPushButton("A&dd", this); + add->resize(add->sizeHint()); + mainGrid->addWidget(add, 0, 4); + connect(add, SIGNAL(clicked()), this, SLOT(addEntry())); + + iFirstName = new QLineEdit(this); + iFirstName->resize(iFirstName->sizeHint()); + mainGrid->addWidget(iFirstName, 1, 0); + liFirstName->setBuddy(iFirstName); + + iLastName = new QLineEdit(this); + iLastName->resize(iLastName->sizeHint()); + mainGrid->addWidget(iLastName, 1, 1); + liLastName->setBuddy(iLastName); + + iAddress = new QLineEdit(this); + iAddress->resize(iAddress->sizeHint()); + mainGrid->addWidget(iAddress, 1, 2); + liAddress->setBuddy(iAddress); + + iEMail = new QLineEdit(this); + iEMail->resize(iEMail->sizeHint()); + mainGrid->addWidget(iEMail, 1, 3); + liEMail->setBuddy(iEMail); + + change = new QPushButton("&Change", this); + change->resize(change->sizeHint()); + mainGrid->addWidget(change, 1, 4); + connect(change, SIGNAL(clicked()), this, SLOT(changeEntry())); + + treeView = new QTreeView(this); + treeView->setSelectionMode(QTreeView::SingleSelection); + treeView->setRootIsDecorated(false); + + model = new AddressBookModel(this); + treeView->setModel(model); + + connect(treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(itemSelected(QModelIndex))); + + mainGrid->addWidget(treeView, 2, 0, 1, 5); +} + +void AddressView::updateOutlook() +{ + model->update(); +} + +void AddressView::addEntry() +{ + if (!iFirstName->text().isEmpty() || !iLastName->text().isEmpty() || + !iAddress->text().isEmpty() || !iEMail->text().isEmpty()) { + model->addItem(iFirstName->text(), iFirstName->text(), iAddress->text(), iEMail->text()); + } + + iFirstName->setText(""); + iLastName->setText(""); + iAddress->setText(""); + iEMail->setText(""); +} + +void AddressView::changeEntry() +{ + QModelIndex current = treeView->currentIndex(); + + if (current.isValid()) + model->changeItem(current, iFirstName->text(), iLastName->text(), iAddress->text(), iEMail->text()); +} + +//! [9] //! [10] +void AddressView::itemSelected(const QModelIndex &index) +{ + if (!index.isValid()) + return; + + QAbstractItemModel *model = treeView->model(); + iFirstName->setText(model->data(model->index(index.row(), 0)).toString()); + iLastName->setText(model->data(model->index(index.row(), 1)).toString()); + iAddress->setText(model->data(model->index(index.row(), 2)).toString()); + iEMail->setText(model->data(model->index(index.row(), 3)).toString()); +} +//! [10] diff --git a/examples/activeqt/qutlook/addressview.h b/examples/activeqt/qutlook/addressview.h new file mode 100644 index 0000000..5363cc1 --- /dev/null +++ b/examples/activeqt/qutlook/addressview.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ADDRESSVIEW_H +#define ADDRESSVIEW_H + +#include <QWidget> + +class AddressBookModel; +QT_BEGIN_NAMESPACE +class QLineEdit; +class QModelIndex; +class QPushButton; +class QTreeView; +QT_END_NAMESPACE + +//! [0] +class AddressView : public QWidget +{ + Q_OBJECT + +public: + AddressView(QWidget *parent = 0); + +protected slots: + void addEntry(); + void changeEntry(); + void itemSelected(const QModelIndex &index); + + void updateOutlook(); + +protected: + AddressBookModel *model; + + QTreeView *treeView; + QPushButton *add, *change; + QLineEdit *iFirstName, *iLastName, *iAddress, *iEMail; +}; +//! [0] + +#endif // ADDRESSVIEW_H diff --git a/examples/activeqt/qutlook/fileopen.xpm b/examples/activeqt/qutlook/fileopen.xpm new file mode 100644 index 0000000..880417e --- /dev/null +++ b/examples/activeqt/qutlook/fileopen.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static const char *fileopen[] = { +" 16 13 5 1", +". c #040404", +"# c #808304", +"a c None", +"b c #f3f704", +"c c #f3f7f3", +"aaaaaaaaa...aaaa", +"aaaaaaaa.aaa.a.a", +"aaaaaaaaaaaaa..a", +"a...aaaaaaaa...a", +".bcb.......aaaaa", +".cbcbcbcbc.aaaaa", +".bcbcbcbcb.aaaaa", +".cbcb...........", +".bcb.#########.a", +".cb.#########.aa", +".b.#########.aaa", +"..#########.aaaa", +"...........aaaaa" +}; diff --git a/examples/activeqt/qutlook/fileprint.xpm b/examples/activeqt/qutlook/fileprint.xpm new file mode 100644 index 0000000..6ada912 --- /dev/null +++ b/examples/activeqt/qutlook/fileprint.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static const char *fileprint[] = { +" 16 14 6 1", +". c #000000", +"# c #848284", +"a c #c6c3c6", +"b c #ffff00", +"c c #ffffff", +"d c None", +"ddddd.........dd", +"dddd.cccccccc.dd", +"dddd.c.....c.ddd", +"ddd.cccccccc.ddd", +"ddd.c.....c....d", +"dd.cccccccc.a.a.", +"d..........a.a..", +".aaaaaaaaaa.a.a.", +".............aa.", +".aaaaaa###aa.a.d", +".aaaaaabbbaa...d", +".............a.d", +"d.aaaaaaaaa.a.dd", +"dd...........ddd" +}; diff --git a/examples/activeqt/qutlook/filesave.xpm b/examples/activeqt/qutlook/filesave.xpm new file mode 100644 index 0000000..bd6870f --- /dev/null +++ b/examples/activeqt/qutlook/filesave.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static const char *filesave[] = { +" 14 14 4 1", +". c #040404", +"# c #808304", +"a c #bfc2bf", +"b c None", +"..............", +".#.aaaaaaaa.a.", +".#.aaaaaaaa...", +".#.aaaaaaaa.#.", +".#.aaaaaaaa.#.", +".#.aaaaaaaa.#.", +".#.aaaaaaaa.#.", +".##........##.", +".############.", +".##.........#.", +".##......aa.#.", +".##......aa.#.", +".##......aa.#.", +"b............." +}; diff --git a/examples/activeqt/qutlook/main.cpp b/examples/activeqt/qutlook/main.cpp new file mode 100644 index 0000000..b015d8a --- /dev/null +++ b/examples/activeqt/qutlook/main.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] +#include "addressview.h" +#include <QApplication> + +int main(int argc, char ** argv) +{ + QApplication a(argc, argv); + + AddressView view; + view.setWindowTitle("Qt Example - Looking at Outlook"); + view.show(); + + return a.exec(); +} +//! [0] diff --git a/examples/activeqt/qutlook/qutlook.pro b/examples/activeqt/qutlook/qutlook.pro new file mode 100644 index 0000000..c1154e0 --- /dev/null +++ b/examples/activeqt/qutlook/qutlook.pro @@ -0,0 +1,23 @@ +#! [0] #! [1] +TEMPLATE = app +TARGET = qutlook +CONFIG += qaxcontainer + +TYPELIBS = $$system(dumpcpp -getfile {00062FFF-0000-0000-C000-000000000046}) +#! [0] + +isEmpty(TYPELIBS) { + message("Microsoft Outlook type library not found!") + REQUIRES += Outlook +} else { +#! [1] #! [2] + HEADERS = addressview.h + SOURCES = addressview.cpp main.cpp +} +#! [2] + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/qutlook +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS qutlook.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt/qutlook +INSTALLS += target sources diff --git a/examples/activeqt/simple/main.cpp b/examples/activeqt/simple/main.cpp new file mode 100644 index 0000000..7f939e4 --- /dev/null +++ b/examples/activeqt/simple/main.cpp @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QAxBindable> +#include <QAxFactory> +#include <QApplication> +#include <QLayout> +#include <QSlider> +#include <QLCDNumber> +#include <QLineEdit> +#include <QMessageBox> + +//! [0] +class QSimpleAX : public QWidget, public QAxBindable +{ + Q_OBJECT + Q_PROPERTY( QString text READ text WRITE setText ) + Q_PROPERTY( int value READ value WRITE setValue ) +public: + QSimpleAX(QWidget *parent = 0) + : QWidget(parent) + { + QVBoxLayout *vbox = new QVBoxLayout( this ); + + slider = new QSlider( Qt::Horizontal, this ); + LCD = new QLCDNumber( 3, this ); + edit = new QLineEdit( this ); + + connect( slider, SIGNAL( valueChanged( int ) ), this, SLOT( setValue(int) ) ); + connect( edit, SIGNAL(textChanged(const QString&)), this, SLOT(setText(const QString&)) ); + + vbox->addWidget( slider ); + vbox->addWidget( LCD ); + vbox->addWidget( edit ); + } + + QString text() const + { + return edit->text(); + } + int value() const + { + return slider->value(); + } + +signals: + void someSignal(); + void valueChanged(int); + void textChanged(const QString&); + +public slots: + void setText( const QString &string ) + { + if ( !requestPropertyChange( "text" ) ) + return; + + edit->blockSignals( true ); + edit->setText( string ); + edit->blockSignals( false ); + emit someSignal(); + emit textChanged( string ); + + propertyChanged( "text" ); + } + void about() + { + QMessageBox::information( this, "About QSimpleAX", "This is a Qt widget, and this slot has been\n" + "called through ActiveX/OLE automation!" ); + } + void setValue( int i ) + { + if ( !requestPropertyChange( "value" ) ) + return; + slider->blockSignals( true ); + slider->setValue( i ); + slider->blockSignals( false ); + LCD->display( i ); + emit valueChanged( i ); + + propertyChanged( "value" ); + } + +private: + QSlider *slider; + QLCDNumber *LCD; + QLineEdit *edit; +}; + +//! [0] +#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}") +//! [1] diff --git a/examples/activeqt/simple/simple.inf b/examples/activeqt/simple/simple.inf new file mode 100644 index 0000000..3657e9f --- /dev/null +++ b/examples/activeqt/simple/simple.inf @@ -0,0 +1,11 @@ +//! [0] +[version] + signature="$CHICAGO$" + AdvancedINF=2.0 + [Add.Code] + simpleax.exe=simpleax.exe + [simpleax.exe] + file-win32-x86=thiscab + clsid={DF16845C-92CD-4AAB-A982-EB9840E74669} + RegisterServer=yes +//! [0] diff --git a/examples/activeqt/simple/simple.pro b/examples/activeqt/simple/simple.pro new file mode 100644 index 0000000..d0f2019 --- /dev/null +++ b/examples/activeqt/simple/simple.pro @@ -0,0 +1,13 @@ +TEMPLATE = app +TARGET = simpleax + +CONFIG += qt warn_off qaxserver + +SOURCES = main.cpp +RC_FILE = $$QT_SOURCE_TREE/src/activeqt/control/qaxserver.rc + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/simple +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS simple.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt/simple +INSTALLS += target sources diff --git a/examples/activeqt/webbrowser/main.cpp b/examples/activeqt/webbrowser/main.cpp new file mode 100644 index 0000000..fe93eab --- /dev/null +++ b/examples/activeqt/webbrowser/main.cpp @@ -0,0 +1,189 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include <QMessageBox> +#include <QProgressBar> +#include <QStatusBar> +#include <QMainWindow> +#include <QAbstractEventDispatcher> + +#if defined(Q_OS_WINCE) +#include "ui_wincemainwindow.h" +#include <windows.h> +#else +#include "ui_mainwindow.h" +#endif + +//! [0] +class MainWindow : public QMainWindow, public Ui::MainWindow +{ + Q_OBJECT +public: + MainWindow(); + +public slots: + void on_WebBrowser_TitleChange(const QString &title); + void on_WebBrowser_ProgressChange(int a, int b); + void on_WebBrowser_CommandStateChange(int cmd, bool on); + void on_WebBrowser_BeforeNavigate(); + void on_WebBrowser_NavigateComplete(QString); + + void on_actionGo_triggered(); + void on_actionNewWindow_triggered(); + void on_actionAbout_triggered(); + void on_actionAboutQt_triggered(); + void on_actionFileClose_triggered(); + +private: + QProgressBar *pb; +}; +//! [0] //! [1] + +MainWindow::MainWindow() +{ + setupUi(this); + + connect(addressEdit, SIGNAL(returnPressed()), actionGo, SLOT(trigger())); + connect(actionBack, SIGNAL(triggered()), WebBrowser, SLOT(GoBack())); + connect(actionForward, SIGNAL(triggered()), WebBrowser, SLOT(GoForward())); + connect(actionStop, SIGNAL(triggered()), WebBrowser, SLOT(Stop())); + connect(actionRefresh, SIGNAL(triggered()), WebBrowser, SLOT(Refresh())); + connect(actionHome, SIGNAL(triggered()), WebBrowser, SLOT(GoHome())); + connect(actionSearch, SIGNAL(triggered()), WebBrowser, SLOT(GoSearch())); + + pb = new QProgressBar(statusBar()); + pb->setTextVisible(false); + pb->hide(); + statusBar()->addPermanentWidget(pb); + + WebBrowser->dynamicCall("GoHome()"); +} + +//! [1] //! [2] +void MainWindow::on_WebBrowser_TitleChange(const QString &title) +{ + setWindowTitle("Qt WebBrowser - " + title); +} + +void MainWindow::on_WebBrowser_ProgressChange(int a, int b) +{ + if (a <= 0 || b <= 0) { + pb->hide(); + return; + } + pb->show(); + pb->setRange(0, b); + pb->setValue(a); +} + +void MainWindow::on_WebBrowser_CommandStateChange(int cmd, bool on) +{ + switch (cmd) { + case 1: + actionForward->setEnabled(on); + break; + case 2: + actionBack->setEnabled(on); + break; + } +} + +void MainWindow::on_WebBrowser_BeforeNavigate() +{ + actionStop->setEnabled(true); +} + +void MainWindow::on_WebBrowser_NavigateComplete(QString) +{ + actionStop->setEnabled(false); +} + +//! [2] //! [3] +void MainWindow::on_actionGo_triggered() +{ + WebBrowser->dynamicCall("Navigate(const QString&)", addressEdit->text()); +} + +void MainWindow::on_actionNewWindow_triggered() +{ + MainWindow *window = new MainWindow; + window->show(); + if (addressEdit->text().isEmpty()) + return; + window->addressEdit->setText(addressEdit->text()); + window->actionStop->setEnabled(true); + window->on_actionGo_triggered(); +} + +void MainWindow::on_actionAbout_triggered() +{ + QMessageBox::about(this, tr("About WebBrowser"), + tr("This Example has been created using the ActiveQt integration into Qt Designer.\n" + "It demonstrates the use of QAxWidget to embed the Internet Explorer ActiveX\n" + "control into a Qt application.")); +} + +void MainWindow::on_actionAboutQt_triggered() +{ + QMessageBox::aboutQt(this, tr("About Qt")); +} + +void MainWindow::on_actionFileClose_triggered() +{ + close(); +} + +#include "main.moc" + +//! [3] //! [4] +int main(int argc, char ** argv) +{ + QApplication a(argc, argv); + MainWindow w; +#if defined(Q_OS_WINCE) + w.showMaximized(); +#else + w.show(); +#endif + return a.exec(); +} +//! [4] diff --git a/examples/activeqt/webbrowser/mainwindow.ui b/examples/activeqt/webbrowser/mainwindow.ui new file mode 100644 index 0000000..12a0a32 --- /dev/null +++ b/examples/activeqt/webbrowser/mainwindow.ui @@ -0,0 +1,306 @@ +<ui version="4.0" stdsetdef="1" > + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow" > + <property name="objectName" > + <string notr="true" >MainWindow</string> + </property> + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>812</width> + <height>605</height> + </rect> + </property> + <property name="windowTitle" > + <string>Qt WebBrowser</string> + </property> + <widget class="QWidget" name="centralWidget"> + <layout class="QHBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QFrame" name="Frame3" > + <property name="objectName" > + <string notr="true" >Frame3</string> + </property> + <property name="frameShape" > + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Sunken</enum> + </property> + <layout class="QVBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>1</number> + </property> + <property name="spacing" > + <number>0</number> + </property> + <item> + <widget class="WebAxWidget" name="WebBrowser" > + <property name="objectName" > + <string notr="true" >WebBrowser</string> + </property> + <property name="focusPolicy" > + <enum>Qt::StrongFocus</enum> + </property> + <property name="control" > + <string>{8856F961-340A-11D0-A96B-00C04FD705A2}</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QToolBar" name="tbNavigate" > + <property name="objectName" > + <string notr="true" >tbNavigate</string> + </property> + <property name="windowTitle" > + <string>Navigation</string> + </property> + <addaction name="actionBack" /> + <addaction name="actionForward" /> + <addaction name="actionStop" /> + <addaction name="actionRefresh" /> + <addaction name="actionHome" /> + <addaction name="separator" /> + <addaction name="actionSearch" /> + </widget> + <widget class="QToolBar" name="tbAddress" > + <property name="objectName" > + <string notr="true" >tbAddress</string> + </property> + <property name="windowTitle" > + <string>Address</string> + </property> + <widget class="QLabel" name="lblAddress" > + <property name="objectName" > + <string notr="true" >lblAddress</string> + </property> + <property name="text" > + <string>Address</string> + </property> + </widget> + <widget class="QLineEdit" name="addressEdit" > + <property name="objectName" > + <string notr="true" >addressEdit</string> + </property> + </widget> + <addaction name="actionGo" /> + </widget> + <widget class="QMenuBar" name="menubar" > + <property name="objectName" > + <string notr="true" >menubar</string> + </property> + <widget class="QMenu" name="PopupMenu" > + <property name="objectName" > + <string notr="true" >PopupMenu</string> + </property> + <property name="title" > + <string>&File</string> + </property> + <widget class="QMenu" name="FileNewGroup_2" > + <property name="objectName" > + <string notr="true" >FileNewGroup_2</string> + </property> + <property name="title" > + <string>New</string> + </property> + <addaction name="actionNewWindow" /> + </widget> + <addaction name="FileNewGroup" /> + <addaction name="FileNewGroup_2" /> + <addaction name="separator" /> + <addaction name="actionFileClose" /> + </widget> + <widget class="QMenu" name="unnamed" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="title" > + <string>&Help</string> + </property> + <addaction name="actionAbout" /> + <addaction name="actionAboutQt" /> + </widget> + <addaction name="PopupMenu" /> + <addaction name="unnamed" /> + </widget> + <action name="actionGo" > + <property name="objectName" > + <string>actionGo</string> + </property> + <property name="icon" > + <iconset>image0</iconset> + </property> + <property name="iconText" > + <string>Go</string> + </property> + </action> + <action name="actionBack" > + <property name="objectName" > + <string>actionBack</string> + </property> + <property name="icon" > + <iconset>image1</iconset> + </property> + <property name="iconText" > + <string>Back</string> + </property> + <property name="shortcut" > + <string>Backspace</string> + </property> + </action> + <action name="actionForward" > + <property name="objectName" > + <string>actionForward</string> + </property> + <property name="icon" > + <iconset>image2</iconset> + </property> + <property name="iconText" > + <string>Forward</string> + </property> + </action> + <action name="actionStop" > + <property name="objectName" > + <string>actionStop</string> + </property> + <property name="icon" > + <iconset>image3</iconset> + </property> + <property name="iconText" > + <string>Stop</string> + </property> + </action> + <action name="actionRefresh" > + <property name="objectName" > + <string>actionRefresh</string> + </property> + <property name="icon" > + <iconset>image4</iconset> + </property> + <property name="iconText" > + <string>Refresh</string> + </property> + </action> + <action name="actionHome" > + <property name="objectName" > + <string>actionHome</string> + </property> + <property name="icon" > + <iconset>image5</iconset> + </property> + <property name="iconText" > + <string>Home</string> + </property> + </action> + <action name="actionFileClose" > + <property name="objectName" > + <string>actionFileClose</string> + </property> + <property name="iconText" > + <string>Close</string> + </property> + <property name="text" > + <string>C&lose</string> + </property> + </action> + <action name="actionSearch" > + <property name="objectName" > + <string>actionSearch</string> + </property> + <property name="icon" > + <iconset>image6</iconset> + </property> + <property name="iconText" > + <string>Search</string> + </property> + </action> + <action name="actionAbout" > + <property name="objectName" > + <string>actionAbout</string> + </property> + <property name="iconText" > + <string>About</string> + </property> + </action> + <action name="actionAboutQt" > + <property name="objectName" > + <string>actionAboutQt</string> + </property> + <property name="iconText" > + <string>About Qt</string> + </property> + </action> + <actiongroup name="FileNewGroup" > + <action name="actionNewWindow" > + <property name="objectName" > + <string>actionNewWindow</string> + </property> + <property name="iconText" > + <string>Window</string> + </property> + <property name="shortcut" > + <string>Ctrl+N</string> + </property> + </action> + <property name="objectName" > + <string>FileNewGroup</string> + </property> + </actiongroup> + </widget> + <customwidgets> + <customwidget> + <class>WebAxWidget</class> + <extends>QAxWidget</extends> + <header>webaxwidget.h</header> + </customwidget> + </customwidgets> + <connections> + <connection> + <sender>addressEdit</sender> + <signal>returnPressed()</signal> + <receiver>actionGo</receiver> + <slot>trigger()</slot> + </connection> + </connections> + <layoutdefault spacing="6" margin="11" /> + <images> + <image name="image0" > + <data format="XPM.GZ" length="1241" >789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54103b11c8563600020b03105719c4b530b08072f50880513560a09c080338d5209420294a4451a38c90426621ab5146d10de524a2aa417505445122861a547722bb0c971a3d2aa921c2ae446c6a9431fc85a9064551220e354009653dec00294e712a1ac4e97078a9a9b5e6020013b3f563</data> + </image> + <image name="image1" > + <data format="XPM.GZ" length="4494" >789ce596497332470c86effe15947573a5f4c1cc30cc542a07ef60bc808dd7540e3d9b6df006186c93ca7f8fba2535ce57be98dc9292313c487a2575f7ccf063a376d53baa6dfc589bbe9ad7fbbc96df99496da3983d3e7efcfec76f7faead87418dfe1a51500bd67f595befbfd6f2daf1f35369014e08a05e6fd4ab96e31e73d0282bc7a7cae23ff3ccfe8170ca6cee9843f51f3b4ec8cff9efccdebf2d2cf9b06bb9417a25c74f98bdff99390a84fb8e49af70f39891b2e40bfbf8b6b0917e87968346a8f5a6cc51c07ab02f2cf1983237552f709c86691e3bbd5be5821998a32067bd1765d13f67563d530a4b3df8b01c523d8ec74059faed086bfc82390e851b8ed3c86485e34365a9bfc5ece3df8433e10bcb5140f5dd3cf0e099f32f99e350cecb5858f2b1c1dc52fda663d334a277c0ecfd5d61c9373973120967969b548fd71b079e797d8e985b21eb63aecceb85e7c299f4ffaa2ce7739359ebc195631387c6ad1f5e302791ccbba72cf173e15cfa2d2cc7619cf1fa63c9dccaa4ff4bcfdc7fa82cfdf7999348f6bf299c4bfd4c59ea0f99535dafca71d60a65ffebca52ff8c3989e47cce98351fb785759e7bcbad65bf0be624ca9a8e87caac0fb1702ef191b2cc9731a7b9ec4f87d934659e27e142f8c671e6eb9d0ae7b2be07cc6924ccf999698a7e4f58f572e64cebb9f393444994e68e4365d9ff7be15caef70766ad678cb0f8f18359ebe109b3af27f199fadd794cf254eb196599774758e77d5496f5dd64a67959af122ef87c639b59eb81d34ba97fe3f4215196f3922acbbc28acf527cc792c7a857029ecf63bcded05efb8a52cf3cc9833ed2f66563dac0b8b1ebe3317ea77f73352173db8f6ccf54a66df0f30fb7c777d9bc214d2cf88d9cf73cfece3ddf3296b66da7fe199d7a32b5cc8feef31fbfe8f99bdde96b0faddf3272bac390665b99e90d9e7ef33972de9d73d7ff3d873255c49fc1b73257ee4f8d2eb5d336b3e8e8535ff86d9e7bbf35f2cf51366ef77cfeb6299df62563f3c0a8b1fdcf3d3569778773f756e66f7fcac967e175f797ffff5dfd9ff4103010d6698a35955030b2cb1c25bbcc3fbd5344861882352b8c5077c5c45836678c267ca7fc1314ebeaf81537cc599eb608e6ff88e1f2b682c705314b6486182dbb8f31d0ddca529f644619ff2db641d3cf82a8bfa9d62d7da670d3cc4233c760a63eaa08d2734478fac8f87ffc833788a6738c073bc20ebe3255eb1069d863e5e3b851bacfb7c6b0d0c30c488f24a3a2d4ddaf1986a3d600b13179be280ef597809e876e206000c69d8ec0e590f32c8a18012b7a0825b9799e018eee0de4e0b4318c103ff2ea2985b78c47d28a487ce276b634cca40356d1655801c3bf044af2136e0195ef8b711be4045ab50ff42e16bdbb6463d8e610253fe3d4855ec3ed80abd9f62397ef9c9e6cee835249bc31bbc731ff0010beacbcdbfaca29f2836a3e839fd1f3acb5cb6fd6e13b6605b34766097d6664cdf0d7faad9813dd827df08daf4de812ddaa7061c4017baf43ea6daef70c8fb0247704c932dc897b94e67da09553a811ef4a94a0f4ee10c069435216b630ae7a43b800b7fc6164ea543ea73ea75663b22a50e5cc215ec50956beaf606ead08080147b64c76403d20ebdc6142268528d3655ee3a1db6f88b535ee015b42081d4205ee1f4f335878501ea7644331dc81acecdb7ef63b86b32eae59956cff63237f92af7319c9a82669c989256bd0b6fa6fabe86bbfe0ecdadb9a399ce61b49a86355adfbedd45736756bc27b30afd161a9a9179585de33bf69fd2f8ebd7b5bf014644b906</data> + </image> + <image name="image2" > + <data format="XPM.GZ" length="4494" >789ce5965b4f23471085dff915d6d6db2aaac5e3b92aca037703cbc55c8c21ca43cf8c8d0dd85c6c307694ff9eeaaed3bd68771f968d14298a0a109fabebd4e99a9ef17cfad8e81d1f343e7e5a99cecc6c5435aaa1796a7cac9fc7e3c5ef7ffcf6e7ca8756d4909f661c35a20fbfac7ce8cc1a55e3f07ed2b7409702b4badaccfb996563020f5c7ecbf340b9a31c3591dff7ac7943e002cc8e73cf74acdcc27a8a2d37a5be4e1d9f04567f9fc105f25dcfea9726caad62a07c1158f58f94e3087e868ea57fa5fa0be590bfb11c3525affd4e03ebfa25b8507fbcaa1c47ca66e459fdf10c6c30af4dcfda8f5f9513dfffce71e1f5a956967adddfaeb25f4f7b60e8d199e596f42f6bc787ca213f554e5be06dc7a28ffdee282791cedb5c83d19fd795a55ecf4b3fb0ee07ebd312fae796e3283665e238524e2265de031bcc774d396d61be25b8c4fe1f02abfeab67f49f2867decfbd6393b6a03f03438f3bca19fa51cb33fc6f80fd7eae2c27e257e7cb4de5b4045f78d679f24960ddcfb172e6f73357ce63e88fc115ce43e558fcabbeb905fb7e47cae24ff5daca41af007bbd81e5b425f53aff6160d52f95f318f37d01a39ee7ca05f4790a469e0e1c97590bfa1b81f53c3e2bfbf5ecf697b532efe754398f31af437085eb65948b18e723f70cbf9e2bcc633db0f65b533609fcbafb372bf318fdcfc015e65b281731ee0ff6acf70767ca5e8f7be01abcab5cfa7e89e53cce2ba3fd1681b5df8172013f44e00acfbf4a39e8ef287b7dbe02234feefce795d727a36c12ccf75239d4b7c1bede9def42fcc0ef7960d5cbc05ebf543635aed752b94aa1ff02ee83ddf3b6a87c3d3f2b9b047a4fcaa17e0cf6f5eef928ab13f5476960d5eb7ac6f5dd07d7e04839e83d29d7be9ffbfe31b50dc723cfa87f08acf947e51a7ad457ee6760773ecaa4f47e36036bfd96673c3fb6c13578a01cf41f9505d5af3b2f655dc28fa93da33e550ef523e5e06f08861eb9e7b94cdfe7ddf753d50feb6f94437e00f67edcf3aa4e831ed8afe73bb05fefe655f7c37edcfd62bb81ddfb82935776cfeb41c87766ff2cfe7f1a4c6cb8e48ae91f68d4dce7015ff390473fad71c3b77cc7639ef03d3ffcb48f013ff293a84c79c6d54f693c8bc28b28589539bff2e2ed647e586389184bacf13a6ff0e6d71a32f92dde96bfdf9dbccc6387dba2d086caae4c668ff7bf68f0673ee0433ee263eef0099ff2199f8b62d0e32e5f704fea2fe5b70d3f57729556b91b349a1c718b634e64faa9fc7fc919e772220a91213254ca273b884bf72b4a54f1846ad925e93b1af56940d734a4110fe4efb5c40dddda907311734c7752d10b3a1ae289c634a17b7dafe331e995b3b124fbdfd25d85471763596fab7aa2a4f53d444653ded3773bb96e8faeae1de2ea8dff9da0b0ebfcd858e3357aa667bb1f68b4a5e7d256853559e8f56d64aefe85e6f44a0b5aea3bac5c2bebf74b8775fb6bfbb858771e7a6f1df09c36f89a36698bb6f53d5c4ef08ee4e6a2dd269b9d488729ed4a171b7bd40ece3228cce5d305edd3673ed7773139bd133a14d5233a96cff7a9237142a77446e7125dba900e70681564f5a6acdc1285ae9e0feaf150d675e8d2d59dd315ad52931fec2973d1a5489c6698e29c5a508829797bd629a52665bcf9fdd32ed95c1d50217b5c18b67390f34befb8e78873a9b6b39ad285216328a2de3bef5b32a59db5ccec42a6b565aaf7dffba6e663d3972b211ea86b065f3cbccbc7b53890399a21a55f677f5863e4f670c337df667f58e3d6dc99dbef3dd5ff6bdf73ff82c65fbfaefc0d4fb5b868</data> + </image> + <image name="image3" > + <data format="XPM.GZ" length="802" >789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232325500210543251d2e25658564056503300071f540dc3430007371012a492a830156496538c094848922c9c2259134c099304914e3604c8424aa5e6449b0044216ca824ba2da8b4512218b4d122e8b55520fee5974072164511da487ea490c7f22cba249e20d3efc018f3fcae0d2702eb5d2106992b5d65c00b9a48974</data> + </image> + <image name="image4" > + <data format="XPM.GZ" length="1241" >789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54105b19c8563600020b03103711c4b530b08072f50880513524ab518681443435ca984ae08ae06a94114a10ac443435ca3043904d4c4453a38ca604ae11590d9a0ab80bd0d46078914c35c4d885a608871a547f61f81d5d117a1862018930e5b8d5c0950c741a1b1e6a6aadb90086a9d853</data> + </image> + <image name="image5" > + <data format="XPM.GZ" length="5598" >789ca5985973db480ec7dff3295cc15b6a0b2351a428d6d63ef83e255bbe647b6a1fd02465dd872d9f53f3dd076c005dc926ce6a32eed8553f37fadf7fa0c1a69cdfbe6cdc9cb537befcf6e97145ab61be910fe861e34bf1349dbefdfedffffcf1e97323dae07f51bdbe117dfed7a7cfddd546bed199cfca0ae888016afeab62e8796ef110ee545caf05be16ae5bfc6ee096e7b6e756983f51b6f53b81257ecfb8eee7e9b162f66af1c78125fe48987f23f3fb81657e691cd5bddecc7316d555efd058f7eb2867aa771058f4de8c55cffb6dd4a34cf5b68d357e681c6515634db81a7e3ef59c35cccf5560bf9ef6953389c77660af074f15c751e05c38a6d81f2ef9f3a848f4e9d658f2c36b635dbfa54cc2383556bd33e12492fc70df38f1f3f8ae4cc2745a711285fda7caa4f95e06967a2d8c63f27a8fc2a60fa4acfa980a371b898f0767dc6cf8fdbc9f84c27e4de124d2fabe186b3dee8c75ff1365dbef2db0ccef0987fd2f2a6632fd576552fd2b63d57b08ecd7d39d70b321fd0560acfb6d1a4b7e3050764de7d79f08a70de937ea7b7689e68f4de1e0776e2c7ab8abecb47eb170aa7ee822b0e89f1b4b7fd24dc529abe9794f02cbf99e2b3badc7a5b1ee97089b3e0e8d253f3c364e253e5576120ff7c63a9f7966d2e771d358e75bca4ef3bb0e2cf9758db5fe47c6b21eeb81bd3f07c2ad58ebd130d67e6a194b3cf97e62b2fa24c67a1f5d2aab3f8781a53e17c6eaa7082cfa3de156acf9d5034b7e3563f1eb96c6eaf7c0b815fbf8d2739e3aedefb1b1de9723618b77a49cebf946c6e20f5f8d251e753e8b5bb9e74c980a4afc7a7fbf66b1ed8fb7c67a9ec7c2ad5cfd74038bdfa6b1f6cbd458fd2e84b358efbb0363f5b71358fccd8c33596f9c4bfddcc458fac78d8cf5797b3296f5f82c4c49e6f5c9bf9fb23ce41307967e3935d6f36c0b67b1ce3f188b5f3757367f5363b98fdc38b0cc0f8cf5f90bf3ea97028bfe50981289777d63edcf81b1c4439897f3c52d615738cfe0df371c1deb7db265acf98d8d253f7a50d67a60c758cfcbf4cc7f2fb0f8bf1736bfae30d6f35f1a4b3ce6c6e2df95ca85f6f7dc58f3db0e5c783e14e6ebc533e87e963fbe0873f9fd3cc97c91693fd028b0d4e3c558f3eb0b9b5f972bab3fe78c353f3056bfabc0e2371636bfe4cf9b29d1e76b69acfdb863accfd33cb0dc2fa7c6e2179e03cb79ae940b7dffbf1b6bfd1363f53b12367f581a6b3d1bca56df6e60a9bfc6e765def4ecef6bc7eafaf9e8d558fbb7a15ce87d7263acf7ffbdb1e40f33e1e0cf29ebfea8eb6d7ff29f17f8f4137dfe51d8fa0117ca65ee3fbfe3bd705116b2de9f775e3af50313e1a229f1f0682cf1b052e6e1d9dfbf1cddd4fd2363cdcfef5fb05b7d1f0c944bed4f67ac9f5f27c265bf4c3d9f07eefb787f1f96695eaa1e0a174d7d7f81b1ee4f81a5fe75e552d9bf1fca7e617e9e8d556f33b0c4fbcf5ffdb44c956bc6a2d75dfd6c2020fd3ce2ff69a0c31c0b2cff91461fef71804374bfaa81231ce3044b9ce2ecd734380fc2392e70890ff888bfa6f184cff8c24e5ef10ddf71f3a37c3ed6c015afdec26dfeb983bbb887fb78f0f734380fe031c7437f3247788c27d8fe713e1f6a1076f014cfb08be7ac7481977885d75c951fe4f3630dcea3c3eb7b9cc70d6b9ce12d9fee26de610debeb69b0fb578cb89a0d8c399711e794609373d9c39455f2b53466d8c20c17809c45cc7a3c00f011081cffccff379fef35388f1d0428a0c401f459e58c3d45700f0003cee71d8678fc730d7430e2557d3c8331f7568c37308129cc7006733e9d262c6008cb6ff3f94ea3c72bc678ca3f1fb80a637884154c71c974c55d72c91a4feca4fdf553f8ad46554d8e9ee30a9eb1efab31611f2ff0ca346427bb9c11e114debe7e7ebed328318702e7f0ce9dbee47a1c724655b745b0c94ea6b0c55519f059b98f73d19a6cc30eecc21eecfb7100877004c770026de8e070bdfe805338832e9cc3055cc2955f7b0d3de8f0cfebb5356ee016eea0c6a30e11342086049a907aadcd35355a90111250f5e5288706bfdb4bea572a78b49e06ddd3a0d2807a2502110d6944639ad09466ebf9e8ae684e0bf5b1a4075ab28f11ffa1df678dc7f57cb0c68a9ee899355e7c2ddbf40a31bdb1c63bcdfe86c6803669cb9f4555c76b38a76dcee57d5d1f5c8f1d5af0b9745581bb029a5c8f3eedd21eed73b70ebe56fa91061dd061f05139e9d1116b1cfb9aee55c4fcf6330d5cd289d778a6b65fdd831dea702e256b9cf2b974a84367d4fd580347744e17744957acc13e7cfc095d538f356ed8cd2ddd518dea147da4c1956890ffcf295ed5e4c83b4a59f182b9455935e3b801ab791c7fa4e188d7a4bcbee66353feaef9df8852ca2f3e9ee3ef73840f359cabfec22979f4ddbd1bf018ba118f318f899bf298b9b95bb8e537cffe9ffffef4171c39a0bf</data> + </image> + <image name="image6" > + <data format="XPM.GZ" length="3742" >789c8d96c9521c490c86ef3c458775734cc8ddd5b5c6c41c303b180cc60b66620eaacc2c9aa5599b7562de7da45fc5180c8e98fa39f091522e4a49c9bbb783bdedcdc1db77735733991d864198c8e5e06dbc9e4eeffffceb8fbfe7de64d9407f466531c8defc36f76667360883adb3d364c013051ae2039f8147266359068f4dc6740a2e4db05f05d726f0253898c017c6a3cc04ffafce79aa3af0143c36c17e055caa0aacbf06aeb2203e5f09ae4d185f75ce472de6e7737063c2fcb57356b702fed673e32c473d4bcf3760198f02e69325706b022f3a676df0f567e05035d1ed273dc79883e7c1d1045e70ae2456d84fd9738a589f0b703261bc72ae25e17ee4b0e7d8f3b5733374e603e32c37c11ff36970db12f193f7e07c1c6bec87c6e0c604ff0e1c4db03f36cec7e3a6f4fd2e38e779eee7bd05e7e350fa7e4fc0455ee6b84fb9eab913bfdf1c5ce5758efba54fffb1e75302d726f8af3817a5f8f922584cf06fc0211f951ebfd0b30afe07ce4510dfdf1e38e665e9f9f1e01c32cf1fda06a73c2f7c7eac5f8c8b61eef582f315b909dc82f1c17e07dc1459e5f1c77d953abb787e0ab832611cf957366dd9c707f556762a3fcf8673ddd6d8afdc1957b909fe98af2a65d4c787c08d09e3c8bfaad504f378de83a309e35fc049d9d747bda19c7dbe8f602d88d6fd11af3a33c1ffde398e02ec69178c0b04bb7fa12be03e08e7ab4b895e2f74ec1ca2e73f6d811b2d37df1feaa9969082f71ff4a73a98c01f9cdb3678fde27eea58f7f9cdc8bfba33c11efda2199ac01bcead048fd72678a4e9e3f6a86f6d172acc87fc69f290f9386f3d72f478a1bf348509fea8b7a66c9b80fec1a8b7a66a53f47cc2fe9b5ae77346fe35ad09e761703081d12f9b68c2fc57ce6d0c1e6fe463934ce0efc63234c11ffd5b4a13c66f9cb53d79fded832bcd27f47f5aeb59055e744eb1df3fe2251aeee4e7453f9264c27aa847b44f7f4f909fda3efb7ae30c5c84b65f1fef435b9a608ff7a4ad4c981ffb6b6b13d8fda5edfb37eff4dcb65e2f787f5a7cb0f7fd0413ecf13eb49d09f6783ff07cf97d8ec0a3f8d8df516f483faf07c45b1f27e9f30ff989e9fdbe11ff1034fd3c9eebe068c238fa9f6677f2fb27ac1f475dd3f97da25fc6c204be755673ef3f8db3360c1f1f824b13c651df2877c44fd0df511efe5ea39f44318151cf9a4e2ab0af870d63fee4dc55fdfe109f880ff3fb788a8ff98df733762630fa471aa6febda2839e5b3f0fe1bef4f18bc9fb01fa7dca4ce0bb9e5b671ef69c3cff18f99cc626d853cf551f3fe453ca531bbdde979cbb2c793e207f536102a39fa5ca0446bf4279f97b89feaabb5181511f38bedf2ffa47373461bdcfe0dc8471d46387860fc6fbaad155c11ef7a5d953747ede69cf2a30fe3fd06c5121fe88572726f8a37f68720ffbfdadf7ac02fb7e82098c7e85ebf2fde37dea92098cf7acc367bc33fbff7a6ecfc4c22d078eaac41d1ff0e4d7f66a7df84293e71ecfec858f9ee8d1fef8a9c733fb139ef2299ff1395ff0255fc167c233befee1f1cc3ef10ddff21ddff303cfabe77bd584177891971e3d7ed8db4e7b2df30aaff29a7aac3ff9ebe4a9bdf2067fe04ddee28ffafb36eff027de558fcfbaab2ffc95bf3db5578b3dfecefb3ce411673c56ceb9e0b23f47a5fbac7fb26f889988742f2a129e504b81a246e0c8ec293cb7a7441d0b1dd0840ee9883486744253bea4533a7bd5fe9c2ed4feb29fff4aff32a36b8dd5e92fe6bfa15bddcf1dddd303cd93c6911668aa2b5cbc363f3c16799f9630fbb2d20aadd21aadeb3d547a8617f6f0d8a00fb4495bfadb47daa61dfa84f977e933c597f64f6e6c9fbed057fa467bf49df669c8bb34a2eca53d8d35576ef88e722aa8a48a6a6a448320a20fd36bf3eb7f407c2c89efb5500f6422877224c77222533915e6b397fbd117f54ccee54275295732936bb9915bb9937b797869ff34e7649ecfe4bd2ce81a8bbc2a4bb2fc5a3dfe2c59915559fb75fdfe8f7affe7f7b97f011cdd9635</data> + </image> + </images> +</ui> diff --git a/examples/activeqt/webbrowser/webaxwidget.h b/examples/activeqt/webbrowser/webaxwidget.h new file mode 100644 index 0000000..0e82311 --- /dev/null +++ b/examples/activeqt/webbrowser/webaxwidget.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef WEBAXWIDGET_H +#define WEBAXWIDGET_H + +#include <ActiveQt/QAxWidget> +#include "windows.h" + +class WebAxWidget : public QAxWidget +{ +public: + + WebAxWidget(QWidget* parent = 0, Qt::WindowFlags f = 0) + : QAxWidget(parent, f) + { + } +protected: + virtual bool translateKeyEvent(int message, int keycode) const + { + if (message >= WM_KEYFIRST && message <= WM_KEYLAST) + return true; + else + return QAxWidget::translateKeyEvent(message, keycode); + } + +}; + +#endif // WEBAXWIDGET_H diff --git a/examples/activeqt/webbrowser/webbrowser.pro b/examples/activeqt/webbrowser/webbrowser.pro new file mode 100644 index 0000000..992d871 --- /dev/null +++ b/examples/activeqt/webbrowser/webbrowser.pro @@ -0,0 +1,17 @@ +TEMPLATE = app + +CONFIG += qaxcontainer + +QTDIR_build:REQUIRES = shared + +HEADERS = webaxwidget.h +SOURCES = main.cpp +FORMS = mainwindow.ui +wince*: FORMS = wincemainwindow.ui + + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/webbrowser +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS webbrowser.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt/webbrowser +INSTALLS += target sources diff --git a/examples/activeqt/webbrowser/wincemainwindow.ui b/examples/activeqt/webbrowser/wincemainwindow.ui new file mode 100644 index 0000000..98a9ddb --- /dev/null +++ b/examples/activeqt/webbrowser/wincemainwindow.ui @@ -0,0 +1,299 @@ +<ui version="4.0" stdsetdef="1" > + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow" > + <property name="objectName" > + <string notr="true" >MainWindow</string> + </property> + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>812</width> + <height>605</height> + </rect> + </property> + <property name="windowTitle" > + <string>Qt WebBrowser</string> + </property> + <widget class="QWidget" name="centralWidget"> + <layout class="QHBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QFrame" name="Frame3" > + <property name="objectName" > + <string notr="true" >Frame3</string> + </property> + <property name="frameShape" > + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Sunken</enum> + </property> + <layout class="QVBoxLayout" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="margin" > + <number>1</number> + </property> + <property name="spacing" > + <number>0</number> + </property> + <item> + <widget class="QAxWidget" name="WebBrowser" > + <property name="objectName" > + <string notr="true" >WebBrowser</string> + </property> + <property name="focusPolicy" > + <enum>Qt::StrongFocus</enum> + </property> + <property name="control" > + <string>{F5AFC7EF-1571-48B6-A69C-F1833F4C3A44}</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QToolBar" name="tbNavigate" > + <property name="objectName" > + <string notr="true" >tbNavigate</string> + </property> + <property name="windowTitle" > + <string>Navigation</string> + </property> + <addaction name="actionBack" /> + <addaction name="actionForward" /> + <addaction name="actionStop" /> + <addaction name="actionRefresh" /> + <addaction name="actionHome" /> + <addaction name="separator" /> + <addaction name="actionSearch" /> + </widget> + <widget class="QToolBar" name="tbAddress" > + <property name="objectName" > + <string notr="true" >tbAddress</string> + </property> + <property name="windowTitle" > + <string>Address</string> + </property> + <widget class="QLabel" name="lblAddress" > + <property name="objectName" > + <string notr="true" >lblAddress</string> + </property> + <property name="text" > + <string>Address</string> + </property> + </widget> + <widget class="QLineEdit" name="addressEdit" > + <property name="objectName" > + <string notr="true" >addressEdit</string> + </property> + </widget> + <addaction name="actionGo" /> + </widget> + <widget class="QMenuBar" name="menubar" > + <property name="objectName" > + <string notr="true" >menubar</string> + </property> + <widget class="QMenu" name="PopupMenu" > + <property name="objectName" > + <string notr="true" >PopupMenu</string> + </property> + <property name="title" > + <string>&File</string> + </property> + <widget class="QMenu" name="FileNewGroup_2" > + <property name="objectName" > + <string notr="true" >FileNewGroup_2</string> + </property> + <property name="title" > + <string>New</string> + </property> + <addaction name="actionNewWindow" /> + </widget> + <addaction name="FileNewGroup" /> + <addaction name="FileNewGroup_2" /> + <addaction name="separator" /> + <addaction name="actionFileClose" /> + </widget> + <widget class="QMenu" name="unnamed" > + <property name="objectName" > + <string notr="true" >unnamed</string> + </property> + <property name="title" > + <string>&Help</string> + </property> + <addaction name="actionAbout" /> + <addaction name="actionAboutQt" /> + </widget> + <addaction name="PopupMenu" /> + <addaction name="unnamed" /> + </widget> + <action name="actionGo" > + <property name="objectName" > + <string>actionGo</string> + </property> + <property name="icon" > + <iconset>image0</iconset> + </property> + <property name="iconText" > + <string>Go</string> + </property> + </action> + <action name="actionBack" > + <property name="objectName" > + <string>actionBack</string> + </property> + <property name="icon" > + <iconset>image1</iconset> + </property> + <property name="iconText" > + <string>Back</string> + </property> + <property name="shortcut" > + <string>Backspace</string> + </property> + </action> + <action name="actionForward" > + <property name="objectName" > + <string>actionForward</string> + </property> + <property name="icon" > + <iconset>image2</iconset> + </property> + <property name="iconText" > + <string>Forward</string> + </property> + </action> + <action name="actionStop" > + <property name="objectName" > + <string>actionStop</string> + </property> + <property name="icon" > + <iconset>image3</iconset> + </property> + <property name="iconText" > + <string>Stop</string> + </property> + </action> + <action name="actionRefresh" > + <property name="objectName" > + <string>actionRefresh</string> + </property> + <property name="icon" > + <iconset>image4</iconset> + </property> + <property name="iconText" > + <string>Refresh</string> + </property> + </action> + <action name="actionHome" > + <property name="objectName" > + <string>actionHome</string> + </property> + <property name="icon" > + <iconset>image5</iconset> + </property> + <property name="iconText" > + <string>Home</string> + </property> + </action> + <action name="actionFileClose" > + <property name="objectName" > + <string>actionFileClose</string> + </property> + <property name="iconText" > + <string>Close</string> + </property> + <property name="text" > + <string>C&lose</string> + </property> + </action> + <action name="actionSearch" > + <property name="objectName" > + <string>actionSearch</string> + </property> + <property name="icon" > + <iconset>image6</iconset> + </property> + <property name="iconText" > + <string>Search</string> + </property> + </action> + <action name="actionAbout" > + <property name="objectName" > + <string>actionAbout</string> + </property> + <property name="iconText" > + <string>About</string> + </property> + </action> + <action name="actionAboutQt" > + <property name="objectName" > + <string>actionAboutQt</string> + </property> + <property name="iconText" > + <string>About Qt</string> + </property> + </action> + <actiongroup name="FileNewGroup" > + <action name="actionNewWindow" > + <property name="objectName" > + <string>actionNewWindow</string> + </property> + <property name="iconText" > + <string>Window</string> + </property> + <property name="shortcut" > + <string>Ctrl+N</string> + </property> + </action> + <property name="objectName" > + <string>FileNewGroup</string> + </property> + </actiongroup> + </widget> + <connections> + <connection> + <sender>addressEdit</sender> + <signal>returnPressed()</signal> + <receiver>actionGo</receiver> + <slot>trigger()</slot> + </connection> + </connections> + <layoutdefault spacing="6" margin="11" /> + <images> + <image name="image0" > + <data format="XPM.GZ" length="1241" >789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54103b11c8563600020b03105719c4b530b08072f50880513560a09c080338d5209420294a4451a38c90426621ab5146d10de524a2aa417505445122861a547722bb0c971a3d2aa921c2ae446c6a9431fc85a9064551220e354009653dec00294e712a1ac4e97078a9a9b5e6020013b3f563</data> + </image> + <image name="image1" > + <data format="XPM.GZ" length="4494" >789ce596497332470c86effe15947573a5f4c1cc30cc542a07ef60bc808dd7540e3d9b6df006186c93ca7f8fba2535ce57be98dc9292313c487a2575f7ccf063a376d53baa6dfc589bbe9ad7fbbc96df99496da3983d3e7efcfec76f7faead87418dfe1a51500bd67f595befbfd6f2daf1f35369014e08a05e6fd4ab96e31e73d0282bc7a7cae23ff3ccfe8170ca6cee9843f51f3b4ec8cff9efccdebf2d2cf9b06bb9417a25c74f98bdff99390a84fb8e49af70f39891b2e40bfbf8b6b0917e87968346a8f5a6cc51c07ab02f2cf1983237552f709c86691e3bbd5be5821998a32067bd1765d13f67563d530a4b3df8b01c523d8ec74059faed086bfc82390e851b8ed3c86485e34365a9bfc5ece3df8433e10bcb5140f5dd3cf0e099f32f99e350cecb5858f2b1c1dc52fda663d334a277c0ecfd5d61c9373973120967969b548fd71b079e797d8e985b21eb63aecceb85e7c299f4ffaa2ce7739359ebc195631387c6ad1f5e302791ccbba72cf173e15cfa2d2cc7619cf1fa63c9dccaa4ff4bcfdc7fa82cfdf7999348f6bf299c4bfd4c59ea0f99535dafca71d60a65ffebca52ff8c3989e47cce98351fb785759e7bcbad65bf0be624ca9a8e87caac0fb1702ef191b2cc9731a7b9ec4f87d934659e27e142f8c671e6eb9d0ae7b2be07cc6924ccf999698a7e4f58f572e64cebb9f393444994e68e4365d9ff7be15caef70766ad678cb0f8f18359ebe109b3af27f199fadd794cf254eb196599774758e77d5496f5dd64a67959af122ef87c639b59eb81d34ba97fe3f4215196f3922acbbc28acf527cc792c7a857029ecf63bcded05efb8a52cf3cc9833ed2f66563dac0b8b1ebe3317ea77f73352173db8f6ccf54a66df0f30fb7c777d9bc214d2cf88d9cf73cfece3ddf3296b66da7fe199d7a32b5cc8feef31fbfe8f99bdde96b0faddf3272bac390665b99e90d9e7ef33972de9d73d7ff3d873255c49fc1b73257ee4f8d2eb5d336b3e8e8535ff86d9e7bbf35f2cf51366ef77cfeb6299df62563f3c0a8b1fdcf3d3569778773f756e66f7fcac967e175f797ffff5dfd9ff4103010d6698a35955030b2cb1c25bbcc3fbd5344861882352b8c5077c5c45836678c267ca7fc1314ebeaf81537cc599eb608e6ff88e1f2b682c705314b6486182dbb8f31d0ddca529f644619ff2db641d3cf82a8bfa9d62d7da670d3cc4233c760a63eaa08d2734478fac8f87ffc833788a6738c073bc20ebe3255eb1069d863e5e3b851bacfb7c6b0d0c30c488f24a3a2d4ddaf1986a3d600b13179be280ef597809e876e206000c69d8ec0e590f32c8a18012b7a0825b9799e018eee0de4e0b4318c103ff2ea2985b78c47d28a487ce276b634cca40356d1655801c3bf044af2136e0195ef8b711be4045ab50ff42e16bdbb6463d8e610253fe3d4855ec3ed80abd9f62397ef9c9e6cee835249bc31bbc731ff0010beacbcdbfaca29f2836a3e839fd1f3acb5cb6fd6e13b6605b34766097d6664cdf0d7faad9813dd827df08daf4de812ddaa7061c4017baf43ea6daef70c8fb0247704c932dc897b94e67da09553a811ef4a94a0f4ee10c069435216b630ae7a43b800b7fc6164ea543ea73ea75663b22a50e5cc215ec50956beaf606ead08080147b64c76403d20ebdc6142268528d3655ee3a1db6f88b535ee015b42081d4205ee1f4f335878501ea7644331dc81acecdb7ef63b86b32eae59956cff63237f92af7319c9a82669c989256bd0b6fa6fabe86bbfe0ecdadb9a399ce61b49a86355adfbedd45736756bc27b30afd161a9a9179585de33bf69fd2f8ebd7b5bf014644b906</data> + </image> + <image name="image2" > + <data format="XPM.GZ" length="4494" >789ce5965b4f23471085dff915d6d6db2aaac5e3b92aca037703cbc55c8c21ca43cf8c8d0dd85c6c307694ff9eeaaed3bd68771f968d14298a0a109fabebd4e99a9ef17cfad8e81d1f343e7e5a99cecc6c5435aaa1796a7cac9fc7e3c5ef7ffcf6e7ca8756d4909f661c35a20fbfac7ce8cc1a55e3f07ed2b7409702b4badaccfb996563020f5c7ecbf340b9a31c3591dff7ac7943e002cc8e73cf74acdcc27a8a2d37a5be4e1d9f04567f9fc105f25dcfea9726caad62a07c1158f58f94e3087e868ea57fa5fa0be590bfb11c3525affd4e03ebfa25b8507fbcaa1c47ca66e459fdf10c6c30af4dcfda8f5f9513dfffce71e1f5a956967adddfaeb25f4f7b60e8d199e596f42f6bc787ca213f554e5be06dc7a28ffdee282791cedb5c83d19fd795a55ecf4b3fb0ee07ebd312fae796e3283665e238524e2265de031bcc774d396d61be25b8c4fe1f02abfeab67f49f2867decfbd6393b6a03f03438f3bca19fa51cb33fc6f80fd7eae2c27e257e7cb4de5b4045f78d679f24960ddcfb172e6f73357ce63e88fc115ce43e558fcabbeb905fb7e47cae24ff5daca41af007bbd81e5b425f53aff6160d52f95f318f37d01a39ee7ca05f4790a469e0e1c97590bfa1b81f53c3e2bfbf5ecf697b532efe754398f31af437085eb65948b18e723f70cbf9e2bcc633db0f65b533609fcbafb372bf318fdcfc015e65b281731ee0ff6acf70767ca5e8f7be01abcab5cfa7e89e53cce2ba3fd1681b5df8172013f44e00acfbf4a39e8ef287b7dbe02234feefce795d727a36c12ccf75239d4b7c1bede9def42fcc0ef7960d5cbc05ebf543635aed752b94aa1ff02ee83ddf3b6a87c3d3f2b9b047a4fcaa17e0cf6f5eef928ab13f5476960d5eb7ac6f5dd07d7e04839e83d29d7be9ffbfe31b50dc723cfa87f08acf947e51a7ad457ee6760773ecaa4f47e36036bfd96673c3fb6c13578a01cf41f9505d5af3b2f655dc28fa93da33e550ef523e5e06f08861eb9e7b94cdfe7ddf753d50feb6f94437e00f67edcf3aa4e831ed8afe73bb05fefe655f7c37edcfd62bb81ddfb82935776cfeb41c87766ff2cfe7f1a4c6cb8e48ae91f68d4dce7015ff390473fad71c3b77cc7639ef03d3ffcb48f013ff293a84c79c6d54f693c8bc28b28589539bff2e2ed647e586389184bacf13a6ff0e6d71a32f92dde96bfdf9dbccc6387dba2d086caae4c668ff7bf68f0673ee0433ee263eef0099ff2199f8b62d0e32e5f704fea2fe5b70d3f57729556b91b349a1c718b634e64faa9fc7fc919e772220a91213254ca273b884bf72b4a54f1846ad925e93b1af56940d734a4110fe4efb5c40dddda907311734c7752d10b3a1ae289c634a17b7dafe331e995b3b124fbdfd25d85471763596fab7aa2a4f53d444653ded3773bb96e8faeae1de2ea8dff9da0b0ebfcd858e3357aa667bb1f68b4a5e7d256853559e8f56d64aefe85e6f44a0b5aea3bac5c2bebf74b8775fb6bfbb858771e7a6f1df09c36f89a36698bb6f53d5c4ef08ee4e6a2dd269b9d488729ed4a171b7bd40ece3228cce5d305edd3673ed7773139bd133a14d5233a96cff7a9237142a77446e7125dba900e70681564f5a6acdc1285ae9e0feaf150d675e8d2d59dd315ad52931fec2973d1a5489c6698e29c5a508829797bd629a52665bcf9fdd32ed95c1d50217b5c18b67390f34befb8e78873a9b6b39ad285216328a2de3bef5b32a59db5ccec42a6b565aaf7dffba6e663d3972b211ea86b065f3cbccbc7b53890399a21a55f677f5863e4f670c337df667f58e3d6dc99dbef3dd5ff6bdf73ff82c65fbfaefc0d4fb5b868</data> + </image> + <image name="image3" > + <data format="XPM.GZ" length="802" >789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232325500210543251d2e25658564056503300071f540dc3430007371012a492a830156496538c094848922c9c2259134c099304914e3604c8424aa5e6449b0044216ca824ba2da8b4512218b4d122e8b55520fee5974072164511da487ea490c7f22cba249e20d3efc018f3fcae0d2702eb5d2106992b5d65c00b9a48974</data> + </image> + <image name="image4" > + <data format="XPM.GZ" length="1241" >789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54105b19c8563600020b03103711c4b530b08072f50880513524ab518681443435ca984ae08ae06a94114a10ac443435ca3043904d4c4453a38ca604ae11590d9a0ab80bd0d46078914c35c4d885a608871a547f61f81d5d117a1862018930e5b8d5c0950c741a1b1e6a6aadb90086a9d853</data> + </image> + <image name="image5" > + <data format="XPM.GZ" length="5598" >789ca5985973db480ec7dff3295cc15b6a0b2351a428d6d63ef83e255bbe647b6a1fd02465dd872d9f53f3dd076c005dc926ce6a32eed8553f37fadf7fa0c1a69cdfbe6cdc9cb537befcf6e97145ab61be910fe861e34bf1349dbefdfedffffcf1e97323dae07f51bdbe117dfed7a7cfddd546bed199cfca0ae888016afeab62e8796ef110ee545caf05be16ae5bfc6ee096e7b6e756983f51b6f53b81257ecfb8eee7e9b162f66af1c78125fe48987f23f3fb81657e691cd5bddecc7316d555efd058f7eb2867aa771058f4de8c55cffb6dd4a34cf5b68d357e681c6515634db81a7e3ef59c35cccf5560bf9ef6953389c77660af074f15c751e05c38a6d81f2ef9f3a848f4e9d658f2c36b635dbfa54cc2383556bd33e12492fc70df38f1f3f8ae4cc2745a711285fda7caa4f95e06967a2d8c63f27a8fc2a60fa4acfa980a371b898f0767dc6cf8fdbc9f84c27e4de124d2fabe186b3dee8c75ff1365dbef2db0ccef0987fd2f2a6632fd576552fd2b63d57b08ecd7d39d70b321fd0560acfb6d1a4b7e3050764de7d79f08a70de937ea7b7689e68f4de1e0776e2c7ab8abecb47eb170aa7ee822b0e89f1b4b7fd24dc529abe9794f02cbf99e2b3badc7a5b1ee97089b3e0e8d253f3c364e253e5576120ff7c63a9f7966d2e771d358e75bca4ef3bb0e2cf9758db5fe47c6b21eeb81bd3f07c2ad58ebd130d67e6a194b3cf97e62b2fa24c67a1f5d2aab3f8781a53e17c6eaa7082cfa3de156acf9d5034b7e3563f1eb96c6eaf7c0b815fbf8d2739e3aedefb1b1de9723618b77a49cebf946c6e20f5f8d251e753e8b5bb9e74c980a4afc7a7fbf66b1ed8fb7c67a9ec7c2ad5cfd74038bdfa6b1f6cbd458fd2e84b358efbb0363f5b71358fccd8c33596f9c4bfddcc458fac78d8cf5797b3296f5f82c4c49e6f5c9bf9fb23ce41307967e3935d6f36c0b67b1ce3f188b5f3757367f5363b98fdc38b0cc0f8cf5f90bf3ea97028bfe50981289777d63edcf81b1c4439897f3c52d615738cfe0df371c1deb7db265acf98d8d253f7a50d67a60c758cfcbf4cc7f2fb0f8bf1736bfae30d6f35f1a4b3ce6c6e2df95ca85f6f7dc58f3db0e5c783e14e6ebc533e87e963fbe0873f9fd3cc97c91693fd028b0d4e3c558f3eb0b9b5f972bab3fe78c353f3056bfabc0e2371636bfe4cf9b29d1e76b69acfdb863accfd33cb0dc2fa7c6e2179e03cb79ae940b7dffbf1b6bfd1363f53b12367f581a6b3d1bca56df6e60a9bfc6e765def4ecef6bc7eafaf9e8d558fbb7a15ce87d7263acf7ffbdb1e40f33e1e0cf29ebfea8eb6d7ff29f17f8f4137dfe51d8fa0117ca65ee3fbfe3bd705116b2de9f775e3af50313e1a229f1f0682cf1b052e6e1d9dfbf1cddd4fd2363cdcfef5fb05b7d1f0c944bed4f67ac9f5f27c265bf4c3d9f07eefb787f1f96695eaa1e0a174d7d7f81b1ee4f81a5fe75e552d9bf1fca7e617e9e8d556f33b0c4fbcf5ffdb44c956bc6a2d75dfd6c2020fd3ce2ff69a0c31c0b2cff91461fef71804374bfaa81231ce3044b9ce2ecd734380fc2392e70890ff888bfa6f184cff8c24e5ef10ddf71f3a37c3ed6c015afdec26dfeb983bbb887fb78f0f734380fe031c7437f3247788c27d8fe713e1f6a1076f014cfb08be7ac7481977885d75c951fe4f3630dcea3c3eb7b9cc70d6b9ce12d9fee26de610debeb69b0fb578cb89a0d8c399711e794609373d9c39455f2b53466d8c20c17809c45cc7a3c00f011081cffccff379fef35388f1d0428a0c401f459e58c3d45700f0003cee71d8678fc730d7430e2557d3c8331f7568c37308129cc7006733e9d262c6008cb6ff3f94ea3c72bc678ca3f1fb80a637884154c71c974c55d72c91a4feca4fdf553f8ad46554d8e9ee30a9eb1efab31611f2ff0ca346427bb9c11e114debe7e7ebed328318702e7f0ce9dbee47a1c724655b745b0c94ea6b0c55519f059b98f73d19a6cc30eecc21eecfb7100877004c770026de8e070bdfe805338832e9cc3055cc2955f7b0d3de8f0cfebb5356ee016eea0c6a30e11342086049a907aadcd35355a90111250f5e5288706bfdb4bea572a78b49e06ddd3a0d2807a2502110d6944639ad09466ebf9e8ae684e0bf5b1a4075ab28f11ffa1df678dc7f57cb0c68a9ee899355e7c2ddbf40a31bdb1c63bcdfe86c6803669cb9f4555c76b38a76dcee57d5d1f5c8f1d5af0b9745581bb029a5c8f3eedd21eed73b70ebe56fa91061dd061f05139e9d1116b1cfb9aee55c4fcf6330d5cd289d778a6b65fdd831dea702e256b9cf2b974a84367d4fd580347744e17744957acc13e7cfc095d538f356ed8cd2ddd518dea147da4c1956890ffcf295ed5e4c83b4a59f182b9455935e3b801ab791c7fa4e188d7a4bcbee66353feaef9df8852ca2f3e9ee3ef73840f359cabfec22979f4ddbd1bf018ba118f318f899bf298b9b95bb8e537cffe9ffffef4171c39a0bf</data> + </image> + <image name="image6" > + <data format="XPM.GZ" length="3742" >789c8d96c9521c490c86ef3c458775734cc8ddd5b5c6c41c303b180cc60b66620eaacc2c9aa5599b7562de7da45fc5180c8e98fa39f091522e4a49c9bbb783bdedcdc1db77735733991d864198c8e5e06dbc9e4eeffffceb8fbfe7de64d9407f466531c8defc36f76667360883adb3d364c013051ae2039f8147266359068f4dc6740a2e4db05f05d726f0253898c017c6a3cc04ffafce79aa3af0143c36c17e055caa0aacbf06aeb2203e5f09ae4d185f75ce472de6e7737063c2fcb57356b702fed673e32c473d4bcf3760198f02e69325706b022f3a676df0f567e05035d1ed273dc79883e7c1d1045e70ae2456d84fd9738a589f0b703261bc72ae25e17ee4b0e7d8f3b5733374e603e32c37c11ff36970db12f193f7e07c1c6bec87c6e0c604ff0e1c4db03f36cec7e3a6f4fd2e38e779eee7bd05e7e350fa7e4fc0455ee6b84fb9eab913bfdf1c5ce5758efba54fffb1e75302d726f8af3817a5f8f922584cf06fc0211f951ebfd0b30afe07ce4510dfdf1e38e665e9f9f1e01c32cf1fda06a73c2f7c7eac5f8c8b61eef582f315b909dc82f1c17e07dc1459e5f1c77d953abb787e0ab832611cf957366dd9c707f556762a3fcf8673ddd6d8afdc1957b909fe98af2a65d4c787c08d09e3c8bfaad504f378de83a309e35fc049d9d747bda19c7dbe8f602d88d6fd11af3a33c1ffde398e02ec69178c0b04bb7fa12be03e08e7ab4b895e2f74ec1ca2e73f6d811b2d37df1feaa9969082f71ff4a73a98c01f9cdb3678fde27eea58f7f9cdc8bfba33c11efda2199ac01bcead048fd72678a4e9e3f6a86f6d172acc87fc69f290f9386f3d72f478a1bf348509fea8b7a66c9b80fec1a8b7a66a53f47cc2fe9b5ae77346fe35ad09e761703081d12f9b68c2fc57ce6d0c1e6fe463934ce0efc63234c11ffd5b4a13c66f9cb53d79fded832bcd27f47f5aeb59055e744eb1df3fe2251aeee4e7453f9264c27aa847b44f7f4f909fda3efb7ae30c5c84b65f1fef435b9a608ff7a4ad4c981ffb6b6b13d8fda5edfb37eff4dcb65e2f787f5a7cb0f7fd0413ecf13eb49d09f6783ff07cf97d8ec0a3f8d8df516f483faf07c45b1f27e9f30ff989e9fdbe11ff1034fd3c9eebe068c238fa9f6677f2fb27ac1f475dd3f97da25fc6c204be755673ef3f8db3360c1f1f824b13c651df2877c44fd0df511efe5ea39f44318151cf9a4e2ab0af870d63fee4dc55fdfe109f880ff3fb788a8ff98df733762630fa471aa6febda2839e5b3f0fe1bef4f18bc9fb01fa7dca4ce0bb9e5b671ef69c3cff18f99cc626d853cf551f3fe453ca531bbdde979cbb2c793e207f536102a39fa5ca0446bf4279f97b89feaabb5181511f38bedf2ffa47373461bdcfe0dc8471d46387860fc6fbaad155c11ef7a5d953747ede69cf2a30fe3fd06c5121fe88572726f8a37f68720ffbfdadf7ac02fb7e82098c7e85ebf2fde37dea92098cf7acc367bc33fbff7a6ecfc4c22d078eaac41d1ff0e4d7f66a7df84293e71ecfec858f9ee8d1fef8a9c733fb139ef2299ff1395ff0255fc167c233befee1f1cc3ef10ddff21ddff303cfabe77bd584177891971e3d7ed8db4e7b2df30aaff29a7aac3ff9ebe4a9bdf2067fe04ddee28ffafb36eff027de558fcfbaab2ffc95bf3db5578b3dfecefb3ce411673c56ceb9e0b23f47a5fbac7fb26f889988742f2a129e504b81a246e0c8ec293cb7a7441d0b1dd0840ee9883486744253bea4533a7bd5fe9c2ed4feb29fff4aff32a36b8dd5e92fe6bfa15bddcf1dddd303cd93c6911668aa2b5cbc363f3c16799f9630fbb2d20aadd21aadeb3d547a8617f6f0d8a00fb4495bfadb47daa61dfa84f977e933c597f64f6e6c9fbed057fa467bf49df669c8bb34a2eca53d8d35576ef88e722aa8a48a6a6a448320a20fd36bf3eb7f407c2c89efb5500f6422877224c77222533915e6b397fbd117f54ccee54275295732936bb9915bb9937b797869ff34e7649ecfe4bd2ce81a8bbc2a4bb2fc5a3dfe2c59915559fb75fdfe8f7affe7f7b97f011cdd9635</data> + </image> + </images> +</ui> diff --git a/examples/activeqt/wrapper/main.cpp b/examples/activeqt/wrapper/main.cpp new file mode 100644 index 0000000..a403084 --- /dev/null +++ b/examples/activeqt/wrapper/main.cpp @@ -0,0 +1,161 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QAxFactory> +#include <QCheckBox> +#include <QRadioButton> +#include <QPushButton> +#include <QToolButton> +#include <QPixmap> + +/* XPM */ +static const char *fileopen[] = { +" 16 13 5 1", +". c #040404", +"# c #808304", +"a c None", +"b c #f3f704", +"c c #f3f7f3", +"aaaaaaaaa...aaaa", +"aaaaaaaa.aaa.a.a", +"aaaaaaaaaaaaa..a", +"a...aaaaaaaa...a", +".bcb.......aaaaa", +".cbcbcbcbc.aaaaa", +".bcbcbcbcb.aaaaa", +".cbcb...........", +".bcb.#########.a", +".cb.#########.aa", +".b.#########.aaa", +"..#########.aaaa", +"...........aaaaa" +}; + + +//! [0] +class ActiveQtFactory : public QAxFactory +{ +public: + ActiveQtFactory( const QUuid &lib, const QUuid &app ) + : QAxFactory( lib, app ) + {} + QStringList featureList() const + { + QStringList list; + list << "QCheckBox"; + list << "QRadioButton"; + list << "QPushButton"; + list << "QToolButton"; + return list; + } + QObject *createObject(const QString &key) + { + if ( key == "QCheckBox" ) + return new QCheckBox(0); + if ( key == "QRadioButton" ) + return new QRadioButton(0); + if ( key == "QPushButton" ) + return new QPushButton(0 ); + if ( key == "QToolButton" ) { + QToolButton *tb = new QToolButton(0); +// tb->setIcon( QPixmap(fileopen) ); + return tb; + } + + return 0; + } + const QMetaObject *metaObject( const QString &key ) const + { + if ( key == "QCheckBox" ) + return &QCheckBox::staticMetaObject; + if ( key == "QRadioButton" ) + return &QRadioButton::staticMetaObject; + if ( key == "QPushButton" ) + return &QPushButton::staticMetaObject; + if ( key == "QToolButton" ) + return &QToolButton::staticMetaObject; + + return 0; + } + QUuid classID( const QString &key ) const + { + if ( key == "QCheckBox" ) + return "{6E795DE9-872D-43CF-A831-496EF9D86C68}"; + if ( key == "QRadioButton" ) + return "{AFCF78C8-446C-409A-93B3-BA2959039189}"; + if ( key == "QPushButton" ) + return "{2B262458-A4B6-468B-B7D4-CF5FEE0A7092}"; + if ( key == "QToolButton" ) + return "{7c0ffe7a-60c3-4666-bde2-5cf2b54390a1}"; + + return QUuid(); + } + QUuid interfaceID( const QString &key ) const + { + if ( key == "QCheckBox" ) + return "{4FD39DD7-2DE0-43C1-A8C2-27C51A052810}"; + if ( key == "QRadioButton" ) + return "{7CC8AE30-206C-48A3-A009-B0A088026C2F}"; + if ( key == "QPushButton" ) + return "{06831CC9-59B6-436A-9578-6D53E5AD03D3}"; + if ( key == "QToolButton" ) + return "{6726080f-d63d-4950-a366-9bf33e5cdf84}"; + + return QUuid(); + } + QUuid eventsID( const QString &key ) const + { + if ( key == "QCheckBox" ) + return "{FDB6FFBE-56A3-4E90-8F4D-198488418B3A}"; + if ( key == "QRadioButton" ) + return "{73EE4860-684C-4A66-BF63-9B9EFFA0CBE5}"; + if ( key == "QPushButton" ) + return "{3CC3F17F-EA59-4B58-BBD3-842D467131DD}"; + if ( key == "QToolButton" ) + return "{f4d421fd-4ead-4fd9-8a25-440766939639}"; + + return QUuid(); + } +}; +//! [0] //! [1] + +QAXFACTORY_EXPORT( ActiveQtFactory, "{3B756301-0075-4E40-8BE8-5A81DE2426B7}", "{AB068077-4924-406a-BBAF-42D91C8727DD}" ) +//! [1] diff --git a/examples/activeqt/wrapper/wrapper.inf b/examples/activeqt/wrapper/wrapper.inf new file mode 100644 index 0000000..fc17a3d --- /dev/null +++ b/examples/activeqt/wrapper/wrapper.inf @@ -0,0 +1,9 @@ +[version] + signature="$CHICAGO$" + AdvancedINF=2.0 + [Add.Code] + wrapperax.dll=wrapperax.dll + [wrapperax.dll] + file-win32-x86=thiscab + clsid={23F5012A-7333-43D3-BCA8-836AABC61B4A} + RegisterServer=yes diff --git a/examples/activeqt/wrapper/wrapper.pro b/examples/activeqt/wrapper/wrapper.pro new file mode 100644 index 0000000..4eb6baf --- /dev/null +++ b/examples/activeqt/wrapper/wrapper.pro @@ -0,0 +1,15 @@ +TEMPLATE = lib +TARGET = wrapperax + +CONFIG += qt warn_off qaxserver dll +contains(CONFIG, static):DEFINES += QT_NODLL + +SOURCES = main.cpp +RC_FILE = wrapperax.rc +DEF_FILE = $$QT_SOURCE_TREE/src/activeqt/control/qaxserver.def + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/wrapper +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS wrapper.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt/wrapper +INSTALLS += target sources diff --git a/examples/activeqt/wrapper/wrapperax.rc b/examples/activeqt/wrapper/wrapperax.rc new file mode 100644 index 0000000..453688d --- /dev/null +++ b/examples/activeqt/wrapper/wrapperax.rc @@ -0,0 +1,32 @@ +#include "winver.h" + +1 TYPELIB "wrapperax.rc" +1 ICON DISCARDABLE "..\\..\\..\\src\\activeqt\\control\\qaxserver.ico" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 + FILEFLAGSMASK 0x3fL + FILEOS 0x00040000L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "Nokia Corporation and/or its subsidiary(-ies)" + VALUE "FileDescription", "Wrapper Example (ActiveQt)" + VALUE "FileVersion", "1.0.0.0" + VALUE "LegalCopyright", "Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)." + VALUE "InternalName", "wrapperax.dll" + VALUE "OriginalFilename", "wrapperax.dll" + VALUE "ProductName", "Wrapper Example (ActiveQt)" + VALUE "ProductVersion", "1.0.0.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END |