diff libgui/graphics/QtHandlesUtils.cc @ 20037: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
line wrap: on
line diff
--- a/libgui/graphics/QtHandlesUtils.cc	Mon Apr 06 23:06:08 2015 -0400
+++ b/libgui/graphics/QtHandlesUtils.cc	Tue Apr 07 12:12:59 2015 -0400
@@ -81,6 +81,23 @@
   return v;
 }
 
+Cell toCellString (const QStringList& l)
+{
+  QStringList tmp = l;
+
+  // dont get any empty lines from end of the list
+  while ((tmp.length () > 0) && (tmp.last ().length () == 0))
+    {
+      tmp.removeLast ();
+    }
+  // no strings will be a a 1x1 cell with empty string
+  if (tmp.length () == 0)
+    tmp += "";
+
+  Cell v(toStringVector (tmp));
+  return v;
+}
+
 template <class T>
 QFont
 computeFont (const typename T::properties& props, int height)