9 Q_DECLARE_METATYPE(
Path)
10 Q_DECLARE_METATYPE(
Path*)
16 qmlRegisterType<Path>(
"de.fuhagen.ti", 1,0,
"Path");
17 qmlRegisterType<Path>(
"de.fuhagen.ti", 1,0,
"frechet::input::Path");
23 engine.installExtensions(QJSEngine::ConsoleExtension);
27 QJSValue global = engine.globalObject();
29 global.setProperty(
"Path", engine.newQMetaObject<
Path>());
31 global.setProperty(
"P", engine.newQObject(&P));
32 global.setProperty(
"Q", engine.newQObject(&Q));
34 global.setProperty(
"SOLID",
SOLID);
35 global.setProperty(
"THIN",
THIN);
36 global.setProperty(
"DOTTED",
DOTTED);
37 global.setProperty(
"NONE",
NONE);
39 QJSValue value = engine.evaluate(program);
40 if (value.isError()) {
42 QTextStream
str(&error_message);
43 str <<
"Script Error " <<
"\n" 44 <<
" line "<< value.property(
"lineNumber").toInt() <<
"\n" 45 << value.toString() <<
"\n";
46 qDebug() << error_message;
50 Path* pp = dynamic_cast<Path*> (global.property(
"P").toQObject());
51 Path* pq = dynamic_cast<Path*> (global.property(
"Q").toQObject());
53 error_message =
"P, Q undefined";
global definitions for all algorithms.
void append(QPointF p, char opcode)
Represents a polygonal curve.