QT QML在OK3399-C的linux系统下运行会卡死
OK3399-C的linux系统下QT启动qml程序会卡死,qt quick 界面不刷新main.cpp 代码如下:
#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}
main.qml代码如下:
import QtQuick 2.12
import QtQuick.Window 2.12
Window {
visible: true
width: 640
height: 480
//显示
Text{
id: textDateTime
text: currentDateTime();
clip: true
visible: true
anchors.centerIn: parent
}
//当前日期时间
function currentDateTime(){
return Qt.formatDateTime(new Date(), "yyyy-MM-dd hh:mm:ss");
}
//定时器
Timer{
id: timer
interval: 1000 //间隔(单位毫秒):1000毫秒=1秒
repeat: true //重复
onTriggered:{
textDateTime.text = currentDateTime();
}
}
Component.onCompleted: {
timer.start();
}
} https://blog.csdn.net/scottmvp/article/details/118927354?spm=1001.2014.3001.5501
请您浏览这篇文章,看能否解决您的问题,环境变量的相关配置写入到开机自启脚本即可。
页:
[1]