comparison libgui/graphics/QtHandlesUtils.cc @ 20072:76c72314d905

QT Text/EditControl: support String cells (Bug 44749) * libgui/graphics/QtHandlesUtils.cc/h (toCellString): New function * libgui/graphics/EditControl.cc (EditControl::init): set text as string_vector (EditControl::updateMultiLine): set text as string_vector (EditControl::returnPressed): set String as cells (EditControl::editingFinished): set String as cells * libgui/graphics/TextControl.cc (TextControl::TextControl): set text as string vector (TextControl::update): set text as string vector
author John Donoghue
date Tue, 07 Apr 2015 12:12:59 -0400
parents f0e61a67ad9f
children 248f2f2e7d48
comparison
equal deleted inserted replaced
20071:0e712de0af4d 20072:76c72314d905
76 int i = 0; 76 int i = 0;
77 77
78 foreach (const QString& s, l) 78 foreach (const QString& s, l)
79 v[i++] = toStdString (s); 79 v[i++] = toStdString (s);
80 80
81 return v;
82 }
83
84 Cell toCellString (const QStringList& l)
85 {
86 QStringList tmp = l;
87
88 // dont get any empty lines from end of the list
89 while ((tmp.length () > 0) && (tmp.last ().length () == 0))
90 {
91 tmp.removeLast ();
92 }
93 // no strings will be a a 1x1 cell with empty string
94 if (tmp.length () == 0)
95 tmp += "";
96
97 Cell v(toStringVector (tmp));
81 return v; 98 return v;
82 } 99 }
83 100
84 template <class T> 101 template <class T>
85 QFont 102 QFont