|
@@ -7230,6 +7230,8 @@ object to the scripting engine.
|
7230
|
7230
|
QScriptValue constructTemperatureDisplay(QScriptContext *context,
|
7231
|
7231
|
QScriptEngine *engine);
|
7232
|
7232
|
void setTemperatureDisplayProperties(QScriptValue value, QScriptEngine *engine);
|
|
7233
|
+QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext *context,
|
|
7234
|
+ QScriptEngine *engine);
|
7233
|
7235
|
|
7234
|
7236
|
@ The scripting engine must be informed of this function.
|
7235
|
7237
|
|
|
@@ -7253,6 +7255,24 @@ QScriptValue constructTemperatureDisplay(QScriptContext *,
|
7253
|
7255
|
void setTemperatureDisplayProperties(QScriptValue value, QScriptEngine *engine)
|
7254
|
7256
|
{
|
7255
|
7257
|
setQLCDNumberProperties(value, engine);
|
|
7258
|
+ value.setProperty("setDisplayUnits",
|
|
7259
|
+ engine->newFunction(TemperatureDisplay_setDisplayUnits));
|
|
7260
|
+}
|
|
7261
|
+
|
|
7262
|
+@ There seems to be a bad interaction when enumerated value types as used as
|
|
7263
|
+the argument to slot methods called through QtScript. Script code that attempts
|
|
7264
|
+to make use of the enumeration appears to get the value without any type
|
|
7265
|
+information. When attempting to use that value as an argument the meta-object
|
|
7266
|
+system cannot find an appropriate match and the script just hangs silently.
|
|
7267
|
+The solution is to wrap such methods in the script bindings and explicitly cast
|
|
7268
|
+the argument value to the enumerated type. This looks stupid but it works.
|
|
7269
|
+
|
|
7270
|
+@<Functions for scripting@>=
|
|
7271
|
+QScriptValue TemperatureDisplay_setDisplayUnits(QScriptContext *context, QScriptEngine *)
|
|
7272
|
+{
|
|
7273
|
+ TemperatureDisplay *self = getself<@[TemperatureDisplay *@]>(context);
|
|
7274
|
+ self->setDisplayUnits((Units::Unit)argument<int>(0, context));
|
|
7275
|
+ return QScriptValue();
|
7256
|
7276
|
}
|
7257
|
7277
|
|
7258
|
7278
|
@* The MeasurementTimeOffset class.
|
|
@@ -8611,6 +8631,8 @@ QScriptValue ZoomLog_restoreState(QScriptContext *context,
|
8611
|
8631
|
QScriptValue ZoomLog_lastTime(QScriptContext *context, QScriptEngine *engine);
|
8612
|
8632
|
QScriptValue ZoomLog_saveTemporary(QScriptContext *context,
|
8613
|
8633
|
QScriptEngine *engnie);
|
|
8634
|
+QScriptValue ZoomLog_setDisplayUnits(QScriptContext *context,
|
|
8635
|
+ QScriptEngine *engine);
|
8614
|
8636
|
|
8615
|
8637
|
@ Of these, the global object only needs to know about the constructor.
|
8616
|
8638
|
|
|
@@ -8641,6 +8663,7 @@ void setZoomLogProperties(QScriptValue value, QScriptEngine *engine)
|
8641
|
8663
|
value.setProperty("lastTime", engine->newFunction(ZoomLog_lastTime));
|
8642
|
8664
|
value.setProperty("saveTemporary",
|
8643
|
8665
|
engine->newFunction(ZoomLog_saveTemporary));
|
|
8666
|
+ value.setProperty("setDisplayUnits", engine->newFunction(ZoomLog_setDisplayUnits));
|
8644
|
8667
|
}
|
8645
|
8668
|
|
8646
|
8669
|
@ The functions for saving data are simple wrappers around the corresponding
|
|
@@ -8741,6 +8764,22 @@ QScriptValue ZoomLog_lastTime(QScriptContext *context, QScriptEngine *engine)
|
8741
|
8764
|
return QScriptValue(engine, self->lastTime(argument<int>(0, context)));
|
8742
|
8765
|
}
|
8743
|
8766
|
|
|
8767
|
+@ There seems to be a bad interaction when enumerated value types as used as
|
|
8768
|
+the argument to slot methods called through QtScript. Script code that attempts
|
|
8769
|
+to make use of the enumeration appears to get the value without any type
|
|
8770
|
+information. When attempting to use that value as an argument the meta-object
|
|
8771
|
+system cannot find an appropriate match and the script just hangs silently.
|
|
8772
|
+The solution is to wrap such methods in the script bindings and explicitly cast
|
|
8773
|
+the argument value to the enumerated type. This looks stupid but it works.
|
|
8774
|
+
|
|
8775
|
+@<Functions for scripting@>=
|
|
8776
|
+QScriptValue ZoomLog_setDisplayUnits(QScriptContext *context, QScriptEngine *)
|
|
8777
|
+{
|
|
8778
|
+ ZoomLog *self = getself<@[ZoomLog *@]>(context);
|
|
8779
|
+ self->setDisplayUnits((Units::Unit)argument<int>(0, context));
|
|
8780
|
+ return QScriptValue();
|
|
8781
|
+}
|
|
8782
|
+
|
8744
|
8783
|
@* A model for roasting data.
|
8745
|
8784
|
|
8746
|
8785
|
\noindent Qt provides a tool called the model view architecture. This provides a
|