Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QMl display hexadecimal



  • Hi friends,

    I am sending int value from c++ to Qml i want to display in hex in QMl how can i do and want pass Whole structure from c++ to Qml any possible solution.


  • Moderators

    @satyanarayana143 said in QMl display hexadecimal:

    I am sending int value from c++ to Qml i want to display in hex in QMl how can i do

    hexString = yourNumber.toString(16);
    

    and want pass Whole structure from c++ to Qml any possible solution.

    possible, more information is required



  • how to pass structure filled with data fromm c++ and display in QML



  • @satyanarayana143 can you share some code? What is the structure that you mention? What exactly do you want to do with the data on the QML side?



  • In Main.cpp
    qmlRegisterType<PowerQualityMain>("PowerQualityMain",1,0,"PowerQualityMain");

    In PowerQualityMain .h

    typedef struct
    {
    /* Power Quality Statistics */
    uint32_t avrms;
    uint32_t bvrms;
    uint32_t cvrms;
    uint32_t avrmsone;
    uint32_t bvrmsone;
    uint32_t cvrmsone;
    }RegDataBuffer;

    RegDataBuffer m_pRegDataBuffer;
    Updatedat8ksps m_pUpdatedat8ksps;

    In PowerQualityMain .cpp filled data to structure

    m_pRegDataBuffer.birms = m_pUpdatedat8ksps.birms;
    m_pRegDataBuffer.cirms = m_pUpdatedat8ksps.cirms;
    m_pRegDataBuffer.avrms = m_pUpdatedat8ksps.avrms;
    m_pRegDataBuffer.bvrms = m_pUpdatedat8ksps.bvrms;
    m_pRegDataBuffer.cvrms = m_pUpdatedat8ksps.cvrms;

    In Qml i tried to display like this not Working
    PowerQualityMain
    {
    id:m_pPowerQualityMain
    console.log("m_pRegDataBuffer.cvrms",(m_pPowerQualityMain.m_pRegDataBuffer.cvrms)
    }

    how to display in Qml



  • satyanarayana143 18 minutes ago
    In Main.cpp
    qmlRegisterType<PowerQualityMain>("PowerQualityMain",1,0,"PowerQualityMain");

    In PowerQualityMain .h

    typedef struct
    {
    /* Power Quality Statistics */
    uint32_t avrms;
    uint32_t bvrms;
    uint32_t cvrms;
    uint32_t avrmsone;
    uint32_t bvrmsone;
    uint32_t cvrmsone;
    }RegDataBuffer;

    RegDataBuffer m_pRegDataBuffer;
    Updatedat8ksps m_pUpdatedat8ksps;

    In PowerQualityMain .cpp filled data to structure

    m_pRegDataBuffer.birms = m_pUpdatedat8ksps.birms;
    m_pRegDataBuffer.cirms = m_pUpdatedat8ksps.cirms;
    m_pRegDataBuffer.avrms = m_pUpdatedat8ksps.avrms;
    m_pRegDataBuffer.bvrms = m_pUpdatedat8ksps.bvrms;
    m_pRegDataBuffer.cvrms = m_pUpdatedat8ksps.cvrms;

    In Qml i tried to display like this not Working
    PowerQualityMain
    {
    id:m_pPowerQualityMain
    console.log("m_pRegDataBuffer.cvrms",(m_pPowerQualityMain.m_pRegDataBuffer.cvrms)
    }

    how to display in Qml


Log in to reply