Explorar el Código

Now button in reminders edit window works.

Neal Wilson hace 9 años
padre
commit
fcbe4ffa2b
Se han modificado 2 ficheros con 14 adiciones y 0 borrados
  1. 4
    0
      config/Windows/editreminder.xml
  2. 10
    0
      src/typica.w

+ 4
- 0
config/Windows/editreminder.xml Ver fichero

@@ -72,6 +72,10 @@
72 72
             var batchesfield = findChildObject(this, 'batches');
73 73
             var hoursfield = findChildObject(this, 'roastingtime');
74 74
             var time = new QTime();
75
+            var nowButton = findChildObject(this, 'now');
76
+            nowButton.clicked.connect(function() {
77
+                sincefield.setToCurrentTime();
78
+            });
75 79
             var deleteButton = findChildObject(this, 'delete');
76 80
             deleteButton.enabled = false;
77 81
             deleteButton.clicked.connect(function() {

+ 10
- 0
src/typica.w Ver fichero

@@ -6050,6 +6050,8 @@ void setQDateTimeEditProperties(QScriptValue value, QScriptEngine *engine)
6050 6050
     value.setProperty("day", engine->newFunction(QDateTimeEdit_day));
6051 6051
     value.setProperty("month", engine->newFunction(QDateTimeEdit_month));
6052 6052
     value.setProperty("year", engine->newFunction(QDateTimeEdit_year));
6053
+    value.setProperty("setToCurrentTime",
6054
+                      engine->newFunction(QDateTimeEdit_setToCurrentTime));
6053 6055
 }
6054 6056
 
6055 6057
 @ Certain operations on a |QDateEdit| are easier with a few convenience
@@ -6094,6 +6096,13 @@ QScriptValue QDateTimeEdit_year(QScriptContext *context, QScriptEngine *)
6094 6096
     return QScriptValue(self->date().year());
6095 6097
 }
6096 6098
 
6099
+QScriptValue QDateTimeEdit_setToCurrentTime(QScriptContext *context, QScriptEngine *)
6100
+{
6101
+    QDateTimeEdit *self = getself<QDateTimeEdit *>(context);
6102
+    self->setDateTime(QDateTime::currentDateTime());
6103
+    return QScriptValue();
6104
+}
6105
+
6097 6106
 @ A few function prototypes are needed for this.
6098 6107
 
6099 6108
 @<Function prototypes for scripting@>=
@@ -6105,6 +6114,7 @@ QScriptValue QDateTimeEdit_day(QScriptContext *context, QScriptEngine *engine);
6105 6114
 QScriptValue QDateTimeEdit_month(QScriptContext *context,
6106 6115
                                  QScriptEngine *engine);
6107 6116
 QScriptValue QDateTimeEdit_year(QScriptContext *context, QScriptEngine *engine);
6117
+QScriptValue QDateTimeEdit_setToCurrentTime(QScriptContext *context, QScriptEngine *engine);
6108 6118
 
6109 6119
 @ In order to get to objects created from the XML description, it is necessary
6110 6120
 to provide a function that can be called to retrieve children of a given widget.

Loading…
Cancelar
Guardar