|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Designer of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #include "qwebview_plugin.h" |
|
43 |
|
44 #include <QtDesigner/QExtensionFactory> |
|
45 #include <QtDesigner/QExtensionManager> |
|
46 |
|
47 #include <QtCore/qplugin.h> |
|
48 #include <QtWebKit/QWebView> |
|
49 |
|
50 static const char *toolTipC = "QtWebKit Web widget"; |
|
51 |
|
52 QT_BEGIN_NAMESPACE |
|
53 |
|
54 QWebViewPlugin::QWebViewPlugin(QObject *parent) : |
|
55 QObject(parent), |
|
56 m_initialized(false) |
|
57 { |
|
58 } |
|
59 |
|
60 QString QWebViewPlugin::name() const |
|
61 { |
|
62 return QLatin1String("QWebView"); |
|
63 } |
|
64 |
|
65 QString QWebViewPlugin::group() const |
|
66 { |
|
67 return QLatin1String("Display Widgets"); |
|
68 } |
|
69 |
|
70 QString QWebViewPlugin::toolTip() const |
|
71 { |
|
72 return QString(QLatin1String(toolTipC)); |
|
73 } |
|
74 |
|
75 QString QWebViewPlugin::whatsThis() const |
|
76 { |
|
77 return QString(QLatin1String(toolTipC)); |
|
78 } |
|
79 |
|
80 QString QWebViewPlugin::includeFile() const |
|
81 { |
|
82 return QLatin1String("QtWebKit/QWebView"); |
|
83 } |
|
84 |
|
85 QIcon QWebViewPlugin::icon() const |
|
86 { |
|
87 return QIcon(QLatin1String(":/trolltech/qwebview/images/qwebview.png")); |
|
88 } |
|
89 |
|
90 bool QWebViewPlugin::isContainer() const |
|
91 { |
|
92 return false; |
|
93 } |
|
94 |
|
95 QWidget *QWebViewPlugin::createWidget(QWidget *parent) |
|
96 { |
|
97 return new QWebView(parent); |
|
98 } |
|
99 |
|
100 bool QWebViewPlugin::isInitialized() const |
|
101 { |
|
102 return m_initialized; |
|
103 } |
|
104 |
|
105 void QWebViewPlugin::initialize(QDesignerFormEditorInterface * /*core*/) |
|
106 { |
|
107 if (m_initialized) |
|
108 return; |
|
109 |
|
110 m_initialized = true; |
|
111 } |
|
112 |
|
113 QString QWebViewPlugin::domXml() const |
|
114 { |
|
115 return QLatin1String("\ |
|
116 <ui language=\"c++\">\ |
|
117 <widget class=\"QWebView\" name=\"webView\">\ |
|
118 <property name=\"url\">\ |
|
119 <url>\ |
|
120 <string>about:blank</string>\ |
|
121 </url>\ |
|
122 </property>\ |
|
123 <property name=\"geometry\">\ |
|
124 <rect>\ |
|
125 <x>0</x>\ |
|
126 <y>0</y>\ |
|
127 <width>300</width>\ |
|
128 <height>200</height>\ |
|
129 </rect>\ |
|
130 </property>\ |
|
131 </widget>\ |
|
132 </ui>"); |
|
133 } |
|
134 |
|
135 Q_EXPORT_PLUGIN2(customwidgetplugin, QWebViewPlugin) |
|
136 |
|
137 QT_END_NAMESPACE |