[Qt-interest] javascript qtwebkit plugin

tang ke tangk at lemote.com
Wed Jul 14 08:12:00 CEST 2010


hi guys:
I write a qt webkit plugin, I want to set the plug-in object value, but
no response.


source code:

class Mplayer : public QWidget
{
Q_OBJECT
Q_PROPERTY(QString fileName WRITE FileName)

public:
Mplayer(MplayerPlugin *plugin, QWidget *parent = 0);
// QUrl url;
//start plugin interface
QString fileName;
int playState;
int currentPosition;
//
void setArgument(const QStringList &names, const QStringList &values) {
for(int i = 0; i < names.size(); i++)
argumentcache.insert(names[i], values[i]);
qDebug() << "width:" << argumentcache["width"] << "height:" <<
argumentcache["height"];
setGeometry(0,0,argumentcache["width"].toInt(),argumentcache["height"].toInt());
qDebug() << geometry();
show();
QPushButton *p = new QPushButton(this);
p->setGeometry(geometry());
p->show();
}
public:
void FileName(QString url) {
fileName = url;
}
.............................................
}


html code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>听力测试</title>
</head>
<body>
<embed id="mediaPlay" type="application/x-test" width="476"
height="296"></embed>
<script type="text/Javascript">
//debugger
//resolve(xml_path,xsl_path);
var media=document.getElementById("mediaPlay");

media.FileName = 'http://172.16.25.34/TransactFileService/ELP10/normal.mp3';
media.play();
</script>

</body>
</html>


I know I write error, but I don't how to write the code,
I the html use the media.play(), I can get the debug information.


thanks in advance



-------------- next part --------------
A non-text attachment was scrubbed...
Name: tangk.vcf
Type: text/x-vcard
Size: 487 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100714/f496565b/attachment.vcf 


More information about the Qt-interest-old mailing list