Results 1 to 6 of 6

Thread: Proper QList usage

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2009
    Posts
    33
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2

    Default Re: Proper QList usage

    Does QList support abstract classes though?

  2. #2
    Join Date
    Apr 2010
    Posts
    769
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    1
    Thanked 94 Times in 86 Posts

    Default Re: Proper QList usage

    Quote Originally Posted by space_otter View Post
    Does QList support abstract classes though?
    What do you mean? You can store anything you like in a QList, but if you're trying to store classes derived from some abstract base class, you'll have to store pointers to the base class, not the derived classes themselves. That's how C++ handles such things.

    QList itself, however, doesn't care what you store in it, as long as all the elements match the template type.

Similar Threads

  1. Copying an QList into a new, sorted QList.
    By Thomas Wrobel in forum Newbie
    Replies: 3
    Last Post: 11th January 2010, 19:27
  2. Replies: 1
    Last Post: 13th November 2009, 02:45
  3. QList: Out of memory - without having defined QList
    By miroslav_karpis in forum Qt Programming
    Replies: 1
    Last Post: 27th March 2009, 09:42
  4. QList usage in place QPtrList
    By darpan in forum Qt Programming
    Replies: 2
    Last Post: 25th October 2006, 16:41
  5. Proper way to #include Qt?
    By pherthyl in forum Qt Programming
    Replies: 1
    Last Post: 11th August 2006, 03:15

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.