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


C++ QPainterPath::lineTo方法代码示例

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


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

示例1: LinearGraphics

MultiLineStringGraphics::MultiLineStringGraphics(OGRMultiLineString* OGRMultiLine, const QPen& Pen):
  LinearGraphics(Pen.color())
{
  QPainterPath Path;

  for (int i=0; i<OGRMultiLine->getNumGeometries();i++)
  {
    QPainterPath LinePath;

    OGRLineString* OGRLine = dynamic_cast<OGRLineString*>(OGRMultiLine->getGeometryRef(i));

    LinePath.moveTo(OGRLine->getX(0),OGRLine->getY(0));

    for (int i=1; i < OGRLine->getNumPoints(); i++)
    {
      LinePath.lineTo(OGRLine->getX(i),OGRLine->getY(i));
    }

    Path.addPath(LinePath);
  }

  setPen(Pen);
  setPath(Path);
}
开发者ID:jylfc0307,项目名称:OpenFluidPlus,代码行数:24,代码来源:MultiLineStringGraphics.cpp

示例2: buildPainterPath

QPainterPath FreehandShape::buildPainterPath(void)
{
    QPainterPath path;

    StlStrokeList::iterator sEnd = _geometry.strokes.end();
    for (StlStrokeList::iterator s = _geometry.strokes.begin(); s != sEnd; ++s)
    {
        StlStroke::iterator pBegin = (*s).begin();
        StlStroke::iterator pEnd = (*s).end();
        for (StlStroke::iterator p = pBegin; p != pEnd; ++p)
        {
            if (p == pBegin)
            {
                // First point.
                path.moveTo(QPointF((*p).x, (*p).y));
            }
            else
            {
                path.lineTo(QPointF((*p).x, (*p).y));
            }
        }
    }
    return path;
}
开发者ID:SollyTaylor,项目名称:dunnart,代码行数:24,代码来源:freehand.cpp

示例3: if

extern "C" void pathext_stroke_path(fz_device *dev, fz_path *path,
                                    fz_stroke_state *, const fz_matrix *ctm,
                                    fz_colorspace *, float *, float)
{
  PathExt *ext = static_cast<PathExt*>(dev->user);
  if( ext == 0 ) {
    return;
  }

  QPainterPath qPath;
  float *c = path->coords;
  for(int i = 0; i < path->cmd_len; i++) {
    if(        path->cmds[i] == FZ_MOVETO ) {
      qPath.moveTo(c[0], c[1]);
      c += 2;
    } else if( path->cmds[i] == FZ_LINETO ) {
      qPath.lineTo(c[0], c[1]);
      c += 2;
    } else if( path->cmds[i] == FZ_CURVETO ) {
      qPath.cubicTo(c[0], c[1], c[2], c[3], c[4], c[5]);
      c += 6;
    } else if( path->cmds[i] == FZ_CLOSE_PATH ) {
      if( !ext->closed ) {
        return;
      }
      qPath.closeSubpath();
    } else {
      return;
    }
  }

  const QTransform qCtm = toTransform(ctm);
  qPath = qCtm.map(qPath);

  ext->paths.push_back(qPath);
}
开发者ID:CaSchmidt,项目名称:cslabs,代码行数:36,代码来源:fz_pathext.cpp

示例4: paint_wave

QPainterPath AscanWidget::paint_wave()
{
    QPainterPath path;

    float xRatio1 = 1.0;
    float xRatio2 = 1.0;
    float yRatio = y_axis_length() / 255.0;

    int drawPoints = 0;
    if ( m_beam.size() < x_axis_length()) {
        xRatio1 = x_axis_length() / 1.0 / m_beam.size();
        drawPoints = m_beam.size();
    } else {
        xRatio2 = m_beam.size() / 1.0 / x_axis_length();
        drawPoints = x_axis_length();
    }

    for (int i = 0; i < drawPoints; ++i) {
        path.lineTo( i*xRatio1,
                     ((quint8)(m_beam.at((int)(i*xRatio2)))) * yRatio + 0.5);
    }

    return path;
}
开发者ID:15903016222,项目名称:a_scan,代码行数:24,代码来源:a_scan_widget.cpp

示例5: move

