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 ItemMonitor::paint( QPainter *painter, const QStyleOptionViewItem &option) const { drawBack( painter, option, isSuperUser() ? &(afqt::QEnvironment::clr_LinkVisited.c) : NULL); int x = option.rect.x(); int y = option.rect.y(); int w = option.rect.width(); int h = option.rect.height(); painter->setPen( clrTextMain( option) ); painter->setFont( afqt::QEnvironment::f_name); painter->drawText( option.rect, Qt::AlignTop | Qt::AlignHCenter, m_name ); painter->setPen( clrTextInfo( option) ); painter->setFont( afqt::QEnvironment::f_info); painter->drawText( x+10, y+15, eventstitle ); for( int e = 0; e < eventscount; e++) painter->drawText( x+5, y+30+12*e, events[e] ); painter->setPen( clrTextInfo( option) ); painter->setFont( afqt::QEnvironment::f_info); int i = y+2; int dy = 15; painter->drawText( x, i+=dy, w-5, h, Qt::AlignTop | Qt::AlignRight, time_launch_str ); painter->drawText( x, i+=dy, w-5, h, Qt::AlignTop | Qt::AlignRight, time_register_str ); painter->drawText( x, i+=dy, w-5, h, Qt::AlignTop | Qt::AlignRight, time_activity_str ); painter->drawText( x, y, w-5, h, Qt::AlignBottom | Qt::AlignRight, address_str ); i = y+2; painter->drawText( x, i+=dy, w-5, h, Qt::AlignTop | Qt::AlignHCenter, m_user_id_str ); painter->drawText( x, i+=dy, w-5, h, Qt::AlignTop | Qt::AlignHCenter, jobsidstitle ); painter->drawText( x, i+=dy, w-5, h, Qt::AlignTop | Qt::AlignHCenter, jobsids ); painter->drawText( x, y+2, w-5, h, Qt::AlignTop | Qt::AlignRight, engine ); }