[solved] adding Qt to existing program
-
wrote on 30 Mar 2011, 16:41 last edited by
a qstring object has a method called arg which replaces %1 by its value and returns a temporary object. if on this temp object, another arg is called, it replaces all instances of %2 by its value and so on. Afaik, up to 99 :-)
-
wrote on 30 Mar 2011, 16:44 last edited by
Interesting...thanks.
So...how do I mark this solved? With a tag?
-
wrote on 30 Mar 2011, 16:46 last edited by
go to your first post, click edit and change the title :-)
Just add [Solved] in front -
wrote on 30 Mar 2011, 17:18 last edited by
[quote author="Gerolf" date="1301503305"]a qstring object has a method called arg which replaces %1 by its value and returns a temporary object. if on this temp object, another arg is called, it replaces all instances of %2 by its value and so on. Afaik, up to 99 :-)[/quote]
The rationale behind the %1 %2 and so on is, that these strings are regularly translatable and the placeholders need not be integers or numbers but also strings. In some languages, things must be reordered to result in a valid sentence. So you can the write
@
QString x = QString("%2 is before %1).arg("first").arg("second");
@The resulting string is "second is before first".
-
wrote on 30 Mar 2011, 21:21 last edited by
[quote author="mzimmers" date="1301501568"]Oh, this is OUTSTANDING. Thanks so much to everyone for their help in this thread. It may not seem like much to anyone else, but this is a major step forward for me.[/quote]
You're welcome. The initial steps are often the most confusing with a new technology. I will shortly post a modified example that performs the calculations in a separate thread and uses signals to let the main GUI thread know about the current status. That way you;ll have an example on which you can build if you do need to do some seriously time consuming number crunching without blocking the GUI.
41/45