Results 1 to 4 of 4

Thread: subclasing a Qlist?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Posts
    39
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1

    Default subclasing a Qlist?

    i have problems when i try to use the iterator with a list an a custom class T. it seems that is out of scope.
    this is an example that explains better my point.
    Qt Code:
    1. include "t.h"
    2. include <QList>
    3. class p
    4. {
    5. public:
    6. void my_function();
    7. private:
    8. QList<T> list;
    9. }
    To copy to clipboard, switch view to plain text mode 
    in the implementation:
    Qt Code:
    1. T::my_funcion()
    2. {
    3. QList<T>::iterator it;//here it seems to be the problem,, because i think this class P, isnt the main class
    4. for(it=list.begin();it!=list.end();it++)
    5. {
    6. //at this time i an only avaible to do this
    7. list.at(i).show();//where show() is an public function of the object T
    8. }
    9. //obviouslly the compiler show the message warning that is not right to do this
    10. //thenn compiler doesnt do nothinhg and do not compile the program
    11. }
    To copy to clipboard, switch view to plain text mode 
    the main intention is to declare a object that use the QList class an declare function to work whit this class in the main class
    some help pleasa!!
    Last edited by wysota; 21st March 2010 at 08:58.

Similar Threads

  1. Copying an QList into a new, sorted QList.
    By Thomas Wrobel in forum Newbie
    Replies: 3
    Last Post: 11th January 2010, 18:27
  2. QList inside a QList
    By jano_alex_es in forum Newbie
    Replies: 2
    Last Post: 1st July 2009, 11:59
  3. QList: Out of memory - without having defined QList
    By miroslav_karpis in forum Qt Programming
    Replies: 1
    Last Post: 27th March 2009, 08:42
  4. QList<QList > question
    By SubV in forum Qt Programming
    Replies: 3
    Last Post: 25th July 2008, 15:14
  5. QList
    By sabeesh in forum Qt Programming
    Replies: 4
    Last Post: 21st September 2007, 19:32

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.