Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Using "open" methods in QPrintDialog and QFileDialog
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gkroeger
    wrote on last edited by
    #1

    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);
    printDialog.open(seismicCanvas, 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];
    
    printer->setResolution(resolution);
    
    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

    1 Reply Last reply
    0
    • G Offline
      G Offline
      gkroeger
      wrote on last edited by
      #2

      Bump... anyone?

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gkroeger
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved