Vuo  2.0.0
VuoInputEditorWithLineEdit.cc
Go to the documentation of this file.
1 
11 
17 {
18  lineEdit = NULL;
19  width = 0;
20 }
21 
27 void VuoInputEditorWithLineEdit::setUpDialog(QDialog &dialog, json_object *originalValue, json_object *details)
28 {
29  setUpLineEdit(new QLineEdit(&dialog), originalValue);
30 }
31 
40 void VuoInputEditorWithLineEdit::setUpLineEdit(QLineEdit *existingLineEdit, json_object *originalValue)
41 {
42  lineEdit = existingLineEdit;
43  lineEdit->setText( convertToLineEditFormat(originalValue) );
44  lineEdit->setFocus();
45  lineEdit->selectAll();
46 
47  lineEdit->adjustSize();
48  if (width > 0)
49  lineEdit->resize(width, lineEdit->height());
50 
53 }
54 
59 {
60  return convertFromLineEditFormat(lineEdit->text());
61 }
62 
67 {
68  return json_object_to_json_string_ext(value, JSON_C_TO_STRING_PLAIN);
69 }
70 
75 {
76  return json_tokener_parse(valueAsString.toUtf8().constData());
77 }
78 
83 {
84  this->width = width;
85 }
86 
91 {
92  return true;
93 }