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

How i can use Report Functionality in Qt As Like Microsoft Report Viewer



  • i am using Qt 5.12.3 Version
    And Kit Name Is : MSVC 2015 x64 Bit

    Description :
    i have data in MySQL and i want to generate Report based that Data
    also I want to display Report in Qt Control

    So please
    Help Me To Slove this Problem


  • Lifetime Qt Champion

    Hi,

    You might want to be more explicit about the kind of help you would like.


  • Lifetime Qt Champion



  • hello Friends

    i am try to generate report using QTRPT
    i am finished allmost work
    but Data dosen't display in report my code is :

    void Report_Time::on_btn_generate_clicked()
    {
    QSqlQuery query(db);
    query.prepare("SELECT * FROM test");
    if(!query.exec())
    {
    qDebug()<<"Error in Query"<<endl;
    }
    else
    {
    QtRPT *report = new QtRPT(this);
    while(query.next())
    {
    qDebug()<<query.value(0).toString()<<endl;
    qDebug()<<query.value(1).toString()<<endl;
    qDebug()<<query.value(2).toString()<<endl;

            report->loadReport(":/new/TestReport.xml");
            connect(report,&QtRPT::setValue,[&](const int recNo,
            const QString paramName, QVariant &paramValue, const int reportPage)
            {
                (void) reportPage;
                if(paramName == "id")
                {
                    paramValue=(((recNo)),query.value(0).toString());
                    qDebug()<<paramValue<<endl;
                }
                if(paramName == "name")
                {
                    paramValue=(((recNo)),query.value(1).toString());
                    qDebug()<<paramValue<<endl;
                }
                if(paramName == "city")
                {
                    paramValue=(((recNo)),query.value(2).toString());
                    qDebug()<<paramValue<<endl;
                }
            });
        }
        report->printExec();
    }
    

    }

    My Output Is :
    Screenshot (12).png


Log in to reply