本文整理汇总了C++中QScriptEngineDebugger::widget方法的典型用法代码示例。如果您正苦于以下问题:C++ QScriptEngineDebugger::widget方法的具体用法?C++ QScriptEngineDebugger::widget怎么用?C++ QScriptEngineDebugger::widget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScriptEngineDebugger
的用法示例。
在下文中一共展示了QScriptEngineDebugger::widget方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: widget
void tst_QScriptEngineDebugger::widget()
{
#if defined(Q_OS_WINCE) && _WIN32_WCE < 0x600
QSKIP("skipped due to high mem usage until task 261062 is fixed", SkipAll);
#endif
QScriptEngine engine;
QScriptEngineDebugger debugger;
debugger.attachTo(&engine);
QList<QScriptEngineDebugger::DebuggerWidget> widgets;
widgets
<< QScriptEngineDebugger::ConsoleWidget
<< QScriptEngineDebugger::StackWidget
<< QScriptEngineDebugger::ScriptsWidget
<< QScriptEngineDebugger::LocalsWidget
<< QScriptEngineDebugger::CodeWidget
<< QScriptEngineDebugger::CodeFinderWidget
<< QScriptEngineDebugger::BreakpointsWidget
<< QScriptEngineDebugger::DebugOutputWidget
<< QScriptEngineDebugger::ErrorLogWidget;
QList<QWidget*> lst;
for (int i = 0; i < widgets.size(); ++i) {
QScriptEngineDebugger::DebuggerWidget dw = widgets.at(i);
QWidget *wid = debugger.widget(dw);
QVERIFY(wid != 0);
QCOMPARE(wid, debugger.widget(dw));
QVERIFY(lst.indexOf(wid) == -1);
lst.append(wid);
QCOMPARE(static_cast<QWidget *>(wid->parent()), (QWidget*)0);
}
}
示例2: main
// Perhaps shpw entire example for getting debugger up with script
int main(int argv, char **args)
{
QApplication app(argv, args);
QString fileName("helloscript.qs");
QFile scriptFile(fileName);
scriptFile.open(QIODevice::ReadOnly);
QTextStream stream(&scriptFile);
QString contents = stream.readAll();
scriptFile.close();
QScriptEngine *engine = new QScriptEngine();
QScriptEngineDebugger *debugger = new QScriptEngineDebugger();
debugger->attachTo(engine);
// Set up configuration with only stack and code
QWidget *widget = new QWidget;
//![0]
QWidget *codeWindow = debugger->widget(QScriptEngineDebugger::CodeWidget);
QWidget *stackWidget = debugger->widget(QScriptEngineDebugger::StackWidget);
QLayout *layout = new QHBoxLayout;
layout->addWidget(codeWindow);
layout->addWidget(stackWidget);
//![0]
//![1]
QAction *continueAction = debugger->action(QScriptEngineDebugger::ContinueAction);
QAction *stepOverAction = debugger->action(QScriptEngineDebugger::StepOverAction);
QAction *stepIntoAction = debugger->action(QScriptEngineDebugger::StepIntoAction);
QToolBar *toolBar = new QToolBar;
toolBar->addAction(continueAction);
//![1]
toolBar->addAction(stepOverAction);
toolBar->addAction(stepIntoAction);
layout->addWidget(toolBar);
continueAction->setIcon(QIcon("copy.png"));
debugger->setAutoShowStandardWindow(false);
widget->setLayout(layout);
widget->show();
QPushButton button;
QScriptValue scriptButton = engine->newQObject(&button);
engine->globalObject().setProperty("button", scriptButton);
//![2]
debugger->action(QScriptEngineDebugger::InterruptAction)->trigger();
engine->evaluate(contents, fileName);
//![2]
return app.exec();
}
示例3: Scene
//.........这里部分代码省略.........
this, SLOT(contextMenuRequested(QPoint)));
// The contextMenuPolicy of infoLabel is now the default one, so that one
// can easily copy-paste its text.
// connect(ui->infoLabel, SIGNAL(customContextMenuRequested(const QPoint & )),
// this, SLOT(showSceneContextMenu(const QPoint &)));
connect(ui->actionRecenterScene, SIGNAL(triggered()),
viewer, SLOT(update()));
connect(ui->actionAntiAliasing, SIGNAL(toggled(bool)),
viewer, SLOT(setAntiAliasing(bool)));
connect(ui->actionDraw_two_sides, SIGNAL(toggled(bool)),
viewer, SLOT(setTwoSides(bool)));
// add the "About CGAL..." and "About demo..." entries
this->addAboutCGAL();
this->addAboutDemo(":/cgal/Polyhedron_3/about.html");
// Connect the button "addButton" with actionLoad
ui->addButton->setDefaultAction(ui->actionLoad);
// Same with "removeButton" and "duplicateButton"
ui->removeButton->setDefaultAction(ui->actionErase);
ui->duplicateButton->setDefaultAction(ui->actionDuplicate);
// Connect actionQuit (Ctrl+Q) and qApp->quit()
connect(ui->actionQuit, SIGNAL(triggered()),
this, SLOT(quit()));
// Connect "Select all items"
connect(ui->actionSelect_all_items, SIGNAL(triggered()),
this, SLOT(selectAll()));
// Recent files menu
this->addRecentFiles(ui->menuFile, ui->actionQuit);
connect(this, SIGNAL(openRecentFile(QString)),
this, SLOT(open(QString)));
// Reset the "Operation menu"
clearMenu(ui->menuOperations);
#ifdef QT_SCRIPT_LIB
std::cerr << "Enable scripts.\n";
script_engine = new QScriptEngine(this);
qScriptRegisterMetaType<Scene_item*>(script_engine,
myScene_itemToScriptValue,
myScene_itemFromScriptValue);
# ifdef QT_SCRIPTTOOLS_LIB
QScriptEngineDebugger* debugger = new QScriptEngineDebugger(this);
debugger->setObjectName("qt script debugger");
QAction* debuggerMenuAction =
menuBar()->addMenu(debugger->createStandardMenu());
debuggerMenuAction->setText(tr("Qt Script &debug"));
for(unsigned int i = 0; i < 9; ++i)
{
QDockWidget* dock = new QDockWidget(debug_widgets_names[i], this);
dock->setObjectName(debug_widgets_names[i]);
dock->setWidget(debugger->widget(debug_widgets[i]));
this->addDockWidget(Qt::BottomDockWidgetArea, dock);
dock->hide();
}
debugger->setAutoShowStandardWindow(false);
debugger->attachTo(script_engine);
# endif // QT_SCRIPTTOOLS_LIB
QScriptValue fun = script_engine->newFunction(myPrintFunction);
script_engine->globalObject().setProperty("print", fun);
// evaluate_script("print('hello', 'world', 'from QtScript!')");
QScriptValue mainWindowObjectValue = script_engine->newQObject(this);
script_engine->globalObject().setProperty("main_window", mainWindowObjectValue);
QScriptValue sceneObjectValue = script_engine->newQObject(scene);
mainWindowObjectValue.setProperty("scene", sceneObjectValue);
script_engine->globalObject().setProperty("scene", sceneObjectValue);
QScriptValue viewerObjectValue = script_engine->newQObject(viewer);
mainWindowObjectValue.setProperty("viewer", viewerObjectValue);
script_engine->globalObject().setProperty("viewer", viewerObjectValue);
QScriptValue cameraObjectValue = script_engine->newQObject(viewer->camera());
viewerObjectValue.setProperty("camera", cameraObjectValue);
script_engine->globalObject().setProperty("camera", cameraObjectValue);
evaluate_script("var plugins = new Array();");
# ifdef QT_SCRIPTTOOLS_LIB
QScriptValue debuggerObjectValue = script_engine->newQObject(debugger);
script_engine->globalObject().setProperty("debugger", debuggerObjectValue);
# endif
#endif
readSettings(); // Among other things, the column widths are stored.
// Load plugins, and re-enable actions that need it.
loadPlugins();
// Setup the submenu of the View menu that can toggle the dockwidgets
Q_FOREACH(QDockWidget* widget, findChildren<QDockWidget*>()) {
ui->menuDockWindows->addAction(widget->toggleViewAction());
}