void FLConnectDBDialog::paintEvent(QPaintEvent *pe) { QPixmap pix(width(), height()); pix.fill(QColor(logo.pixel(1, 1))); QPainter p(&pix); int dx = width() - logo.width(); int dy = height() - logo.height(); p.drawImage(QPoint(dx, dy), logo); if (pbnMore->isOn()) { #if defined(Q_OS_MACX) QFont font7(qApp->font().family(), 9); QFont font8(qApp->font().family(), 10); #else QFont font7(qApp->font().family(), 7); QFont font8(qApp->font().family(), 8); #endif font8.setBold(true); int lineWidth = QFontMetrics(font7).width("This software is provided under the terms"); int lineHeight = QFontMetrics(font7).height(); p.drawImage(lineWidth + 30 , height() - lineHeight * 4, QImage::fromMimeSource("defFactory")); p.setFont(font7); p.drawText(QRect(6, height() - lineHeight * 3 - 2, lineWidth + 10, lineHeight), Qt::AlignVCenter | Qt::AlignJustify | Qt::SingleLine, "This software is provided under the terms"); p.drawText(QRect(6, height() - lineHeight * 2 - 2, lineWidth + 10, lineHeight), Qt::AlignVCenter | Qt::AlignJustify | Qt::SingleLine, "of GNU General Public License ( GPL ) and"); p.drawText(QRect(6, height() - lineHeight - 2, lineWidth + 10, lineHeight), Qt::AlignVCenter | Qt::AlignJustify | Qt::SingleLine, "without warranty of any kind."); } p.drawImage(QRect(6, 5, 45, 15), QImage::fromMimeSource("defFactory")); p.end(); bitBlt(this, 0, 0, &pix); QWidget::paintEvent(pe); }
void FLConnectDBDialog::paintEvent( QPaintEvent * pe ) { QPainter p( this ); p.fillRect( pe->rect(), QColor( logo.pixel( 1, 1 ) ) ); int dx = width() - logo.width(); int dy = height() - logo.height(); p.drawImage( QPoint( dx, dy ), logo ); if ( pbnMore->isOn() ) { QFont font7( qApp->font().family(), 7 ); QFont font8( qApp->font().family(), 8 ); font8.setBold( true ); QString copyright( "Copyright (C) 2003-2009 by InfoSiAL S.L." ); int lineWidth = QFontMetrics( font8 ).width( copyright ); int lineHeight = QFontMetrics( font8 ).height(); p.setFont( font8 ); p.drawText( QRect( 6, height() - lineHeight * 4 - 2, lineWidth + 10, lineHeight ), Qt::AlignVCenter | Qt::AlignJustify | Qt::SingleLine, copyright ); p.drawImage( lineWidth + 20 , height() - lineHeight * 4, QImage::fromMimeSource( "defFactory" ) ); lineWidth = QFontMetrics( font7 ).width( "This software is provided under the terms" ); lineHeight = QFontMetrics( font7 ).height(); p.setFont( font7 ); p.drawText( QRect( 6, height() - lineHeight * 3 - 2, lineWidth + 10, lineHeight ), Qt::AlignVCenter | Qt::AlignJustify | Qt::SingleLine, "This software is provided under the terms" ); p.drawText( QRect( 6, height() - lineHeight * 2 - 2, lineWidth + 10, lineHeight ), Qt::AlignVCenter | Qt::AlignJustify | Qt::SingleLine, "of GNU General Public License ( GPL ) and" ); p.drawText( QRect( 6, height() - lineHeight - 2, lineWidth + 10, lineHeight ), Qt::AlignVCenter | Qt::AlignJustify | Qt::SingleLine, "without warranty of any kind." ); } #if defined(Q_OS_WIN32) || defined(Q_OS_MACX) QFont font6( qApp->font().family(), 8 ); #else QFont font6( qApp->font().family(), 6 ); #endif p.setFont( font6 ); p.drawText( 54, 18, "(C) 2003-2009 InfoSiAL S.L." ); p.drawImage( QRect( 6, 5, 45, 15 ), QImage::fromMimeSource( "defFactory" ) ); QColor pColor( 0, 0, 32 ); p.setPen( pColor ); p.setBrush( pColor ); p.drawRect( dx + 32, 0, 4, dy ); p.end(); QWidget::paintEvent( pe ); }