[Interest] Console output on OS X

Sherif Ghali sherif.ghali.1 at gmail.com
Fri May 11 01:21:59 CEST 2012


If I run the following program with a command-line parameter of 0.0 on
Windows, the message
    QPainterPath::lineTo: Adding point where x or y is NaN or Inf, ignoring call
is printed on the console.

How should the project file or the program be modified to be able to
see the same message in a Terminal window under OS X? Experimenting
with qInstallMsgHandler() does not solve the problem. Also, some
references indicate that it is necessary to run OS X's Console to see
these diagnostic messages. I see the diagnostics in Console for
programs that crash, but not for warning messages.

Sherif


# console_output.pro
TEMPLATE    = app
CONFIG     += console debug
mac:CONFIG -= app_bundle

SOURCES = console_output.cpp


// console_output.cpp
#include <QtGui>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QPrinter printer;
    printer.setOutputFileName("rect.pdf");
    printer.setPaperSize(QSizeF(400,300), QPrinter::Point);
    printer.setFullPage(true);

    QPainter painter(&printer);
    painter.setPen(QPen(Qt::black, 4));
    painter.drawRect(QRectF(40, 40, 320, 220));

    const qreal d = (argc == 2) ? atof(argv[1]) : 1.0;
    painter.drawLine(QPointF(40.0, 40.0),
                     QPointF(360.0, 260.0 / d));
}



More information about the Interest mailing list