void ItemUser::paint( QPainter *painter, const QStyleOptionViewItem &option) const { drawBack( painter, option); int x = option.rect.x() + 5; int y = option.rect.y() + 2; int w = option.rect.width() - 10; int h = option.rect.height() - 4; int height_user = HeightUser-4; painter->setPen( clrTextMain( option) ); if( permanent) painter->setFont( afqt::QEnvironment::f_name); else painter->setFont( afqt::QEnvironment::f_info); painter->drawText( x, y, w, h, Qt::AlignLeft | Qt::AlignTop, strLeftTop); painter->setPen( clrTextInfo( option) ); painter->setFont( afqt::QEnvironment::f_info); painter->drawText( x, y, w, height_user, Qt::AlignLeft | Qt::AlignBottom, strLeftBottom ); painter->drawText( x, y, w, height_user, Qt::AlignHCenter | Qt::AlignTop, strHCenterTop ); painter->drawText( x, y, w, height_user, Qt::AlignRight | Qt::AlignBottom, strRightBottom ); painter->setPen( afqt::QEnvironment::qclr_black ); painter->drawText( x, y, w, height_user, Qt::AlignRight | Qt::AlignTop, strRightTop ); if( false == annotation.isEmpty()) painter->drawText( x, y, w, h, Qt::AlignBottom | Qt::AlignHCenter, annotation ); { // draw stars: static const int stars_size = 8; static const int stars_height = 21; static const int stars_left = 35; static const int stars_maxdelta = stars_size * 2 + 5; int quantity = numrunningtasks; //quantity = 155; if( quantity > 0) { int numstars = quantity; int stars_right = w - 50; int stars_delta = (stars_right - stars_left) / numstars; if( stars_delta < 1 ) { stars_delta = 1; numstars = stars_right - stars_left; } else if( stars_delta > stars_maxdelta ) stars_delta = stars_maxdelta; int sx = x + stars_left; for( int j = 0; j < numstars; j++) { drawStar( stars_size, sx, y + stars_height, painter); sx += stars_delta; } painter->setFont( afqt::QEnvironment::f_name); painter->setPen( afqt::QEnvironment::clr_textstars.c); painter->drawText( x, y, w, HeightUser, Qt::AlignHCenter | Qt::AlignBottom, QString::number(numrunningtasks)); } } drawPost( painter, option); }
void drawContext::drawView() { OrthofFromGModel(); glMatrixMode(GL_MODELVIEW); // fill the background glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if(CTX::instance()->bgGradient){ glPushMatrix(); glLoadIdentity(); const GLfloat squareVertices[] = { (GLfloat)_top, (GLfloat)_left, 2*_far, (GLfloat)_top, (GLfloat)_right, 2*_far, (GLfloat)_bottom, (GLfloat)_left, 2*_far, (GLfloat)_bottom, (GLfloat)_right, 2*_far, }; const GLubyte squareColors[] = { 255, 255, 255, 255, 255, 255, 255, 255, 190, 200, 255, 255, 190, 200, 255, 255, }; glVertexPointer(3, GL_FLOAT, 0, squareVertices); glEnableClientState(GL_VERTEX_ARRAY); glColorPointer(4, GL_UNSIGNED_BYTE, 0, squareColors); glEnableClientState(GL_COLOR_ARRAY); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); glPopMatrix(); } checkGlError("Draw background"); glLoadIdentity(); glScalef(_scale[0], _scale[1], _scale[2]); glTranslatef(_translate[0], _translate[1], _translate[2]); if(CTX::instance()->rotationCenterCg) glTranslatef(CTX::instance()->cg[0], CTX::instance()->cg[1], CTX::instance()->cg[2]); else glTranslatef(CTX::instance()->rotationCenter[0], CTX::instance()->rotationCenter[1], CTX::instance()->rotationCenter[2]); buildRotationMatrix(); glMultMatrixf(_rotatef); if(CTX::instance()->rotationCenterCg) glTranslatef(-CTX::instance()->cg[0], -CTX::instance()->cg[1], -CTX::instance()->cg[2]); else glTranslatef(-CTX::instance()->rotationCenter[0], -CTX::instance()->rotationCenter[1], -CTX::instance()->rotationCenter[2]); checkGlError("Initialize position"); glEnable(GL_DEPTH_TEST); drawMesh(); checkGlError("Draw mesh"); drawGeom(); checkGlError("Draw geometry"); drawPost(); checkGlError("Draw post-pro"); glDisable(GL_DEPTH_TEST); drawScale(); checkGlError("Draw scales"); drawAxes(); checkGlError("Draw axes"); }