February 22, 2011

julio jerez julio jerez
Lab Rat
43 posts

Different behavior of QPaint Print Text in different machines.


The is my Main GlPaint function

  1. void DemoEntityManager::paintEvent(QPaintEvent* ev)
  2. {
  3.  newtonDemos* const mainWindow = (newtonDemos*) parent();
  5.  makeCurrent();
  7.  // do all 2d drawing
  8.  glShadeModel(GL_FLAT);
  9.  glDisable(GL_CULL_FACE);
  10.  glDisable(GL_DEPTH_TEST);
  11.  glDisable(GL_LIGHTING);
  13.  QPainter painter(this);
  14.   painter.setPen(Qt::white);
  16.   //This is correct on all OS
  17.   Print (painter, 14, 14, "FPS: %6.2f", fps);
  19.   // This is correct on Widnows 7, Linux and Mac but wrong on Windows64 (what is wrong?)
  20.   Print (painter, 14, 30, "Physics time (ms): %6.3f", m_physicsTime * 1000.0f);
  22.  painter.end();
  23. }

and this is the Print function

  1. void DemoEntityManager::Print (QPainter& painter, int x, int y, const char *fmt, ... ) const
  2. {
  3.  va_list argptr;
  4.  char string[2048];
  6.  va_start (argptr, fmt);
  7.  vsprintf (string, fmt, argptr);
  8.  va_end( argptr );
  10.  painter.drawText(x, y, tr(string));
  11. }

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

2 replies

February 24, 2011

Deleted Member # 4a2 Deleted Member # 4a2
Ant Farmer
1274 posts

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

February 24, 2011

julio jerez julio jerez
Lab Rat
43 posts

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

EDIT: Also fixed spellings

  ‹‹ A little desperate as no advice works... Paint Problems and method strangeness      Is there really no way to move a QWidget into a new thread ››

You must log in to post a reply. Not a member yet? Register here!