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


C++ QPointF::y方法代码示例

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


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

示例1: rotate

void Plugin_Entity::rotate(QPointF center, double angle){
    entity->rotate( RS_Vector(center.x(), center.y()) , angle);
}
开发者ID:absorb-it,项目名称:LibreCAD,代码行数:3,代码来源:doc_plugin_interface.cpp

示例2: drawForeground

void MScene::drawForeground(QPainter *painter, const QRectF &rect)
{
    Q_D(MScene);

    /* Overlay information on the widgets in development mode */
    if (MApplication::showBoundingRect() || MApplication::showSize() || MApplication::showPosition() || MApplication::showMargins() || MApplication::showObjectNames() || MApplication::showStyleNames()) {
        QList<QGraphicsItem *> itemList = items(rect);
        QList<QGraphicsItem *>::iterator item;

        painter->setFont(TextFont);
        int fontHeight = d->metrics.height();
        QTransform rotationMatrix;
        painter->setTransform(rotationMatrix);

        QList<QGraphicsItem *>::iterator end = itemList.end();
        for (item = itemList.begin(); item != end; ++item) {
            QRectF br = (*item)->boundingRect();
            QPolygonF bp = (*item)->mapToScene(br);

            if (MApplication::showBoundingRect()) {
                if (!dynamic_cast<MApplicationPage *>(*item)) { // filter out page for clarity
                    painter->setOpacity(BoundingRectOpacity);
                    painter->setPen(d->boundingRectLinePen);
                    painter->setBrush(d->boundingRectFillBrush);
                    painter->drawPolygon(bp);
                }
            }

            if (MApplication::showMargins()) {
                // Draw content margins
                QGraphicsLayoutItem *layoutItem = dynamic_cast<QGraphicsLayoutItem *>(*item);
                if (layoutItem) {
                    qreal left, top, right, bottom;
                    layoutItem->getContentsMargins(&left, &top, &right, &bottom);

                    QRectF outerRect = (*item)->mapRectToScene(br);
                    QRectF innerRect = (*item)->mapRectToScene(br.adjusted(left, top, -right, -bottom));

                    QRectF leftRect(outerRect.x(), outerRect.y(), innerRect.x() - outerRect.x(), outerRect.height());
                    QRectF topRect(innerRect.x(), outerRect.y(), innerRect.width(), innerRect.y() - outerRect.y());
                    QRectF rightRect(innerRect.bottomRight().x(), outerRect.y(), outerRect.bottomRight().x() - innerRect.bottomRight().x(), outerRect.height());
                    QRectF bottomRect(innerRect.x(), innerRect.bottomRight().y(), innerRect.width(), outerRect.bottomRight().y() - innerRect.bottomRight().y());

                    painter->setOpacity(0.5);

                    d->fillMarginRectWithPattern(painter, leftRect, leftRect.width());
                    d->fillMarginRectWithPattern(painter, topRect, topRect.height());
                    d->fillMarginRectWithPattern(painter, rightRect, rightRect.width());
                    d->fillMarginRectWithPattern(painter, bottomRect, bottomRect.height());

                }

                painter->setOpacity(1.0);
            }

            if (MApplication::showPosition()) {
                QPointF topLeft = ((*item)->mapToScene(br.topLeft()));
                QString posStr = QString("(%1, %2)").arg(topLeft.x()).arg(topLeft.y());
                painter->setPen(Qt::black);
                painter->drawText(topLeft += QPointF(5, fontHeight), posStr);
                painter->setPen(Qt::white);
                painter->drawText(topLeft -= QPointF(1, 1),  posStr);
            }

            if (MApplication::showSize()) {
                QPointF bottomRight = ((*item)->mapToScene(br.bottomRight()));
                QPointF pos = (*item)->mapToScene(br.topLeft());
                QString sizeStr = QString("%1x%2 (%3,%4)").arg(br.width()).arg(br.height()).arg(pos.x()).arg(pos.y());
                painter->setPen(Qt::black);
                painter->drawText(bottomRight -= QPointF(d->metrics.width(sizeStr), 2), sizeStr);
                painter->setPen(Qt::white);
                painter->drawText(bottomRight -= QPointF(1, 1), sizeStr);
            }

            if (MApplication::showObjectNames()) {
                d->drawObjectNames(painter, item);
            }

            if (MApplication::showStyleNames()) {
                d->drawStyleNames(painter, item);
            }
        }
    }

    bool countingFps = MApplication::logFps() || MApplication::showFps();
    if (countingFps) {
        if (d->fps.frameCount < 0) {
            d->fps.time.restart();
            d->fps.frameCount = 0;
        }
        ++d->fps.frameCount;

        int ms = d->fps.time.elapsed();
        if (ms > FpsRefreshInterval) {
            float fps = d->fps.frameCount * 1000.0f / ms;
            d->fps.time.restart();
            d->fps.frameCount = 0;
            if (MApplication::logFps()) {
                QTime time = d->fps.time.currentTime();
                d->logFpsCounter(&time, fps);
//.........这里部分代码省略.........
开发者ID:dudochkin-victor,项目名称:libgogootouch,代码行数:101,代码来源:mscene.cpp

示例3: OnMouseMoveEvent

void GraphiItemCtrl::OnMouseMoveEvent( QPointF oPoint )
{
	QString sValue;
	sValue.sprintf("%f x %f", oPoint.x(),oPoint.y());
	lbl_Coordinates->setText(sValue);
}
开发者ID:kanishka3000,项目名称:ImgTool,代码行数:6,代码来源:GraphiItemCtrl.cpp

示例4: paintEvent

//----------------------------------------------------------------------------------------------
/// Paint the overlay
void LineOverlay::paintEvent(QPaintEvent * /*event*/) {
  // Don't paint until created
  // Also, don't paint while right-click dragging (panning) the underlying pic
  if (m_creation || m_rightButton || !m_shown)
    return;

  QPainter painter(this);
  //    int r = rand() % 255;
  //    int g = rand() % 255;
  //    int b = rand() % 255;

  //    painter.setBrush(QBrush(QColor(r,g,b)));

  QPointF diff = m_pointB - m_pointA;
  // Angle of the "width" perpendicular to the line
  double angle = atan2(diff.y(), diff.x()) + M_PI / 2.0;
  QPointF widthOffset(m_width * cos(angle), m_width * sin(angle));

  // Rectangle with a rotation
  QPointF pA1 = m_pointA + widthOffset;
  QPointF pA2 = m_pointA - widthOffset;
  QPointF pB1 = m_pointB + widthOffset;
  QPointF pB2 = m_pointB - widthOffset;

  QPen boxPenLight(QColor(255, 255, 255, 200));
  QPen boxPenDark(QColor(0, 0, 0, 200));
  QPen centerPen(QColor(192, 192, 192, 128));

  // Special XOR pixel drawing
  // painter.setCompositionMode( QPainter::RasterOp_SourceXorDestination ); //
  // RHEL5 has an old version of QT?

  boxPenLight.setDashPattern(QVector<qreal>() << 5 << 5);
  boxPenDark.setDashPattern(QVector<qreal>() << 0 << 5 << 5 << 0);

  // --- Draw the box ---
  boxPenLight.setWidthF(1.0);
  boxPenDark.setWidthF(1.0);

  //    QPoint points[4] = {transform(pA1), transform(pB1), transform(pB2),
  //    transform(pA2)};
  //    painter.drawPolygon(points, 4);

  painter.setPen(boxPenLight);
  painter.drawLine(transform(pA1), transform(pB1));
  painter.drawLine(transform(pB1), transform(pB2));
  painter.drawLine(transform(pA2), transform(pB2));
  painter.drawLine(transform(pA2), transform(pA1));
  painter.setPen(boxPenDark);
  painter.drawLine(transform(pA1), transform(pB1));
  painter.drawLine(transform(pB1), transform(pB2));
  painter.drawLine(transform(pA2), transform(pB2));
  painter.drawLine(transform(pA2), transform(pA1));

  // Go back to normal drawing mode
  painter.setCompositionMode(QPainter::CompositionMode_SourceOver);

  // --- Draw the central line ---
  if (m_showLine) {
    centerPen.setWidth(2);
    centerPen.setCapStyle(Qt::FlatCap);
    painter.setPen(centerPen);
    painter.drawLine(transform(m_pointA), transform(m_pointB));
  }

  // --- Draw and store the rects of the 4 handles ---
  m_handles.clear();
  m_handles.push_back(drawHandle(painter, m_pointA, QColor(0, 0, 0)));
  m_handles.push_back(drawHandle(painter, m_pointB, QColor(255, 255, 255)));
  m_handles.push_back(drawHandle(
      painter, (m_pointA + m_pointB) / 2 + widthOffset, QColor(0, 255, 255)));
  m_handles.push_back(drawHandle(
      painter, (m_pointA + m_pointB) / 2 - widthOffset, QColor(0, 255, 255)));
}
开发者ID:rosswhitfield,项目名称:mantid,代码行数:76,代码来源:LineOverlay.cpp

示例5: drawSVGMarker

void QgsComposerArrow::drawSVGMarker( QPainter* p, MarkerType type, const QString &markerPath )
{
  Q_UNUSED( markerPath );
  double ang = QgsComposerUtils::angle( mStartPoint, mStopPoint );

  double arrowHeadHeight;
  if ( type == StartMarker )
  {
    arrowHeadHeight = mStartArrowHeadHeight;
  }
  else
  {
    arrowHeadHeight = mStopArrowHeadHeight;
  }
  if ( mArrowHeadWidth <= 0 || arrowHeadHeight <= 0 )
  {
    //bad image size
    return;
  }

  QPointF imageFixPoint;
  imageFixPoint.setX( mArrowHeadWidth / 2.0 );
  QPointF canvasPoint;
  if ( type == StartMarker )
  {
    canvasPoint = QPointF( mStartPoint.x() - pos().x(), mStartPoint.y() - pos().y() );
    imageFixPoint.setY( mStartArrowHeadHeight );
  }
  else //end marker
  {
    canvasPoint = QPointF( mStopPoint.x() - pos().x(), mStopPoint.y() - pos().y() );
    imageFixPoint.setY( 0 );
  }

  QString svgFileName = ( type == StartMarker ? mStartMarkerFile : mEndMarkerFile );
  if ( svgFileName.isEmpty() )
    return;

  QSvgRenderer r;
  const QByteArray &svgContent = QgsSvgCache::instance()->svgContent( svgFileName, mArrowHeadWidth, mArrowHeadFillColor, mArrowHeadOutlineColor, mArrowHeadOutlineWidth,
                                 1.0, 1.0 );
  r.load( svgContent );

  p->save();
  p->setRenderHint( QPainter::Antialiasing );
  if ( mBoundsBehaviour == 22 )
  {
    //if arrow was created in versions prior to 2.4, use the old rendering style
    //rotate image fix point for backtransform
    QPointF fixPoint;
    if ( type == StartMarker )
    {
      fixPoint.setX( 0 );
      fixPoint.setY( arrowHeadHeight / 2.0 );
    }
    else
    {
      fixPoint.setX( 0 );
      fixPoint.setY( -arrowHeadHeight / 2.0 );
    }
    QPointF rotatedFixPoint;
    double angleRad = ang / 180 * M_PI;
    rotatedFixPoint.setX( fixPoint.x() * cos( angleRad ) + fixPoint.y() * -sin( angleRad ) );
    rotatedFixPoint.setY( fixPoint.x() * sin( angleRad ) + fixPoint.y() * cos( angleRad ) );
    p->translate( canvasPoint.x() - rotatedFixPoint.x(), canvasPoint.y() - rotatedFixPoint.y() );
  }
  else
  {
    p->translate( canvasPoint.x(), canvasPoint.y() );
  }

  p->rotate( ang );
  p->translate( -mArrowHeadWidth / 2.0, -arrowHeadHeight / 2.0 );
  r.render( p, QRectF( 0, 0, mArrowHeadWidth, arrowHeadHeight ) );
  p->restore();

  return;
}
开发者ID:V17nika,项目名称:QGIS,代码行数:78,代码来源:qgscomposerarrow.cpp

示例6: if

bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, const QgsSymbolV2RenderContext* context, const QgsFeature* f, const QPointF& shift ) const
{
  //width
  double symbolWidth = mSymbolWidth;
  QgsExpression* widthExpression = expression( "width" );
  if ( widthExpression ) //1. priority: data defined setting on symbol layer level
  {
    symbolWidth = widthExpression->evaluate( const_cast<QgsFeature*>( f ) ).toDouble();
  }
  else if ( context->renderHints() & QgsSymbolV2::DataDefinedSizeScale ) //2. priority: is data defined size on symbol level
  {
    symbolWidth = mSize;
  }
  if ( mSymbolWidthUnit == QgsSymbolV2::MM )
  {
    symbolWidth *= mmMapUnitScaleFactor;
  }

  //height
  double symbolHeight = mSymbolHeight;
  QgsExpression* heightExpression = expression( "height" );
  if ( heightExpression ) //1. priority: data defined setting on symbol layer level
  {
    symbolHeight =  heightExpression->evaluate( const_cast<QgsFeature*>( f ) ).toDouble();
  }
  else if ( context->renderHints() & QgsSymbolV2::DataDefinedSizeScale ) //2. priority: is data defined size on symbol level
  {
    symbolHeight = mSize;
  }
  if ( mSymbolHeightUnit == QgsSymbolV2::MM )
  {
    symbolHeight *= mmMapUnitScaleFactor;
  }

  //outline width
  double outlineWidth = mOutlineWidth;
  QgsExpression* outlineWidthExpression = expression( "outline_width" );
  if ( outlineWidthExpression )
  {
    outlineWidth = outlineWidthExpression->evaluate( const_cast<QgsFeature*>( context->feature() ) ).toDouble();
  }
  if ( mOutlineWidthUnit == QgsSymbolV2::MM )
  {
    outlineWidth *= outlineWidth;
  }

  //fill color
  QColor fc = mFillColor;
  QgsExpression* fillColorExpression = expression( "fill_color" );
  if ( fillColorExpression )
  {
    fc = QColor( fillColorExpression->evaluate( const_cast<QgsFeature*>( context->feature() ) ).toString() );
  }
  int fillColorIndex = e.closestColorMatch( fc.rgb() );

  //outline color
  QColor oc = mOutlineColor;
  QgsExpression* outlineColorExpression = expression( "outline_color" );
  if ( outlineColorExpression )
  {
    oc = QColor( outlineColorExpression->evaluate( const_cast<QgsFeature*>( context->feature() ) ).toString() );
  }
  int outlineColorIndex = e.closestColorMatch( oc.rgb() );


  //symbol name
  QString symbolName =  mSymbolName;
  QgsExpression* symbolNameExpression = expression( "symbol_name" );
  if ( symbolNameExpression )
  {
    QgsExpression* symbolNameExpression = expression( "symbol_name" );
    symbolName = symbolNameExpression->evaluate( const_cast<QgsFeature*>( context->feature() ) ).toString();
  }

  //offset
  double offsetX = 0;
  double offsetY = 0;
  markerOffset( *context, offsetX, offsetY );
  QPointF off( offsetX, offsetY );

  //priority for rotation: 1. data defined symbol level, 2. symbol layer rotation (mAngle)
  double rotation = 0.0;
  QgsExpression* rotationExpression = expression( "rotation" );
  if ( rotationExpression )
  {
    rotation = rotationExpression->evaluate( const_cast<QgsFeature*>( context->feature() ) ).toDouble();
  }
  else if ( !qgsDoubleNear( mAngle, 0.0 ) )
  {
    rotation = mAngle;
  }
  rotation = -rotation; //rotation in Qt is counterclockwise
  if ( rotation )
    off = _rotatedOffset( off, rotation );

  QTransform t;
  t.translate( shift.x() + offsetX, shift.y() + offsetY );

  if ( rotation != 0 )
    t.rotate( rotation );
//.........这里部分代码省略.........
开发者ID:Aladar64,项目名称:QGIS,代码行数:101,代码来源:qgsellipsesymbollayerv2.cpp

示例7: generateTilePixmap

QPixmap TileWidget::generateTilePixmap()
{
    const QSize currentSize(size());

    if (currentSize.isEmpty())
        return QPixmap();

    const QRect borderRect(0, 0, currentSize.width(), currentSize.height());
    const int maxSideLength = qMax(currentSize.width(), currentSize.height());
    const int borderWidth = 1;

    const QPointF midpoint((double)(currentSize.width() + borderWidth) / 2, (double)(currentSize.height() + borderWidth) / 2);
    const QColor color(tileColor());

    QPixmap ret(currentSize);

    if (PixmapCacher::self()->contains(color))
        ret = PixmapCacher::self()->get(color);
    else
    {
        //UVcout << "cache miss for color " << color.rgb() << endl;
        double radius = maxSideLength / 2 * 1.41 + maxSideLength / 10 + 2;

        // could be used for cool effect -- the color of the bonus square we're obscuring
        //const QColor outerColor(backgroundColor());

        QRadialGradient gradient(QPointF(radius, radius), radius * 3, QPointF(radius / 3, radius / 3));
        gradient.setColorAt(0, color.light(GraphicalBoardFrame::s_highlightFactor));
        gradient.setColorAt(.95, color.dark(GraphicalBoardFrame::s_highlightFactor));

        QPainter painter(&ret);
        painter.setBrush(gradient);
    
        painter.drawEllipse((int)(midpoint.x() - radius), (int)(midpoint.y() - radius), (int)(radius * 2), (int)(radius * 2));

        QPalette customPalette;
        customPalette.setColor(QPalette::Light, color.light(GraphicalBoardFrame::s_highlightFactor));
        customPalette.setColor(QPalette::Dark, color);
        customPalette.setColor(QPalette::Mid, color);

        qDrawShadePanel(&painter, borderRect.x(), borderRect.y(), borderRect.width(), borderRect.height(), customPalette, false, borderWidth);

        PixmapCacher::self()->put(color, ret);
    }

    const QString nanism = miniText();
    const bool hasNanism = !nanism.isEmpty();

    const QString text = letterText();
    if (!text.isEmpty())
    {
        QPainter painter(&ret);
        painter.setFont(letterFont());
        QPen pen(letterTextColor());
        painter.setPen(pen);
        painter.setBrush(Qt::NoBrush);

        const QRectF textSize(painter.boundingRect(borderRect, text));
        const QPointF startPoint(midpoint - textSize.bottomRight() / 2);
        const QPointF roundedStartPoint(floor(startPoint.x()), floor(startPoint.y()));

        QRectF textRect(textSize);
        textRect.moveTo(roundedStartPoint);

        painter.drawText(textRect, Qt::TextDontClip, text);

        if (m_information.isBlank)
        {
            painter.setBrush(Qt::NoBrush);
            pen.setWidth(1);
            painter.setPen(pen);

            const int border = currentSize.width() / 5;
            painter.drawRect(QRect(border, border, currentSize.width() - 2 * border, currentSize.height() - 2 * border));
        }
    }

    if (hasNanism)
    {
        QPainter painter(&ret);
        painter.setFont(miniFont());
        QPen pen(miniTextColor());
        painter.setPen(pen);
        painter.setBrush(Qt::NoBrush);

        const QRectF textSize(painter.boundingRect(borderRect, nanism));
        const QPointF startPoint((midpoint * (nanism.length() > 1? 1.65 : 1.68)) - textSize.bottomRight() / 2);
        const QPointF roundedStartPoint(floor(startPoint.x()), floor(startPoint.y()));

        QRectF textRect(textSize);
        textRect.moveTo(roundedStartPoint);

        painter.drawText(textRect, Qt::TextDontClip, nanism);
    }

    return ret;
}
开发者ID:gokceneraslan,项目名称:quackle,代码行数:97,代码来源:graphicalboard.cpp

示例8: pointRect

QRectF QtGradientWidgetPrivate::pointRect(const QPointF &point, double size) const
{
    return QRectF(point.x() - size / 2, point.y() - size / 2, size, size);
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:4,代码来源:qtgradientwidget.cpp

示例9: toViewport

QPointF QtGradientWidgetPrivate::toViewport(const QPointF &point) const
{
    QSize size = q_ptr->size();
    return QPointF(point.x() * size.width(), point.y() * size.height());
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:5,代码来源:qtgradientwidget.cpp

示例10: qDebug

void MainView2D::createFixtureItem(quint32 fxID, quint16 headIndex, quint16 linkedIndex,
                                   QVector3D pos, bool mmCoords)
{
    if (isEnabled() == false)
        return;

    if (m_gridItem == NULL)
       initialize2DProperties();

    qDebug() << "[MainView2D] Creating fixture with ID" << fxID << headIndex << linkedIndex << "pos:" << pos;

    Fixture *fixture = m_doc->fixture(fxID);
    if (fixture == NULL)
        return;

    quint32 itemID = FixtureUtils::fixtureItemID(fxID, headIndex, linkedIndex);
    QLCFixtureMode *fxMode = fixture->fixtureMode();
    QQuickItem *newFixtureItem = qobject_cast<QQuickItem*>(fixtureComponent->create());
    quint32 itemFlags = m_monProps->fixtureFlags(fxID, headIndex, linkedIndex);

    newFixtureItem->setParentItem(m_gridItem);
    newFixtureItem->setProperty("itemID", itemID);

    if (itemFlags & MonitorProperties::HiddenFlag)
        newFixtureItem->setProperty("visible", false);

    if (fxMode != NULL && fixture->type() != QLCFixtureDef::Dimmer)
    {
        QLCPhysical phy = fxMode->physical();

        //qDebug() << "Current mode fixture heads:" << fxMode->heads().count();
        newFixtureItem->setProperty("headsNumber", fxMode->heads().count());

        if (fixture->channelNumber(QLCChannel::Pan, QLCChannel::MSB) != QLCChannel::invalid())
        {
            int panDeg = phy.focusPanMax();
            if (panDeg == 0) panDeg = 360;
            newFixtureItem->setProperty("panMaxDegrees", panDeg);
        }
        if (fixture->channelNumber(QLCChannel::Tilt, QLCChannel::MSB) != QLCChannel::invalid())
        {
            int tiltDeg = phy.focusTiltMax();
            if (tiltDeg == 0) tiltDeg = 270;
            newFixtureItem->setProperty("tiltMaxDegrees", tiltDeg);
        }
    }

    QPointF itemPos;
    QSizeF size = FixtureUtils::item2DDimension(fixture->type() == QLCFixtureDef::Dimmer ? NULL : fxMode,
                                                m_monProps->pointOfView());

    if (mmCoords == false && (pos.x() != 0 || pos.y() != 0))
    {
        float gridUnits = m_monProps->gridUnits() == MonitorProperties::Meters ? 1000.0 : 304.8;
        itemPos.setX((pos.x() * gridUnits) / m_cellPixels);
        itemPos.setY((pos.y() * gridUnits) / m_cellPixels);
    }

    if (m_monProps->containsItem(fxID, headIndex, linkedIndex))
    {
        itemPos = FixtureUtils::item2DPosition(m_monProps, m_monProps->pointOfView(), pos);
        newFixtureItem->setProperty("rotation",
                                    FixtureUtils::item2DRotation(m_monProps->pointOfView(),
                                                                 m_monProps->fixtureRotation(fxID, headIndex, linkedIndex)));
    }
    else
    {
        itemPos = FixtureUtils::available2DPosition(m_doc, m_monProps->pointOfView(),
                                                    QRectF(itemPos.x(), itemPos.y(), size.width(), size.height()));
        // add the new fixture to the Doc monitor properties
        QVector3D newPos = FixtureUtils::item3DPosition(m_monProps, itemPos, 1000.0);
        m_monProps->setFixturePosition(fxID, headIndex, linkedIndex, newPos);
        m_monProps->setFixtureFlags(fxID, headIndex, linkedIndex, 0);
        Tardis::instance()->enqueueAction(Tardis::FixtureSetPosition, itemID, QVariant(QVector3D(0, 0, 0)), QVariant(newPos));
    }

    newFixtureItem->setProperty("mmXPos", itemPos.x());
    newFixtureItem->setProperty("mmYPos", itemPos.y());
    newFixtureItem->setProperty("mmWidth", size.width());
    newFixtureItem->setProperty("mmHeight", size.height());
    newFixtureItem->setProperty("fixtureName", fixture->name());

    // and finally add the new item to the items map
    m_itemsMap[itemID] = newFixtureItem;

    QByteArray values;
    updateFixture(fixture, values);
}
开发者ID:exmatrikulator,项目名称:qlcplus,代码行数:88,代码来源:mainview2d.cpp

示例11: setColorFromPoint

void ColorRing::setColorFromPoint(float x, float y)
{
	float r2 = x*x + y*y;
	QRect r = contentsRect();
	if(grabring && grabtriangle) {
		grabring = grabtriangle = false;
	}
	if(!grabring && !grabtriangle) {
		if(r2 > RING2) {
			grabring = true;
		} else {
			grabtriangle = true;
		}
	}
	if(grabring) {
		float angle = (atan2f(y,-x)/M_PI);
		angle = (angle * 0.5f) + 0.5f;
		col.setHsvF(angle, col.saturationF(), col.valueF());
	} else if(grabtriangle) {
		QMatrix m;
		m.scale(1.f/RING, 1.f/RING);
		m.rotate(col.hueF() * 360);
		if(triangleMode) {
			QPointF p = m.map(QPointF(x, y)), p2;
			QLineF satL(points[0], points[1]);
			QLineF l1(points[2], p);
			switch(satL.intersect(l1, &p2)) {
			case QLineF::BoundedIntersection:
			case QLineF::UnboundedIntersection:
				{
					float sat = QLineF(points[1], p2).length()/satL.length();
					if(satL.length() < QLineF(points[0], p2).length()) sat = 0;
					float val = QLineF(points[2], p).length()/QLineF(points[2], p2).length();
					if(QLineF(p, p2).length() > QLineF(points[2], p2).length()) val = .0f;
					if(sat > 1.f) sat = 1.f;
					if(sat < .0f) sat = 0.f;
					if(val > 1.f) val = 1.f;
					if(val < .0f) val = .0f;
					col.setHsvF(col.hueF(), sat, val);
					break;
				}
			case QLineF::NoIntersection:
				break;
			}
		} else { // box mode
			QMatrix m2;
			m2.rotate(45);
			m.rotate(45);
			QPointF p = m.map(QPointF(x, y)), p1  = m2.map(points2[1]), p2 = m2.map(points2[2]), p0 = m2.map(points2[0]);
			float sat = (p.x() - p1.x()) / (p0.x() - p1.x());
			float val = (p.y() - p1.y()) / (p2.y() - p1.y());
			if(sat > 1.f) sat = 1.f;
			if(sat < .0f) sat = 0.f;
			if(val > 1.f) val = 1.f;
			if(val < .0f) val = .0f;
			col.setHsvF(col.hueF(), sat, val);
			//QMessageBox::information(0, "", QString("x=%1, y=%2, p1.x=%3, p1.y=%4, p2.x=%5, p2.y=%6").arg(QString::number(p.x())).arg(QString::number(p.y())).arg(QString::number(p1.x())).arg(QString::number(p1.y())).arg(QString::number(p2.x())).arg(QString::number(p2.y())));
		}
	}
	emit hChanged(col.hueF());
	emit colorChanged(col);
	repaint();
}
开发者ID:nopper,项目名称:quadro,代码行数:63,代码来源:colorring.cpp

示例12: updatePath

void PlotObject::updatePath()
{
    _path = QPainterPath();
    if (((SelectProperty*) properties()["mode"])->currentIndex() == 0) {
        QList<qreal> xValues;
        QList<qreal> yValues;
        qreal start = ((RealProperty*) properties()["start"])->value();
        qreal end = ((RealProperty*) properties()["end"])->value();
        qreal pointCount = ((IntegerProperty*) properties()["points"])->value();

        qreal step = (end - start) / pointCount;
        if (step > 0) {
            for (qreal x = start; x <= end; x += step) {
                xValues.append(x);
           }
        } else if (step < 0) {
            for (qreal x = start; x >= end; x += step) {
                xValues.append(x);
            }
        } else {
            return;
        }
        if (xValues.isEmpty()) return;


        yValues = MathUtility::parse(((PropertyString*) properties()["formular"])->string(), xValues);
        _path = QPainterPath(QPointF(xValues.first(), yValues.first()));
        for (int i = 1; i < xValues.size(); i++) {
            _path.lineTo(xValues[i], yValues[i]);
        }
    } else {
        QList<qreal> alphas;
        QList<qreal> radius;
        qreal start = ((RealProperty*) properties()["polar-start"])->value() * M_PI/180.0;
        qreal end = ((RealProperty*) properties()["polar-end"])->value() * M_PI/180.0;
        qreal pointCount = ((IntegerProperty*) properties()["points"])->value();
        qreal step = (end - start) / pointCount;
        if (step > 0) {
            for (qreal x = start; x <= end; x += step) {
                alphas.append(x);
           }
        } else if (step < 0) {
            for (qreal x = start; x >= end; x += step) {
                alphas.append(x);
            }
        } else {
            return;
        }
        radius = MathUtility::parse(((PropertyString*) properties()["formular"])->string(), alphas);

        auto polarToCart = [](qreal alpha, qreal radius) {
            return QPointF(qCos(alpha) * radius,
                           qSin(alpha) * radius);
        };

        _path = QPainterPath(polarToCart(alphas.first(), radius.first()));
        for (int i = 1; i < alphas.size(); i++) {
            QPointF p = polarToCart(alphas[i], radius[i]);
            _path.lineTo(p.x(), p.y());
        }

    }
}
开发者ID:oVooVo,项目名称:freezing-happiness,代码行数:63,代码来源:plotobject.cpp

示例13:

void
FormText::moveResizable( const QPointF & delta )
{
	moveBy( delta.x(), delta.y() );
}
开发者ID:igormironchik,项目名称:prototyper,代码行数:5,代码来源:form_text.cpp

示例14: scale

void Plugin_Entity::scale(QPointF center, QPointF factor){
    entity->scale( RS_Vector(center.x(), center.y()),
                RS_Vector(factor.x(), factor.y()) );
}
开发者ID:absorb-it,项目名称:LibreCAD,代码行数:4,代码来源:doc_plugin_interface.cpp

示例15: QPoint

QPoint QtfeCanal::listPos2WidgetPos(QPointF pf)
{
	return QPoint(pf.x()*width(), height() * (1.0 - pf.y()));
}
开发者ID:theShmoo,项目名称:medvis2,代码行数:4,代码来源:QtfeCanal.cpp


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