Results 1 to 20 of 20

Thread: dynamic matrix of QStrings

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    Join Date
    Jul 2006
    Posts
    36
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 1 Time in 1 Post

    Default Re: dynamic matrix of QStrings

    Qt Code:
    1. //Q2DVector.h
    2. #include <QVector>
    3.  
    4. template <class type>
    5. class Q2DVector : public QVector< QVector<type> >
    6. {
    7.  
    8. public:
    9. Q2DVector() : QVector< QVector<type> >(){};
    10. Q2DVector(int rows, int columns) : QVector< QVector<type> >(rows) {
    11. for(int r=0; r<rows; r++) {
    12. this[r].resize(columns);
    13. }
    14. };
    15. virtual ~Q2DVector() {};
    16. };
    17. typedef Q2DVector<QString> Q2DQStringVector;
    18. typedef Q2DVector<int> Q2DQIntVector;
    To copy to clipboard, switch view to plain text mode 
    nothing in Q2Dvector.cpp
    Qt Code:
    1. //main.cpp
    2.  
    3. ...
    4. Q2DQStringVector myStringMatrix(P,Q);
    5. ...
    6. myStringMatrix[i][j]= someString;
    7. ...
    To copy to clipboard, switch view to plain text mode 


    I have got
    Unhandled exception at 0x004244e0 in APP.exe: 0x80000001: Not implemented
    Last edited by QiT; 3rd April 2007 at 15:12.
    power of mind > mind of power

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.