QRect AGenericBrush::move(const QString &brush, QPainter &painter,const QPoint &oldPos, const QPoint &newPos)
{
	painter.save();

	int rad = painter.pen().width();
	QRect boundingRect = QRect(oldPos, newPos).normalized().adjusted(-rad, -rad, +rad, +rad);
	QColor color = painter.pen().color();
	int thickness = painter.pen().width();
	QColor transparentColor(color.red(), color.green(), color.blue(), 0);
	
	QPainterPath path;
	path.setFillRule ( Qt::WindingFill );
// 	m_path.setFillRule ( Qt::WindingFill );
	path.moveTo(oldPos);
	path.lineTo(newPos);
	
	m_path.closeSubpath();
	m_path.addPath(path);

	painter.drawPath(path);
	
	painter.restore();
	return boundingRect;
}
开发者ID:BackupTheBerlios,项目名称:ktoon-svn,代码行数:24,代码来源:agenericbrush.cpp

示例6: updateShape

void SunMenuItemView::updateShape()
{
    QPainterPath newPath;

    qreal tmp = qAbs(sweepLength());
    if (width() != 0 && tmp > 0.001)
    {
        qint32 innerRad = innerRadius();
        qint32 outerRadius = innerRad + width();
        QRectF r = QRect(-outerRadius, -outerRadius, outerRadius * 2,
                         outerRadius * 2);

        if (innerRad == 0 && qAbs(sweepLength() - 360) < 0.0001)
        {
            newPath.addEllipse(r);
        }
        else
        {
            newPath.arcMoveTo(r, startAngle());
            newPath.arcTo(r, startAngle(), sweepLength());

            if(innerRad == 0)
            {
                newPath.lineTo(0,0);
            }else
            {
                r = QRect(-innerRad, -innerRad, innerRad * 2, innerRad * 2);
                newPath.arcTo(r, startAngle() + sweepLength(), -sweepLength());
            }
            newPath.closeSubpath();
        }
    }
    //
    setPath(newPath);
    reinitializeDisplayedItemPosition();
}
开发者ID:mcdir,项目名称:sui,代码行数:36,代码来源:sunmenuIiemview.cpp

示例7: paintToScene

void PAData::paintToScene(QGraphicsScene &scene, QGraphicsItemGroup *group)
{
    CODEBOOK *ts = static_cast<CODEBOOK*>(this->associatedData.data()->getData());
    PARTITIONING *pa = &this->partition;

    CONVEXHULLSET *hull = NULL;
    ConstructConvexHulls(ts, pa, &hull);

    QGraphicsItem *item = NULL;
    CONVEXVERTEX* CV;

    for (int index=0; index < CHS_size(hull); index++ )
    {
        CV = CHS_hullfirst(hull, index);
        if(!CV) continue;

        QPointF start_point = QPointF(VectorScalar(ts, CV->index, 0), VectorScalar(ts, CV->index, 1));
        QPainterPath path = QPainterPath(start_point);

        CV = CV_next(CV);
        while( CV != NULL )
        {
            QPointF point = QPointF(VectorScalar(ts, CV->index, 0), VectorScalar(ts, CV->index, 1));
            path.lineTo(point);

            CV = CV_next(CV);
        }

        item = new QGraphicsPathItem(path);

        if (group) group->addToGroup(item);
        else scene.addItem(item);
    }

    if (hull != NULL) FreeConvexHulls(hull);
}
开发者ID:RoboEvangelist,项目名称:cluster,代码行数:36,代码来源:padata.cpp

示例8: magnifierPath

QPainterPath Previewer::magnifierPath( const QSize & top , const QRect & rct , int padding ) const
{
    QPainterPath path;
        path.setFillRule( Qt::WindingFill );
        /*! ======= Draw Top of the Magnifier ======= */
        path.moveTo( (rct.width()-top.width())/2 , padding+top.height() );
        path.lineTo( rct.width()/2 , padding );
        path.lineTo( (rct.width()+top.width())/2 , padding+top.height() );
        /*! ========================================= */
        /*! ===== Draw Bottom of the Magnifier ====== */
        path.lineTo( rct.width()-padding-ROUNDED_PIXEL , padding+top.height() );
        path.quadTo( rct.width()-padding , padding+top.height() , rct.width()-padding , padding+top.height()+ROUNDED_PIXEL );
        path.lineTo( rct.width()-padding , rct.height()-padding-ROUNDED_PIXEL );
        path.quadTo( rct.width()-padding , rct.height()-padding , rct.width()-padding-ROUNDED_PIXEL , rct.height()-padding );
        path.lineTo( padding+ROUNDED_PIXEL , rct.height()-padding );
        path.quadTo( padding , rct.height()-padding , padding , rct.height()-padding-ROUNDED_PIXEL );
        path.lineTo( padding , padding+top.height()+ROUNDED_PIXEL );
        path.quadTo( padding , padding+top.height() , padding+ROUNDED_PIXEL , padding+top.height() );
        path.lineTo( (rct.width()-top.width())/2 , padding+top.height() );
        /*! ========================================= */

    return path;
}
开发者ID:realbardia,项目名称:silicon,代码行数:23,代码来源:silitab.cpp

示例9: rebuildShape

void UIMiniToolBar::rebuildShape()
{
#ifdef VBOX_RUNTIME_UI_WITH_SHAPED_MINI_TOOLBAR
    /* Rebuild shape: */
    QPainterPath shape;
    switch (m_alignment)
    {
        case Qt::AlignTop:
        {
            shape.moveTo(0, 0);
            shape.lineTo(shape.currentPosition().x(), height() - 10);
            shape.arcTo(QRectF(shape.currentPosition(), QSizeF(20, 20)).translated(0, -10), 180, 90);
            shape.lineTo(width() - 10, shape.currentPosition().y());
            shape.arcTo(QRectF(shape.currentPosition(), QSizeF(20, 20)).translated(-10, -20), 270, 90);
            shape.lineTo(shape.currentPosition().x(), 0);
            shape.closeSubpath();
            break;
        }
        case Qt::AlignBottom:
        {
            shape.moveTo(0, height());
            shape.lineTo(shape.currentPosition().x(), 10);
            shape.arcTo(QRectF(shape.currentPosition(), QSizeF(20, 20)).translated(0, -10), 180, -90);
            shape.lineTo(width() - 10, shape.currentPosition().y());
            shape.arcTo(QRectF(shape.currentPosition(), QSizeF(20, 20)).translated(-10, 0), 90, -90);
            shape.lineTo(shape.currentPosition().x(), height());
            shape.closeSubpath();
            break;
        }
        default:
            break;
    }
    m_shape = shape;

    /* Update: */
    update();
#endif /* VBOX_RUNTIME_UI_WITH_SHAPED_MINI_TOOLBAR */
}
开发者ID:apaka,项目名称:vbox,代码行数:38,代码来源:UIMiniToolBar.cpp

示例10: setType

