PDA

View Full Version : Qml plugin in html inside WebView problem



xeento
25th January 2011, 17:26
Hi everyone,
I have strange problem. I want to use qml plugin inside html which is use by webview in qml form. I've found solution which says if i want to do so i have to follow this:


import QtWebKit 2.1
import Qt 4.7

WebView {
width: 500; height: 500
settings.pluginsEnabled: true
html: "<html>\
<body bg color=white>\
These are QML plugins, shown in a QML WebView via HTML OBJECT tags\
<table border=1>\
<tr><th>Duration <th>Color <th>Plugin\
<tr><td>500 <td>red <td><object data=ColorSquare.qml type=x-qt-plugin width=100 height=100 ></object>\
<tr><td>2000 <td>blue <td><OBJECT data=ColorSquare.qml type=application/x-qt-plugin width=100 height=100 period=2000 color=blue />\
<tr><td>1000 <td>green <td><OBJECT data=ColorSquare.qml type=application/x-qt-plugin width=100 height=100 period=1000 color=green />\
</table>\
</body>
</html>"
}

ColorSquare.qml



import Qt 4.7

Item {
property int period: 250 //unused for sake of space
property string color: "black"
id: root
Item {
x: root.width/2; y: root.height/2
Rectangle {
color: root.color
width: root.width; height: width
x: -width/2; y: -height/2
}
}
}

Everything should work but problem is it's not. when you run this code instead of plugin webview display empty blocks with missing plugin icon.

Do you know solution to this problem by any chance?
Maybe there is no support for that kind of approach?
Thank you in advance.

wysota
29th January 2011, 14:27
Did you implement the actual plugin?