• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ QLine函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中QLine函数的典型用法代码示例。如果您正苦于以下问题:C++ QLine函数的具体用法?C++ QLine怎么用?C++ QLine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: penline

// No hardcoding test!!!
void SidarTestPaint1::sidarPaint(const SidarLabel &pSidar)
{
    QPen penline(QColor(70, 255, 0));
    QPen pentext(QColor(0, 167, 255));

    QSize Sidar_size = pSidar.size();
    QPainter pnt((QPaintDevice*)&pSidar);
    pnt.setPen(penline);
    QString s("WRAPPED");
    QFont fnt(pSidar.font());
    QFontMetrics fm(fnt);
    int pixW = fm.width(s);
    int pixH = fm.height(); // unused for now
    pnt.save();

    int texBegin = (Sidar_size.width()/2) - pixW/2;
    int texEnd   = (Sidar_size.width()/2) + pixW/2;

    int drawHeight = Sidar_size.height()/2;

    pnt.drawLine(QLine(0, drawHeight, texBegin, drawHeight));
    pnt.setPen(pentext);
    pnt.drawText(texBegin, drawHeight+(pixH/3), s);
    pnt.setPen(penline);
    pnt.drawLine(QLine(texEnd, drawHeight, Sidar_size.width(), drawHeight));
    pnt.restore();
}
开发者ID:heatblazer,项目名称:qt-paint-label,代码行数:28,代码来源:sidartestpaint.cpp


示例2: fontMetrics

void UBGraphicsRuler::paintGraduations(QPainter *painter)
{
    painter->save();
    painter->setFont(font());
    QFontMetricsF fontMetrics(painter->font());
    for (int millimeters = 0; millimeters < (rect().width() - sLeftEdgeMargin - sRoundingRadius) / sPixelsPerMillimeter; millimeters++)
    {
        int graduationX = rotationCenter().x() + sPixelsPerMillimeter * millimeters;
        int graduationHeight = (0 == millimeters % UBGeometryUtils::millimetersPerCentimeter) ?
            UBGeometryUtils::centimeterGraduationHeight :
            ((0 == millimeters % UBGeometryUtils::millimetersPerHalfCentimeter) ?
                UBGeometryUtils::halfCentimeterGraduationHeight : UBGeometryUtils::millimeterGraduationHeight);
        painter->drawLine(QLine(graduationX, rotationCenter().y(), graduationX, rotationCenter().y() + graduationHeight));
        painter->drawLine(QLine(graduationX, rotationCenter().y() + rect().height(), graduationX, rotationCenter().y() + rect().height() - graduationHeight));
        if (0 == millimeters % UBGeometryUtils::millimetersPerCentimeter)
        {
            QString text = QString("%1").arg((int)(millimeters / UBGeometryUtils::millimetersPerCentimeter));
            if (graduationX + fontMetrics.width(text) / 2 < rect().right())
            {
                qreal textWidth = fontMetrics.width(text);
                qreal textHeight = fontMetrics.tightBoundingRect(text).height() + 5;
                painter->drawText(
                    QRectF(graduationX - textWidth / 2, rect().top() + 5 + UBGeometryUtils::centimeterGraduationHeight, textWidth, textHeight),
                    Qt::AlignVCenter, text);
                painter->drawText(
                    QRectF(graduationX - textWidth / 2, rect().bottom() - 5 - UBGeometryUtils::centimeterGraduationHeight - textHeight, textWidth, textHeight),
                    Qt::AlignVCenter, text);
            }
        }
    }
    painter->restore();
}
开发者ID:OpenBoard-org,项目名称:OpenBoard,代码行数:32,代码来源:UBGraphicsRuler.cpp


示例3: QPen

