Results 1 to 2 of 2

Thread: Error with QMap

  1. #1
    Join Date
    Jul 2006
    Posts
    126
    Thanks
    17
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Error with QMap

    Hi,

    I have this problem with this function:

    Qt Code:
    1. void ImageLandmarkProxyModel::countRowsInserted(const QModelIndex &parent, int start, int end) const
    2. {
    3. const int idImageColumn=sourceModel()->column(
    4. ImageLandmarkTableModel::IdImage);
    5. const int idPointColumn=sourceModel()->column(
    6. ImageLandmarkTableModel::IdPoint);
    7. qDebug()<<"Rows inserted";
    8. for(int i=start;i<=end;i++)
    9. {
    10. QModelIndex col1=sourceModel()->index(i, idImageColumn);
    11. QModelIndex col2=sourceModel()->index(i, idPointColumn);
    12. bool ok;
    13. int id=col1.data().toInt(&ok);
    14. Q_ASSERT(ok);
    15. if(m_rowCount.contains(id)){
    16. m_rowCount[id]=1;
    17. // m_rowCount[id]=m_rowCount.value(id)+1;
    18. }
    19. else{
    20. // m_rowCount.insert(id, col2.data().isNull() ? 0 : 1);
    21. }
    22. }
    23. qDebug()<<m_rowCount;
    24. }
    To copy to clipboard, switch view to plain text mode 
    src\imagelandmarkproxymodel.cpp:101: error: non-lvalue in assignment

    in line: m_rowCount[id]=1;

    m_rowCount is a QMap<int,int>

    Thanks

  2. #2
    Join Date
    Jul 2006
    Posts
    126
    Thanks
    17
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Error with QMap

    Solved the problem was that I use const in the function definition

Similar Threads

  1. QMap to keep the model statistcs
    By gyre in forum Newbie
    Replies: 14
    Last Post: 10th December 2007, 18:18
  2. QMap model data
    By gyre in forum Newbie
    Replies: 3
    Last Post: 9th December 2007, 22:19
  3. Qmap
    By phillip_Qt in forum Qt Programming
    Replies: 3
    Last Post: 23rd November 2007, 10:43
  4. QMap Problem with arguments.
    By ankurjain in forum Qt Programming
    Replies: 1
    Last Post: 24th May 2006, 12:12
  5. QMap destructor bug
    By Ruud in forum Qt Programming
    Replies: 6
    Last Post: 8th April 2006, 09:08

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.