Important: Please read the Qt Code of Conduct -

Different behavior of QPaint Print Text in different machines.

  • The is my Main GlPaint function
    @void DemoEntityManager::paintEvent(QPaintEvent* ev)
    newtonDemos* const mainWindow = (newtonDemos*) parent();


    // do all 2d drawing

    QPainter painter(this);

    //This is correct on all OS
    Print (painter, 14, 14, "FPS: %6.2f", fps);

    // This is correct on Widnows 7, Linux and Mac but wrong on Windows64 (what is wrong?)
    Print (painter, 14, 30, "Physics time (ms): %6.3f", m_physicsTime * 1000.0f);


    and this is the Print function
    @void DemoEntityManager::Print (QPainter& painter, int x, int y, const char *fmt, ... ) const
    va_list argptr;
    char string[2048];

    va_start (argptr, fmt);
    vsprintf (string, fmt, argptr);
    va_end( argptr );

    painter.drawText(x, y, tr(string));

    This work fine on an Window 7, Linux and Mac
    whoever when I test it on a win64 system the statics text is all over the place on the screen.

    the funny thing is that If I only call Print once, the Text is printed correct,
    Am I doing something incorrect?

    cleanup code to bare mimum tha reproduces the Bug on win64

  • hi julio, please also remove unnecessary code or commented out code from above code snip. easier for other readers to look at your code

  • Ok I edited to the bare minumum that can reproduce the Bug.
    Sorry about that.

    EDIT: Also fixed spellings

Log in to reply