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

How to output debug from ModelTest helper class ?



  • Hey

    I'm trying to debug my model but I'm hitting a wall with its output. When I look in to source it has stuff like :

       qCDebug(lcModelTest) << "rowsInserted"
                             << "start=" << start << "end=" << end << "parent=" << parent
                             << "parent data=" << model->data(parent).toString()
                             << "current count of parent=" << model->rowCount(parent);
    
    

    But none of it gets printed for me, how do I enable it?
    model > https://wiki.qt.io/Model_Test

    TIA


  • Lifetime Qt Champion

    Hi,

    Please check the QLoggingCategory documentation.



  • @SGaist Yes I did but the modelTest creates its own category > Q_LOGGING_CATEGORY(lcModelTest, "qt.modeltest") and I have no idea how to enable it or what. I have installed my own qInstallMessageHandler() and made sure that default() always prints whatever gets sent to it. But it looks like nothing get sends to it at all.


    Ok looks like I need to run this :

    QLoggingCategory::setFilterRules("qt.modeltest.debug=true\n");//qt.modeltest

Log in to reply