Guest User

Untitled

a guest
Oct 20th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1.  
  2.  
  3.     void Widget::render()
  4.     {
  5.         QImage *tex = new QImage();
  6.         QPainter painter(tex);
  7.         int lastZ   = 0;
  8.         int z       = 1;
  9.         while (lastZ < z)
  10.         {
  11.             bool found  = false;
  12.             for (int i = 0; i < cWidgets.length(); i++)
  13.             {
  14.                 Widget *act     = cWidgets.at(i);
  15.                 int actZ            = act->zIndex();
  16.                 if (actZ == z)
  17.                 {
  18.                     Point pos       = act->globalPos();
  19.                     painter.drawImage(QPoint(pos.x(), pos.y()), *act->paint());
  20.                     found           = true;
  21.                 }
  22.             }
  23.             if (found)
  24.             {
  25.                 lastZ   = z;
  26.                 z++;
  27.             }
  28.             else
  29.             {
  30.                 lastZ   = z;
  31.             }
  32.         }
  33.     }
Add Comment
Please, Sign In to add comment