void CRFTagRobot::drawPath(){

    //Flecha superior
    QVector<QPoint> arrow0;
    arrow0.append(QPoint(190, 10)); //punto sobre la recta
    arrow0.append(QPoint(200, 5));  //punto arriba de la recta
    arrow0.append(QPoint(200, 15)); //punto debajo de la recta
    //Flecha inferior
    QVector<QPoint> arrow1;
    arrow1.append(QPoint(190, 400)); //punto sobre la recta
    arrow1.append(QPoint(200, 395)); //punto arriba de la recta
    arrow1.append(QPoint(200, 405)); //punto debajo de la recta
    //Flecha diagonal 1
    QVector<QPoint> arrow2;
    arrow2.append(QPoint(170, 175)); //punto sobre de la recta
    arrow2.append(QPoint(170, 165)); //punto arriba de la recta
    arrow2.append(QPoint(160, 175)); //punto debajo de la recta
    //Flecha diagonal 2
    QVector<QPoint> arrow3;
    arrow3.append(QPoint(230, 175));
    arrow3.append(QPoint(220, 175));
    arrow3.append(QPoint(230, 185));

    this->scene.addPolygon(QPolygon(arrow0), QPen(), QBrush(QColor("black")));
    this->scene.addPolygon(QPolygon(arrow1), QPen(), QBrush(QColor("black")));
    this->scene.addPolygon(QPolygon(arrow2), QPen(), QBrush(QColor("black")));
    this->scene.addPolygon(QPolygon(arrow3), QPen(), QBrush(QColor("black")));
    this->scene.addLine(QLine(QPoint(0, 10), QPoint(400, 400)),QPen(QColor("black")));
    this->scene.addLine(QLine(QPoint(0, 400), QPoint(400, 10)),QPen(QColor("black")));
    this->scene.addLine(QLine(QPoint(0, 10), QPoint(400, 10)),QPen(QColor("black")));
    this->scene.addLine(QLine(QPoint(0, 400), QPoint(400, 400)),QPen(QColor("black")));
}
开发者ID:jjvainstein,项目名称:CRFRobotSimulation,代码行数:32,代码来源:crftagrobot.cpp


示例4: painter

void QZoomLabel::paintEvent( QPaintEvent * event)
{
  QLabel::paintEvent(event);

  QPainter painter(this);

  // frame
  painter.setPen(QPen(QColor(237,237,230),1));

  painter.drawLine(QLine(0,0,width(),0));
  painter.drawLine(QLine(0,height()-1,width(),height()-1));
  painter.drawLine(QLine(0,0,0,height()));
  painter.drawLine(QLine(width()-1,0,width()-1,height()));

  // enable anti-aliasing
  painter.setRenderHint(QPainter::Antialiasing);

  painter.setPen(QPen(QColor(0,0,0),1)); // black

  QLineF line_down_1(40.0f, 9.0f, 44.0f, 12.0f);
  QLineF line_up_1  (44.0f, 12.0f, 48.0f, 9.0f);

  QLineF line_down_2(40.0f, 6.0f, 44.0f, 3.0f);
  QLineF line_up_2  (44.0f, 3.0f, 48.0f, 6.0f);

  // draw down-arrow
  painter.drawLine(line_down_1);
  painter.drawLine(line_up_1);

  // draw up-arrow
  painter.drawLine(line_down_2);
  painter.drawLine(line_up_2);
}
开发者ID:AchimTuran,项目名称:ssr,代码行数:33,代码来源:qzoomlabel.cpp


示例5: switch

int BC_GEN::insertbuf(const QChar & bc)
{
	for(int index=0;index<(CODE39_SIZE+1);++index){//include '*'
		if(bc.toUpper().toLatin1()==code39_table[index]){//found char
			global_Xposition+=INTER_GAP_LEN;//char gap
			for(int i=0;i<CODE39_CODE_LEN;++i){
				switch(code39_code_table[index][i]){
					case 'B':
						for(int j=0;j<WIDE_BAR_LEN_R3;++j){
							encode_buf->append(QLine(global_Xposition,global_Yposition,global_Xposition,global_Yposition+global_height));
							global_Xposition+=1;}
						break;
					case 'b':
						for(int j=0;j<NARROW_BAR_LEN;++j){
							encode_buf->append(QLine(global_Xposition,global_Yposition,global_Xposition,global_Yposition+global_height));
							global_Xposition+=1;}
						break;
					case 'W':
						global_Xposition+=WIDE_BAR_LEN_R3;
						break;
					case 'w':
						global_Xposition+=NARROW_BAR_LEN;
						break;
					default:
						return -2;//code error
				}
			}
			chksum+=index;
			return 1;//insert successful
		}
	}
	return -3;//not found char
}
开发者ID:xufooo,项目名称:conference_assistant,代码行数:33,代码来源:bc_generator.cpp


