Browse Source

Add basic QBrush scripting support

Neal Wilson 5 years ago
parent
commit
6db56fff58
Signed by: neal <neal@typica.us> GPG Key ID: D6F25C90DD5819DF
1 changed files with 24 additions and 0 deletions
  1. 24
    0
      src/typica.w

+ 24
- 0
src/typica.w View File

@@ -3956,6 +3956,30 @@ QScriptValue constructQColor(QScriptContext *context, QScriptEngine *engine)
3956 3956
     return object;
3957 3957
 }
3958 3958
 
3959
+@* Scripting QBrush.
3960
+
3961
+\noindent |QBrush| support is limited to creating brushes from color strings to
3962
+pass to objects expecting a brush.
3963
+
3964
+@<Function prototypes for scripting@>=
3965
+QScriptValue constructQBrush(QScriptContext *context, QScriptEngine *engine);
3966
+
3967
+@ The script is informed of the constructor.
3968
+
3969
+@<Set up the scripting engine@>=
3970
+constructor = engine->newFunction(constructQBrush);
3971
+engine->globalObject().setProperty("QBrush", constructor);
3972
+
3973
+@ The constructor is trivial.
3974
+
3975
+@<Functions for scripting@>=
3976
+QScriptValue constructQBrush(QScriptContext *context, QScriptEngine *engine)
3977
+{
3978
+	QBrush theBrush = QBrush(QColor(argument<QString>(0, context)));
3979
+	QScriptValue object = engine->toScriptValue(theBrush);
3980
+	return object;
3981
+}
3982
+
3959 3983
 @* Scripting Item View Classes.
3960 3984
 
3961 3985
 \noindent |QAbstractScrollArea| is a |QFrame| that serves as the base class for

Loading…
Cancel
Save