Advertisement
Guest User

Untitled

a guest
Apr 21st, 2014
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #ifndef MYWEBPAGE_H
  2. #define MYWEBPAGE_H
  3.  
  4. #include <QWebPage>
  5. #include <QDebug>
  6.  
  7. class MyWebPage : public QWebPage
  8. {
  9. Q_OBJECT
  10. public:
  11. explicit MyWebPage(QObject *parent = 0);
  12.  
  13. signals:
  14.  
  15. public slots:
  16.  
  17. protected:
  18. virtual void javaScriptConsoleMessage(const QString &message, int lineNumber, const QString &sourceID);
  19.  
  20. };
  21.  
  22. #endif // MYWEBPAGE_H
  23.  
  24. #include "mywebpage.h"
  25.  
  26. MyWebPage::MyWebPage(QObject *parent) :
  27. QWebPage(parent)
  28. {
  29. }
  30.  
  31. void MyWebPage::javaScriptConsoleMessage(const QString &message, int lineNumber, const QString &sourceID)
  32. {
  33. qDebug() << lineNumber << ": " << message;
  34. }
  35.  
  36. MainWindow::MainWindow(QWidget *parent) :
  37. QMainWindow(parent),
  38. ui(new Ui::MainWindow)
  39. {
  40. ui->setupUi(this);
  41.  
  42. mwp = new MyWebPage(this);
  43. ui->webView->setPage(mwp);
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement