zoukankan      html  css  js  c++  java
  • Qt:xml

    QString filePath = QString::fromStdString(kbd_public::CFileUtil::getCurModuleDir()) + QString("../../data/model/alarm_color_define.xml");
        QDomDocument document;
        QFile file(filePath);
        if (!file.open(QIODevice::ReadOnly))
        {
            LOGINFO("loadColorConfig Failed!");
            return;
        }
        if (!document.setContent(&file))
        {
            file.close();
            return;
        }
        file.close();
    
    
        bool isFlash = false;
        QDomElement element = document.documentElement();
        QDomNode node = element.firstChild();
        while(!node.isNull())
        {
            QDomElement attr = node.toElement();
            if(!attr.isNull())
            {
                if(QString("Flash") == attr.tagName())
                {
                    isFlash = (bool)attr.attribute("alternate").toInt();
                }
                else if(QString("Level") == attr.tagName())
                {
                    int priority = attr.attribute("priority").toInt();
                    m_backgroundMap[priority] = QColor(attr.attribute("background_color"));
                    m_alternatingMap[priority] = QColor(attr.attribute("alternating_color"));
                    m_confirmMap[priority] = QColor(attr.attribute("confirm_color"));
    
    
                    m_activeTextMap[priority] = QColor(attr.attribute("active_text_color"));
                    m_confirmTextMap[priority] = QColor(attr.attribute("confirm_text_color"));
                }
                else if(QString("Select") == attr.tagName())
                {
                    m_selectBackgroundColor = QColor(attr.attribute("background_color"));
                    m_selectTextColor = QColor(attr.attribute("text_color"));
                }
                else if(QString("NoItem") == attr.tagName())
                {
                    m_emptyBackgroundColor = QColor(attr.attribute("background_color"));
                    m_emptyTipColor = QColor(attr.attribute("tips_color"));
                    m_emptyTip = tr("当前无报警!");
                }
            }
            node = node.nextSibling();
        }
    不为其他,只为快乐!
  • 相关阅读:
    前端 HTML
    python3内置函数
    内置函数的随机验证码
    线程、进程以及协程,上下文管理器
    线程池的定义方法
    python_控制台输出带颜色的文字方法
    while 循环 continue break 用法例子
    JVM 基础知识
    ios 设置状态栏文本颜色为白色
    ios 常用第三方库要加的framework,ARC的设置
  • 原文地址:https://www.cnblogs.com/1521299249study/p/11841500.html
Copyright © 2011-2022 走看看