当前位置: 首页>>代码示例>>C++>>正文


C++ QPainter::setMatrix方法代码示例

本文整理汇总了C++中QPainter::setMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ QPainter::setMatrix方法的具体用法?C++ QPainter::setMatrix怎么用?C++ QPainter::setMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QPainter的用法示例。


在下文中一共展示了QPainter::setMatrix方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DrawYText

void MyPlotter::DrawYText(QPainter &painter)
{
	QRect rect_y_text(0,draw_area_.top(),draw_area_.left(),draw_area_.height());
	QRect rect_y_virtual(-rect_y_text.top(),rect_y_text.left(),-rect_y_text.height(),rect_y_text.width());
	painter.setMatrix(QMatrix(0,-1,1,0,0,0));
	//painter.drawRect(rect_y_virtual);
	painter.drawText(rect_y_virtual,Qt::AlignTop|Qt::AlignHCenter,y_text_);
	painter.resetMatrix();
}
开发者ID:liye0005,项目名称:QT_POJ,代码行数:9,代码来源:myplotter.cpp

示例2: paint

void KarbonOutlinePaintingStrategy::paint( KoShape * shape, QPainter &painter, const KoViewConverter &converter, bool )
{
    painter.save();
    painter.setMatrix( shape->absoluteTransformation(&converter) * painter.matrix() );

    m_border->paintBorder( shape, painter, converter );

    painter.restore();
}
开发者ID:JeremiasE,项目名称:KFormula,代码行数:9,代码来源:KarbonOutlinePaintingStrategy.cpp

示例3: DrawAxeUPartText

void AccumulateEnergy::DrawAxeUPartText(QPainter &painter)
{
    painter.save();
    QPen pen;
    painter.setFont(QFont(QObject::tr("WenQuanYi"),10));


    QRect rect_y_text(0,draw_area_range.top(),draw_area_range.left(),uheight_);
    QRect rect_y_virtual(-rect_y_text.top(),rect_y_text.left(),-rect_y_text.height(),rect_y_text.width());
    QRect rect_y_text2(0,draw_area_range.top() + uheight_,draw_area_range.left(),dheight_);
    QRect rect_y_virtual2(-rect_y_text2.top(),rect_y_text2.left(),-rect_y_text2.height(),rect_y_text2.width());
    painter.setMatrix(QMatrix(0,-1,1,0,0,0));
    pen.setColor(Qt::black);
    painter.setPen(pen);
    //painter.drawRect(rect_y_virtual);
    painter.drawText(rect_y_virtual,Qt::AlignTop|Qt::AlignHCenter,STRING_GRAPHIC_ADVANCEMETER);
    pen.setColor(Qt::black);
    painter.setPen(pen);
    painter.drawText(rect_y_virtual2,Qt::AlignTop|Qt::AlignHCenter,STRING_GRAPHIC_EVNET_NUMBERS);
    painter.resetMatrix();
    painter.restore();
}
开发者ID:liye0005,项目名称:QT_POJ,代码行数:22,代码来源:accumulateenergy.cpp

示例4: paintEvent

void MyRenderWidget::paintEvent(QPaintEvent * /*event*/ )
{
    QPainter painter;
    painter.begin(this);
    
    QColor color(0,0,0,255);
    QMatrix m,n;

    QString secstr = QString::number(sec);
    QString minstr = QString::number(min);
    QString hourstr = QString::number(hour);

    QFont font("Arial",12);
    painter.setFont(font);
    painter.drawText(200,75,hourstr);
    painter.drawText(250,75,minstr);
    painter.drawText(300,75,secstr);
	
    //Shadow
    m.reset();
    m.translate(90,420);
    m.rotate(-35);
    m.shear(1,0.2);
    m.scale(0.5,0.5);

    painter.setMatrix(m);
    painter.setPen(Qt::gray);
    painter.setBrush(QColor(138, 121, 93,255));
    painter.drawEllipse(100,100,300,300);

    //Background
    m.reset();
    painter.setMatrix(m);
    painter.setPen(QColor(0,0,0,255));
    painter.setBrush(QColor(16,23,33,255));
    painter.drawEllipse(100,100,300,300);

    m.scale(0.8,0.8);
    painter.setMatrix(m);
    painter.setBrush(QColor(188,237,241,255));
    painter.drawEllipse(165,163,300,300);    

    //Number
    QPoint rotatedPoint;
    painter.setMatrix(m);
    for(int deg = 1; deg < 13; deg++){
        m.reset();
        m.translate(146,155);
        m.rotate(deg*30-135);

        rotatedPoint = QPoint(97,97)* m;
        n.reset();
        n.translate(rotatedPoint.x(), rotatedPoint.y());

        painter.setMatrix(n);
        painter.setPen(QColor(245,146,55,255));

        QString hour = QString::number(deg);
        QFont font("Arial",12);
        painter.setFont(font);
        painter.drawText(100,100,hour);
    }

    //Second Hand
    m.reset();
    m.translate(250,250);
    m.rotate(180+6*sec);
    m.translate(-100,-100);

    painter.setMatrix(m);
    painter.setPen(QColor(245,146,55,255));
    painter.drawLine(99,100,99,220);

    //Minute Hand
    m.reset();
    m.translate(250,250);
    m.rotate(-90+6*min);
    m.translate(-100,-100);

    painter.setMatrix(m);
    painter.setPen(QColor(245,146,55,255));
    painter.setBrush(QColor(245,146,55,255));
    painter.drawRect(100,100,130,5);

    //Hour Hand
    m.reset();
    m.translate(250,250);
    m.rotate(-90+30*hour+0.5*min);
    m.translate(-100,-100);

    painter.setMatrix(m);
    painter.setPen(QColor(245,146,55,255));
    painter.setBrush(QColor(245,146,55,255));
    painter.drawRect(100,100,100,10);
	
    //Center dot
    m.reset();
    painter.setMatrix(m);
    painter.setPen(QColor(0,0,0,255));
    painter.setBrush(QColor(16,23,33,255));
//.........这里部分代码省略.........
开发者ID:rl404,项目名称:CSC335-CG,代码行数:101,代码来源:MyRenderWidget.cpp


注:本文中的QPainter::setMatrix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。