Trolltech Home | QSA-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

QSA-interest Archive, January 2006
QTL vs STL || QString vs std::string


Message 1 in thread

Hi everyone,

In an old thread (2003 -
http://lists.trolltech.com/qt-interest/2003-03/thread00260-0.html ), 
Robert liguori asked :
  > Do Qt programmers prefer using Qt's container classes or C++'s STL ?

I would like to reopen this discussion shortly, if possible.

More precisely, I am new to Qt and starting a rather big project, and I 
wonder wether (or where) I should use the std-c++ STL or the QTL (Qt 
Template Library) .


My a-priori choice would be to use the STL as much as possible, in order 
to make the code usable in applications that are not based on Qt - and 
tp to use older code I wrote in the current application.

Especially, I would tend not to use Qt in the core (non-GUI).

However, in that case, many conversion will be needed from the core to 
the GUI, for updating GUI lists, trees, etc...



My questions are :

- There exist today in Qt stl->qtl and qtl->stl convertors, such as
    QVector<T> fromStdVector ( const std::vector<T> & vector )
    std::list<T> QLinkedList::toStdList () const
    etc.
    What is the algorithmic complexity of these convertors ?
    How efficient are they ?

- How portable is today the std template library (std::vector, etc.) ?
    I will compile on Linux Mac and Windows using gcc.

- question on string : do you, developers, use std::string whenever you 
can, or use always QString even in the non-GUI code ?

- question on the template library : do develepers prefer to use the QTL 
in the whole application, or C++ containers whenever possible ?

- more generally : do you, developers, use Qt as much as possible, or 
not ? "How far" should Qt enter the application code ?



Well, these are quite general design questions... But I need to make the 
best choices ASAP, before coding ;=)


Thanks for your attention !
All the best
Nicolas

To unsubscribe - send "unsubscribe" in the subject to qsa-interest-request@xxxxxxxxxxxxx


Message 2 in thread

Hi everyone,

In an old thread (2003 -
http://lists.trolltech.com/qt-interest/2003-03/thread00260-0.html ), 
Robert liguori asked :
  > Do Qt programmers prefer using Qt's container classes or C++'s STL ?

I would like to reopen this discussion shortly, if possible.

More precisely, I am new to Qt and starting a rather big project, and I 
wonder wether (or where) I should use the std-c++ STL or the QTL (Qt 
Template Library) .


My a-priori choice would be to use the STL as much as possible, in order 
to make the code usable in applications that are not based on Qt - and 
tp to use older code I wrote in the current application.

Especially, I would tend not to use Qt in the core (non-GUI).

However, in that case, many conversion will be needed from the core to 
the GUI, for updating GUI lists, trees, etc...



My questions are :

- There exist today in Qt stl->qtl and qtl->stl convertors, such as
    QVector<T> fromStdVector ( const std::vector<T> & vector )
    std::list<T> QLinkedList::toStdList () const
    etc.
    What is the algorithmic complexity of these convertors ?
    How efficient are they ?

- How portable is today the std template library (std::vector, etc.) ?
    I will compile on Linux Mac and Windows using gcc.

- question on string : do you, developers, use std::string whenever you 
can, or use always QString even in the non-GUI code ?

- question on the template library : do develepers prefer to use the QTL 
in the whole application, or C++ containers whenever possible ?

- more generally : do you, developers, use Qt as much as possible, or 
not ? "How far" should Qt enter the application code ?



Well, these are quite general design questions... But I need to make the 
best choices ASAP, before coding ;=)


Thanks for your attention !
All the best
Nicolas

To unsubscribe - send "unsubscribe" in the subject to qsa-interest-request@xxxxxxxxxxxxx


Message 3 in thread

Hello - my answers to a couple of your questions:

On Wednesday 04 January 2006 09:57, Nicolas Castagne wrote:
> [...]
> My questions are :
> [...]
>
> - How portable is today the std template library (std::vector, etc.) ?
>     I will compile on Linux Mac and Windows using gcc.

In the past, I have had problems with STL under gcc, but mainly
across gcc versions, and only with versions of gcc less than about
3.0 (or earlier?  I don't remember).  But, this is probably a thing of the
past.

>
> - question on string : do you, developers, use std::string whenever you
> can, or use always QString even in the non-GUI code ?

I use QString as much as possible, because I love the internationalization
support.  See:

 http://doc.trolltech.com/4.0/i18n.html

My experience with QString is it's easy to use and does everything I want,
so I almost never use std::string anymore (in Qt projects).

> - question on the template library : do develepers prefer to use the QTL
> in the whole application, or C++ containers whenever possible ?

In my applications, I tend to use QTL instead of STL, but only because
I find it's simpler to deal with fewer libraries.  STL is more flexible and 
powerful than QTL, and from what I've read on this mailing list it seems
to have some slight performance advantages.   On the other hand, QTL
works fairly well for most (simple) things (like lists or such).  It's not
the best feature of Qt though.

>
> - more generally : do you, developers, use Qt as much as possible, or
> not ? "How far" should Qt enter the application code ?

I use Qt as much as possible.  I no longer look at it as just a UI library.  I
would certainly consider using Qt (version 4 or higher) in non-UI code or
projects.

   -Chris

To unsubscribe - send "unsubscribe" in the subject to qsa-interest-request@xxxxxxxxxxxxx