示例#1
0
  QVariant TablaModelR::headerData(int section, Qt::Orientation orientation , int role) const
  {
    if (role == Qt::DisplayRole) {
      if (orientation == Qt::Horizontal)
        return cabeceraH[section];
      else
        return cabeceraV[section];
    }
    if (role == Qt::BackgroundRole) {
      if (orientation == Qt::Horizontal){
        QLinearGradient gradiant(5, 0, 25, 25);
        gradiant.setColorAt(0, QColor::fromRgb(13, 249, 0, 255));
        gradiant.setColorAt(0.05, QColor::fromRgb(12, 232, 0, 255));
        gradiant.setColorAt(0.36, QColor::fromRgb(11, 204, 0, 255));
        gradiant.setColorAt(0.6, QColor::fromRgb(9, 179, 0, 255));
        gradiant.setColorAt(0.75, QColor::fromRgb(8, 150, 0, 255));
        gradiant.setColorAt(0.79, QColor::fromRgb(6, 122, 0, 255));
        gradiant.setColorAt(0.86, QColor::fromRgb(5, 97, 0, 255));
        gradiant.setColorAt(0.935, QColor::fromRgb(3, 71, 0, 255));
        return QBrush(gradiant);
      }else {
        return QBrush(QColor::fromRgb(0, 11, 234, 255), Qt::SolidPattern);
      }
    }
    if (role == Qt::ForegroundRole)
      return QColor(Qt::white);

    return QVariant();
  }
