コード例 #1
0
QPixmap SPics::erno_pix() 
{
        
            QPixmap pError = QPixmap(20, 20 );
            pError.fill( Qt::red  );
            QPainter pter( &pError );
            pter.setFont( QFont( "Helvetica", 8 ) );
            pter.setBrush( Qt::green );
            pter.drawText( 5, 12 , "0" );
            return pError;
}
コード例 #2
0
QPixmap VIFrame::erno_pix() 
{
    maxframe = QRect(0,0,250,250);
    
    QPixmap pError = QPixmap(maxframe.width(),maxframe.height());
    pError.fill( Qt::red  );
    QPainter pter( &pError );
    pter.setFont( QFont( "Helvetica", 8 ) );
    pter.setBrush( Qt::green );
    pter.drawText( 20, 12 , "Sorry is not APNG image!" );
    return pError;
} 
コード例 #3
0
ファイル: FLCodBar.cpp プロジェクト: AliYousuf/abanq-port
void FLCodBar::createBarcode() {
  if ( barcode.value.isEmpty() ) {
    barcode.valid = true;
    return ;
  }

  QString psBarcode;

  barcode.valid = false;
  cleanUp();

  struct Barcode_Item *bc;

  bc = Barcode_Create(( char * ) barcode.value.ascii() );
  if ( !bc )
    return ;

  bc->scalef = barcode.scale;

  if ( Barcode_Encode( bc, barcode.type ) == -1 ) {
    pError.resize( 350, 50 );
    pError.fill( barcode.bg );
    QPainter pter( &pError );
    pter.setFont( QFont( "Helvetica", 11 ) );
    pter.setBrush( barcode.fg );
    pter.drawText( 15, 30, tr( "El valor no se puede codificar para %1" ).arg( typeToName( barcode.type ) ) );
    return ;
  }

  if ( Barcode_Print( bc, &psBarcode, BARCODE_OUT_PS ) ) {
    pError.resize( 300, 50 );
    pError.fill( barcode.bg );
    QPainter pter( &pError );
    pter.setFont( QFont( "Helvetica", 11 ) );
    pter.setBrush( barcode.fg );
    pter.drawText( 15, 30, tr( "Error en la generación del código de barras" ) );
    return ;
  }

  proc = new QProcess();
#if defined(Q_OS_WIN32)

  proc->addArgument( "gswin32c" );
#else

  proc->addArgument( "gs" );
#endif

  proc->addArgument( "-q" );
  proc->addArgument( "-dBATCH" );
  proc->addArgument( "-dNOPAUSE" );
  proc->addArgument( "-sDEVICE=pnggray" );
  proc->addArgument( QString( "-g%1x%2" ).arg( bc->xoff + ( bc->width * barcode.res / 72 ) + ( 2 * barcode.margin * barcode.res / 72 ) ).arg( bc->yoff + ( bc->height * barcode.res / 72 ) + ( 2 * barcode.margin * barcode.res / 72 ) ) );
  QString res = QString::number( barcode.res );
  proc->addArgument( "-r" + res + "x" + res );
  proc->addArgument( "-sOutputFile=-" );
  proc->addArgument( "-" );

  Barcode_Delete( bc );

  writingStdout = true;
  if ( !proc->launch( psBarcode ) ) {
    pError.resize( 300, 50 );
    pError.fill( barcode.bg );
    QPainter pter( &pError );
    pter.setFont( QFont( "Helvetica", 11 ) );
    pter.setBrush( barcode.fg );
    pter.drawText( 27, 20, tr( "Necesita tener instalado GhostScript" ) );
    pter.drawText( 27, 39, tr( "para poder generar códigos de barras" ) );
    writingStdout = false;
    return ;
  } else {
    readingStdout = true;
    while ( readingStdout ) {
      qApp->processEvents();
      if ( !proc->isRunning() )
        writingStdoutFinished();
    }
  }
}