diff options
author | axis <qt-info@nokia.com> | 2009-04-24 11:34:15 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-04-24 11:34:15 (GMT) |
commit | 8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76 (patch) | |
tree | a17e1a767a89542ab59907462206d7dcf2e504b2 /examples/activeqt | |
download | Qt-8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76.zip Qt-8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76.tar.gz Qt-8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76.tar.bz2 |
Long live Qt for S60!
Diffstat (limited to 'examples/activeqt')
64 files changed, 5053 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..1cd05f6 --- /dev/null +++ b/examples/activeqt/activeqt.pro @@ -0,0 +1,22 @@ +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 + +include($$QT_SOURCE_TREE/examples/examplebase.pri) diff --git a/examples/activeqt/comapp/comapp.pro b/examples/activeqt/comapp/comapp.pro new file mode 100644 index 0000000..29aebae --- /dev/null +++ b/examples/activeqt/comapp/comapp.pro @@ -0,0 +1,15 @@ +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 + +include($$QT_SOURCE_TREE/examples/examplebase.pri) 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 |