Results 1 to 8 of 8

Thread: What is best for concatenating values in QString: arg(...) or +?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: What is best for concatenating values in QString: arg(...) or +?

    First, is there another method to do this?
    Sure, you can use append() or push_back(), operator +=, or even sprintf, but I really doubt you will notice any change in performance with such micro-optimizations.
    Second, which of them is the best for situations like the one mentioned above?
    The most readable one (for me the "arg()" method, but it is a matter of personal preference).
    what about speed and memory efficiency?
    The thing you are doing in the background and stuff related to gui will have much greater impact on the performance than actual string composition.
    Anyway, if you are unsure, then measure, do some performance tests.

  2. The following user says thank you to stampede for this useful post:

    Momergil (2nd April 2014)

Similar Threads

  1. Replies: 6
    Last Post: 1st February 2013, 08:32
  2. How to access QString characters values
    By rdelgado in forum Newbie
    Replies: 7
    Last Post: 15th November 2010, 14:01
  3. Replies: 4
    Last Post: 1st February 2010, 14:21
  4. concatenating path QStrings
    By rbp in forum Qt Programming
    Replies: 2
    Last Post: 19th December 2008, 04:46
  5. Concatenating two binary files
    By nbkhwjm in forum Newbie
    Replies: 13
    Last Post: 23rd April 2007, 03:30

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.