void PianoKeyItem::setType(int val)
{
    type = val;
    QPainterPath path;

    switch(type) {
    case 0:
        path.moveTo(0,0);
        path.lineTo(0,   KEY_HEIGHT-2);
        path.lineTo(2.0, KEY_HEIGHT);
        path.lineTo(KEY_WIDTH-2, KEY_HEIGHT);
        path.lineTo(KEY_WIDTH, KEY_HEIGHT-2);
        path.lineTo(KEY_WIDTH, BKEY_HEIGHT);
        path.lineTo(KEY_WIDTH - BKEY_WIDTH * 5/9, BKEY_HEIGHT);
        path.lineTo(KEY_WIDTH - BKEY_WIDTH * 5/9, 0);
        break;
    case 1:
        path.moveTo(BKEY_WIDTH * 4/9, 0);
        path.lineTo(BKEY_WIDTH * 4/9, BKEY_HEIGHT);
        path.lineTo(0, BKEY_HEIGHT);
        path.lineTo(0,   KEY_HEIGHT-2);
        path.lineTo(2.0, KEY_HEIGHT);
        path.lineTo(KEY_WIDTH-2, KEY_HEIGHT);
        path.lineTo(KEY_WIDTH, KEY_HEIGHT-2);
        path.lineTo(KEY_WIDTH, BKEY_HEIGHT);
        path.lineTo(KEY_WIDTH - BKEY_WIDTH * 4/9, BKEY_HEIGHT);
        path.lineTo(KEY_WIDTH - BKEY_WIDTH * 4/9, 0);
        break;
    case 2:
        path.moveTo(BKEY_WIDTH * 5/9, 0);
        path.lineTo(BKEY_WIDTH * 5/9, BKEY_HEIGHT);
        path.lineTo(0,   BKEY_HEIGHT);
        path.lineTo(0,   KEY_HEIGHT-2);
        path.lineTo(2.0, KEY_HEIGHT);
        path.lineTo(KEY_WIDTH-2, KEY_HEIGHT);
        path.lineTo(KEY_WIDTH,  KEY_HEIGHT-2);
        path.lineTo(KEY_WIDTH,  BKEY_HEIGHT);
        path.lineTo(KEY_WIDTH, 0);
        break;
    case 3:
        path.moveTo(BKEY_WIDTH * 4/9, 0);
        path.lineTo(BKEY_WIDTH * 4/9, BKEY_HEIGHT);
        path.lineTo(0, BKEY_HEIGHT);
        path.lineTo(0,   KEY_HEIGHT-2);
        path.lineTo(2.0, KEY_HEIGHT);
        path.lineTo(KEY_WIDTH-2, KEY_HEIGHT);
        path.lineTo(KEY_WIDTH, KEY_HEIGHT-2);
        path.lineTo(KEY_WIDTH, BKEY_HEIGHT);
        path.lineTo(KEY_WIDTH - BKEY_WIDTH * 5/9, BKEY_HEIGHT);
        path.lineTo(KEY_WIDTH - BKEY_WIDTH * 5/9, 0);
        break;
    case 4:
        path.moveTo(BKEY_WIDTH * 5/9, 0);
        path.lineTo(BKEY_WIDTH * 5/9, BKEY_HEIGHT);
        path.lineTo(0, BKEY_HEIGHT);
        path.lineTo(0,   KEY_HEIGHT-2);
        path.lineTo(2.0, KEY_HEIGHT);
        path.lineTo(KEY_WIDTH-2, KEY_HEIGHT);
        path.lineTo(KEY_WIDTH, KEY_HEIGHT-2);
        path.lineTo(KEY_WIDTH, BKEY_HEIGHT);
        path.lineTo(KEY_WIDTH - BKEY_WIDTH * 4/9, BKEY_HEIGHT);
        path.lineTo(KEY_WIDTH - BKEY_WIDTH * 4/9, 0);
        break;
    case 5:
        path.moveTo(0,0);
        path.lineTo(0,   KEY_HEIGHT-2);
        path.lineTo(2.0, KEY_HEIGHT);
        path.lineTo(KEY_WIDTH-2, KEY_HEIGHT);
        path.lineTo(KEY_WIDTH, KEY_HEIGHT-2);
        path.lineTo(KEY_WIDTH, BKEY_HEIGHT);
        path.lineTo(KEY_WIDTH - BKEY_WIDTH * 4/9, BKEY_HEIGHT);
        path.lineTo(KEY_WIDTH - BKEY_WIDTH * 4/9, 0);
        break;
    case 6:
        path.moveTo(0,0);
        path.lineTo(0,   KEY_HEIGHT-2);
        path.lineTo(2.0, KEY_HEIGHT);
        path.lineTo(KEY_WIDTH-2, KEY_HEIGHT);
        path.lineTo(KEY_WIDTH, KEY_HEIGHT-2);
        path.lineTo(KEY_WIDTH, 0);
        break;
    case 7:
        path.moveTo(0,0);
        path.lineTo(0,            BKEY_HEIGHT-1);
        path.lineTo(1.0,          BKEY_HEIGHT);
        path.lineTo(BKEY_WIDTH-1, BKEY_HEIGHT);
        path.lineTo(BKEY_WIDTH,   BKEY_HEIGHT-1);
        path.lineTo(BKEY_WIDTH, 0);
        break;
    default:
        break;
    }
    path.closeSubpath();
    setPath(path);
}
开发者ID:gthomas,项目名称:MuseScore,代码行数:95,代码来源:pianotools.cpp

示例11: render_qt_text

