The code i modified was located at openRPT/renderapp folder in your source code posted in sourceforge (i used the version 3.2.0, because the 3.2.1 code wasn’t uploaded to your sourceforge project).
I just had to modify the main.cpp file, adding the run-time switch to the ones you had already defined, using a boolean called autoPrint to add the feature I needed.
After reading the command line parameters, i added the autoPrint boolean to the renderWindow class, so it could be aware when the users want to print without prompting the QPrintDialog or not, and set it with the value false if -autoPrint wasn’t in the arguments received or true if it was.
The changes I made to the code who is responsible to show the window and make it print or not are in the next lines:
If autoPrint is true, we don’t need to show the renderWindow.
if (!pdfOutput and !autoPrint)
If autoprint or print is true, we have to print numCopies of the report
if(print or autoPrint) //AUTOPRINT
mainwin.filePrint( numCopies );
The rest of the modifications are located in the renderWindow class. (renderwindow.h and renderwindow.cpp).
In the renderwindow.h i added a boolean parameter so the window is aware of the election of the user (autoprint or not). I declared this parameter in the public section:
RenderWindow(QWidget* parent = 0, Qt::WindowFlags fl = 0);
bool _autoPrint; //AUTOPRINT
In the renderwindow.cpp the modifications are located just in the print function:
void RenderWindow::print(bool showPreview, int numCopies ) //AUTOPRINT
ORODocument * doc = pre.generate();
printer.setNumCopies( numCopies );
_printerName = QString::null;
PreviewDialog preview (doc, &printer, this);
if (preview.exec() == QDialog::Rejected)
if(pd.exec() == QDialog::Accepted)
as marked by the //AUTOPRINT comment, I added an if statement in which, if autoPrint is set, the report is directly printed without prompting the QPrintDialog. If autoPrint is not set, it just does the regular functionality
I attach a .zip with the three files i had to modify in your code.