コード例 #1
0
ファイル: kled.cpp プロジェクト: ViktorNova/chipsynth
void KLed::paintEvent( QPaintEvent* )
{
    switch( d->shape ) {
      case Rectangular:
        switch ( d->look ) {
          case Sunken:
            paintRectFrame( false );
            break;
          case Raised:
            paintRectFrame( true );
            break;
          case Flat:
            paintRect();
            break;
        }
        break;
      case Circular:
        switch ( d->look ) {
          case Flat:
            paintFlat();
            break;
          case Raised:
            paintRaised();
            break;
          case Sunken:
            paintSunken();
            break;
        }
        break;
    }
}
コード例 #2
0
void KLed::paintEvent( QPaintEvent* )
{
#ifdef PAINT_BENCH
  const int rounds = 1000;
  QTime t;
  t.start();
  for ( int i = 0; i < rounds; i++ ) {
#endif
    switch( d->shape ) {
      case Rectangular:
        switch ( d->look ) {
          case Sunken:
            paintRectFrame( false );
            break;
          case Raised:
            paintRectFrame( true );
            break;
          case Flat:
            paintRect();
            break;
          default:
            qWarning( "%s: in class KLed: no KLed::Look set", qApp->argv()[0] );
        }
        break;
      case Circular:
        switch ( d->look ) {
          case Flat:
            paintFlat();
            break;
          case Raised:
            paintRaised();
            break;
          case Sunken:
            paintSunken();
            break;
          default:
            qWarning( "%s: in class KLed: no KLed::Look set", qApp->argv()[0] );
        }
        break;
      default:
        qWarning( "%s: in class KLed: no KLed::Shape set", qApp->argv()[0] );
        break;
    }
#ifdef PAINT_BENCH
  }

  int ready = t.elapsed();
  qWarning( "elapsed: %d msec. for %d rounds", ready, rounds );
#endif
}