1
我正在將項目從Qt4遷移到Qt5,實際上我已完成遷移,但現在我必須遷移這些庫,並且遇到了一個問題,弄清楚:將項目從qt4遷移到qt5時沒有匹配的調用函數
..\qenc\ShapeLandPOI.cpp: In member function 'virtual void ShapeLandPOI::draw(QPainter*)':
..\qenc\ShapeLandPOI.cpp:74:92: error: no matching function for call to 'QMap<QString, ShapeAttribute>::iterator::iterator(QMap<QString, ShapeAttribute>::const_iterator)'
AttributeSet::iterator vItPOI = (AttributeSet::iterator)attributes.at(i).find("POI");
note: candidates are:QMap<Key, T>::iterator::iterator(QMap<Key, T>::Node*) [with Key = QString; T = ShapeAttribute; QMap<Key, T>::Node = QMapNode<QString, ShapeAttribute>]
inline iterator(Node *node) : i(node) { }
^
一個我得到下面的另一個錯誤後,但我認爲一旦上述錯誤的解決了這一不會是一個問題,儘管它可能有助於知道怎麼回事:
..\..\..\..\..\Qt5\5.2.1\mingw48_32\include\QtCore/qmap.h:423:16: note: no known conversion for argument 1 from 'QMap<QString, ShapeAttribute>::const_iterator' to 'QMap<QString, ShapeAttribute>::Node* {aka QMapNode<QString, ShapeAttribute>*}'
..\..\..\..\..\Qt5\5.2.1\mingw48_32\include\QtCore/qmap.h:422:16: note: QMap<Key, T>::iterator::iterator() [with Key = QString; T = ShapeAttribute]
inline iterator() : i(0) { }
^
這些是給出問題的兩條線:
AttributeSet::iterator vItPOI = (AttributeSet::iterator)attributes.at(i).find("POI");
AttributeSet::iterator vItPOI0 = (AttributeSet::iterator)attributes.at(i).find("POI0");
我誠實地不知道如何糾正這些行,以便它們匹配建議的候選功能。 我希望有人能夠對這個問題有所瞭解。 Thankyou。
編輯:我已經嘗試使用static_cast來代替,但它仍然是相同的錯誤。
Qt不喜歡你使用C風格明顯 –
@ratchetfreak但它不是我的錯,我沒有代碼它:(這就是爲什麼我們不能有好東西 – dasjkdj