QtRpt report from Databse
Solved
QML and Qt Quick
-
Hello,
This problem is solved.here is the right code.
void MainWindow::on_btnGenrateReport_clicked() { QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName("/home/gtek/Work/validscan_proj/validscan_db"); if(!db.open()) { qDebug()<<"Database not Open"<<endl; } else { QSqlQuery qry; qry.prepare("select * from vs_channel"); if(!qry.exec()) { qDebug()<<"Error in Query"<<endl; } else { QtRPT *report = new QtRPT(this); while(qry.next()) { p = new pojo(); p->setChannel_id(qry.value(12).toString()); p->setChannel_tag(qry.value(1).toString()); p->setUnit(qry.value(6).toString()); plist.push_back(p); } report->loadReport(":/chreport.xml"); report->recordCount.append(plist.count()); connect(report,&QtRPT::setValue,[&](const int recNo, const QString paramName, QVariant ¶mValue, const int reportPage) { (void) reportPage; if(paramName=="channel_id") { paramValue=plist[recNo]->getChannel_id(); } if(paramName=="channel_tag") { paramValue=plist[recNo]->getChannel_tag(); } if(paramName=="unit") { paramValue=plist[recNo]->getUnit(); } }); report->printExec(); } } }
I had created one pojo class for getter setter method.
-
@Mahesh-Arrajella The official web site of QtRPT project here http://www.qtrpt.tk
-
-
@ali-aydin there are none officially provided by the Qt Company. QtRpt is one well known. AFAIK, they have moved their website.
-
That's not enough information. Please open your own thread about that issue and provide complete information like Qt version used, platform, QtRpt version and full error output.
-
@aha_1980 Unfortunately the link http://www.qtrpt.tk is no more working.
To get official source of the project please use
https://sourceforge.net/p/qtrpt/discussion/general/