Kaynağa Gözat

Add QMessageBox::information() support to host environment

Neal Wilson 7 yıl önce
ebeveyn
işleme
7499b8a1db
1 değiştirilmiş dosya ile 10 ekleme ve 0 silme
  1. 10
    0
      src/typica.w

+ 10
- 0
src/typica.w Dosyayı Görüntüle

@@ -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…
İptal
Kaydet