|
@@ -937,12 +937,15 @@ message and return the selected action.
|
937
|
937
|
|
938
|
938
|
@<Function prototypes for scripting@>=
|
939
|
939
|
QScriptValue displayWarning(QScriptContext *context, QScriptEngine *engine);
|
|
940
|
+QScriptValue displayError(QScriptContext *context, QScriptEngine *engine);
|
940
|
941
|
|
941
|
942
|
@ This function is exposed to the host environment.
|
942
|
943
|
|
943
|
944
|
@<Set up the scripting engine@>=
|
944
|
945
|
constructor = engine->newFunction(displayWarning);
|
945
|
946
|
engine->globalObject().setProperty("displayWarning", constructor);
|
|
947
|
+constructor = engine->newFunction(displayError);
|
|
948
|
+engine->globalObject().setProperty("displayError", constructor);
|
946
|
949
|
|
947
|
950
|
@ The function takes some arguments.
|
948
|
951
|
|
|
@@ -959,6 +962,13 @@ QScriptValue displayWarning(QScriptContext *context, QScriptEngine *)
|
959
|
962
|
return QScriptValue(false);
|
960
|
963
|
}
|
961
|
964
|
|
|
965
|
+QScriptValue displayError(QScriptContext *context, QScriptEngine *)
|
|
966
|
+{
|
|
967
|
+ QMessageBox::critical(NULL, argument<QString>(0, context),
|
|
968
|
+ argument<QString>(1, context));
|
|
969
|
+ return QScriptValue();
|
|
970
|
+}
|
|
971
|
+
|
962
|
972
|
@* Scripting QMainWindow.
|
963
|
973
|
|
964
|
974
|
\noindent Rather than directly exposing |QMainWindow| to the scripting engine,
|