Problem Simple Encryptacion QT5
-
I happen http://qt-project.org/wiki/Simple_encryption encrypt using simple, when I compile with the new version get this error:
simplecrypt.cpp:-1: In member function 'QByteArray SimpleCrypt::encryptToByteArray(QByteArray)':
simplecrypt.cpp:73: error: variable 'QDataStream s' has initializer but incomplete type
simplecrypt.cpp:-1: In member function 'QString SimpleCrypt::encryptToString(const QString&)':
simplecrypt.cpp:111: error: 'fromAscii' is not a member of 'QString'
simplecrypt.cpp:-1: In member function 'QString SimpleCrypt::encryptToString(QByteArray)':
simplecrypt.cpp:118: error: 'fromAscii' is not a member of 'QString'
simplecrypt.cpp:-1: In member function 'QString SimpleCrypt::decryptToString(const QString&)':
simplecrypt.cpp:124: error: 'const class QString' has no member named 'toAscii'
simplecrypt.cpp:-1: In member function 'QByteArray SimpleCrypt::decryptToByteArray(const QString&)':
simplecrypt.cpp:141: error: 'const class QString' has no member named 'toAscii'
simplecrypt.cpp:-1: In member function 'QByteArray SimpleCrypt::decryptToByteArray(QByteArray)':
simplecrypt.cpp:189: error: variable 'QDataStream s' has initializer but incomplete type -
QString::toAscii() and QString::fromAscii() are now deprecated, but should still be there (they are replaced by QString::fromLatin1() and QString::toLatin1()). Anyway, that should not generate those errors. Do you include all the code from that example (all #includes), and do you have a valid .pro file? Did it work with Qt4? What compiler are you using?
-
This still looks like missing includes to me. Or possibly a broken package, if you use precompiled stuff.
Try building a minimal example that would use QDataStream and offending methods from QString to see if they work.
-
Deprecated members (as for instance QString::toAscii()) are disabled by default in Qt5 and can be enabled using "QT_DISABLE_DEPRECATED_BEFORE":http://qt-project.org/doc/qt-5.0/qtcore/qtglobal.html#QT_DISABLE_DEPRECATED_BEFORE.
-
(I'm the author of the SimpleCrypt you're referencing).
I have not updated to Qt5 yet, but it would be good to update the code to be usable on Qt5. I'll try to get around to do that, but if somebody else wants to step up to make the needed adjustments (preferably using the proper Qt 5 way, not by re-enabling decrecated features), then please go ahead!