嵌入式爱好者

查看: 8673|回复: 1

[Linux] QT QML在OK3399-C的linux系统下运行会卡死

[复制链接]

4

主题

4

帖子

54

积分

RK3399通行证

扫一扫,手机访问本帖
发表于 2021-9-9 10:03:41 | 显示全部楼层 |阅读模式
OK3399-C的linux系统下QT启动qml程序会卡死,qt quick 界面不刷新

main.cpp 代码如下:
#include <QGuiApplication>
#include <QQmlApplicationEngine>
&#160;
int main(int argc, char *argv[])
{
&#160;&#160;&#160; QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
&#160;
&#160;&#160;&#160; QGuiApplication app(argc, argv);
&#160;
&#160;&#160;&#160; QQmlApplicationEngine engine;
&#160;&#160;&#160; engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
&#160;&#160;&#160; if (engine.rootObjects().isEmpty())
&#160;&#160;&#160;&#160;&#160;&#160;&#160; return -1;
&#160;
&#160;
&#160;&#160;&#160; 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();
    }
}
回复

使用道具 举报

0

主题

89

帖子

282

积分

A40i/T3/T507/T527通行证i.MX6Q通行证i.MX6UL通行证i.MX8MM通行证i.MX8MP通行证RK3568通行证RK3399通行证LS1028A通行证LS1012A通行证LS1043A\46A通行证TCU通行证FDU产品通行证FCU1401通行证FCU1301通行证FCU11xx通行证FCU1201通行证FCU2201通行证FCU2301/FCU2302通行证FCU2401通行证5G转接卡通行证FCU3001通行证AM5718通行证Hi3519A通信证AM335x通行证i.MX RT通行证XX18通行证

发表于 2021-9-11 10:37:07 | 显示全部楼层
https://blog.csdn.net/scottmvp/article/details/118927354?spm=1001.2014.3001.5501
请您浏览这篇文章,看能否解决您的问题,环境变量的相关配置写入到开机自启脚本即可。
点评回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )

GMT+8, 2024-4-19 20:56

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表