void render_qt_text(QPainter *painter, int w, int h, const QColor &color) {
    QPainterPath path;
    path.moveTo(-0.083695, 0.283849);
    path.cubicTo(-0.049581, 0.349613, -0.012720, 0.397969, 0.026886, 0.428917);
    path.cubicTo(0.066493, 0.459865, 0.111593, 0.477595, 0.162186, 0.482108);
    path.lineTo(0.162186, 0.500000);
    path.cubicTo(0.115929, 0.498066, 0.066565, 0.487669, 0.014094, 0.468810);
    path.cubicTo(-0.038378, 0.449952, -0.088103, 0.423839, -0.135082, 0.390474);
    path.cubicTo(-0.182061, 0.357108, -0.222608, 0.321567, -0.256722, 0.283849);
    path.cubicTo(-0.304712, 0.262250, -0.342874, 0.239362, -0.371206, 0.215184);
    path.cubicTo(-0.411969, 0.179078, -0.443625, 0.134671, -0.466175, 0.081963);
    path.cubicTo(-0.488725, 0.029255, -0.500000, -0.033043, -0.500000, -0.104932);
    path.cubicTo(-0.500000, -0.218407, -0.467042, -0.312621, -0.401127, -0.387573);
    path.cubicTo(-0.335212, -0.462524, -0.255421, -0.500000, -0.161752, -0.500000);
    path.cubicTo(-0.072998, -0.500000, 0.003903, -0.462444, 0.068951, -0.387331);
    path.cubicTo(0.133998, -0.312218, 0.166522, -0.217440, 0.166522, -0.102998);
    path.cubicTo(0.166522, -0.010155, 0.143394, 0.071325, 0.097138, 0.141441);
    path.cubicTo(0.050882, 0.211557, -0.009396, 0.259026, -0.083695, 0.283849);
    path.moveTo(-0.167823, -0.456963);
    path.cubicTo(-0.228823, -0.456963, -0.277826, -0.432624, -0.314831, -0.383946);
    path.cubicTo(-0.361665, -0.323340, -0.385082, -0.230335, -0.385082, -0.104932);
    path.cubicTo(-0.385082, 0.017569, -0.361376, 0.112025, -0.313964, 0.178433);
    path.cubicTo(-0.277248, 0.229368, -0.228534, 0.254836, -0.167823, 0.254836);
    path.cubicTo(-0.105088, 0.254836, -0.054496, 0.229368, -0.016045, 0.178433);
    path.cubicTo(0.029055, 0.117827, 0.051605, 0.028691, 0.051605, -0.088975);
    path.cubicTo(0.051605, -0.179562, 0.039318, -0.255803, 0.014744, -0.317698);
    path.cubicTo(-0.004337, -0.365409, -0.029705, -0.400548, -0.061362, -0.423114);
    path.cubicTo(-0.093018, -0.445680, -0.128505, -0.456963, -0.167823, -0.456963);
    path.moveTo(0.379011, -0.404739);
    path.lineTo(0.379011, -0.236460);
    path.lineTo(0.486123, -0.236460);
    path.lineTo(0.486123, -0.197292);
    path.lineTo(0.379011, -0.197292);
    path.lineTo(0.379011, 0.134913);
    path.cubicTo(0.379011, 0.168117, 0.383276, 0.190442, 0.391804, 0.201886);
    path.cubicTo(0.400332, 0.213330, 0.411246, 0.219052, 0.424545, 0.219052);
    path.cubicTo(0.435531, 0.219052, 0.446227, 0.215264, 0.456635, 0.207689);
    path.cubicTo(0.467042, 0.200113, 0.474993, 0.188910, 0.480486, 0.174081);
    path.lineTo(0.500000, 0.174081);
    path.cubicTo(0.488436, 0.210509, 0.471957, 0.237911, 0.450564, 0.256286);
    path.cubicTo(0.429170, 0.274662, 0.407054, 0.283849, 0.384215, 0.283849);
    path.cubicTo(0.368893, 0.283849, 0.353859, 0.279094, 0.339115, 0.269584);
    path.cubicTo(0.324371, 0.260074, 0.313530, 0.246534, 0.306592, 0.228965);
    path.cubicTo(0.299653, 0.211396, 0.296184, 0.184075, 0.296184, 0.147002);
    path.lineTo(0.296184, -0.197292);
    path.lineTo(0.223330, -0.197292);
    path.lineTo(0.223330, -0.215667);
    path.cubicTo(0.241833, -0.224049, 0.260697, -0.237992, 0.279922, -0.257495);
    path.cubicTo(0.299147, -0.276999, 0.316276, -0.300129, 0.331310, -0.326886);
    path.cubicTo(0.338826, -0.341070, 0.349523, -0.367021, 0.363400, -0.404739);
    path.lineTo(0.379011, -0.404739);
    path.moveTo(-0.535993, 0.275629);

    painter->translate(w / 2, h / 2);
    double scale = qMin(w, h) * 8 / 10.0;
    painter->scale(scale, scale);

    painter->setRenderHint(QPainter::Antialiasing);

    painter->save();
    painter->translate(.1, .1);
    painter->fillPath(path, QColor(0, 0, 0, 63));
    painter->restore();

    painter->setBrush(color);
    painter->setPen(QPen(Qt::black, 0.02, Qt::SolidLine, Qt::FlatCap, Qt::RoundJoin));
    painter->drawPath(path);
}
开发者ID:inequation,项目名称:particlasm,代码行数:68,代码来源:main.cpp

示例12: paintEvent

