[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/graphics/kst/kst
From:       Barth Netterfield <netterfield () astro ! utoronto ! ca>
Date:       2005-11-30 23:11:45
Message-ID: 1133392305.667360.27727.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 484478 by netterfield:

Tabs and spaces come and go properly in text edit 


 M  +16 -1     kstviewlabel.cpp  


--- trunk/extragear/graphics/kst/kst/kstviewlabel.cpp #484477:484478
@@ -37,6 +37,7 @@
 #include <qmetaobject.h>
 #include <qptrstack.h>
 #include <qtextedit.h>
+#include <qregexp.h>
 
 #include <stdlib.h>
 
@@ -576,7 +577,14 @@
   if (!w) {
     return false;
   }
-  widget->_text->setText(_txt);
+  // replace \n & \t with tabs and newlines for the text edit box
+  QString tmpstr = _txt;
+  QRegExp cr("\\\\n");
+  QRegExp tab("\\\\t");
+  tmpstr.replace(cr,"\n");
+  tmpstr.replace(tab,"\t");
+  widget->_text->setText(tmpstr);
+  
   return true;
 }
 
@@ -585,7 +593,14 @@
   if (!w) {
     return false;
   }
+  
+  // Replace tabs and newlines in text edit box with \n and \t 
+  QRegExp cr("\n");
+  QRegExp tab("\t");
   _txt = widget->_text->text();
+  _txt.replace(cr, "\\n");
+  _txt.replace(tab, "\\t");
+
   reparse(); // calls setDirty()
   return true;
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic