QCA Report “Failed to load Legacy provider” - c++

windows 10 install:
vs2019
Win64OpenSSL-3_0_5
qca-2.3.4
qt-5.15.2
using cmake build and install to qt directory
then I test the library.
bool temp = QCA::isSupported("cert", QStringLiteral("qca-ossl"));
the program exit here,and report “Failed to load Legacy provider”
note,this code used by qgis.
the program load dll correctly!
QCA::Initializer init;
QCoreApplication app(argc, argv);
QCA::scanForPlugins();
bool temp4s = QCA::isSupported("sha224", QStringLiteral("qca-ossl"));

Related

"Failed to setup resampler" when starting QAudioSink

I'm porting some QtMultimedia code from Qt 5.15 to 6.4.1. The following program, when built with Qt 6.4.1 on Windows:
int main (int argc, char *argv[]) {
QCoreApplication a(argc, argv);
QAudioDevice device = QMediaDevices::defaultAudioOutput();
QAudioFormat format = device.preferredFormat();
QAudioSink *output = new QAudioSink(device, format);
output->start();
return a.exec();
}
Fails to start the audio output, printing the following message:
qt.multimedia.audiooutput: Failed to setup resampler
The equivalent code in Qt5 (using QAudioDeviceInfo and QAudioOutput) seems to run fine. What am I missing here?
Apparently, it's a bug in Qt 6.4.1 on Windows, where, as the user johnco3 discovered in that forum post, for some reason QAudioSink is looking for a DLL named "mfplat.dll.dll" when it should be looking for "mfplat.dll" (it adds an extra ".dll" suffix).
The correctly named version of this DLL lives in the Windows system directory (e.g. C:\Windows\System32\mfplat.dll), so there are a couple of workaround until the bug is fixed:
Go back to Qt 6.4.0, apparently it's a new issue in 6.4.1, or
Copy mfplat.dll to somewhere in the DLL path then rename it to "mfplat.dll.dll":
Either copy it to the application executable's directory and rename it there, or
Create some folder somewhere, copy and rename it there, then add that folder to the PATH environment variable.
It's a somewhat silly bug, but alas. At least the workaround exists and can be easily undone when the bug is eventually fixed.
See also:
https://bugreports.qt.io/browse/QTBUG-108383 (johnco3's bug report)
https://bugreports.qt.io/browse/QTBUG-108669 (a duplicate bug report; I filed it before I found any of this)

Qt plugin not loaded

I have problems loading the built-in plugins for iconengines for a deployed application. Below is a minimal program to show the problem. It is not exactly the same, because Qt scans the plugin directories at start and registers it according to the file suffix, but I hope when I can get the minimal program to run, then the automatic scanning works, too.
main.cpp:
#include <QCoreApplication>
#include <QPluginLoader>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QPluginLoader loader("C:/Qt/5.15.1/msvc2019_64/plugins/iconengines/qsvgicon.dll");
if (loader.load()) {
qDebug() << "load ok";
} else {
qDebug() << "load failed";
}
return a.exec();
}
and PluginTest.pro:
QT -= gui
CONFIG += c++11 console
CONFIG -= app_bundle
SOURCES += main.cpp
When I start it from the Qt Creator IDE, version 4.13.1, with Visual Studio 2019, 64 bit compiled, it prints "load ok". Now I do this from a "x64 Native Tools Command Prompt for VS 2019" command prompt in the project directory:
set PATH=%PATH%;C:\Qt\5.15.1\msvc2019_64\bin
mkdir deploy
copy release\PluginTest.exe deploy
windeployqt --release release\PluginTest.exe --plugindir deploy\QtPlugins
When I start PluginText.exe from the command prompt in the deploy directory, I get the output "load failed".
Additional information: when I set set qt_debug_plugins=1 and start the real application, I see these errors:
QFactoryLoader::QFactoryLoader() checking directory path "C:/projects/deploy/QtPlugins/iconengines" ...
QFactoryLoader::QFactoryLoader() looking at "C:/projects/deploy/QtPlugins/iconengines/qsvgicon.dll"
"Failed to extract plugin meta data from 'C:/projects/deploy/QtPlugins/iconengines/qsvgicon.dll'"
not a plugin
The qsvgicon.dll file is identical to "c:\Qt\5.15.1\msvc2019_64\plugins\iconengines\qsvgicon.dll".
I found the problem. It used some other Qt DLLs from the path when starting the application. This fixed it:
xcopy /y c:\Qt\5.15.1\msvc2019_64\bin\*.dll deploy

C++ build error in Netbeans using MinGW and Qt

I have installed the MinGW compiler and I am attempting to run a C++ QT Application from within Netbeans.
As you can see from this screenshot, I have successfully set up the native build tools using Netbeans:
Unfortunately when attempting to run my program, I get the following error:
make.exe": /bin/sh: Command not found
make.exe": /bin/sh: Command not found
make.exe": *** [.validate-impl] Error 127
BUILD FAILED (exit value 2, total time: 303ms)
Just to be clear, I am not running a complicated program, in fact, I am just trying to execute a basic generated main file:
#include <QApplication>
int main(int argc, char *argv[]) {
// initialize resources, if needed
// Q_INIT_RESOURCE(resfile);
QApplication app(argc, argv);
// create and show your widgets here
return app.exec();
}
You can download my Makefile-Debug and Makefile-impl here: http://wikisend.com/download/467700/makefiles.zip
I would be extremely grateful for your help.

qt connect to oracle database on windows

On Windows 7 I installed qt creator and now I am trying to connect to the oracle database. I installed oracle client and plsql/developer and everything works fine. In qt creator I have error:
QsqlDatabase: QOCI driver not loaded
This qt documentation does not work for me. Is it clear tutorial how to do it on different platforms and situations?
Ok. I found solution.
Documentation says
set INCLUDE=%INCLUDE%;c:\oracle\oci\include
set LIB=%LIB%;c:\oracle\oci\lib\msvc
cd %QTDIR%\src\plugins\sqldrivers\oci
qmake oci.pro
nmake
If you are not using a Microsoft compiler, replace nmake with make in
the line above.
but make or nmake didn't work for me. Because I have not installed Microsoft Visual c++ on my machine.
I made instruction how to do this:
At first don't forget to install qt sources. During the installation check Sources checkbox.
then download and install oracle client win32_11gR2_client.zip. choose Runtime option during installation.(even if you are using 64 bit os download 32 bit version on oracle client). It creates c:\app\user\product\client_1... directory
then open qt minGW command line(start ->all peograms -> qt[version] -> [version] -> MinGW [version] -> Qt [version] for Desktop MinGW [version]) and move to the oci source folder:
cd C:\Qt\Qt[version]\[version]\Src\qtbase\src\plugins\sqldrivers\oci
then as documentation says include OCI(Oracle call interface) path and library:
set INCLUDE=%INCLUDE%;c:\app\user\product[version]\client_1\oci\include
set LIB=%LIB%;c:\app\user\product[version]\client_1\oci\lib\msvc
5.compile oci driver by executing these two lines:
qmake oci.pro
mingw32-make
it will creates two .dll files for you qsqloci.dll(release version) and qsqlocid.dll(debug version)
last step is to copy these two files into qtcreator installation folder.
go to the:
C:\Qt\Qt[version]\[version]\Src\qtbase\plugins\sqldrivers
and copy these files into:
C:\Qt\Qt[version]\[version]\mingw[version]\plugins\sqldrivers
and you are ready to go. to check connection try this code:
#include <QCoreApplication>
#include <QtSql>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QSqlDatabase db = QSqlDatabase::addDatabase("QOCI");
db.setHostName("MY_IP_OR_HOST_NAME");
db.setDatabaseName("XE");
db.setUserName("test");
db.setPassword("test_password");
if (!db.open())
{
qDebug() << db.lastError().text();
}
else{
qDebug() << "Wow opened";
}
return a.exec();
}
You should use QODBC instea of QOCI.
gogagubi's answer is good, but step 4 does not work for me because set INCLUDE and LIB does not work for mingw32-make.
It need to set INCPATH and LIBS in oci.pro or use:
qmake "INCPAH +=c:\app\user\product[version]\client_1\oci\include
LIBS +=-Lc:\app\user\product[version]\client_1\oci\lib\msvc" oci.pro
Add the following lines to the oci.pro:
INCPATH +=c:\app\user\product[version]\client_1\oci\include
LIBS+=-Lc:\app\user\product[version]\client_1\oci\lib\msvc
ciao tutto;
you can connect to oracle db with QODBC driver if it exist;(default in Qt windows is exist) Like below:
QSqlDatabase db=QSqlDatabase::addDatabase("QODBC");
db.setConnectOptions();
db.setDatabaseName("Driver={Microsoft ODBC for Oracle};Server=127.0.0.1:1521;Uid=ep;Pwd=605605");
if(!db.open())
exit(0);
QSqlQuery query(db);
query.exec("select * from t");
while(query.next())
QMessageBox::information(0,"",query.value(1).toString());
this is connected and allow to execurte query;
buona fortuna;

Compiler can't find ui_xyz.h file

I've install Netbeans 7.2 and Qt 5 on Windows7. Everything compiles fine.
But recently when I create a Qt form and try to use it in this way:
New Project > C/C++ Qt Application > Finish
Right click on new Qt project > New > Qt Form > Finish
After saving ui file in Designer
This error appears:
newForm.h:11:24: fatal error: ui_newForm.h: No such file or directory
The content of main.cpp is :
#include <QGuiApplication>
#include "newForm.h"
int main(int argc, char *argv[])
{
// initialize resources, if needed
// Q_INIT_RESOURCE(resfile);
QGuiApplication app(argc, argv);
// create and show your widgets here
return app.exec();
}
I tried to manually create ui_xwz.h file and add it to my project. But I want it work automatically as same as before. How can I solve it?
I have a ridiculous solution, Maybe we should report it as a bug to Netbeans or Qt.
Go and active QtSVG and QtXml modules of your project and rebuild it. I tested this way and the problem vanished.