示例#2
0
void Previewer::paintEvent( QPaintEvent * )
{
    QSize input_size = INPUT_SIZE;
    const QRect & rct = rect();

    QPainter painter(this);
        painter.setRenderHint( QPainter::Antialiasing , true );

    QColor color1( BASE_COLOR_1 );
    QColor color2( BASE_COLOR_2 );
    QColor shadow_color( "#000000" );

    color1.setAlpha( MAGNIFIER_ALPHA );
    color2.setAlpha( MAGNIFIER_ALPHA );

    QLinearGradient gradiant(QPointF(0, rct.y()), QPointF(0,rct.y()+rct.height()));
        gradiant.setColorAt(0, color1);
        gradiant.setColorAt(1, color2);

    painter.fillPath( magnifierPath( input_size , rct , SHADOW_SIZE ) , gradiant );

    for( int i=SHADOW_SIZE-1 ; i>=0 ; i-- )
    {
        QSize top_size( input_size.width() + 2*(SHADOW_SIZE-i) , input_size.height() );

        shadow_color.setAlpha( ((double)i/SHADOW_SIZE)*MAGNIFIER_ALPHA/2 );

        painter.setPen( shadow_color );
        painter.drawPath( magnifierPath(top_size , rct , i) );
    }
}
示例#3
0
void add_point_DRAW(int a,int i,int j,int k,float *P,float *No)
{
  static int p,off;
  static float t,Nt;
  static float N1[3],N2[3];
  
  Nt=(float)(N>>1);   


     off=j*N+i;
     switch(a)
	{
	 case 3  : 
                               t=((float)(VAL-F[k][off]))/((float)(F[k][off+N]-F[k][off]));
                               P[0]  = (    (float)i - TRANSX)/Nt ;
                               P[1]  = (t + (float)j - TRANSY)/Nt;
                               P[2]  = (    (float)k - TRANSZ)/Nt;
			       gradiant(i,j,k,N1);
                               gradiant(i,j+1,k,N2);
                               No[0]=N1[0] + t*(N2[0]-N1[0]);
                               No[1]=N1[1] + t*(N2[1]-N1[1]);
                               No[2]=N1[2] + t*(N2[2]-N1[2]);


	           break;
	 case 11 : 
                               t=((float)(VAL-F[k][off+N]))/((float)(F[k+1][off+N]-F[k][off+N]));
                               P[0]  = (    (float)i  - TRANSX)/Nt;
                               P[1]  = (1 + (float)j  - TRANSY)/Nt;
                               P[2]  = (t + (float)k  - TRANSZ)/Nt;
                               gradiant(i,j+1,k,N1);
                               gradiant(i,j+1,k+1,N2);
                               No[0]=N1[0] + t*(N2[0]-N1[0]);
                               No[1]=N1[1] + t*(N2[1]-N1[1]);
                               No[2]=N1[2] + t*(N2[2]-N1[2]);

                   
	           break;
	 case 7  : 
                               t=((float)(VAL-F[k+1][off]))/((float)(F[k+1][off+N]-F[k+1][off]));
                               P[0]  = (    (float)i  - TRANSX)/Nt;
                               P[1]  = (t + (float)j  - TRANSY)/Nt;
                               P[2]  = (1 + (float)k  - TRANSZ)/Nt;
                               gradiant(i,j  ,k+1,N1);
                               gradiant(i,j+1,k+1,N2);
                               No[0]=N1[0] + t*(N2[0]-N1[0]);
                               No[1]=N1[1] + t*(N2[1]-N1[1]);
                               No[2]=N1[2] + t*(N2[2]-N1[2]);

                   
	           break;
	 case 8  : 
                               t=((float)(VAL-F[k][off]))/((float)(F[k+1][off]-F[k][off]));
                               P[0]  = (    (float)i  - TRANSX)/Nt;
                               P[1]  = (    (float)j  - TRANSY)/Nt;
                               P[2]  = (t + (float)k  - TRANSZ)/Nt;
                               gradiant(i,j  ,k ,N1);
                               gradiant(i,j  ,k+1,N2);
                               No[0]=N1[0] + t*(N2[0]-N1[0]);
                               No[1]=N1[1] + t*(N2[1]-N1[1]);
                               No[2]=N1[2] + t*(N2[2]-N1[2]);			       

	           break;
	 case 0  : 
                               t=((float)(VAL-F[k][off]))/((float)(F[k][off+1]-F[k][off]));
                               P[0]  = (t + (float)i  - TRANSX)/Nt;
                               P[1]  = (    (float)j  - TRANSY)/Nt;
                               P[2]  = (    (float)k  - TRANSZ)/Nt;
                               gradiant(i  ,j  ,k  ,N1);
                               gradiant(i+1,j  ,k  ,N2);
                               No[0]=N1[0] + t*(N2[0]-N1[0]);
                               No[1]=N1[1] + t*(N2[1]-N1[1]);
                               No[2]=N1[2] + t*(N2[2]-N1[2]);
			       



	           break;
	 case 9  :   t=((float)(VAL-F[k][off+1]))/((float)(F[k+1][off+1]-F[k][off+1]));
                               P[0]  = (1 + (float)i  - TRANSX)/Nt;
                               P[1]  = (    (float)j  - TRANSY)/Nt;
                               P[2]  = (t + (float)k  - TRANSZ)/Nt;
                               gradiant(i+1,j  ,k,N1);
                               gradiant(i+1,j  ,k+1,N2);
                               No[0]=N1[0] + t*(N2[0]-N1[0]);
                               No[1]=N1[1] + t*(N2[1]-N1[1]);
                               No[2]=N1[2] + t*(N2[2]-N1[2]);


	           break;
	 case 4  : 
                               t=((float)(VAL-F[k+1][off]))/((float)(F[k+1][off+1]-F[k+1][off]));
                               P[0]  = (t + (float)i  - TRANSX)/Nt;
                               P[1]  = (    (float)j  - TRANSY)/Nt;
                               P[2]  = (1 + (float)k  - TRANSZ)/Nt;
                               gradiant(i  ,j  ,k+1,N1);
                               gradiant(i+1,j  ,k+1,N2);
                               No[0]=N1[0] + t*(N2[0]-N1[0]);
                               No[1]=N1[1] + t*(N2[1]-N1[1]);
                               No[2]=N1[2] + t*(N2[2]-N1[2]);
			       

	           break;
 	 case 1  : 
                               t=((float)(VAL-F[k][off+1]))/((float)(F[k][off+N+1]-F[k][off+1]));
                               P[0]  = (1 + (float)i  - TRANSX)/Nt;
                               P[1]  = (t + (float)j  - TRANSY)/Nt;
                               P[2]  = (    (float)k  - TRANSZ)/Nt;
                               gradiant(i+1,j  ,k,N1);
                               gradiant(i+1,j+1,k,N2);
                               No[0]=N1[0] + t*(N2[0]-N1[0]);
                               No[1]=N1[1] + t*(N2[1]-N1[1]);
                               No[2]=N1[2] + t*(N2[2]-N1[2]);
			       

                   break;
 	 case 2  : 
                               t=((float)(VAL-F[k][off+N]))/((float)(F[k][off+N+1]-F[k][off+N]));
                               P[0]  = (t  + (float)i  - TRANSX)/Nt;
                               P[1]  = (1  + (float)j  - TRANSY)/Nt;
                               P[2]  = (     (float)k  - TRANSZ)/Nt;
                               gradiant(i  ,j+1,k,N1);
                               gradiant(i+1,j+1,k,N2);
                               No[0]=N1[0] + t*(N2[0]-N1[0]);
                               No[1]=N1[1] + t*(N2[1]-N1[1]);
                               No[2]=N1[2] + t*(N2[2]-N1[2]);
			       

                   break;
	case 10 :  
		     t=((float)(VAL-F[k][off+N+1]))/((float)(F[k+1][off+N+1]-F[k][off+N+1]));
		     P[0] = (1 + (float)i  - TRANSX)/Nt;
		     P[1] = (1 + (float)j  - TRANSY)/Nt;
		     P[2] = (t + (float)k  - TRANSZ)/Nt;
                     gradiant(i+1,j+1,k  ,N1);
                     gradiant(i+1,j+1,k+1,N2);
                     No[0]=N1[0] + t*(N2[0]-N1[0]);
                     No[1]=N1[1] + t*(N2[1]-N1[1]);
                     No[2]=N1[2] + t*(N2[2]-N1[2]);       
		     

                   break;
	case 5  : 
                   t=((float)(VAL-F[k+1][off+1]))/((float)(F[k+1][off+N+1]-F[k+1][off+1]));
                   P[0]   = (1 + (float)i  - TRANSX)/Nt;
                   P[1]   = (t + (float)j  - TRANSY)/Nt;
                   P[2]   = (1 + (float)k  - TRANSZ)/Nt;
                   gradiant(i+1,j  ,k+1,N1);
                   gradiant(i+1,j+1,k+1,N2);
                   No[0]=N1[0] + t*(N2[0]-N1[0]);
                   No[1]=N1[1] + t*(N2[1]-N1[1]);
                   No[2]=N1[2] + t*(N2[2]-N1[2]);         
		   
                  break;
	case 6  : 
                   t=((float)(VAL-F[k+1][off+N]))/((float)(F[k+1][off+N+1]-F[k+1][off+N]));
                   P[0]  = (t + (float)i  - TRANSX)/Nt;
                   P[1]  = (1 + (float)j  - TRANSY)/Nt;
                   P[2]  = (1 + (float)k  - TRANSZ)/Nt;
                   gradiant(i  ,j+1,k+1,N1);
                   gradiant(i+1,j+1,k+1,N2);
                   No[0]=N1[0] + t*(N2[0]-N1[0]);
                   No[1]=N1[1] + t*(N2[1]-N1[1]);
                   No[2]=N1[2] + t*(N2[2]-N1[2]);         
		   

                   break;
	}

     
}
void QStatusLight::paintEvent(QPaintEvent *e)
{
    Q_UNUSED(e);
    QPainter painter(this);
    int dropShadowSize = 4;
    int maxSize = qMin(width(), height()) -1 - dropShadowSize;  // -1 to fit and -2 to allow for dropshadow and border space
    painter.save();

    painter.setPen(Qt::darkGray);
    painter.setBrush(Qt::darkGray);
    painter.drawEllipse(dropShadowSize -1, dropShadowSize, maxSize, maxSize);

    painter.setPen(Qt::black);
    painter.setBrush(Qt::black);
    painter.drawEllipse(0,0,maxSize+1,maxSize+1);

    QColor darkColor;
    QRadialGradient gradiant(maxSize/2, maxSize/2, maxSize/2, maxSize/3, maxSize/3);
    gradiant.setColorAt(0, Qt::white);

    switch (m_dnssecTest.status()) {
    case DNSSECTest::UNKNOWN:
    case DNSSECTest::TESTINGNOW:
        painter.setPen(Qt::gray);
        darkColor = Qt::darkGray;
        gradiant.setColorAt(1, Qt::gray);
        break;
    case DNSSECTest::GOOD:
        painter.setPen(Qt::green);
        darkColor = Qt::darkGreen;
        gradiant.setColorAt(1, Qt::green);
        break;
    case DNSSECTest::BAD:
        painter.setPen(Qt::red);
        darkColor = Qt::darkRed;
        gradiant.setColorAt(1, Qt::red);
        break;
    case DNSSECTest::WARNING:
        painter.setPen(Qt::yellow);
        darkColor = Qt::darkYellow;
        gradiant.setColorAt(1, Qt::yellow);
        break;
    }


    QBrush gbrush(gradiant);
    painter.setBrush(gbrush);
    painter.drawEllipse(0,0,maxSize,maxSize);

    painter.setPen(darkColor);
    painter.setBrush(Qt::NoBrush);

    painter.drawEllipse(0,0,maxSize+1,maxSize+1);
    if (m_dnssecTest.name().length() > 0) {
        QFont font = painter.font();
        font.setPointSize(3*font.pointSize()/4);
        painter.setFont(font);
        painter.setPen(Qt::black);
        painter.drawText(QRect(1,maxSize/2, maxSize, maxSize/2), Qt::AlignCenter, m_dnssecTest.name());
    }

    painter.restore();
}