Browse Source

QLineEdit can now be constructed from host environment.

Neal Wilson 12 years ago
parent
commit
4a1e6e84bf
1 changed files with 40 additions and 0 deletions
  1. 40
    0
      src/typica.w

+ 40
- 0
src/typica.w View File

1521
 	setQFrameProperties(value, engine);
1521
 	setQFrameProperties(value, engine);
1522
 }
1522
 }
1523
 
1523
 
1524
+@* Scripting QLineEdit.
1525
+
1526
+\noindent Similarly, we may want to allow line edits in interfaces defined
1527
+through the host environment. For example, this is used for the free text
1528
+annotation control for roasters this has been configured on.
1529
+
1530
+@<Function prototypes for scripting@>=
1531
+void setQLineEditProperties(QScriptValue value, QScriptEngine *engine);
1532
+QScriptValue constructQLineEdit(QScriptContext *context, QScriptEngine *engine);
1533
+
1534
+@ The constructor must be passed to the host environment.
1535
+
1536
+@<Set up the scripting engine@>=
1537
+constructor = engine->newFunction(constructQLineEdit);
1538
+value = engine->newQMetaObject(&QLineEdit::staticMetaObject, constructor);
1539
+engine->globalObject().setProperty("QLineEdit", value);
1540
+
1541
+@ The constructor is trivial.
1542
+
1543
+@<Functions for scripting@>=
1544
+QScriptValue constructQLineEdit(QScriptContext *context, QScriptEngine *engine)
1545
+{
1546
+	QScriptValue object = engine->newQObject(new QLineExit(text));
1547
+	setQLineEditProperties(object, engine);
1548
+	return object;
1549
+}
1550
+
1551
+@ At present all of the QLineEdit functionality exposed through this interface
1552
+is provided automatically through the meta-object system.
1553
+
1554
+@<Functions for scripting@>=
1555
+void setQLineEditProperties(QScriptValue value, QScriptEngine *engine)
1556
+{
1557
+	setQWidgetProperties(value, engine);
1558
+}
1559
+
1524
 @* Scripting QSplitter.
1560
 @* Scripting QSplitter.
1525
 
1561
 
1526
 \noindent The |QSplitter| class is one of the main classes used for user
1562
 \noindent The |QSplitter| class is one of the main classes used for user
5423
 {
5459
 {
5424
 	setQWebViewProperties(value, engine);
5460
 	setQWebViewProperties(value, engine);
5425
 }
5461
 }
5462
+else if(className == "QLineEdit")
5463
+{
5464
+	setQLineEditProperties(value, engine);
5465
+}
5426
 
5466
 
5427
 @ In the list of classes, the SaltTable entry is for a class which does not
5467
 @ In the list of classes, the SaltTable entry is for a class which does not
5428
 strictly exist on its own. It is, however, useful to provide some custom
5468
 strictly exist on its own. It is, however, useful to provide some custom

Loading…
Cancel
Save