Results 1 to 9 of 9

Thread: 2D array in Qt: QVector or QList

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2017
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: 2D array in Qt: QVector or QList

    i want to creat a two-dimensional QVector of QLine which means in front of each line another line:

    for(int i=0;i<symZqaq.size();i++)
    {
    QVector<QLineF> sym;
    sym.append(L4);
    sym.append(L5);
    sym.append(L29);
    sym.append(L25);
    sym.append(L42);
    sym.append(L26);
    sym.append(L28);
    sym.append(L31);
    sym.append(L36);
    sym.append(L44);
    symZqaq.append(sym);
    }
    for(int i=0;i<symZqaq.size();i++)
    {
    for(int j=0;j<symZqaq[i].size();i++)
    {
    symZqaq.append(L9);
    symZqaq.append(L12);
    symZqaq.append(L24);
    symZqaq.append(L30);
    symZqaq.append(L27);
    symZqaq.append(L43);
    symZqaq.append(L7);
    symZqaq.append(L2);
    symZqaq.append(L6);
    symZqaq.append(L3);
    }
    }
    the problem is in last loop for erreur : no matching function for call to 'QVector<QVector<QLineF> >:ush_back(QLineF&)'
    symZqaq.push_back(L9);

    any help plz

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,349
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    318
    Thanked 872 Times in 859 Posts

    Default Re: 2D array in Qt: QVector or QList

    no matching function for call to 'QVector<QVector<QLineF> >:: push_back(QLineF&)'
    "symZqaq" is a QVector of QVectors, not a QVector of QLines. You can't push a QLine onto symZqaq, only a QVector< QLine >. You did it correctly in the first loop. Use the same method in the nested loop.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. extracting QVectors from a multidimensional QVEctor array
    By OzQTNoob in forum Qt Programming
    Replies: 2
    Last Post: 23rd February 2012, 07:45
  2. QVector array declear
    By zhxys in forum Newbie
    Replies: 8
    Last Post: 2nd February 2011, 09:17
  3. Replies: 1
    Last Post: 4th August 2010, 17:13
  4. use QVector as 2 dimensional Array
    By umulingu in forum Qt Programming
    Replies: 3
    Last Post: 1st January 2010, 12:31
  5. QVector crashes when array size is big
    By Sheng in forum Qt Programming
    Replies: 49
    Last Post: 27th February 2009, 22:13

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.