Using NCReports in Qt



  • I've read the guide that came with the NCReports installer, looked at the demos inside it too but I just cannot understand on how to make it work...

    What I did was:

    Design a report in NCReport Designer

    Tried to integrate it into my .pro file

    but when I try to run it, the preview shows nothing..

    This is the part of the code when I use NcReport. I used the same test data and the same report file as in the demo but it still shows nothing...
    @void ChairMenu::on_generateFacListReport_clicked()
    {

    NCReport *report = new NCReport();
    
    //-------------------------------------------
    // TEST STRINGLIST DATASOURCE
    //-------------------------------------------
    QStringList list;
    list << "24\tRenate Moulding\tDesert Hot Springs,CA\t1\t2008-01-01";
    list << "78\tAlfred Muller\tMiami Beach, FL\t1\t2008-01-03";
    list << "140\tAngela Merkel\tMunchen, Germany\t1\t2008-01-07";
    list << "139\tBob Larson\tDallas, TX\t0\t2008-01-20";
    
    report->addStringList( list, "sl0" );
    
    report->setReportFile&#40; "C:\Program Files\NCReport\2.8.7.MinGW.eval\reports\stringlist_demo.xml"&#41;;
    report->runReport();
    
    NCReportOutput *output = new NCReportPreviewOutput();
    output->setAutoDelete( FALSE );
    report->setOutput( output );
    report->runReportToPreview();
    
    NCReportPreviewWindow *pv = new NCReportPreviewWindow();
    pv->setReport( report );
    pv->setOutput( (NCReportPreviewOutput*)output );
    pv->setWindowModality(Qt::ApplicationModal );
    pv->setAttribute( Qt::WA_DeleteOnClose );
    pv->show();
    

    }@



  • Hi tertel!
    try this:

    NCReport *report = new NCReport();
    QStringList list;
    list << "24\tRenate Moulding\tDesert Hot Springs,CA\t1\t2008-01-01";
    list << "78\tAlfred Muller\tMiami Beach, FL\t1\t2008-01-03";
    list << "140\tAngela Merkel\tMunchen, Germany\t1\t2008-01-07";
    list << "139\tBob Larson\tDallas, TX\t0\t2008-01-20";
    report->addStringList( list, "sl0" );
    report->setReportFile( "C:\Program Files\NCReport\2.8.7.MinGW.eval\reports\stringlist_demo.xml");
    report->runReportToPreview();
    NCReportPreviewWindow pv = new NCReportPreviewWindow();
    pv->setOutput( (NCReportPreviewOutput
    ) report->output() );
    pv->setWindowModality(Qt::ApplicationModal );
    pv->setAttribute( Qt::WA_DeleteOnClose );
    pv->show();



  • Guys, NCReports is commercial product is it? Are you using the open source edition from sourceforge.net?



  • Please I have a probleme with cross-table, I have attributed a datasource based on item-Model , but no thing is appeared .
    Thanks


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.