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,6 +995,7 @@ message and return the selected action.
995 995
 @<Function prototypes for scripting@>=
996 996
 QScriptValue displayWarning(QScriptContext *context, QScriptEngine *engine);
997 997
 QScriptValue displayError(QScriptContext *context, QScriptEngine *engine);
998
+QScriptValue displayInfo(QScriptContext *context, QScriptEngine *engine);
998 999
 
999 1000
 @ This function is exposed to the host environment.
1000 1001
 
@@ -1003,6 +1004,8 @@ constructor = engine->newFunction(displayWarning);
1003 1004
 engine->globalObject().setProperty("displayWarning", constructor);
1004 1005
 constructor = engine->newFunction(displayError);
1005 1006
 engine->globalObject().setProperty("displayError", constructor);
1007
+constructor = engine->newFunction(displayInfo);
1008
+engine->globalObject().setProperty("displayInfo", constructor);
1006 1009
 
1007 1010
 @ The function takes some arguments.
1008 1011
 
@@ -1026,6 +1029,13 @@ QScriptValue displayError(QScriptContext *context, QScriptEngine *)
1026 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 1039
 @* Scripting QMainWindow.
1030 1040
 
1031 1041
 \noindent Rather than directly exposing |QMainWindow| to the scripting engine,

Loading…
Cancel
Save