ui/qt/entry.cpp

changeset 561
5798e3a28c59
parent 560
9e302b8a6c37
child 597
fc85ca42a7ce
equal deleted inserted replaced
560:9e302b8a6c37 561:5798e3a28c59
106 value->get = ui_spinbox_double_get; 106 value->get = ui_spinbox_double_get;
107 value->set = ui_spinbox_double_set; 107 value->set = ui_spinbox_double_set;
108 } else if(var->type == UI_VAR_RANGE) { 108 } else if(var->type == UI_VAR_RANGE) {
109 UiRange *value = (UiRange*)var->value; 109 UiRange *value = (UiRange*)var->value;
110 value->obj = widget; 110 value->obj = widget;
111 // TODO 111 QDoubleSpinBox *spinbox = (QDoubleSpinBox*)widget;
112 if(value->value != 0) {
113 spinbox->setValue(value->value);
114 }
115 if(value->min != value->max) {
116 spinbox->setRange(value->min, value->max);
117 }
118 if(value->extent != 0) {
119 spinbox->setSingleStep(value->extent);
120 }
121 value->get = ui_spinbox_range_get;
122 value->set = ui_spinbox_range_set;
123 value->setrange = ui_spinbox_range_setrange;
124 value->setextent = ui_spinbox_range_setextent;
112 } 125 }
113 } 126 }
114 127
115 128
116 ctn->add(widget, false); 129 ctn->add(widget, false);
138 void ui_spinbox_double_set(UiDouble *d, double value) { 151 void ui_spinbox_double_set(UiDouble *d, double value) {
139 QDoubleSpinBox *spinbox = (QDoubleSpinBox*)d->obj; 152 QDoubleSpinBox *spinbox = (QDoubleSpinBox*)d->obj;
140 spinbox->setValue(value); 153 spinbox->setValue(value);
141 d->value = spinbox->value(); 154 d->value = spinbox->value();
142 } 155 }
156
157 double ui_spinbox_range_get(UiRange *range) {
158 QDoubleSpinBox *spinbox = (QDoubleSpinBox*)range->obj;
159 range->value = spinbox->value();
160 return range->value;
161 }
162
163 void ui_spinbox_range_set(UiRange *range, double value) {
164 QDoubleSpinBox *spinbox = (QDoubleSpinBox*)range->obj;
165 spinbox->setValue(value);
166 range->value = spinbox->value();
167 }
168
169 void ui_spinbox_range_setrange(UiRange *range, double min, double max) {
170 QDoubleSpinBox *spinbox = (QDoubleSpinBox*)range->obj;
171 spinbox->setRange(min, max);
172 range->min = min;
173 range->max = max;
174 }
175
176 void ui_spinbox_range_setextent(UiRange *range, double extent) {
177 QDoubleSpinBox *spinbox = (QDoubleSpinBox*)range->obj;
178 spinbox->setSingleStep(extent);
179 range->extent = extent;
180 }

mercurial