Quote Originally Posted by tommy View Post
How do you convert numbers into text for QString.
For example, I want to build a word 2house4 using append(). I know how to make such a string but I want the string to be all text (the numbers should also be treated as text):

Qt Code:
  1. QString test;
  2. test.append(2);
  3. test.append("house");
  4. test.append(4);
To copy to clipboard, switch view to plain text mode 

This doesn't work:
Qt Code:
  1. QString test;
  2. test.append(2).text();
  3. test.append("house");
  4. test.append(4).text();
To copy to clipboard, switch view to plain text mode 

thanks
You can do it like this :

Qt Code:
  1. QString test;
  2. test = QString ( "%1%2%3" ).arg ( 2 ).arg ( "house" ).arg ( 4 );
To copy to clipboard, switch view to plain text mode 
If all three paarams where strings ( up to 10 ), you can use alternative syntax :

Qt Code:
  1. test = QString ( "%1%2%3" ).arg ( "2", "house", "4" );
To copy to clipboard, switch view to plain text mode