Browse Source

Add QMessageBox::information() support to host environment

Neal Wilson 7 years ago
parent
commit
7499b8a1db
1 changed files with 10 additions and 0 deletions
  1. 10
    0
      src/typica.w

+ 10
- 0
src/typica.w View File

995
 @<Function prototypes for scripting@>=
995
 @<Function prototypes for scripting@>=
996
 QScriptValue displayWarning(QScriptContext *context, QScriptEngine *engine);
996
 QScriptValue displayWarning(QScriptContext *context, QScriptEngine *engine);
997
 QScriptValue displayError(QScriptContext *context, QScriptEngine *engine);
997
 QScriptValue displayError(QScriptContext *context, QScriptEngine *engine);
998
+QScriptValue displayInfo(QScriptContext *context, QScriptEngine *engine);
998
 
999
 
999
 @ This function is exposed to the host environment.
1000
 @ This function is exposed to the host environment.
1000
 
1001
 
1003
 engine->globalObject().setProperty("displayWarning", constructor);
1004
 engine->globalObject().setProperty("displayWarning", constructor);
1004
 constructor = engine->newFunction(displayError);
1005
 constructor = engine->newFunction(displayError);
1005
 engine->globalObject().setProperty("displayError", constructor);
1006
 engine->globalObject().setProperty("displayError", constructor);
1007
+constructor = engine->newFunction(displayInfo);
1008
+engine->globalObject().setProperty("displayInfo", constructor);
1006
 
1009
 
1007
 @ The function takes some arguments.
1010
 @ The function takes some arguments.
1008
 
1011
 
1026
     return QScriptValue();
1029
     return QScriptValue();
1027
 }
1030
 }
1028
 
1031
 
1032
+QScriptValue displayInfo(QScriptContext *context, QScriptEngine *)
1033
+{
1034
+    QMessageBox::information(NULL, argument<QString>(0, context),
1035
+                             argument<QString>(1, context));
1036
+    return QScriptValue();
1037
+}
1038
+
1029
 @* Scripting QMainWindow.
1039
 @* Scripting QMainWindow.
1030
 
1040
 
1031
 \noindent Rather than directly exposing |QMainWindow| to the scripting engine,
1041
 \noindent Rather than directly exposing |QMainWindow| to the scripting engine,

Loading…
Cancel
Save