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. When using QPainter and QPrinter, the message "Invalid parameter passed to C runtime function." is displayed.
QtWS25 Last Chance

When using QPainter and QPrinter, the message "Invalid parameter passed to C runtime function." is displayed.

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 383 Views
  • 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.
  • Q Offline
    Q Offline
    QtNewer
    wrote on last edited by
    #1

    When using QPainter and QPrinter in Qt 5.15.12 to print some content, the printed content is displayed normally, but the output window shows "Invalid parameter passed to C runtime function." I am seeking advice on where the problem lies. The source code is as follows:

    **void MainWindow::on_pushButton_clicked()
    {

    QPrinter ptr(QPrinter::PrinterResolution);
    QPainter painter;
        bool d=painter.begin(&ptr);
    
        if(!d)
        {
            return;
    
        }
    #painter.drawsomething()
        painter.end();
    

    }**
    the output window shows :
    250ceddc-58e1-4c4c-9e21-c0086119c9a7-image.png

    Pl45m4P 1 Reply Last reply
    1
    • Q QtNewer

      When using QPainter and QPrinter in Qt 5.15.12 to print some content, the printed content is displayed normally, but the output window shows "Invalid parameter passed to C runtime function." I am seeking advice on where the problem lies. The source code is as follows:

      **void MainWindow::on_pushButton_clicked()
      {

      QPrinter ptr(QPrinter::PrinterResolution);
      QPainter painter;
          bool d=painter.begin(&ptr);
      
          if(!d)
          {
              return;
      
          }
      #painter.drawsomething()
          painter.end();
      

      }**
      the output window shows :
      250ceddc-58e1-4c4c-9e21-c0086119c9a7-image.png

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by
      #2

      @QtNewer said in When using QPainter and QPrinter, the message "Invalid parameter passed to C runtime function." is displayed.:

      Qt 5.15.12

      From the screenshot I can tell that you are using Qt5.15.2 ;-)

      5.15.12 is a commercial version. Without the screen, you would get replies like
      "Since you have a commercial version and pay for it, ask the official support and dont post in user forum"

      ;-)

      @QtNewer said in When using QPainter and QPrinter, the message "Invalid parameter passed to C runtime function." is displayed.:

      The source code is as follows

      Is this all? What else do you do? Where does 1127, FromFileMap come from?


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      Q 1 Reply Last reply
      0
      • Pl45m4P Pl45m4

        @QtNewer said in When using QPainter and QPrinter, the message "Invalid parameter passed to C runtime function." is displayed.:

        Qt 5.15.12

        From the screenshot I can tell that you are using Qt5.15.2 ;-)

        5.15.12 is a commercial version. Without the screen, you would get replies like
        "Since you have a commercial version and pay for it, ask the official support and dont post in user forum"

        ;-)

        @QtNewer said in When using QPainter and QPrinter, the message "Invalid parameter passed to C runtime function." is displayed.:

        The source code is as follows

        Is this all? What else do you do? Where does 1127, FromFileMap come from?

        Q Offline
        Q Offline
        QtNewer
        wrote on last edited by
        #3

        Sorry, I made a mistake in my writing, it's actually Qt5.15.2 ;-)
        The message '1127, FromFileMap' is displayed when running any default "Qt Widgets Application" program and it has been like this since Qt4, though I don't know why.
        There is no other code in this program; I just added a QPushButton to a default “Qt Widgets Application” and connected it to the on_pushButton_clicked() slot. When I click the button, "Invalid parameter passed to C runtime function." is displayed.:

        I tried to locate the problem and found that it is at the line "bool d=painter.begin(&ptr);", but I can't debug into the Qt source code."

        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