Tag Archives: qt

Qt Failed opening project “xxx“: No plugin can open project type “text/plain“

After going out for a while, QT couldn’t open the project when he came back, so Baidu took it
it turns out that the plug-in is not enabled, so just check it
the top menu bar – help – about plug-ins
check QBs, qmake and support for project construction

Restart QT creator and try to build again. It is successful.

How to Solve QT and PCIe interactive loading setupapi.H error

Setupapi.H relies on these header files

#include <Windows.h>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <strsafe.h>
#include <stdint.h>
#include <SetupAPI.h>
#include <INITGUID.H>
#include <WinIoCtl.h>
//#include <AtlBase.h>
#include <io.h>
#include "xdma_public.h"
#include "pcie_fun.h"

1. The error is reported as follows:

the loading sequence of the adjustment header file is as follows:

#include <SetupAPI.h>
#include <strsafe.h>

About to #include & lt; strsafe.h> Put #include & lt; SetupAPI.h> Just behind.

2. Then continue to report an error

because it is not linked to the setupapi.lib library
Library location: C:\program files (x86)\Microsoft SDKs\windows\v7.1a\lib\setupapi.lib

Solution: load the library into the project.

1. Create a new lib folder under the project path, copy the library to the Lib folder, and add it in the project * * *. Pro

LIBS +=  -L$$PWD/lib/  -lSetupAPI

2. A simpler way is to add directly

LIBS += -lSetupAPI

[Solved] QT Programme Error: error: no matching function for call to…

The following error occurred in the binding mechanism between signal and slot function:

error: no matching function for call to 'Widget::connect(QPushButton*&, void (QAbstractButton::*)(bool), Widget*, <unresolved overloaded function type>)'

The reason for the error is that when making a response call, you do not know which function to call, indicating that function reuse occurs.

void classover();
void classover(QString food);

For the above two functions, you can mask one. Which one?

When signals correspond to slot functions, two characteristics need to be noted:
1. The parameter types of signals and slots must correspond one by one
2. The number of parameters of signals and slots can be different, but the number of signal parameters must be more than that of slot functions

To sum up, the nonparametric function is retained to achieve the correct result.

[Solved] error: ‘QStringLiteral’ was not declared in this scope

The following problem occurs with QT compilation:

