Results 1 to 2 of 2

Thread: How to copy/convert an array to QVector without iterating?

  1. #1
    Join Date
    Feb 2010
    Posts
    64
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default How to copy/convert an array to QVector without iterating?

    Hi guys,

    I want to copy the information from an array to a Qvector, I know it is simple by iterating the elements, but how to do it without iteration?

    I've tried memcpy function but it doesnt work

    Thanks

  2. #2
    Join Date
    Feb 2010
    Posts
    64
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to copy/convert an array to QVector without iterating?

    SOLVED:

    Qt Code:
    1. std::vector<double> auxVector;
    2. auxVector.assign(array, array + numberOfElementsInArray);
    3. m_myQVector.fromStdVector(auxVector);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. use QVector as 2 dimensional Array
    By umulingu in forum Qt Programming
    Replies: 3
    Last Post: 1st January 2010, 13:31
  2. QVector crashes when array size is big
    By Sheng in forum Qt Programming
    Replies: 49
    Last Post: 27th February 2009, 23:13
  3. QVector copy constructor
    By Caius Aérobus in forum Qt Programming
    Replies: 3
    Last Post: 3rd March 2008, 18:52
  4. how to copy QString content into array
    By eric in forum Qt Programming
    Replies: 12
    Last Post: 15th November 2007, 00:13
  5. QVector, containers, deep copy
    By TheKedge in forum Qt Programming
    Replies: 2
    Last Post: 23rd January 2007, 06:45

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.