Results 1 to 3 of 3

Thread: Big problem with QVector::apend() function

  1. #1
    Join Date
    Apr 2010
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Big problem with QVector::apend() function

    Hello everybody, i am encoutering a problem using the append/push_back funtcion of Qvector:

    Doing this with the std works:
    Qt Code:
    1. testclass test(&j); // just to try the declaration of one object
    2. vector<testclass> table(1,testclass(&j));
    3. table.push_back(&j);
    To copy to clipboard, switch view to plain text mode 

    Now doing this with Qt doesn't work:
    Qt Code:
    1. QVector<testclass> table(1,testclass(&j));
    2. table.push_back(&j);
    To copy to clipboard, switch view to plain text mode 
    Code blocks said :
    error: no matching function for call to `testclass::testclass()' (error on line 2)
    But i don't understand were the programm does such a call ( with no argument to the constructor )

    If anybody can help me.. this would be great....
    thks

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Big problem with QVector::apend() function

    What is j? and is textclass a subclass of QWidget? If so, you have to store pointers.

  3. #3
    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: Big problem with QVector::apend() function

    Your code doesn't make much sense, you know...
    You have a vector of objects and you are trying to push a pointer into it. Are you 100% sure this works with std::vector?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. SOLVED: QVector<QWidget*> problem
    By vectori in forum Qt Programming
    Replies: 3
    Last Post: 7th July 2009, 12:20
  2. QVector.push_back problem...
    By luche in forum Newbie
    Replies: 2
    Last Post: 11th January 2009, 02:22
  3. Problem regarding QVector
    By sudheer168 in forum Qt Programming
    Replies: 1
    Last Post: 6th December 2008, 11:56
  4. Problem with qvector
    By zorro68 in forum Qt Programming
    Replies: 1
    Last Post: 23rd February 2008, 01:02
  5. QVector problem
    By kingslee in forum Qt Programming
    Replies: 5
    Last Post: 19th October 2006, 10:42

Tags for this Thread

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.