void KeyBoardPreview::paintEvent(QPaintEvent* event) {
    QPainter p(this);
    p.setRenderHint(QPainter::Antialiasing);

    p.setBrush(QColor(0xd6, 0xd6, 0xd6));
    p.drawRect(rect());

    QPen pen;
    pen.setWidth(1);
    pen.setColor(QColor(0x58, 0x58, 0x58));
    p.setPen(pen);

    p.setBrush(QColor(0x58, 0x58, 0x58));

    p.setBackgroundMode(Qt::TransparentMode);
    p.translate(0.5, 0.5);

    int rx = 3;
    int x=6;
    int y=6;
    int first_key_w = 0;
    int remaining_x[] = {0,0,0,0};
    int remaining_widths[] = {0,0,0,0};

    for (int i = 0; i < 4; i++) {
        if (first_key_w > 0) {
            first_key_w = first_key_w*1.375;

            if (kb == &kbList[KB_105] && i == 3)
                first_key_w = key_w * 1.275;

            p.drawRoundedRect(QRectF(6, y, first_key_w, key_w), rx, rx);
            x = 6 + first_key_w + space;
        }
        else {
            first_key_w = key_w;
        }



        bool last_end = (i==1 && ! kb->kb_extended_return);
        int rw=usable_width-x;
        int ii=0;

        for (int k : kb->keys.at(i)) {
            QRectF rect = QRectF(x, y, key_w, key_w);

            if (ii == kb->keys.at(i).size()-1 && last_end)
                rect.setWidth(rw);

            p.drawRoundedRect(rect, rx, rx);

            rect.adjust(5, 1, 0, 0);

            p.setPen(QColor(0x9e, 0xde, 0x00));
            p.setFont(upperFont);
            p.drawText(rect, Qt::AlignLeft | Qt::AlignTop, shift_text(k));

            rect.setBottom(rect.bottom() - 2.5);

            p.setPen(QColor(0xff, 0xff, 0xff));
            p.setFont(lowerFont);
            p.drawText(rect, Qt::AlignLeft | Qt::AlignBottom, regular_text(k));

            rw = rw - space - key_w;
            x = x + space + key_w;
            ii = ii+1;

            p.setPen(pen);
        }



        remaining_x[i] = x;
        remaining_widths[i] = rw;

        if (i != 1 && i != 2)
            p.drawRoundedRect(QRectF(x, y, rw, key_w), rx, rx);

        y = y + space + key_w;
    }


    if (kb->kb_extended_return) {
        rx=rx*2;
        int x1 = remaining_x[1];
        int y1 = 6 + key_w*1 + space*1;
        int w1 = remaining_widths[1];
        int x2 = remaining_x[2];
        int y2 = 6 + key_w*2 + space*2;

        // this is some serious crap... but it has to be so
        // maybe one day keyboards won't look like this...
        // one can only hope
        QPainterPath pp;
        pp.moveTo(x1, y1+rx);
        pp.arcTo(x1, y1, rx, rx, 180, -90);
        pp.lineTo(x1+w1-rx, y1);
        pp.arcTo(x1+w1-rx, y1, rx, rx, 90, -90);
        pp.lineTo(x1+w1, y2+key_w-rx);
//.........这里部分代码省略.........
开发者ID:Apricity-OS,项目名称:calamares,代码行数:101,代码来源:keyboardpreview.cpp

示例13: draw


//.........这里部分代码省略.........

  int waveColorN = _waveColors.count();
  int ch;
  for( ch = 0; ch < soundStream->channels(); ++ch ) {

    if( ch < waveColorN && _waveColors[ch].isValid() ) {
      QColor clr( _waveColors[ch] );
      rmsPen.setColor( clr );
      minMaxPen.setColor( clr.darker( 140 ) );
    }
    else {
      rmsPen.setColor( _rmsColor );
      minMaxPen.setColor( _peakColor );
    }

    // draw center line
    p.setPen( QColor(90,90,90) );
    p.drawLine( x, 0, x + width, 0 );

    // draw bounding lines
    p.setPen( QColor(100,100,100) );
    p.drawLine( x, halfChH, x+width, halfChH );
    p.drawLine( x, -halfChH, x+width, -halfChH );

    p.save();

    p.setClipping(true);
    p.setClipRect( x, -halfChH, x+width, chHeight );
    p.scale( 1.f, yScale );

    if( _fpp > 1.0 ) {

      // draw min-max regions and RMS

      short minBuffer[width];
      short maxBuffer[width];
      short minRMS[width];
      short maxRMS[width];

      bool ok = soundStream->displayData( ch, f_beg, f_dur,
                                        minBuffer, maxBuffer,
                                        minRMS, maxRMS,
                                        width );
//    printf("integration ok: %i\n", ok);
      Q_ASSERT( ok );

      int i;
      for( i = 0; i < width; ++i ) {
        short min = minBuffer[i];
        short max = maxBuffer[i];
        if( max != min ) {
          p.setPen( minMaxPen );
          p.drawLine( x + i, min, x + i, max );
        }
        else {
          p.setPen( minMaxPen );
          p.drawPoint( x + i, min );
        }
        p.setPen( rmsPen );
        p.drawLine( x + i, minRMS[i], x + i, maxRMS[i] );
      }
    }
    else {

      // draw lines between actual values

      qreal ppf = 1.0 / _fpp;
      qreal dx = (i_beg - f_beg) * ppf;

      bool interleaved = false;
      short *data = soundStream->rawFrames( ch, i_beg, i_count, &interleaved );
      //printf("got raw frames ok: %i\n", data != 0 );
      Q_ASSERT( data != 0 );
      int step = interleaved ? soundStream->channels() : 1;

      QPainterPath path;

      if( i_count ) {
        QPointF pt( dx, (qreal) *data );
        path.moveTo( pt );
      }
      int f; // frame
      for( f = 1; f < i_count; ++f ) {
        data += step;
        QPointF pt( f * ppf + dx, (qreal) *data );
        path.lineTo( pt );
      }
      if( i_count && !haveOneMore ) {
        path.lineTo( QPointF( f * ppf + dx, (qreal)*data ) );
      }

      p.setPen( rmsPen );
      p.drawPath( path );
    }

    p.restore();

    p.translate( 0.f, chHeight + spacing );
  }
}
开发者ID:acamari,项目名称:supercollider,代码行数:101,代码来源:view.cpp

示例14: paintEvent

void XYVirtualKeyboard::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);
    painter.setRenderHint(QPainter::Antialiasing);
    int btn_w = 60;
    QPainterPath path;

    path.moveTo(width() - 40, 15);
    path.lineTo(width() - 30, 25);
    path.lineTo(width() - 20, 15);
    painter.setPen(XYSKIN->borderPen);
    if (!XYSKIN->topBKPixmap.isNull())
    {
        painter.setBrush(XYSKIN->topBKPixmap.scaled(width(),
                                                    letterLabel->height() + 8));
    }
    else
    {
        painter.setBrush(XYSKIN->topColor);
    }

    painter.drawRect(rect().x(), rect().y(), rect().width(), letterLabel->height() + 8);
    triangleBtnRect = QRect(rect().width() - btn_w, rect().y(), btn_w, letterLabel->height() + 8);

    if (triangleBtnPressed)
    {
        if (!XYSKIN->triangleBKPressedPixmap.isNull())
        {
            painter.setBrush(XYSKIN->triangleBKPressedPixmap.scaled(triangleBtnRect.size()));
            painter.drawRect(triangleBtnRect);
        }
        else
        {
            painter.setBrush(XYSKIN->trianglePressedBKColor);
            painter.setPen(painter.brush().color());
            painter.drawRect(triangleBtnRect);
            painter.setPen(XYSKIN->trianglePen);
            painter.drawPath(path);
        }
    }
    else
    {
        if (!XYSKIN->triangleBKPixmap.isNull())
        {
            painter.setBrush(XYSKIN->triangleBKPixmap.scaled(triangleBtnRect.size()));
            painter.drawRect(triangleBtnRect);
        }
        else
        {
            painter.setBrush(XYSKIN->topColor);
            painter.setPen(XYSKIN->trianglePen);
            painter.drawPath(path);
        }
    }

    painter.setPen(XYSKIN->borderPen);
    if (stackedWidget->currentWidget() == symbolDragableWidget
            || stackedWidget->currentWidget() == translateVDragableWidget)
    {
        painter.setBrush(XYSKIN->bottomColor1);
    }
    else
    {
        if (!XYSKIN->bottomBKPixmap.isNull())
        {
            painter.setBrush(XYSKIN->bottomBKPixmap.scaled(width(),
                                                           height() -
                                                           letterLabel->height() - 8));
        }
        else
        {
            painter.setBrush(XYSKIN->bottomColor2);
        }
    }

    painter.drawRect(rect().x(),
                     rect().y() + letterLabel->height() + 8,
                     rect().width(),
                     rect().height() - letterLabel->height() - 8);
}
开发者ID:Fishguys,项目名称:Soft-keyboard,代码行数:80,代码来源:xyvirtualkeyboard.cpp

