QML Image: TLS initialization failed
-
I get the error: qrc:/main.qml:4:1: QML Image: TLS initialization failed for
Image
(line 4) when running the QML project below:import QtQuick 2.15 import QtQuick.Window 2.15 Image { id: europe width: 1000; height: 1000 source: "https://cdn.britannica.com/s:300x169,c:crop/67/367-050-0F839196/Europe.jpg" fillMode: Image.PreserveAspectFit Rectangle { x: 0; y: 950 color: "dodgerblue" height: 50 width: 1000 * europe.progress visible: europe.progress != 1 } }
-
You need to use OpenSSL in your project - link OpenSSL libs with your application and it should start working.
Some docs:
-
Yes, well there isn't any installed OpenSSL library on Windows :D
-
@qcoderpro said in QML Image: TLS initialization failed:
But I've installed OpenSSL using Qt!
But it's not a system-wide installation.
You mean I can't load an image from the Internet on Windows!?
You can. Just link OpenSSL to your project, or place OpenSSL DLLs close to the .exe.
-
- find where your OpenSSL installation is
- in your .pro file (I assume you're using qmake), add:
LIBS+=path/to/openssl/libs INCLUDEPATH+=path/to/openssl/include
-
I've installed both x64 and x86 versions of openssl but the kit I'm using to run the project is x64 so I add:
C:\Qt\Tools\OpenSSL\Win_x64\lib
But I'm using CMake. Can I add these two lines just like the .pro file of qmake in it?
LIBS += C:\Qt\Tools\OpenSSL\Win_x64\lib // (There's no 'libs' folder in the openssl directory) INCLUDEPATH += C:\Qt\Tools\OpenSSL\Win_x64\include
-
For cmake, you should use
FindOpenSSL
: https://cmake.org/cmake/help/latest/module/FindOpenSSL.html -
-
Hi,
Which version of OpenSSL are you using ?
-
That's the minimal cmake version required to build the project.
As for OpenSSL, the installer might tell you this.
The headers of the library. -
As for OpenSSL, the installer might tell you this.
The headers of the library.Or use QSslSocket::sslLibraryVersionString.
How to use it in my QML project?
I used it this way but that doesn't work!Component.onCompleted: { console.log(QSslSocket::sslLibraryVersionString) }
-
@qcoderpro said in QML Image: TLS initialization failed:
QSslSocket::sslLibraryVersionString
Use it in you main.cpp.
-
I included these two header files:
#include <iostream> #include <QSslSocket>
and this line in main.cpp:
std::cout<< "The openSSL version is: " << QSslSocket::sslLibraryVersionString << '\n'
In return I get this warning in the Issues window and nothing related to what I foresee in Application/Compile Output windows!
warning: address of function 'QSslSocket::sslLibraryVersionString' will always evaluate to 'true'
-
QSslSocket::sslLibraryVersionString
is a static function that you have to call. -
Except it should be the j release. You should ensure that this is the one used by your application.