代码拉取完成,页面将自动刷新
同步操作将从 王徐晓/serialQuickCore 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
//#include <QGuiApplication>
//#include <QQmlApplicationEngine>
//#include <qqmlengine.h>
//#include <qqmlcontext.h>
//#include <qqml.h>
//#include <QtQuick/qquickitem.h>
//#include <QtQuick/qquickview.h>
//#include <QFontDatabase>
//#include <QQmlContext>
//#include <QSettings>
//#include <QQuickStyle>
//#include <QIcon>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QSettings>
#include <QQuickStyle>
#include <QIcon>
#include <QFontDatabase>
#include <QtQuickControls2>
#include "qmlconncpp.h"
#include "../serialQuickCommon/globalobject.h"
qmlConnCpp qmlconncpp;
int main(int argc, char *argv[])
{
GlobalObject::objectInit();
qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
QGuiApplication::setApplicationName("Gallery");
QGuiApplication::setOrganizationName("QtProject");
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
//设置默认字体
QFont font;
font.setPixelSize(10);
font.setFamily("Microsoft YaHei");
app.setFont(font);
QIcon::setThemeName("gallery");
#if defined(Q_OS_WIN32)
QSettings settings;
QString style = QQuickStyle::name();
if (!style.isEmpty())
settings.setValue("style", style);
else
QQuickStyle::setStyle(settings.value("style").toString());//该代码在嵌入式系统中出错
#elif defined(Q_OS_LINUX)
#endif
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty("station", &station);
engine.rootContext()->setContextProperty("qmlconncpp", &qmlconncpp);
engine.rootContext()->setContextProperty("portlist", &portlist);
engine.rootContext()->setContextProperty("devicelist",&(devicelist));
engine.rootContext()->setContextProperty("hostlist",&(hostlist));
engine.rootContext()->setContextProperty("codelist",&(codelist));
#if defined(Q_OS_WIN32)
engine.rootContext()->setContextProperty("availableStyles", QQuickStyle::availableStyles());//该代码在嵌入式系统中出错
#elif defined(Q_OS_LINUX)
#endif
engine.load(QUrl("qrc:/serialQuickDemo/gallery.qml"));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}
//int main(int argc, char *argv[])
//{
// GlobalObject::objectInit();
// qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
// QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
// QGuiApplication app(argc, argv);
// //设置默认字体
// QFont font;
// font.setPixelSize(10);
// font.setFamily("Microsoft YaHei");
// app.setFont(font);
// QIcon::setThemeName("gallery");
// //qmlRegisterType<SerialPort>("an.qt.mySerialPort",1,0,"SerialPort");
// //qmlRegisterType<SerialPortHelper>("an.qt.mySerialPortHelper",1,0,"SerialPortHelper");
// //qRegisterMetaType<DeviceList>("DeviceList");
// //qRegisterMetaType<QList<Device>>("QList<Device>");
// //qmlRegisterType<Station>("an.qt.Station",1,0,"Station");
// //调试出系统字体列表
//// QFontDatabase database;
//// foreach (const QString &family, database.families(QFontDatabase::SimplifiedChinese))
//// {
//// qDebug()<<family;
//// }
// QSettings settings;
// QString style = QQuickStyle::name();
// if (!style.isEmpty())
// settings.setValue("style", style);
// else
// QQuickStyle::setStyle(settings.value("style").toString());
// QQmlApplicationEngine engine;
// engine.rootContext()->setContextProperty("station", &station);
// engine.rootContext()->setContextProperty("qmlconncpp", &qmlconncpp);
// engine.rootContext()->setContextProperty("portlist", &portlist);
// engine.rootContext()->setContextProperty("devicelist",&(devicelist));
// engine.rootContext()->setContextProperty("hostlist",&(hostlist));
// engine.rootContext()->setContextProperty("availableStyles", QQuickStyle::availableStyles());
// engine.load(QUrl("qrc:/serialQuickDemo/gallery.qml"));
// if (engine.rootObjects().isEmpty())
// return -1;
//// const QUrl url(QStringLiteral("qrc:/serialQuickDemo/gallery.qml"));
//// QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
//// &app, [url](QObject *obj, const QUrl &objUrl) {
//// if (!obj && url == objUrl)
//// QCoreApplication::exit(-1);
//// }, Qt::QueuedConnection);
//// engine.load(url);
// return app.exec();
//}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。