Vuo
2.0.0
type
inputEditor
widget
VuoInputEditorWithLineEdit.cc
Go to the documentation of this file.
1
10
#include "
VuoInputEditorWithLineEdit.hh
"
11
15
VuoInputEditorWithLineEdit::VuoInputEditorWithLineEdit
(
void
)
16
:
VuoInputEditorWithDialog
()
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
51
setFirstWidgetInTabOrder
(
lineEdit
);
52
setLastWidgetInTabOrder
(
lineEdit
);
53
}
54
58
json_object
*
VuoInputEditorWithLineEdit::getAcceptedValue
(
void
)
59
{
60
return
convertFromLineEditFormat
(
lineEdit
->text());
61
}
62
66
QString
VuoInputEditorWithLineEdit::convertToLineEditFormat
(
json_object
*value)
67
{
68
return
json_object_to_json_string_ext(value, JSON_C_TO_STRING_PLAIN);
69
}
70
74
json_object
*
VuoInputEditorWithLineEdit::convertFromLineEditFormat
(
const
QString &valueAsString)
75
{
76
return
json_tokener_parse(valueAsString.toUtf8().constData());
77
}
78
82
void
VuoInputEditorWithLineEdit::setWidth
(
int
width)
83
{
84
this->width = width;
85
}
86
90
bool
VuoInputEditorWithLineEdit::supportsTabbingBetweenPorts
(
void
)
91
{
92
return
true
;
93
}
Generated on Tue Oct 22 2019 18:07:55 for Vuo by
1.8.16