Congratulations to our 2022 Qt Champions!

[SOLVED] Using "open" methods in QPrintDialog and QFileDialog

  • I'm confused about the syntax here. The documentation implies that the call to open makes the connection between the accepted() signal and the arguments to open. So I have

    @void SeismicCanvasWindow::showPrintDialog(){
    QPrintDialog printDialog(thePrinter, this);
    printDialog.setWindowModality(Qt::WindowModal);, SLOT(printCanvas(QPrinter*)));

    With the corresponding slot:

    void SeismicCanvas::printCanvas(QPrinter *printer){
    int resolution, i;
    QList<int> resolutions;

    resolution = printer->resolution();
    resolutions = printer->supportedResolutions();
    for(i=0; i< resolutions.size(); i++)
        if(resolutions[i] > resolution) resolution = resolutions[i];
    cerr <<"Printer resolution is set to:" << resolution <<"dpi\n";


    This crashes every time the print dialog is closed, with either ok or cancel buttons. Clearly I am doing something wrong, but I get no error that the signal and slot aren't connected.

    Any suggestions for my error?

    Thanks Glenn

  • Bump... anyone?

  • Qt 4.8.4 has fixed the bug that was causing this problem.

Log in to reply