示例6: LOG_DEBUG

void TraceGraphView::drawGrid(QPainter *painter,
                              const QRectF &rect) {
  // draw lines
  QPointF start = rect.topLeft().toPoint();
  QPointF end = rect.bottomRight().toPoint();
  LOG_DEBUG("Draw grid!");
  LOG_DEBUG(rect.topLeft().x() << " , " << rect.topLeft().y());
  LOG_DEBUG(rect.bottomRight().x() << " , " << rect.bottomRight().y());
  LOG_DEBUG(start.x() << " , " << start.y());
  LOG_DEBUG(end.x() << " , " << end.y());

  // draw vertical grid
  for (int i = start.x();
       i < end.x();
       ++i) {
    if (i % m_gridSpacing == 0) {
      painter->drawLine(QLine(QPoint(i, rect.top()),
                              QPoint(i, rect.bottom())));
      i+= m_gridSpacing - 2;
    }
  }

  // draw horizontal grid
  for (int i = start.y();
       i < end.y();
       ++i) {
    if (i % m_gridSpacing == 0) {
      painter->drawLine(QLine(QPoint(rect.left(), i),
                              QPoint(rect.right(), i)));
      i+= m_gridSpacing - 2;
    }
  }
}
开发者ID:Kaldie,项目名称:GeRoBot,代码行数:33,代码来源:TraceGraphView.cpp


示例7: center

void GameWidget::newTurn(Turn turn) {
    QPoint center(turn.pos.x_cor * cell_size, turn.pos.y_cor * cell_size);

    center.rx() = (center.x() / cell_size) * cell_size + cell_size / 2;
    center.ry() = (center.y() / cell_size) * cell_size + cell_size / 2;
    
    qDebug() << center.rx() << " " << center.ry();

    if (turn.side == TICK_SIDE) {
        ticks.push_back(QLine(center.x() - cell_size / 2 + TIC_TOE_SMALL_COEF, 
            center.y() - cell_size / 2 + TIC_TOE_SMALL_COEF,
            center.x() + cell_size / 2 - TIC_TOE_SMALL_COEF, 
            center.y() + cell_size / 2 - TIC_TOE_SMALL_COEF));
        ticks.push_back(QLine(center.x() + cell_size / 2 - TIC_TOE_SMALL_COEF, 
            center.y() - cell_size / 2 + TIC_TOE_SMALL_COEF,
            center.x() - cell_size / 2 + TIC_TOE_SMALL_COEF, 
            center.y() + cell_size / 2 - TIC_TOE_SMALL_COEF));
    } else {
        toes.push_back(QRect(QPoint(center.x() - cell_size / 2 + TIC_TOE_SMALL_COEF, 
                   center.y() - cell_size / 2 + TIC_TOE_SMALL_COEF),
            QPoint(center.x() + cell_size / 2 - TIC_TOE_SMALL_COEF, 
                    center.y() + cell_size / 2 - TIC_TOE_SMALL_COEF)));
    }

    repaint();
}
开发者ID:akulinich,项目名称:tic-tac-toe,代码行数:26,代码来源:game_widget.cpp


