PDA

View Full Version : Script Debugger LocalsWidget does not show variables



ctgrund
22nd March 2011, 00:01
Hi,

i have problems integrating debugger widgets in my project. Using standardWindow() everything works fine.
When I integrate the widgets via widget() in my application all widgets are working except the LocalsWidget. This widget keeps empty.
What am I doing wrong?

Thanks for your help!

Thomas

(code attached)

ctgrund
22nd March 2011, 10:03
zip file was corrupted, sorry

3 Files:

Main.cpp:



#include <QApplication>
#include "Window.h"

int main(int argc, char *argv[]) {
QApplication A(argc, argv);

Window W;
W.show();

return A.exec();
}


Window.h:



#include <QWidget>

class QTextEdit;
class QScriptEngine;
class QScriptEngineDebugger;

class Window: public QWidget {
Q_OBJECT
public:
Window();

private slots:
void runScript();

private:
QTextEdit *mTE;
QScriptEngine *mEngine;
QScriptEngineDebugger *mDebugger;
};


Window.cpp:



#include <QAction>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QTextEdit>
#include <QPushButton>
#include <QScriptEngine>
#include <QScriptEngineDebugger>
#include "Window.h"

Window::Window() {
QHBoxLayout *HBL = new QHBoxLayout(this);
QVBoxLayout *VBL = new QVBoxLayout;
HBL->addLayout(VBL);
mTE = new QTextEdit;
mTE->setText("Sum = 0\nfor (i=1; i<=10; i++)\n Sum += i\n Sum");
VBL->addWidget(mTE);

QPushButton *PB = new QPushButton("run");
VBL->addWidget(PB);
connect(PB, SIGNAL(clicked()), this, SLOT(runScript()));

mEngine = new QScriptEngine;
mDebugger = new QScriptEngineDebugger;
mDebugger->attachTo(mEngine);
mDebugger->setAutoShowStandardWindow(false);

HBL->addWidget(mDebugger->widget(QScriptEngineDebugger::CodeWidget));
HBL->addWidget(mDebugger->widget(QScriptEngineDebugger::ConsoleWidget));
HBL->addWidget(mDebugger->widget(QScriptEngineDebugger::LocalsWidget));
}

void Window::runScript() {
mDebugger->action(QScriptEngineDebugger::InterruptAction)->trigger();
mEngine->evaluate(mTE->toPlainText());
}

corsairr
13th June 2011, 19:28
Hi,

I do have the same issue. Does anyone has a clue what is happening ?

cheers

Corsairr