Qt Error: 'Qt::AA_EnableHighDpiScaling' Must Be Set Before QCoreApplication Creation
This error message indicates that the attribute 'Qt::AA_EnableHighDpiScaling' needs to be set before creating an instance of 'QCoreApplication'.
To fix this issue, you should set the attribute before creating the 'QCoreApplication' object. Here's an example of how to do it:
#include <QCoreApplication>
#include <QApplication>
#include <QtGlobal>
int main(int argc, char *argv[])
{
// Set the attribute before creating the QCoreApplication or QApplication
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
// Create the QCoreApplication or QApplication object
// depending on whether you are using a GUI or console application
QApplication app(argc, argv);
// Rest of your code...
return app.exec();
}
Make sure to include the necessary headers ('QCoreApplication' and 'QtGlobal') and set the attribute before creating the 'QCoreApplication' or 'QApplication' object.
原文地址: https://www.cveoy.top/t/topic/pEYT 著作权归作者所有。请勿转载和采集!