Wrapper Example (ActiveQt)Files: The Wrapper example demonstrates how to export existing QWidget classes as ActiveX controls, and the use of QAxFactory together with the QAXFACTORY_EXPORT() macro. ActiveX controls in this example are the standard button classes QPushButton, QCheckBox and QRadioButton as provided by Qt. ** This file is part of the example classes of the Qt Toolkit. ** ** This file may be used under the terms of the GNU General Public ** License version 2.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 GNU ** General Public Licensing requirements will be met: ** http://www.trolltech.com/products/qt/opensource.html ** ** If you are unsure which license is appropriate for your use, please ** review the following information: ** http://www.trolltech.com/products/qt/licensing.html or contact the ** sales department at sales@trolltech.com. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ****************************************************************************/ #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" }; The factory implementation returns the list of supported controls, creates controls on request and provides information about the unique IDs of the COM classes and interfaces for each control. class ActiveQtFactory : public QAxFactory { public: ActiveQtFactory( const QUuid &lib, const QUuid &app ) : QAxFactory( lib, app ) {} The factory is exported using the QAXFACTORY_EXPORT macro. To build the example you must first build the QAxServer library. Then run qmake and your make tool in examples/activeqt/wrapper. The demonstration requires a web browser that supports ActiveX controls, and scripting to be enabled. <SCRIPT LANGUAGE="VBScript"> Sub ToolButton_Clicked() RadioButton.text = InputBox( "Enter something", "Wrapper Demo" ) End Sub Sub PushButton_clicked() MsgBox( "Thank you!" ) End Sub Sub CheckBox_toggled( state ) if state = 0 then CheckBox.text = "Check me!" else CheckBox.text = "Uncheck me!" end if End Sub </SCRIPT> <p /> A QPushButton:<br /> <object ID="PushButton" CLASSID="CLSID:2B262458-A4B6-468B-B7D4-CF5FEE0A7092" CODEBASE="http://www.trolltech.com/demos/wrapperax.cab"> <PARAM NAME="text" VALUE="Click me!" /> [Object not available! Did you forget to build and register the server?] </object><br /> <p /> A QCheckBox:<br /> <object ID="CheckBox" CLASSID="CLSID:6E795de9-872d-43cf-a831-496ef9d86c68" CODEBASE="http://www.trolltech.com/demos/wrapperax.cab"> <PARAM NAME="text" VALUE="Check me!" /> [Object not available! Did you forget to build and register the server?] </object><br /> <p /> A QToolButton:<br /> <object ID="ToolButton" CLASSID="CLSID:7c0ffe7a-60c3-4666-bde2-5cf2b54390a1" CODEBASE="http://www.trolltech.com/demos/wrapperax.cab"> [Object not available! Did you forget to build and register the server?] </object><br /> <p /> A QRadioButton:<br /> <object ID="RadioButton" CLASSID="CLSID:afcf78c8-446c-409a-93b3-ba2959039189" CODEBASE="http://www.trolltech.com/demos/wrapperax.cab"> <PARAM NAME="text" VALUE="Tune me!" /> [Object not available! Did you forget to build and register the server?] </object><br /> |
Publicité
Best OfActualités les plus luesSemaine
Mois
Année
Le blog Digia au hasardDéploiement d'applications Qt Commercial sur les tablettes Windows 8Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. Lire l'article.
CommunautéRessources
Liens utilesContact
Qt dans le magazine |
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.2 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com