示例8: p

    void BurgerWidget::paintEvent(QPaintEvent *e)
    {
        QPainter p(this);
        QImage pix(QSize(burger_width * 2, burger_height * 2), QImage::Format_ARGB32);
        QPainter painter(&pix);
        p.setRenderHint(QPainter::Antialiasing);
        p.setRenderHint(QPainter::TextAntialiasing);
        painter.setRenderHint(QPainter::Antialiasing);
        QPen pen(QColor(ql1s("#454545")));
        pen.setWidth(4);
        pen.setCapStyle(Qt::RoundCap);
        painter.setPen(pen);
        pix.fill(Qt::transparent);

        const static std::array<QLine, 3> lines =
        {
            QLine(QPoint(2, 6), QPoint(44, 6)),
            QLine(QPoint(2, 20), QPoint(44, 20)),
            QLine(QPoint(2, 34), QPoint(44, 34))
        };
        painter.drawLines(lines.data(), lines.size());

        painter.end();
        Utils::check_pixel_ratio(pix);
        if (Utils::is_mac_retina())
            pix = pix.scaled(QSize(width() * 2, height() * 2), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
        else
            pix = pix.scaled(size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);

        p.fillRect(rect(), CommonStyle::getFrameColor());
        p.drawImage(0, 0, pix);
    }
开发者ID:mailru,项目名称:icqdesktop,代码行数:32,代码来源:TopPanel.cpp


示例9: QImage

QImage Rotater::HideRollOutCorners(const QImage image)
{
    QImage destImage = QImage( image);

    QLine hline, vlineR, vlineL;
    int x0, y0, x1, y1;
    if (m_sign < 0)
    {
        x0 = 0, y0 = 0, x1 = m_width, y1 = 0;
    }
    else
    {
        x0 = 0, y0 = m_height, x1 = m_width, y1 = m_height;
    }

    hline = QLine(x0, y0, x1, y1);
    vlineR = QLine(m_width, 0, m_width, m_height);
    vlineL = QLine(0, 0, 0, m_height);

    QLine rvline = m_transform.map(vlineR);
    QPoint pa = get_line_cross_point(hline, rvline);
    QPoint pb = get_line_cross_point(vlineR, rvline);

    QLine rhline = m_transform.map(hline);
    QPoint pc = get_line_cross_point(vlineL, rhline);
    QPoint pd = get_line_cross_point(hline, rhline);

//    destImage = markOnImage( image, pa.x(), pa.y(), MarkType::CrossLines);
//    destImage = markOnImage( destImage, pb.x(), pb.y(), MarkType::CrossLines);
//    destImage = markOnImage( destImage, pc.x(), pc.y(), MarkType::CrossLines);
//    destImage = markOnImage( destImage, pd.x(), pd.y(), MarkType::CrossLines);

    QPolygonF triagle1, triagle2;
    triagle1 << pa << pb << QPointF(x1, y1);
    triagle2 << pc << pd << QPointF(x0, y0);

    QPainterPath myPath;
    myPath.addPolygon(triagle1);
    myPath.addPolygon(triagle2);

    QTransform transform;
    transform.translate(0, m_height * 0.5);
    transform.rotate(180, Qt::XAxis);
    transform.translate(0, -m_height * 0.5);
    QPainterPath myPath1 = transform.map(myPath);

    transform.reset();
    transform.translate(m_width * 0.5, 0);
    transform.rotate(180, Qt::YAxis);
    transform.translate(-m_width * 0.5, 0);
    myPath = transform.map(myPath);
    myPath.addPath(myPath1);

    QPainter painter(&destImage);
    painter.setBrush(Qt::SolidPattern);
    painter.drawPath(myPath);

    return destImage;
}
开发者ID:chenx77,项目名称:MyCodeLab,代码行数:59,代码来源:rotater.cpp


示例10: paint

 void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
 {
     static const QLine lines[] = {
         QLine(-8,0, 8,0),
         QLine(0,-8, 0,8),
     };
     painter->setPen(QPen(Qt::DashLine));
     painter->drawLines(lines, sizeof(lines) / sizeof(lines[0]));
 }
开发者ID:bradley45,项目名称:tiled,代码行数:9,代码来源:objectselectiontool.cpp


示例11: drawH

void Canvas::drawH(int x, int y, int size) {
    int x0 = x - size / 2;
    int x1 = x + size / 2;
    int y0 = y - size / 2;
    int y1 = y + size / 2;

    lines.push_back(QLine(x0, y0, x0, y1));
    lines.push_back(QLine(x1, y0, x1, y1));
    lines.push_back(QLine(x0, y, x1, y));
}
开发者ID:devkaz,项目名称:cs203,代码行数:10,代码来源:canvas.cpp


示例12: Q_UNUSED

void ControlsOverlay::paintEvent(QPaintEvent *event) {
    Q_UNUSED(event)

    QPainter painter(this);
    painter.fillRect(QRect(0,0,60,20),QBrush(QColor(0,0,0,60),Qt::SolidPattern));
    painter.setPen(pen);
    painter.drawLine(QLine(4,15,15,15)); //minimize
    painter.drawRect(QRect(24,10,10,5)); //square
    painter.drawLine(QLine(44,4,54,14)); //cross 1
    painter.drawLine(QLine(44,15,54,5)); //cross 2
}
开发者ID:srrcboy,项目名称:qimgv,代码行数:11,代码来源:controlsoverlay.cpp


示例13: pointToLineDistance

/*!
 * \param[in] aPos point to insert into the polygon
 * \param[in] aPoly polygon
 */
int
ImageHolder::posInPolygon(QPoint *aPos, QPolygon *aPoly) const
{
	if (!aPos || !aPoly || aPoly->count() < 2 || aPos->isNull()) {
		return -1;
		/* NOTREACHED */
	}

	int x = aPos->x();
	int y = aPos->y();

	int index = 0;
	int dist = 100000;
	int temp = 0;
	int count = aPoly->count();
	QRect rect;

	for (int i = 0; i < count - 1; i++) {
		temp = pointToLineDistance(
			QLine(aPoly->at(i), aPoly->at(i + 1)),
			*aPos
			);
		rect.setTopLeft(aPoly->at(i));
		rect.setBottomRight(aPoly->at(i + 1));
		rect = rect.normalized();
		if (temp < dist &&
			((x < rect.right() && rect.left() < x) ||
			(y < rect.bottom() && rect.top() < y)))
		{
			dist = temp;
			index = i + 1;
		}
	}

	/* first and last points */
	temp = pointToLineDistance(
		QLine(aPoly->at(0), aPoly->at(count - 1)),
		*aPos
		);

	rect.setTopLeft(aPoly->at(0));
	rect.setBottomRight(aPoly->at(count - 1));
	rect = rect.normalized();
	if (temp < dist &&
		((x < rect.right() && rect.left() < x) ||
		(y < rect.bottom() && rect.top() < y)))
	{
		index = 0;
	}

	return index;
}
开发者ID:gavlig,项目名称:Image-labeling-tool,代码行数:56,代码来源:ImageHolder.cpp


示例14: QLine

void OriginIndicator::paint(QPainter *painter,
                            const QStyleOptionGraphicsItem *,
                            QWidget *)
{
    static const QLine lines[] = {
        QLine(-8,0, 8,0),
        QLine(0,-8, 0,8),
    };
    painter->setPen(QPen(mUnderMouse ? Qt::white : Qt::lightGray, 1, Qt::DashLine));
    painter->drawLines(lines, sizeof(lines) / sizeof(lines[0]));
    painter->translate(1, 1);
    painter->setPen(QPen(Qt::black, 1, Qt::DashLine));
    painter->drawLines(lines, sizeof(lines) / sizeof(lines[0]));
}
开发者ID:EdenIndustries,项目名称:tiled,代码行数:14,代码来源:objectselectiontool.cpp


示例15: drawFoldIcon

/*!
  \code
    QPalette p = QApplication::palette();
    QPalette p2 = p;
    p2.setColor(QPalette::Highlight,p2.color(QPalette::Highlight).lighter());
    headerButtonFold = drawFoldIcon(p, true);
    headerButtonFoldOver = drawFoldIcon(p2, true);
    headerButtonUnfold = drawFoldIcon(p, false);
    headerButtonUnfoldOver = drawFoldIcon(p2, false);
  \endcode
 */
QPixmap SystemPanelScheme::drawFoldIcon(const QPalette& p, bool fold) const
{
    QImage img(17,17,QImage::Format_ARGB32_Premultiplied);
    img.fill(0x00000000);
    QPainter painter;
    painter.begin(&img);
    painter.setBrush(p.window());
    painter.drawEllipse(2,2,13,13);
    painter.setPen(p.color(QPalette::Base));
    painter.drawEllipse(2,2,13,13);
    painter.setPen(p.color(QPalette::Highlight));
    painter.drawLine(QLine(5,7,8,4));
    painter.drawLine(QLine(6,7,8,5));
    painter.drawLine(QLine(8,4,11,7));
    painter.drawLine(QLine(8,5,10,7));
    painter.drawLine(QLine(5,11,8,8));
    painter.drawLine(QLine(6,11,8,9));
    painter.drawLine(QLine(8,8,11,11));
    painter.drawLine(QLine(9,8,10,11));
    painter.end();

    if (!fold) {
        QTransform mat;
        mat.rotate(180.0);
        img = img.transformed(mat);
    }
    return QPixmap::fromImage(img);
}
开发者ID:WandererFan,项目名称:FreeCAD,代码行数:39,代码来源:freecadscheme.cpp


示例16: QLine

lineItem::lineItem(int width, int height)
{
    m_width = width;
    m_height =  height;

    QLine horizonLine = QLine(4, height * 0.55, width - 4, height  * 0.55);
    m_linePos.push_back(horizonLine);
    QLine verticalLine = QLine(width * 0.19, 4, width * 0.19, height - 4);
    m_linePos.push_back(verticalLine);
    m_lineCroPos.rx() = (double)(width * 19/100);
    m_lineCroPos.ry() = (double)(height * 55 /100) ;
    qDebug("lineItem::lineItem %d, %d",  m_lineCroPos.rx(),  m_lineCroPos.ry());

}
开发者ID:Ranpop,项目名称:QT-Monitor,代码行数:14,代码来源:lineItem.cpp


示例17: SShadeRect

void SShadeRect( IRect *irect , int darkcolor , int lightcolor )

{
	float xmin = XTRANS(irect->xmin);
	float ymax = YTRANS(irect->ymin);
	float xmax = XTRANS(irect->xmax);
	float ymin = YTRANS(irect->ymax);

	/* printf("SShadeRect (0) : %d %d %d %d\n",
		irect->xmin,irect->ymin,irect->xmax,irect->ymax); */
	/* printf("SShadeRect (1) : %f %f %f %f\n",xmin,ymin,xmax,ymax); */

	/* first pass */

	QNewPen(darkcolor);
	QLine( xmin , ymin , xmax , ymin );	/* top */
	QLine( xmax , ymin , xmax , ymax );	/* right */
	QNewPen(lightcolor);
	QLine( xmax , ymax , xmin , ymax );	/* bottom */
	QLine( xmin , ymax , xmin , ymin );	/* left */

	/* second pass -> thicken line */

	xmin += 1.; ymin += 1.;
	xmax -= 1.; ymax -= 1.;

	QNewPen(darkcolor);
	QLine( xmin , ymin , xmax , ymin );	/* top */
	QLine( xmax , ymin , xmax , ymax );	/* right */
	QNewPen(lightcolor);
	QLine( xmax , ymax , xmin , ymax );	/* bottom */
	QLine( xmin , ymax , xmin , ymin );	/* left */

	/* printf("SShadeRect (2) : %f %f %f %f\n",xmin,ymin,xmax,ymax); */
}
开发者ID:EricPascolo,项目名称:shyfem,代码行数:35,代码来源:screen.c


示例18: switch

//! [paint function]
void DisplayWidget::paint(QPainter &painter)
{
//![paint picture]
    painter.setClipRect(QRect(0, 0, 200, 200));
    painter.setPen(Qt::NoPen);

    switch (background) {
    case Sky:
    default:
        painter.fillRect(QRect(0, 0, 200, 200), Qt::darkBlue);
        painter.translate(145, 10);
        painter.setBrush(Qt::white);
        painter.drawPath(moon);
        painter.translate(-145, -10);
        break;
    case Trees:
    {
        painter.fillRect(QRect(0, 0, 200, 200), Qt::darkGreen);
        painter.setBrush(Qt::green);
        painter.setPen(Qt::black);
        for (int y = -55, row = 0; y < 200; y += 50, ++row) {
            int xs;
            if (row == 2 || row == 3)
                xs = 150;
            else
                xs = 50;
            for (int x = 0; x < 200; x += xs) {
                painter.save();
                painter.translate(x, y);
                painter.drawPath(tree);
                painter.restore();
            }
        }
        break;
    }
    case Road:
        painter.fillRect(QRect(0, 0, 200, 200), Qt::gray);
        painter.setPen(QPen(Qt::white, 4, Qt::DashLine));
        painter.drawLine(QLine(0, 35, 200, 35));
        painter.drawLine(QLine(0, 165, 200, 165));
        break;
    }

    painter.setBrush(shapeColor);
    painter.setPen(Qt::black);
    painter.translate(100, 100);
    painter.drawPath(shapeMap[shape]);
//![paint picture]
}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:50,代码来源:displaywidget.cpp


示例19: gradient1

/*!
    \fn TitleBar::draw_close_btn()
 */
void TitleBar::draw_close_btn()
{
    //draw close button
	int ih1 = 13;
	int iw1 = 30;
        QPainter painter;
        QPen pen;
	QLinearGradient gradient1(0, ih1, 0, 0);
	gradient1.setColorAt(0, QColor::fromRgb(131, 3, 3));
	rightPm = QPixmap(iw1, ih1);
	painter.begin(&rightPm);
	
	if(bpress)
	{
		gradient1.setColorAt(1, QColor::fromRgb(237, 26, 86));
		painter.fillRect(0, 0, iw1, ih1, QBrush(gradient1));
		//draw frame close button
		painter.setPen(QColor(0,0,0));
		painter.drawLine(0,0,iw1,0);
		painter.drawLine(0,ih1,0,0);
                painter.drawLine(0, ih1-1, iw1,ih1-1);
                pen.setColor(QColor(83,31,31));

	}
	else
	{
		
	    gradient1.setColorAt(1, QColor::fromRgb(243, 115, 115));
	    painter.fillRect(0, 0, iw1, ih1, QBrush(gradient1));
		//draw frame close button
	    painter.setPen(QColor(66,67,70));
	    painter.drawLine(0,0,iw1,0);
		painter.setPen(QColor(71,71,74));
	    painter.drawLine(0,ih1,0,0);
		painter.setPen(QColor(88,88,90));
            painter.drawLine(0, ih1-1, iw1,ih1-1);
            pen.setColor(QColor(255,255,255));
	}
		
	//draw line close button
	painter.setPen(pen);
	QVector<QLine> lines;
	lines << QLine(iw1-16,ih1-10,iw1-11,ih1-5) << QLine(iw1-11,ih1-10,iw1-16,ih1-5);
	painter.drawLines(lines);
		
	update();
	painter.end();
}
开发者ID:CheeryLee,项目名称:QShaderEditor,代码行数:51,代码来源:titlebar.cpp


示例20: prepareGeometryChange

void GraphicsGridItem::updateGrid()
{
    prepareGeometryChange();

    // horizontal lines
    mHLines.clear();
    for(int i=0; i<=mRows; i++) {
        mHLines << QLine(QPoint(0, i*mHSpacing), QPoint(mRect.width(),i*mHSpacing));
    }

    // vertical lines
    mVLines.clear();
    for(int i=0; i<=mColumns; i++) {
        mVLines << QLine(QPoint(i*mVSpacing,0), QPoint(i*mVSpacing,mRect.height()));
    }
}
开发者ID:jreuss,项目名称:tudimapper,代码行数:16,代码来源:graphicsgriditem.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ QLineF函数代码示例发布时间:2022-05-30
下一篇:
C++ QLatin1String函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap