Results 1 to 9 of 9

Thread: vector of vector

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: vector of vector

    Quote Originally Posted by mickey
    if you referred to this, don't compile...
    If you want a vector of vectors of pointers to spin boxes you need:
    Qt Code:
    1. vector<QSpinBox*> sbx;
    2. vector< vector<QSpinBox*> > sb;
    3. sb.push_back(sbx); // no error
    To copy to clipboard, switch view to plain text mode 

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

    mickey (5th June 2006)

  3. #2
    Join Date
    Jan 2006
    Posts
    75
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: vector of vector

    Jacek,

    How does that work again? When setting an object equal to another object in c++, it doesn't call the copy constructor, but rather the operator =, right? So in either case we can't "copy" widgets? That is, even when evoking the copy constructor?

  4. #3
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: vector of vector

    Quote Originally Posted by kroenecker
    Jacek,

    How does that work again? When setting an object equal to another object in c++, it doesn't call the copy constructor, but rather the operator =, right? So in either case we can't "copy" widgets? That is, even when evoking the copy constructor?
    widgets can't be copied! All you can use is a pointer (or a reference depending what you want to do, but a pointer is better anyway) to them that can be used to modify them.
    Current Qt projects : QCodeEdit, RotiDeCode

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: vector of vector

    Quote Originally Posted by kroenecker
    So in either case we can't "copy" widgets?
    Yes, you can't copy widgets, but here you have a vector of pointers to widgets.

Similar Threads

  1. vector
    By mickey in forum General Programming
    Replies: 1
    Last Post: 26th May 2006, 19:57
  2. <vector> and new
    By mickey in forum General Programming
    Replies: 11
    Last Post: 18th May 2006, 15:27
  3. model conception
    By xavier in forum General Programming
    Replies: 7
    Last Post: 10th May 2006, 09:34
  4. vector of objects
    By mickey in forum General Programming
    Replies: 2
    Last Post: 8th May 2006, 20:13
  5. vector memory allocation
    By TheKedge in forum General Programming
    Replies: 1
    Last Post: 23rd March 2006, 17:27

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.