Results 1 to 4 of 4

Thread: Datastructures: QT vs STD

  1. #1
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Thanks
    9
    Thanked 29 Times in 29 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Datastructures: QT vs STD

    When you use data-structures (strings, lists, sets) in your qt project code, do you use the std ones, or the qt ones?

    How do they compare size/speed wise? And when, for example, I want to use an std::string in some existing widgets, will they need be converted to a QString (automatically or otherwise) first?

    I'm trying to make this decision. I'm probably going to use std classes, though, since I'd like to make a command-line version of the same application, and I'd like to avoid using any QT libraries in that.
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Datastructures: QT vs STD

    Quote Originally Posted by Michiel
    When you use data-structures (strings, lists, sets) in your qt project code, do you use the std ones, or the qt ones?
    In most cases Qt containers are compatible with STL ones, so it doesn't matter which ones you use. For some cases Qt classes are faster or more adjusted to cooperating with other Qt classes. In some cases you have to use Qt containers.

    How do they compare size/speed wise?
    Qt classes are generally "not slower" than STL ones, but they have more capabilities when it comes to cooperating with Qt.

    [qutote] And when, for example, I want to use an std::string in some existing widgets, will they need be converted to a QString (automatically or otherwise) first?[/quote]
    In most cases it'll get automatically converted. But the main difference is that QString uses unicode internally, whereas std::string doesn't. It has more features than std::string and is probably a bit slower.


    I'm trying to make this decision. I'm probably going to use std classes, though, since I'd like to make a command-line version of the same application, and I'd like to avoid using any QT libraries in that.
    You can make a command-line version of the application using Qt too. You can even have the same binary for GUI and console versions.

  3. #3
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Thanks
    9
    Thanked 29 Times in 29 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Datastructures: QT vs STD

    Quote Originally Posted by wysota
    You can make a command-line version of the application using Qt too. You can even have the same binary for GUI and console versions.
    I know I could. But won't compiling with QT in the mix mean a lot of overhead? I've looked at that QT inheritance tree.
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Datastructures: QT vs STD

    No, it won't. Why would it? Just use QtCore only if you want an extra-light version.

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.