示例15: paintAveragePath

void AverageSceneItem::paintAveragePath(QPainter *painter)
{
    if(m_lAverageData.size() == 0)
        return;

    //get maximum range of respective channel type (range value in FiffChInfo does not seem to contain a reasonable value)
    float dMaxValue = 1e-9f;

    switch(m_iChannelKind) {
        case FIFFV_MEG_CH: {
            if(m_iChannelUnit == FIFF_UNIT_T_M) { //gradiometers
                dMaxValue = 1e-10f;
                if(m_scaleMap.contains(FIFF_UNIT_T_M))
                    dMaxValue = m_scaleMap[FIFF_UNIT_T_M];
            }
            else if(m_iChannelUnit == FIFF_UNIT_T) //magnitometers
            {
                dMaxValue = 1e-11f;

                if(m_scaleMap.contains(FIFF_UNIT_T))
                    dMaxValue = m_scaleMap[FIFF_UNIT_T];
            }
            break;
        }

        case FIFFV_REF_MEG_CH: {  /*11/04/14 Added by Limin: MEG reference channel */
            dMaxValue = 1e-11f;
            if(m_scaleMap.contains(FIFF_UNIT_T))
                dMaxValue = m_scaleMap[FIFF_UNIT_T];
            break;
        }
        case FIFFV_EEG_CH: {
            dMaxValue = 1e-4f;
            if(m_scaleMap.contains(FIFFV_EEG_CH))
                dMaxValue = m_scaleMap[FIFFV_EEG_CH];
            break;
        }
        case FIFFV_EOG_CH: {
            dMaxValue = 1e-3f;
            if(m_scaleMap.contains(FIFFV_EOG_CH))
                dMaxValue = m_scaleMap[FIFFV_EOG_CH];
            break;
        }
        case FIFFV_STIM_CH: {
            dMaxValue = 5;
            if(m_scaleMap.contains(FIFFV_STIM_CH))
                dMaxValue = m_scaleMap[FIFFV_STIM_CH];
            break;
        }
        case FIFFV_MISC_CH: {
            dMaxValue = 1e-3f;
            if(m_scaleMap.contains(FIFFV_MISC_CH))
                dMaxValue = m_scaleMap[FIFFV_MISC_CH];
            break;
        }
    }

    //Plot averaged data
    QRectF boundingRect = this->boundingRect();
    double dScaleY = (boundingRect.height()*10)/(2*dMaxValue);
    QPointF qSamplePosition;

    //do for all currently stored evoked set data
    for(int dataIndex = 0; dataIndex<m_lAverageData.size(); dataIndex++) {
        //plot data from averaged data m_lAverageData with the calculated downsample factor
        const double* averageData = m_lAverageData.at(dataIndex).first;
        int totalCols =  m_lAverageData.at(dataIndex).second;

        //Calculate downsampling factor of averaged data in respect to the items width
        int dsFactor;
        totalCols / boundingRect.width()<1 ? dsFactor = 1 : dsFactor = totalCols / boundingRect.width();
        if(dsFactor == 0)
            dsFactor = 1;

        //Create path
        //float offset = (*(averageData+(abs(m_firstLastSample.first)*m_iTotalNumberChannels)+m_iChannelNumber)); //choose offset to be the signal value at time instance 0
        QPainterPath path = QPainterPath(QPointF(boundingRect.x(), boundingRect.y() + boundingRect.height()/2));
        QPen pen;
        pen.setStyle(Qt::SolidLine);
        pen.setColor(Qt::yellow);
        if(!m_cAverageColors.isEmpty() && !(dataIndex<m_cAverageColors.size()))
            pen.setColor(m_cAverageColors.at(dataIndex));
        pen.setWidthF(5);
        painter->setPen(pen);

        for(int i = 0; i < totalCols && path.elementCount() <= boundingRect.width(); i += dsFactor) {
            //evoked matrix is stored in column major
            double val = ((*(averageData+(i*m_iTotalNumberChannels)+m_iChannelNumber))/*-offset*/) * dScaleY;

            qSamplePosition.setY(-val);
            qSamplePosition.setX(path.currentPosition().x()+1);

            path.lineTo(qSamplePosition);
        }

        painter->drawPath(path);
    }
}
开发者ID:BulatSuleymanoff,项目名称:mne-cpp,代码行数:98,代码来源:averagesceneitem.cpp


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