소스 검색

Add basic QBrush scripting support

Neal Wilson 6 년 전
부모
커밋
6db56fff58
로그인 계정: neal <neal@typica.us> GPG Key ID: D6F25C90DD5819DF
1개의 변경된 파일24개의 추가작업 그리고 0개의 파일을 삭제
  1. 24
    0
      src/typica.w

+ 24
- 0
src/typica.w 파일 보기

@@ -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…
취소
저장