Get confirmation that a key has reached JS
-
Should something like the 2 console.log lines below give me some output on the console?
Excerpt from JS code:case(event.keyCode >= 65 && event.keyCode <= 73): /* a..i */ var index = 0; var rowNum = event.keyCode - 65; var jBottommenuRows = $(this).children('.row'); console.log("JS"); console.log(event.keyCode);
-
OK, fine. What if there is nothing ... on the very same console all qDebug() perfectly appear?
-
Ahhh ... OK ... Thanks a lot.
Never saw the 'Inspector' and will try to read it up ... is it also part of webKit in Qt?
I know the inspector on desktop browser but it won't help because it unfortunately does not show the issue there.
I'll try (tomorrow) to connect the signal to a slot and use qDebug() in there. -
@McLion
Activated the inspector with the following line:
QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
Basically works. However, as soon as I have the inspector turned on my webView's do behave very strange, like they do not get all inputs anymore, and I can not debug the situation.Looks like I need to implement
QWebPage::javaScriptConsoleMessage
and send the messages back to C++ and debug from there.
According docs this is not a signal so I can not simply connect to it. -
@Konstantin-Tokarev
Need some help ...
I have the following:
in h:#include <QWebPage> class DBGWebPage : public QWebPage { Q_OBJECT public: explicit DBGWebPage(QObject *parent = 0); protected: void javaScriptConsoleMessage( const QString & message, int lineNumber, const QString & sourceID ); };
in cpp:
void DBGWebPage::javaScriptConsoleMessage( const QString & message, int lineNumber, const QString & sourceID ) { qDebug() << message << lineNumber << sourceID; }
and my webGUI's are derived from qWebView:
QWebView *webGUI = new QWebView(QTGUI_MainWindow::centralWidget());
How do I make it use the reimplementation of javaScriptConsoleMessage()?
-
@Konstantin-Tokarev
Thanks .. seems to be too late for today ... I don't get it to build ... dam... -
@Konstantin-Tokarev
There's something I don't get ... probably soemthing with these C++ classes I'm always stumbling over:#include <QWebPage> class DBGWebPage : public QWebPage { Q_OBJECT public: explicit DBGWebPage(QObject *parent = 0); QWebPage *DebugWebPage; protected: void javaScriptConsoleMessage( const QString & message, int lineNumber, const QString & sourceID ); };
DBGWebPage::DBGWebPage(QObject *parent) : QWebPage(parent) { //QWebPage* DebugWebPage = new QWebPage; DebugWebPage = new QWebPage(this); }
QWebView * QTGUI_MainWindow::CreateNewWebGUI(int iID) { // check if already existing if(webGUIMap.value(iID) != 0) { qDebug("GUI %d existing", iID); return false; } // check for max GUI count here if(iID > GUI_COUNT_MAX) { qDebug("GUI %d failed - Max GUI ID is %d", iID, GUI_COUNT_MAX); return false; } // create new webGUI and add it to the list QWebView *webGUI = new QWebView(QTGUI_MainWindow::centralWidget()); webGUIMap.insert(iID, webGUI); // make some basic settings to the new GUI webGUI->setPage(DBGWebPage::DebugWebPage); webGUI->setObjectName(QString::fromUtf8("webGUI%1").arg(iID)); ......
Fehler:object missing in reference to 'DBGWebPage::DebugWebPage'
-
This post is deleted!
-
I somehow understand all you're saying, but I so far am not able to modify my code to not crash.
Currently ended up with (modified to it while Konstantin was writing it too):DBGWebPage *page=new DBGWebPage(); webGUI->setPage(page);
and an empty constructor.
Still crashing .... I'm stumped. -
remove DebugWebPage and all code messing with it