error: ‘QStringLiteral’ was not declared in this scope
resmodel->setHorizontalHeaderLabels(QStringList()<<QStringLiteral(Name)<<QStringLiteral(Size));
^
QMetaObject::Connection connRet = QObject::connect(naManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*)));
error: ‘connRet’ was not declared in this scope
Q_ASSERT(connRet);
^
/usr/include/qt4/QtCore/qglobal.h:1940:32: note: in definition of macro ‘Q_ASSERT’
define Q_ASSERT(cond) ((!(cond)) ?qt_assert(#cond,FILE,LINE) : qt_noop())
error: ‘class QComboBox’ has no member named ‘setCurrentText’; did you mean ‘setCurrentIndex’?
CombBox->setCurrentText(curX);

There is a situation that is caused by using QT4 to compile code written in QT5 environment, some operating systems have both QT4, QT5, just switch to QT5 is fine
QT Creator “Tools” —- “Options” —- “build&run” – “Build Kit ( kit)”-“qt version” select QT5 on it

Error: one input ui-file must be specified [How to Solve]

QT designer installed   After success, install PIP anyway   install PyQt5   And pip   Install pyqt5 designer is useless

So consider whether the installation path of QT designer is wrong. Therefore, searching designer.exe in the folder unexpectedly found 2 files.

The first path has been used before, but the UI file cannot be converted to py file. The link below was replaced.

OK after running the test

Hope to help you!

JOM error 2 problem when qtcreator uses cmake to build a project

When qtcreator uses the MSVC compilation environment to build a project, a JOM: C: /… /… [cmtc_fe41e \ fast] error 2 error will occur due to incorrect configuration. Here are my solutions and understanding of this problem. I hope it can help small partners who encounter the same problem.

Error screenshot

Error reason

When qtcreator uses cmake to build a project, it will first test the environment configuration. If you have used cmake GUI or the command line to generate the corresponding project file (vs. vcxproj or Makefile, etc.) through cmakelists.txt, you will understand this process. Cmake uses the – g parameter to see which specific projects are supported, called cmake generators.

Cmake command line generates makefiles:
MD build
CD build
cmake – G “nmake makefiles JOM”…
#[[
… Indicates that cmakelists.txt is placed in the upper level directory. In this step, cmake will automatically detect the environment. If an error occurs, you cannot generate project files or makefiles
#]]
nmake

Cmake GUI: after setting, click Configure to generate if there is no problem

so the JOM error above is that cmake detects that the environment configuration is incorrect. At this time, you will see that qtcreator will not load the source file at all. Only one cmakelists.txt

open cmake’s error log file, and you will find that some tools needed in the construction process cannot be found:

“D:\Program Files (x86)\CMake\bin\cmake.exe” -E vs_ link_ exe
–intdir=CMakeFiles\cmTC_ 5b162.dir
–rc=rc
–mt=CMAKE_ MT-NOTFOUND
–manifests
– D:\PROGRA1\MICROS1.0\VC\bin\amd64\link.exe /nologo @CMakeFiles\cmTC_ 5b162.dir\objects1.rsp @C:\Users\ADMINI~1\AppData\Local\Temp\cmTC_ 5b162.exe.9516.577.jom

RC pass 1: command “RC/fo cmakefiles \ cmtc_5b162. Dir/manifest. Res cmakefiles \ cmtc_5b162. Dir/manifest. RC” failed (exit code 0) with the following output:
the system cannot find the specified file. jom: C:\Users\Administrator\AppData\Local\Temp\QtCreator-liCfaX\qtc-cmake-pToFXfXx\CMakeFiles\CMakeTmp\CMakeFiles\cmTC_ 5b162.dir\build.make [cmTC_5b162.exe] Error 2

jom: C:\Users\Administrator\AppData\Local\Temp\QtCreator-liCfaX\qtc-cmake-pToFXfXx\CMakeFiles\CMakeTmp\Makefile [cmTC_5b162\fast] Error 2

RC is rc.exe, and the resource compiler
MT is mt.exe

resolvent

It’s easy to know the cause of the error

First, add the path of jom.exe to the environment variable path
${QT installation directory} \ tools \ qtcreator \ bin

Then add the paths of rc.exe and mt.exe to the environment variable path
C: \ program files (x86) \ windows kits \ 10 \ bin \ 10.0.17763.0 \ x86
depending on the system version and 32-bit/64 bit, find out for yourself

When there are no problems, you can build the project

goldendict: error while loading shared libraries: libQt5Svg.so.5

In Ubuntu system, use the tool goldendict

goldendict: error while loading shared libraries: libQt5Svg.so.5: cannot open shared object file: No such file or directory

The reason is that the environment variable is not set. Solution:

1 find the libqt5svg. So. 5 path./opt/Netease/Netease cloud music/LIBS/libqt5svg. So. 5

2/etc/LD. So. Conf.d add a file goldendict.conf, which reads as follows
/opt/Netease/Netease cloud music/LIBS

3 execute the command to update the dynamic link library sudo ldconfig

The following is the reference address:
QT error resolution: error while loading shared libraries: libxxx.so

[Solved] Qt UpdateLayeredWindowIndirect failed for ptDst Error

Error encountered when setting QT window transparent shaded border:

The widget used in the code implementation is embedded with a frame, and the white background and fillet style settings are set for the frame

Then directly call the setgraphicseffect method on the widget to add the shadow effect, and the above error occurs.

Solution:

Remove the shadow setting of the widget and directly set the shadow on the frame, UI -> frame-> Setgraphicseffect calls shadow.

After testing, the above error printing will not appear again.

C++:error C2872: ‘byte‘: ambiguous symbol [How to Solve]

The reason is to merge two project programs written by others. There is no problem with separate testing. After merging, compile and report errors

After searching the data, it is suspected that it is related to the header file windows.H

#include<math.h>
#include <string>
#include <iostream>
#include <fstream>
#include <vector>
#include <windows.h> // Commented out to compile properly
#include <map>
#include <any>

My solution is to #include <windows.h> comment it out (the header file is not used in the code), and then it can run successfully. I didn’t delve into the specific reasons, mainly by referring to the reference materials at the end of the article.

[Solved] QT Warning: Slots named on_foo_bar are error prone

Problem phenomenon:

Cause:
this warning appears because when processing the signal slot relationship, we use “go-to slot” in the UI designer to make the program generate automatically
the weakness of this automatic generation is that one day, you may change the name of the control in the UI designer, but the compilation will not report an error. The program still runs normally, and the compilation does not prompt errors
in this way, the control is equivalent to not being connected to the slot function and becomes invalid.

Recommended solution:
recommendation 1: do not automatically generate signal slot connection through “go to slot” of UI designer. The relationship can be established manually. For example:
connect (toolbutton, & QPushButton:: clicked,
this, & yourclassname:: nameofyourslot)
recommendation 1: ignore this warning and just ignore it. Because this is just a kind reminder.