source: trunk/examples/activeqt/wrapper/main.cpp

Last change on this file was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 4.9 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the examples of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:BSD$
10** You may use this file under the terms of the BSD license as follows:
11**
12** "Redistribution and use in source and binary forms, with or without
13** modification, are permitted provided that the following conditions are
14** met:
15** * Redistributions of source code must retain the above copyright
16** notice, this list of conditions and the following disclaimer.
17** * Redistributions in binary form must reproduce the above copyright
18** notice, this list of conditions and the following disclaimer in
19** the documentation and/or other materials provided with the
20** distribution.
21** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
22** the names of its contributors may be used to endorse or promote
23** products derived from this software without specific prior written
24** permission.
25**
26** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
37** $QT_END_LICENSE$
38**
39****************************************************************************/
40
41#include <QAxFactory>
42#include <QCheckBox>
43#include <QRadioButton>
44#include <QPushButton>
45#include <QToolButton>
46#include <QPixmap>
47
48/* XPM */
49static const char *fileopen[] = {
50" 16 13 5 1",
51". c #040404",
52"# c #808304",
53"a c None",
54"b c #f3f704",
55"c c #f3f7f3",
56"aaaaaaaaa...aaaa",
57"aaaaaaaa.aaa.a.a",
58"aaaaaaaaaaaaa..a",
59"a...aaaaaaaa...a",
60".bcb.......aaaaa",
61".cbcbcbcbc.aaaaa",
62".bcbcbcbcb.aaaaa",
63".cbcb...........",
64".bcb.#########.a",
65".cb.#########.aa",
66".b.#########.aaa",
67"..#########.aaaa",
68"...........aaaaa"
69};
70
71
72//! [0]
73class ActiveQtFactory : public QAxFactory
74{
75public:
76 ActiveQtFactory( const QUuid &lib, const QUuid &app )
77 : QAxFactory( lib, app )
78 {}
79 QStringList featureList() const
80 {
81 QStringList list;
82 list << "QCheckBox";
83 list << "QRadioButton";
84 list << "QPushButton";
85 list << "QToolButton";
86 return list;
87 }
88 QObject *createObject(const QString &key)
89 {
90 if ( key == "QCheckBox" )
91 return new QCheckBox(0);
92 if ( key == "QRadioButton" )
93 return new QRadioButton(0);
94 if ( key == "QPushButton" )
95 return new QPushButton(0 );
96 if ( key == "QToolButton" ) {
97 QToolButton *tb = new QToolButton(0);
98// tb->setIcon( QPixmap(fileopen) );
99 return tb;
100 }
101
102 return 0;
103 }
104 const QMetaObject *metaObject( const QString &key ) const
105 {
106 if ( key == "QCheckBox" )
107 return &QCheckBox::staticMetaObject;
108 if ( key == "QRadioButton" )
109 return &QRadioButton::staticMetaObject;
110 if ( key == "QPushButton" )
111 return &QPushButton::staticMetaObject;
112 if ( key == "QToolButton" )
113 return &QToolButton::staticMetaObject;
114
115 return 0;
116 }
117 QUuid classID( const QString &key ) const
118 {
119 if ( key == "QCheckBox" )
120 return "{6E795DE9-872D-43CF-A831-496EF9D86C68}";
121 if ( key == "QRadioButton" )
122 return "{AFCF78C8-446C-409A-93B3-BA2959039189}";
123 if ( key == "QPushButton" )
124 return "{2B262458-A4B6-468B-B7D4-CF5FEE0A7092}";
125 if ( key == "QToolButton" )
126 return "{7c0ffe7a-60c3-4666-bde2-5cf2b54390a1}";
127
128 return QUuid();
129 }
130 QUuid interfaceID( const QString &key ) const
131 {
132 if ( key == "QCheckBox" )
133 return "{4FD39DD7-2DE0-43C1-A8C2-27C51A052810}";
134 if ( key == "QRadioButton" )
135 return "{7CC8AE30-206C-48A3-A009-B0A088026C2F}";
136 if ( key == "QPushButton" )
137 return "{06831CC9-59B6-436A-9578-6D53E5AD03D3}";
138 if ( key == "QToolButton" )
139 return "{6726080f-d63d-4950-a366-9bf33e5cdf84}";
140
141 return QUuid();
142 }
143 QUuid eventsID( const QString &key ) const
144 {
145 if ( key == "QCheckBox" )
146 return "{FDB6FFBE-56A3-4E90-8F4D-198488418B3A}";
147 if ( key == "QRadioButton" )
148 return "{73EE4860-684C-4A66-BF63-9B9EFFA0CBE5}";
149 if ( key == "QPushButton" )
150 return "{3CC3F17F-EA59-4B58-BBD3-842D467131DD}";
151 if ( key == "QToolButton" )
152 return "{f4d421fd-4ead-4fd9-8a25-440766939639}";
153
154 return QUuid();
155 }
156};
157//! [0] //! [1]
158
159QAXFACTORY_EXPORT( ActiveQtFactory, "{3B756301-0075-4E40-8BE8-5A81DE2426B7}", "{AB068077-4924-406a-BBAF-42D91C8727DD}" )
160//! [1]
Note: See TracBrowser for help on using the repository browser.