Debug Script with Creator 4.4.1



  • I am new to QT and I'm working on a mac c++ app with javascript. How can I debug script. I don't see a QT Debug app and I can't step into script functions. I thought maybe into the moc file but that doesn't work.

    any help would be appreciated

    John


  • Moderators

    @coltrane58 I don't think you can debug JavaScript in QtCreator. How do you execute these scripts?



  • I am working on a mac app which is a combo of c++ and javascript. I have been debugging the c++ portion in Creator. I thought I could just add console.info type functions in the javascript but I just get errors. I'm not the original author of the code so I have been trying to come up to speed using QT. If the javascript wasn't so complex I would just convert the whole thing to c++. argh!

    any help would be really be appreciated. I'm going bonkers

    thanks
    john



  • @coltrane58

    I thought I could just add console.info type functions in the javascript but I just get errors

    What functions and what errors?

    P.S.
    You aren't The John Coltrane, are you?



  • First, I don't know why I put 4.4.1 in the title. Must have been a brain hic-up. I am running QT Creator 5.9.3.
    I have tried 4.4.1 and 4.4.8 but I can't build with either of those versions because my XCode is close to the latest. The code I am trying to fix was written with QT 4.8.4, at least that was what was communicated to me.

    I am trying to use
    >>console.info("yada yada yada");
    in a key handling function. When I press a key I get:

    ReferenceError: Can't find variable: console2984

    I can use

    alert("nada nada nada");
    successfully

    I am not well versed in javascript. I can read it an understand it to some extent but I wouldn't try to create anything more complicated than HelloWorld.js. And i am totally clueless on how to debug it. I am for the most part a c++ developer with some java under my belt.

    and yes, I am THE john coltrane. Neighbors hate when I blow my sax at 2am 🎷;-)
    john


  • Qt Champions 2017

    Hi
    Just to be clear
    QtCreator is version 4.4.1.(newest) And it the IDE/editor
    Qt version is not tied to creator. you can use any Qt version with it.
    Like Qt4.8 (old gen) or Qt.5.9/10 (newest)

    If you have Qt4.8 based code, it might need some porting to run in Qt5.9
    Some classes have changed.
    Also, QtScript is deprecated and superseded with QJSEngine but still fully functional in
    later Qt version. ( whole of 5.X as i understand it)

    There is a tool to debug QScript
    http://doc.qt.io/qt-5/qtscriptdebugger-manual.html
    And you can use
    http://doc.qt.io/qt-5/qscriptenginedebugger.html
    to embed into the app.

    I assume this is how you use js ?
    I mean via QScript ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.