Closed Light-Wizzard closed 3 years ago
Here is the problem: toJson is not a member of QJsonObject
toJson
is a member of QOption
, not QJSon
. I can compile the project successfully using CMake.
But I think I know what the problem is. Are you probably using QMake? I noticed that I forgot to add qoption.cpp
and qoption.h
to qonlinetranslator.pri. Will fix it today after work or you can send a PR.
I used qmake, I need to convert to cmake since it is the future of Qt 6, add in qexample and it works great, I should have looked at cmake, it was in the path and pulling in the code at compile time but was not linking to it because it was not part of the project, and we call that Intellisence, you have to love it and qexample throw me off, it seems redundant and was throwing the same error, so it must be an example of how to extend your own class, and was no issue after adding in qoption and qexample to the pri.
Thanks, Flesh
Yes, I also switched to CMake. But QMake should also work now.
I get the following error in after adding QOnlineTranslator to my project:
The error is in this file: https://github.com/crow-translate/QOnlineTranslator/blob/master/src/qonlinetranslator.cpp
The lines involved are here:
QOption is defined here: https://github.com/crow-translate/QOnlineTranslator/blob/master/src/qoption.h
Here is the problem: toJson is not a member of QJsonObject
QOption: https://github.com/crow-translate/QOnlineTranslator/blob/master/docs/QOption.md
QJsonObject QOption::toJson()
toJson() is not a member of QJsonObject: https://doc.qt.io/qt-5/qjsondocument.html
QJsonDocument Class shows toJson as a Member: https://doc.qt.io/qt-5/qjsondocument.html, and that did not work due to this void QJsonArray::append(const QJsonValue&).
I only see that you added this function to it, but nothing after that, does anyone have an idea how to fix it, I am using the latest Qt Creator.
Thanks, Flesh