本文整理汇总了C++中painter函数的典型用法代码示例。如果您正苦于以下问题:C++ painter函数的具体用法?C++ painter怎么用?C++ painter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了painter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initLines
void LinkStatusWidget::paintEvent(QPaintEvent *event){
initLines();
QPainter painter(this);
QPixmap pic(QString::fromUtf8(":/computer_white.png"));
QRectF dest(0,0,pic.width(),pic.height());
QPixmap pic2(QString::fromUtf8(":/honeywell.png"));
QRectF dest2(0,0,pic2.width(),pic2.height());
//220*180
QRectF target_0(this->left_left,this->left_top,this->left_width,this->left_height);
QRectF target_1(this->width()-this->right_right-this->right_width,this->right_top,this->right_width,this->right_height);
QRectF target_2(this->width()-this->right_right-this->right_width,this->right_top+this->right_height+this->right_space,this->right_width,this->right_height);
painter.setPen(Qt::white);
painter.drawPixmap(target_0,pic2,dest2);
painter.drawText(this->left_left+this->left_width+this->left_space,this->left_top+painter.fontMetrics().height(),Config::LINKSTATUS_LABEL.split("#").at(2));
painter.drawPixmap(target_1,pic,dest);
QString text=Config::LINKSTATUS_LABEL.split("#").at(0);
int f_w=painter.fontMetrics().width(text);
painter.drawText(this->width()-this->right_right-this->right_width-this->right_space*2-f_w,this->right_top+painter.fontMetrics().height()+this->right_space,text);
painter.drawPixmap(target_2,pic,dest);
text=Config::LINKSTATUS_LABEL.split("#").at(1);
f_w=painter.fontMetrics().width(text);
painter.drawText(this->width()-this->right_right-this->right_width-this->right_space*2-f_w,this->right_top+this->right_height+this->right_space*2+painter.fontMetrics().height(),text);
//draw base line
painter.save();
//#353942
QPen pen1(Qt::white,8,Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
pen1.setColor(QColor(53, 57, 66));
painter.setPen(pen1);
painter.drawLines(lines);
painter.restore();
if(!this->isConn){
return;
}
int centerHeight=this->right_top+this->right_height+this->right_space/2;
QColor co1 =QColor(146, 196, 15) ;
QColor co2 =QColor(0, 255, 0, 0);
QColor co3 =QColor( 255,0, 0,200);
QColor co4 =QColor( 255,0,0, 0);
int mleft=this->width()-this->right_right-this->right_width-this->right_space-this->countMain;
int mright=mleft+this->line_width_main;
if(this->isBroken_1){
QLinearGradient linearGradient = QLinearGradient(mleft,centerHeight,mright,centerHeight);
linearGradient.setColorAt(0,co3);
linearGradient.setColorAt(1,co4);
QPen pen2(linearGradient,5);
pen2.setCapStyle(Qt::RoundCap);
painter.setPen(pen2);
}else{
QLinearGradient linearGradient = QLinearGradient(mleft,centerHeight,mright,centerHeight);
linearGradient.setColorAt(0,co1);
linearGradient.setColorAt(1,co2);
QPen pen2(linearGradient,5);
pen2.setCapStyle(Qt::RoundCap);
painter.setPen(pen2);
}
painter.drawLine(mleft,centerHeight,mright,centerHeight);
int sbottom= this->right_top+this->right_height/2+this->countSub;
int stop= sbottom-this->line_width_sub;
//.........这里部分代码省略.........
示例2: painter
void MyGLWidget::paintGL()
{
QPainter painter(this);
drawBubble(&painter);
}
示例3: lineImage
QImage VisionDisplayModule::makeOverlay(Camera::Type which)
{
QImage lineImage(320, 240, QImage::Format_ARGB32);
lineImage.fill(qRgba(0, 0, 0, 0));
QPainter painter(&lineImage);
painter.setPen(QColor(246, 15, 15));
const messages::VisionField *visField = visMod.vision_field.getMessage(true).get();
const messages::VisionBall *visBall = visMod.vision_ball.getMessage(true).get();
const messages::VisionRobot *visRobots = visMod.vision_robot.getMessage(true).get();
if (which == Camera::TOP) {
for (int i = 0; i < visField->visual_line_size(); i++) {
painter.drawLine(visField->visual_line(i).start_x(),
visField->visual_line(i).start_y(),
visField->visual_line(i).end_x(),
visField->visual_line(i).end_y());
}
painter.setPen(Qt::magenta);
for (int i = 0; i < visField->visual_corner_size(); i++) {
switch(visField->visual_corner(i).corner_type()) {
case messages::VisualCorner::INNER_L: painter.setPen(Qt::green);
break;
case messages::VisualCorner::OUTER_L: painter.setPen(Qt::blue);
break;
case messages::VisualCorner::T: painter.setPen(Qt::black);
break;
case messages::VisualCorner::CIRCLE: painter.setPen(Qt::magenta);
break;
}
painter.drawLine(visField->visual_corner(i).x() - 5,
visField->visual_corner(i).y() - 5,
visField->visual_corner(i).x() + 5,
visField->visual_corner(i).y() + 5);
painter.drawLine(visField->visual_corner(i).x() + 5,
visField->visual_corner(i).y() - 5,
visField->visual_corner(i).x() - 5,
visField->visual_corner(i).y() + 5);
}
if (visBall->intopcam()) {
int ball_x = visBall->x();
int ball_y = visBall->y();
int ball_radius = visBall->radius();
painter.setPen(QPen(QColor(0,0,255,200), 1, Qt::SolidLine, Qt::FlatCap));
painter.setBrush(QBrush(QColor(255,0,0,80),Qt::SolidPattern));
painter.drawEllipse(ball_x,ball_y,2*ball_radius,2*ball_radius);
}
const messages::Robot red1 = visRobots->red1();
const messages::Robot navy1 = visRobots->navy1();
const messages::Robot red2 = visRobots->red2();
const messages::Robot navy2 = visRobots->navy2();
painter.setPen(QColor(0,0,0));
painter.setBrush(QBrush(QColor(0, 0, 255, 0), Qt::SolidPattern));
painter.setPen(QPen(QColor(255,0,0,200), 1, Qt::SolidLine, Qt::FlatCap));
painter.setBrush(QBrush(QColor(255,0,0,80), Qt::SolidPattern));
if (red1.on()) {
QPoint r_points[4] = {
QPoint(red1.x(), red1.y()),
QPoint(red1.x()+red1.width(), red1.y()),
QPoint(red1.x()+red1.width(), red1.y()+red1.height()),
QPoint(red1.x(), red1.y()+red1.height())
};
painter.drawConvexPolygon(r_points, 4);
if (red2.on()) {
QPoint r_points[4] = {
QPoint(red2.x(), red2.y()),
QPoint(red2.x()+red2.width(), red2.y()),
QPoint(red2.x()+red2.width(), red2.y()+red2.height()),
QPoint(red2.x(), red2.y()+red2.height())
};
painter.drawConvexPolygon(r_points, 4);
}
}
painter.setPen(QPen(QColor(0,0,255,200), 1, Qt::SolidLine, Qt::FlatCap));
painter.setBrush(QBrush(QColor(255, 0, 0, 0), Qt::SolidPattern));
painter.setBrush(QBrush(QColor(0,0,255,80), Qt::SolidPattern));
if (navy1.on()) {
QPoint r_points[4] = {
QPoint(navy1.x(), navy1.y()),
QPoint(navy1.x()+navy1.width(), navy1.y()),
QPoint(navy1.x()+navy1.width(), navy1.y()+navy1.height()),
QPoint(navy1.x(), navy1.y()+navy1.height())
};
painter.drawConvexPolygon(r_points, 4);
if (navy2.on()) {
QPoint r_points[4] = {
QPoint(navy2.x(), navy2.y()),
QPoint(navy2.x()+navy2.width(), navy2.y()),
QPoint(navy2.x()+navy2.width(), navy2.y()+navy2.height()),
QPoint(navy2.x(), navy2.y()+navy2.height())
};
painter.drawConvexPolygon(r_points, 4);
}
}
//.........这里部分代码省略.........
示例4: isDown
void ToolButton::paintEvent( QPaintEvent * _pe )
{
const bool active = isDown() || isChecked();
QPainter painter(this);
painter.setRenderHint(QPainter::SmoothPixmapTransform);
painter.setRenderHint(QPainter::Antialiasing);
painter.setPen(Qt::NoPen);
QLinearGradient outlinebrush(0, 0, 0, height());
QLinearGradient brush(0, 0, 0, height());
brush.setSpread(QLinearGradient::PadSpread);
QColor highlight(255, 255, 255, 70);
QColor shadow(0, 0, 0, 70);
QColor sunken(220, 220, 220, 30);
QColor normal1(255, 255, 245, 60);
QColor normal2(255, 255, 235, 10);
if( active )
{
outlinebrush.setColorAt(0.0f, shadow);
outlinebrush.setColorAt(1.0f, highlight);
brush.setColorAt(0.0f, sunken);
painter.setPen(Qt::NoPen);
}
else
{
outlinebrush.setColorAt(1.0f, shadow);
outlinebrush.setColorAt(0.0f, highlight);
brush.setColorAt(0.0f, normal1);
if( m_mouseOver == false )
{
brush.setColorAt(1.0f, normal2);
}
painter.setPen(QPen(outlinebrush, 1));
}
painter.setBrush(brush);
painter.drawRoundedRect( 0, 0, width(), height(), 5, 5 );
const int dd = active ? 1 : 0;
QPoint pt = QPoint( ( width() - m_img.width() ) / 2 + dd, 3 + dd );
if( s_iconOnlyMode )
{
pt.setY( ( height() - m_img.height() ) / 2 - 1 + dd );
}
painter.drawImage( pt, m_img );
if( s_iconOnlyMode == false )
{
const QString l = ( active && m_altLabel.isEmpty() == FALSE ) ?
m_altLabel : m_label;
const int w = painter.fontMetrics().width( l );
painter.setPen( Qt::black );
painter.drawText( ( width() - w ) / 2 +1+dd, height() - 4+dd, l );
painter.setPen( Qt::white );
painter.drawText( ( width() - w ) / 2 +dd, height() - 5+dd, l );
}
}
示例5: Q_UNUSED
/*!
\return Icon representing the curve on the legend
\param index Index of the legend entry
( ignored as there is only one )
\param size Icon size
\sa QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData()
*/
QwtGraphic QwtPlotCurve::legendIcon( int index,
const QSizeF &size ) const
{
Q_UNUSED( index );
if ( size.isEmpty() )
return QwtGraphic();
QwtGraphic graphic;
graphic.setDefaultSize( size );
graphic.setRenderHint( QwtGraphic::RenderPensUnscaled, true );
QPainter painter( &graphic );
painter.setRenderHint( QPainter::Antialiasing,
testRenderHint( QwtPlotItem::RenderAntialiased ) );
if ( d_data->legendAttributes == 0 ||
d_data->legendAttributes & QwtPlotCurve::LegendShowBrush )
{
QBrush brush = d_data->brush;
if ( brush.style() == Qt::NoBrush &&
d_data->legendAttributes == 0 )
{
if ( style() != QwtPlotCurve::NoCurve )
{
brush = QBrush( pen().color() );
}
else if ( d_data->symbol &&
( d_data->symbol->style() != QwtSymbol::NoSymbol ) )
{
brush = QBrush( d_data->symbol->pen().color() );
}
}
if ( brush.style() != Qt::NoBrush )
{
QRectF r( 0, 0, size.width(), size.height() );
painter.fillRect( r, brush );
}
}
if ( d_data->legendAttributes & QwtPlotCurve::LegendShowLine )
{
if ( pen() != Qt::NoPen )
{
QPen pn = pen();
pn.setCapStyle( Qt::FlatCap );
painter.setPen( pn );
const double y = 0.5 * size.height();
QwtPainter::drawLine( &painter, 0.0, y, size.width(), y );
}
}
if ( d_data->legendAttributes & QwtPlotCurve::LegendShowSymbol )
{
if ( d_data->symbol )
{
QRectF r( 0, 0, size.width(), size.height() );
d_data->symbol->drawSymbol( &painter, r );
}
}
return graphic;
}
示例6: painter
void Screen::paintEvent( QPaintEvent * e ) {
//qDebug("Screen::paintEvent");
QPainter painter(this);
painter.eraseRect( e->rect() );
//painter.fillRect( e->rect(), QColor(255,0,0) );
}
示例7: painter
void MusicWidget::paintEvent(QPaintEvent *)
{
QPainter painter(this);
painter.drawPixmap(0,0,QPixmap("image/player_skin.png"));
painter.drawPixmap(QRectF(142,133,ArtistPic.width()/ArtistPic.height()*67,67),ArtistPic,QRectF(0,0,ArtistPic.width(),ArtistPic.height()));
}
示例8: Q_UNUSED
void AreaDialog::paintEvent(QPaintEvent* e)
{
Q_UNUSED(e);
if (mGrabbing) // grabWindow() should just get the background
return;
QPainter painter(this);
QPalette pal = palette();
QFont font = QToolTip::font();
QColor handleColor(85, 160, 188, 220);
QColor overlayColor(0, 0, 0, mOverlayAlpha);
QColor textColor = pal.color(QPalette::Active, QPalette::Text);
QColor textBackgroundColor = pal.color(QPalette::Active, QPalette::Base);
painter.drawPixmap(0, 0, mScreenshot->pixmap());
painter.setFont(font);
QRect r = mSelection.normalized().adjusted(0, 0, -1, -1);
QRegion grey(rect());
grey = grey.subtracted(r);
painter.setPen(handleColor);
painter.setBrush(overlayColor);
painter.setClipRegion(grey);
painter.drawRect(-1, -1, rect().width() + 1, rect().height() + 1);
painter.setClipRect(rect());
painter.setBrush(Qt::NoBrush);
painter.drawRect(r);
if (mShowHelp) {
//Drawing the explanatory text.
QRect helpRect = qApp->desktop()->screenGeometry(qApp->desktop()->primaryScreen());
QString helpTxt = tr("Lightscreen area mode:\nUse your mouse to draw a rectangle to capture.\nPress any key or right click to exit.");
helpRect.setHeight(qRound((float)(helpRect.height() / 10))); // We get a decently sized rect where the text should be drawn (centered)
// We draw the white contrasting background for the text, using the same text and options to get the boundingRect that the text will have.
painter.setPen(QPen(Qt::white));
painter.setBrush(QBrush(QColor(255, 255, 255, 180), Qt::SolidPattern));
QRectF bRect = painter.boundingRect(helpRect, Qt::AlignCenter, helpTxt);
// These four calls provide padding for the rect
bRect.setWidth(bRect.width() + 12);
bRect.setHeight(bRect.height() + 10);
bRect.setX(bRect.x() - 12);
bRect.setY(bRect.y() - 10);
painter.drawRoundedRect(bRect, 8, 8);
// Draw the text:
painter.setPen(QPen(Qt::black));
painter.drawText(helpRect, Qt::AlignCenter, helpTxt);
}
if (!mSelection.isNull()) {
// The grabbed region is everything which is covered by the drawn
// rectangles (border included). This means that there is no 0px
// selection, since a 0px wide rectangle will always be drawn as a line.
QString txt = QString("%1x%2").arg(mSelection.width() == 0 ? 2 : mSelection.width())
.arg(mSelection.height() == 0 ? 2 : mSelection.height());
QRect textRect = painter.boundingRect(rect(), Qt::AlignLeft, txt);
QRect boundingRect = textRect.adjusted(-4, 0, 0, 0);
if (textRect.width() < r.width() - 2*mHandleSize &&
textRect.height() < r.height() - 2*mHandleSize &&
(r.width() > 100 && r.height() > 100)) // center, unsuitable for small selections
{
boundingRect.moveCenter(r.center());
textRect.moveCenter(r.center());
}
else if (r.y() - 3 > textRect.height() &&
r.x() + textRect.width() < rect().right()) // on top, left aligned
{
boundingRect.moveBottomLeft(QPoint(r.x(), r.y() - 3));
textRect.moveBottomLeft(QPoint(r.x() + 2, r.y() - 3));
}
else if (r.x() - 3 > textRect.width()) // left, top aligned
{
boundingRect.moveTopRight(QPoint(r.x() - 3, r.y()));
textRect.moveTopRight(QPoint(r.x() - 5, r.y()));
}
else if (r.bottom() + 3 + textRect.height() < rect().bottom() &&
r.right() > textRect.width()) // at bottom, right aligned
{
boundingRect.moveTopRight(QPoint(r.right(), r.bottom() + 3));
textRect.moveTopRight(QPoint(r.right() - 2, r.bottom() + 3));
}
else if (r.right() + textRect.width() + 3 < rect().width()) // right, bottom aligned
{
boundingRect.moveBottomLeft(QPoint(r.right() + 3, r.bottom()));
textRect.moveBottomLeft(QPoint(r.right() + 5, r.bottom()));
}
// if the above didn't catch it, you are running on a very tiny screen...
painter.setPen(textColor);
painter.setBrush(textBackgroundColor);
painter.drawRect(boundingRect);
painter.drawText(textRect, txt);
//.........这里部分代码省略.........
示例9: painter
void Plotter::paintEvent(QPaintEvent *)
{
QStylePainter painter(this);
painter.drawPixmap(0 , 0 ,this->pixmap);
this->refreshImage();
}
示例10: settings
bool Object::exportFrames1( ExportFrames1Parameters par )
{
int frameStart = par.frameStart;
int frameEnd = par.frameEnd;
QTransform view = par.view;
Layer* currentLayer = par.currentLayer;
QSize exportSize = par.exportSize;
QString filePath = par.filePath;
const char* format = par.format;
int quality = par.quality;
bool background = par.background;
bool antialiasing = par.antialiasing;
QProgressDialog* progress = par.progress;
int progressMax = par.progressMax;
int fps = par.fps;
int exportFps = par.exportFps;
int frameRepeat;
int frameReminder, frameReminder1;
int framePutEvery, framePutEvery1;
int frameSkipEvery, frameSkipEvery1;
int frameNumber;
int framePerSecond;
QSettings settings( "Pencil", "Pencil" );
QString extension = "";
QString formatStr = format;
if ( formatStr == "PNG" || formatStr == "png" )
{
format = "PNG";
extension = ".png";
}
if ( formatStr == "JPG" || formatStr == "jpg" || formatStr == "JPEG" )
{
format = "JPG";
extension = ".jpg";
background = true; // JPG doesn't support transparency so we have to include the background
}
if ( filePath.endsWith( extension, Qt::CaseInsensitive ) )
{
filePath.chop( extension.size() );
}
//qDebug() << "format =" << format << "extension = " << extension;
qDebug() << "Exporting frames from " << frameStart << "to" << frameEnd << "at size " << exportSize;
convertNFrames( fps, exportFps, &frameRepeat, &frameReminder, &framePutEvery, &frameSkipEvery );
qDebug() << "fps " << fps << " exportFps " << exportFps << " frameRepeat " << frameRepeat << " frameReminder " << frameReminder << " framePutEvery " << framePutEvery << " frameSkipEvery " << frameSkipEvery;
frameNumber = 0;
framePerSecond = 0;
frameReminder1 = frameReminder;
framePutEvery1 = framePutEvery;
frameSkipEvery1 = frameSkipEvery;
for ( int currentFrame = frameStart; currentFrame <= frameEnd; currentFrame++ )
{
if ( progress != NULL ) progress->setValue( ( currentFrame - frameStart )*progressMax / ( frameEnd - frameStart ) );
QImage tempImage( exportSize, QImage::Format_ARGB32_Premultiplied );
QPainter painter( &tempImage );
// Make sure that old frame is erased before exporting a new one
tempImage.fill( 0x00000000 );
if ( currentLayer->type() == Layer::CAMERA )
{
QRect viewRect = ( ( LayerCamera* )currentLayer )->getViewRect();
QTransform mapView = RectMapTransform( viewRect, QRectF( QPointF( 0, 0 ), exportSize ) );
mapView = ( ( LayerCamera* )currentLayer )->getViewAtFrame( currentFrame ) * mapView;
painter.setWorldTransform( mapView );
}
else
{
painter.setTransform( view );
}
paintImage( painter, currentFrame, background, antialiasing );
frameNumber++;
framePerSecond++;
QString frameNumberString = QString::number( frameNumber );
while ( frameNumberString.length() < 4 ) frameNumberString.prepend( "0" );
tempImage.save( filePath + frameNumberString + extension, format, quality );
int delta = 0;
if ( framePutEvery )
{
framePutEvery1--;
qDebug() << "-->framePutEvery1" << framePutEvery1;
if ( framePutEvery1 )
{
delta = 0;
}
else
{
delta = 1; framePutEvery1 = framePutEvery;
}
}
if ( frameSkipEvery )
{
frameSkipEvery1--;
qDebug() << "-->frameSkipEvery1" << frameSkipEvery1;
if ( frameSkipEvery1 )
//.........这里部分代码省略.........
示例11: painter
/*绘制*/
void CheckersPicture::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setViewport(p.x(),p.y(),side,side);
painter.setWindow(0, 0, zoom*(n), zoom*(n));
QColor dark(0xcc,0xcc,0xcc,200);
QColor endColor(0x78,0xff,0x21,200); /*终点颜色*/
QColor startColor(0xea,0x76,0x0f,200); /*起点颜色*/
QColor capturedColor(0xed,0x50,0x62,200); /*捕获颜色*/
QColor normalColor(0xd6,0xb8,0x2c,200); /*正常色*/
QColor black(0x00, 0x00, 0x00, 200);
QColor white(0xff, 0xff, 0xff, 220);
QColor light(0xed,0xfc,0xdf,200);
QColor deep(0x5a,0x61,0x54,200);
/*绘制棋盘*/
for(int i=0; i<n; i++) {
for(int j=0; j<n; j++) {
QRect rect = pixelRect(i, j);
if( !((i+j%2)%2) ) {
painter.fillRect(rect, deep);
} else {
painter.fillRect(rect, light);
}
}
}
int ix,jx;
if(v.size()) {
int type;
for(unsigned i=0; i< v.size(); i++) {
color==WHITE ? jx = n-1-v.at(i).y : jx = v.at(i).y;
color==WHITE ? ix = n-1-v.at(i).x : ix = v.at(i).x;
QRect rect = pixelRect(ix, jx);
type = v.at(i).type;
if(type == MOVEDFROM)
painter.fillRect(rect, startColor);
else if(type == MOVEDTO || type == TOKING)
painter.fillRect(rect, endColor);
else if(type == MOVEDTHROUGH)
painter.fillRect(rect, normalColor);
else if(type == DELETED)
painter.fillRect(rect, capturedColor);
}
}
int s = zoom*0.4;
int sd = zoom*0.3;
/*画白棋*/
if(curstate){ /*如果棋局状态发生了改变*/
painter.setPen(QPen(black,zoom*0.025));
painter.setBrush(QBrush(white));
for(int i=0; i<n; i++) {
for(int j=0; j<n; j++) {
/*如果是白色则从最后一行开始画*/
color==WHITE ? jx = j+1 : jx = n-j;
color==WHITE? ix = n-i : ix = i+1;
if(curstate->at(i,j)==WHITE)
painter.drawEllipse(QPoint(zoom*(ix-0.5),zoom*(jx-0.5)),s,s);
if(curstate->at(i,j)==WHITEKING) {
painter.drawEllipse(QPoint(zoom*(ix-0.5),zoom*(jx-0.5)),s,s);
painter.drawEllipse(QPoint(zoom*(ix-0.5),zoom*(jx-0.5)),sd,sd);
}
}
}
/*画黑棋*/
painter.setBrush(QBrush(black));
for(int i=0; i<n; i++) {
for(int j=0; j<n; j++) {
color==WHITE ? jx = j+1 : jx = n-j;
color==WHITE ? ix = n-i : ix = i+1;
if(curstate->at(i,j)==BLACK)
painter.drawEllipse(QPoint(zoom*(ix-0.5),zoom*(jx-0.5)),s,s);
if(curstate->at(i,j)==BLACKKING) {
painter.drawEllipse(QPoint(zoom*(ix-0.5),zoom*(jx-0.5)),s,s);
painter.setPen(QPen(white,zoom*0.1));
painter.drawEllipse(QPoint(zoom*(ix-0.5),zoom*(jx-0.5)),sd,sd);
painter.setPen(QPen(black,zoom*0.1));
}
}
}
}
if (thinking && showHourglass)
{
painter.setWindow(painter.viewport());
painter.drawImage((width() - hourglass.width()) / 2, (height() - hourglass.height()) / 2, hourglass);
}
}
示例12: painter
void CWizShadowWidget::paintEvent(QPaintEvent *)
{
QPainter painter(this);
m_shadow->DrawBorder(&painter, rect());
}
示例13: switch
/************
*
*功能:绘制背景
*
*
*
**/
void mainview::paintEvent(QPaintEvent *)
{
switch(ui->widgetstack->currentIndex())
{
case 0:
case 2:
logo_y = this->height()/2 - 200;
logo_x = this->width()/2 - 100;
break;
default:
logo_y = 50;
logo_x=this->width()/2-100;
break;
}
switch(ui->widgetstack->currentIndex())
{
case 0:
ui->widgetstack->move(logo_x-80,logo_y+50);
break;
case 1://networkconfig
{
ui->widgetstack->move(logo_x-150,height()/2-325);
if(height()/2 > 325)
ui->widgetstack->resize(461,650);
break;}
case 3://wifi
ui->widgetstack->move(logo_x-50,height()/2-283);
break;
case 4://vmlist
{
if(this->hostlist->nums_vm <= 12)
//vmlist display order in the windows
{
ui->widgetstack->move(width()/20,this->height()/2-100);
}
else if(this->hostlist->nums_vm > 12 && this->hostlist->nums_vm <= 18 )
{
ui->widgetstack->move(width()/20,this->height()/2-200);
}
else
{
ui->widgetstack->move(width()/20,this->height()/2-300);
}
break;
}
default:
ui->widgetstack->move(logo_x-100,height()/2-80);
break;
}
QFont font("Arial",10);
QPainter painter(this);
painter.drawPixmap(rect(),QPixmap("./images/terminal-bg.png"));
painter.drawPixmap(QPoint(logo_x,logo_y),QPixmap("./images/terminal-logo.png"));
QPixmap *map = new QPixmap("./images/information.png");
painter.drawPixmap(QPoint(this->width()-200,this->height()-50),map->copy(0,map->height()/2,map->width(),
map->height()/14));//down
painter.drawPixmap(QPoint(this->width()-100,this->height()-50),map->copy(0,map->height()/2+map->height()/7,//reset
map->width(),map->height()/14));
painter.drawPixmap(QPoint(this->width()-70,10),map->copy(0,map->height()/14,map->width(),map->height()/14));//?help
painter.drawPixmap(QPoint(this->width()-230,10),map->copy(0,map->height()/7+map->height()/14,//reflush
map->width(),map->height()/14));
painter.drawPixmap(QPoint(this->width()-270,10),map->copy(0,2*(map->height()/7)+map->height()/14,map->width(),
map->height()/14));//more operator
delete map;
if(wifi->connectedname.length()<=0)
{
map = new QPixmap("./images/wifi.png");
painter.drawPixmap(QPoint(this->width()-120,5),map->copy(0,map->height()/2,map->width(),map->height()/2));
}
else
{
map = new QPixmap("./images/wifi_img.png"/*wifi->CheckSignals(wifi->choice_signal)*/);
painter.drawPixmap(QPoint(this->width()-120,5),map->copy(0,10*map->height()/14,map->width(),map->height()/14));
}
delete map;
QFont font1("Arial",10,QFont::Normal,true);
painter.setFont(font1);//????
painter.setPen(QColor(Qt::white));
painter.drawText(155+logo_x,15+logo_y,version);
painter.setFont(font);//????
painter.drawText(20,this->height()-30,"Copyright (C)2001-2015 Yovole Corporation, All Rights Reserved");
//.........这里部分代码省略.........
示例14: painter
void ImagingWindow::paintEvent(QPaintEvent *)
{
QPainter painter(this);
painter.drawPixmap(0, 0, plot);
}
示例15: painter
void ScribbleArea::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
QRect dirtyRect = event->rect();
painter.drawImage(dirtyRect, image, dirtyRect);
}