connect qwebkit and javascript problem
hi to all
i am using qwebkit
i have a cpp object and export it to javascript but it does not connect to it , because it does not work
here is my code :
my cpp code :
- #include "mainwindow.h"
- #include "ui_mainwindow.h"
- #include <QWebFrame>
- #include <QMessageBox>
- ui(new Ui::MainWindow)
- {
- ui->setupUi(this);
- this->setObjectName("MyWin");
- connectCPPObjectToJS(this->objectName() , this);
- }
- void MainWindow::test()
- {
- }
- {
- }
- void MainWindow::on_comboBox_currentIndexChanged(int index)
- {
- QString s ;
- emit sendChangedIndexToJS(index);
- }
- {
- ui->webView->page()->mainFrame()->addToJavaScriptWindowObject( objectName() , objecttype);
- }
- {
- }
and here is my html code :
- <html>
- <head>
- <meta http-equiv="Content-Language" content="en-us">
- <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
- <title>مثال چهار قل</title>
- [removed]
- function updatesura(value){
- alert("the value was changed to " + value);
- }
- MyWin.test();
- MyWin.sendChangedIndexToJS.connect(updatesura());
- [removed]
- </head>
- <body>
- <p align="center"><font face="Tahoma">سوره</font>
- </p>
- </body>
- </html>
what is wrong ?
thanks a lot
3 replies
You must log in to post a reply. Not a member yet? Register here!


