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


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

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


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

示例1: InCloseRegion

/*
    Function to check if the event positon was in 'close' section of the label.
    @detail This fuction checks the event position against the detection area for
    the close part of the label.
    @param QPointF position is the event position
    @return bool indicates if the event was in a relevant position
*/
bool GraphicsScene::InCloseRegion(QPointF& position)
{
    if(   (position.rx() >= selected_point->getCenter().rx()+LABEL_WIDTH/2-2*METRICS.width("X") && position.rx() <= selected_point->getCenter().rx()+LABEL_WIDTH/2)
       && (position.ry() >= selected_point->getCenter().ry()-LABEL_HEIGHT-LABEL_HEIGHT_MARGIN   && position.ry() <= selected_point->getCenter().ry()-LABEL_HEIGHT_MARGIN))
        return true;
    return false;
}
开发者ID:maytim,项目名称:Particles-on-a-Board-GUI,代码行数:14,代码来源:GraphicsScene.cpp

示例2: leftBottomCorner

ParkingLots::ParkingLots(const qreal &leftCorner, const qreal &bottomCorner)
{
    QPointF tempPoint;
    QPointF leftBottomCorner(leftCorner, bottomCorner);
    OccupancyCell emptyCell;
    QPointF leftBottomUtm(871831, 6077369);
    qDebug() << "num of rows"<<_numOfRows;
    qDebug() << "num of cols"<<_numOfCols;
    for (int colNum = 0; colNum < _numOfCols; ++colNum)
    {
        for (int rowNum = 0; rowNum < _numOfRows; ++rowNum)
        {
            tempPoint.ry() =
                    leftBottomCorner.y() * _metersInPx + leftBottomUtm.y() +
                    rowNum * _height * _metersInPx +
                    (_height / 2) * _metersInPx;
            tempPoint.rx() =
                    leftBottomCorner.x() * _metersInPx + leftBottomUtm.x() +
                    colNum * _width * _metersInPx +
                    (_width / 2) * _metersInPx;
            // the rows are as follows:
            // 01___23___45___67___ ...
            // so we need to account for the gap
            tempPoint.rx() = tempPoint.x() + (colNum / _gap_every) * (_gap) * _metersInPx;
            _centers.append(tempPoint);
            _occupancy.append(emptyCell);
            _currentOccupancy.append(emptyCell);
        }
    }
}
开发者ID:niosus,项目名称:OccupancyAnalyzer,代码行数:30,代码来源:parking_lots.cpp

示例3: paint

		void HueSaturationDisc::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
		{
			QPen pen(Qt::black, 2, Qt::SolidLine);
			pen.setCosmetic ( true );
			QBrush brush( Qt::SolidPattern );
			brush.setColor(QColor::fromHsv( m_currentColor.hue(), m_currentColor.saturation(), 255));
			painter->setBrush(brush);
			painter->setPen(pen);


			// compute position from current color
			int hue, sat, val;
			m_currentColor.getHsv(&hue, &sat, &val);

			// hue point
			{
				float r = (sat/255.0f)*m_radius;
				float angle = (1.0f - hue/359.0f)*2.0f*MATH_PIf;
				QPointF p = getPoint( angle, r );
				float t = p.x();
				p.rx() = -p.y();
				p.ry() = t;

				float width = 5.0f;
				painter->drawEllipse( p, width, width  );
			}
		}
开发者ID:dkoerner,项目名称:sandbox,代码行数:27,代码来源:HueSaturationDisc.cpp

示例4: cal

//计算t时,输出点的位置:有Bug
//当控制点的横坐标位于两个端点之外时,出现bug  == 找到,由于插入控制点的错误造成
QPointF QBezier::cal(float t)
{
  QPointF result;
  QPointF pStart,pEnd;
  knowPoints.insert(knowPoints.begin(),startPoint);
  knowPoints.append(endPoint);
  if(knowPoints.count() <= 1){
    return QPointF(0.0,0.0);
  }

  pStart.rx() = (1-t)*knowPoints.first().x() + t*knowPoints.at(1).x();
  pStart.ry() = (1-t)*knowPoints.first().y() + t*knowPoints.at(1).y();
  int cnt = knowPoints.count();
  for(int i = 1; i < cnt - 1; i++)
  {
      pEnd.rx() = (1-t)*knowPoints.at(i).x() + t*knowPoints.at(i+1).x();
      pEnd.ry() = (1-t)*knowPoints.at(i).y() + t*knowPoints.at(i+1).y();
      result.rx() = (1-t)*pStart.x() + t*pEnd.x();
      result.ry() = (1-t)*pStart.y() + t*pEnd.y();
      pStart = result;
  }
  knowPoints.removeFirst();
  knowPoints.removeLast();
  return result;
}
开发者ID:sunshinemyson,项目名称:CurveDraw,代码行数:27,代码来源:qbezier.cpp

示例5: getHandle

/**********************************************************************
 * Function: get handle point
 * Parameters: handle id, bound rect
 * Return: none
 **********************************************************************/
QPointF QArcItem::getHandle(int iHandle, QRectF &qrcBondingRect) const
{
    QPointF qpPoint;

    if (iHandle > 8)
    {
        QList<QPolygonF> polygonfs = m_ArcPath.toSubpathPolygons();
        int iSize = polygonfs.size();
        if (iSize <= 0 || iSize > 1)
        {
            return qpPoint;
        }
        QPolygonF polygonf = polygonfs.at(0);
        int j = polygonf.size();
        if (j <= 1)
        {
            return qpPoint;;
        }

        /*Get the key points*/
        QPointF qpDimCenter;
        qpDimCenter = polygonf.at(0);
        switch (iHandle)
        {
        case 9:
            qpPoint = polygonf.at(1);
            qpPoint.rx() = (qpPoint.x() + qpDimCenter.x()) / 2;
            qpPoint.ry() = (qpPoint.y() + qpDimCenter.y()) / 2;
            break;
        case 10:
            qpPoint = polygonf.at(j - 1);
            qpPoint.rx() = (qpPoint.x() + qpDimCenter.x()) / 2;
            qpPoint.ry() = (qpPoint.y() + qpDimCenter.y()) / 2;
            break;
        default:
            break;
        }

        qpPoint = this->mapToScene(qpPoint);
        qpPoint.rx() = qpPoint.x();
        return qpPoint;
    }
    else
    {
        return SamDrawItemBase::getHandle(iHandle, qrcBondingRect);
    }
}
开发者ID:maqiangddb,项目名称:pc_code,代码行数:52,代码来源:QArcItem.cpp

示例6: handleMouseMove

void ShapeResizeStrategy::handleMouseMove(const QPointF &point, Qt::KeyboardModifiers modifiers)
{
    tool()->canvas()->updateCanvas(tool()->canvas()->snapGuide()->boundingRect());
    QPointF newPos = tool()->canvas()->snapGuide()->snap( point, modifiers );
    tool()->canvas()->updateCanvas(tool()->canvas()->snapGuide()->boundingRect());

    bool keepAspect = modifiers & Qt::ShiftModifier;
    foreach(KoShape *shape, m_selectedShapes)
        keepAspect = keepAspect || shape->keepAspectRatio();

    qreal startWidth = m_initialSize.width();
    if (startWidth < std::numeric_limits<qreal>::epsilon())
        startWidth = std::numeric_limits<qreal>::epsilon();
    qreal startHeight = m_initialSize.height();
    if (startHeight < std::numeric_limits<qreal>::epsilon())
        startHeight = std::numeric_limits<qreal>::epsilon();

    QPointF distance = m_unwindMatrix.map(newPos) - m_unwindMatrix.map( m_start );
    // guard against resizing zero width shapes, which would result in huge zoom factors
    if (m_initialSize.width() < std::numeric_limits<qreal>::epsilon()) {
        distance.rx() = 0.0;
    }
    // guard against resizing zero height shapes, which would result in huge zoom factors
    if (m_initialSize.height() < std::numeric_limits<qreal>::epsilon()) {
        distance.ry() = 0.0;
    }

    const bool scaleFromCenter = modifiers & Qt::ControlModifier;
    if (scaleFromCenter) {
        distance *= 2.0;
    }
    qreal zoomX=1, zoomY=1;
    if (m_left)
        zoomX = (startWidth - distance.x()) / startWidth;
    else if (m_right)
        zoomX = (startWidth + distance.x()) / startWidth;
    if (m_top)
        zoomY = (startHeight - distance.y()) / startHeight;
    else if (m_bottom)
        zoomY = (startHeight + distance.y()) / startHeight;

    if (keepAspect) {
        const bool cornerUsed = ((m_bottom?1:0) + (m_top?1:0) + (m_left?1:0) + (m_right?1:0)) == 2;
        if ((cornerUsed && startWidth < startHeight) || m_left || m_right)
            zoomY = zoomX;
        else
            zoomX = zoomY;
    }

    QPointF move;

    if (scaleFromCenter)
        move = QPointF(startWidth / 2.0, startHeight / 2.0);
    else
        move = QPointF(m_left?startWidth:0, m_top?startHeight:0);

    resizeBy( move, zoomX, zoomY );
}
开发者ID:NavyZhao1978,项目名称:QCalligra,代码行数:58,代码来源:ShapeResizeStrategy.cpp

示例7: updateDragging

void PrintTool::updateDragging(MapCoordF mouse_pos_map)
{
	QPointF delta = QPointF(mouse_pos_map - click_pos_map);
	QRectF area = map_printer->getPrintArea();
	switch (region)
	{
		case Inside:
			area.moveTopLeft(area.topLeft() + delta);
			break;
		case LeftBorder:
			area.setLeft(area.left() + delta.rx());
			break;
		case TopLeftCorner:
			area.setTopLeft(area.topLeft() + delta);
			break;
		case TopBorder:
			area.setTop(area.top() + delta.ry());
			break;
		case TopRightCorner:
			area.setTopRight(area.topRight() + delta);
			break;
		case RightBorder:
			area.setRight(area.right() + delta.rx());
			break;
		case BottomRightCorner:
			area.setBottomRight(area.bottomRight() + delta);
			break;
		case BottomBorder:
			area.setBottom(area.bottom() + delta.ry());
			break;
		case BottomLeftCorner:
			area.setBottomLeft(area.bottomLeft() + delta);
			break;
		case Outside:
			Q_ASSERT(false); // Handled outside.
		case Unknown:
			; // Nothing
	}
	
	if (area.left() < area.right() && area.top() < area.bottom())
	{
		map_printer->setPrintArea(area);
		click_pos_map = mouse_pos_map;
	}
}
开发者ID:999999333,项目名称:mapper,代码行数:45,代码来源:print_tool.cpp

示例8: MAKELPARAM

void Cocos2dxView::mouseMoveInChoiceEdit(QMouseEvent *event)
{
	QPointF	pos = event->localPos();
	//组装windows消息
	UINT  message = WM_MOUSEMOVE;
	WPARAM wparam = MK_LBUTTON;
	LPARAM lparam = MAKELPARAM(pos.rx(), pos.ry());
	CCEGLView::sharedOpenGLView()->WindowProc(message, wparam, lparam);
}
开发者ID:cubemoon,项目名称:SceneEditor-1,代码行数:9,代码来源:Cocos2dxView.cpp

示例9: Translate

/*
 * Translates the items in the main
 * layer by (x, y). Note: the input
 * parameters are in the main layers
 * coordinate system.
 */
void View::Translate(qreal x, qreal y)
{
    QPointF pos = m_pMainLayer->pos();

    pos.rx() += (x * m_pMainLayer->scale());
    pos.ry() += (y * m_pMainLayer->scale());

    m_pMainLayer->setPos(pos);
}
开发者ID:romoadri21,项目名称:boi,代码行数:15,代码来源:View.cpp

示例10: svgLineToVertical

void KoPathShapeLoaderPrivate::svgLineToVertical(qreal y, bool abs)
{
    if (abs)
        lastPoint.setY(y);
    else
        lastPoint.ry() += y;

    path->lineTo(lastPoint);
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:9,代码来源:KoPathShapeLoader.cpp

示例11:

QPointF
ViewerNode::getWipeCenter() const
{
    KnobDoublePtr wipeCenter = _imp->wipeCenter.lock();
    QPointF r;
    r.rx() = wipeCenter->getValue();
    r.ry() = wipeCenter->getValue(DimIdx(1));
    return r;
}
开发者ID:ebrayton,项目名称:Natron,代码行数:9,代码来源:ViewerNode.cpp

示例12: toStored

QPointF SymbolDataEditor::toStored(const QPointF &point) const
{
    QRectF symbolRect = scene->items(Qt::AscendingOrder).at(Item::SymbolItem)->boundingRect();
    symbolRect.moveTopLeft(scene->items(Qt::AscendingOrder).at(Item::SymbolItem)->pos());
    QPointF result = point - symbolRect.topLeft();
    result.rx() = point.x() / symbolRect.width();
    result.ry() = point.y() / symbolRect.height();
    result -= QPointF(2.0,2.0); //WARNING: I don't know why this works, but it depends on SvgView::scaleViewBox()
    return result;
}
开发者ID:aizenbit,项目名称:Scribbler,代码行数:10,代码来源:symboldataeditor.cpp

示例13: hitTest

/***********************************************************************
 *Funtion : Hit test for the object
 *Return  : integer handle id.
 *Parameter: QPoint local mouse point, scene bonding rect, bool selected flag.
 **********************************************************************/
int SamDrawItemBase::hitTest(QPointF qpPoint, QRectF &qrcBondingRect, bool bSelected)
{
    if (this->getResizable() == false)
    {
        return 0;
    }

    /*Object is selected*/
    if (bSelected)
    {
        /*Check the handle, if the mouse point in it's area*/
        int iHandleCount = getHandleCount();
        for (int iHandle = 1; iHandle <= iHandleCount; iHandle++)
        {
            // GetHandleRect returns in logical coords
            QRectF qrcRect = getHandleRect(iHandle, qrcBondingRect);
            if ( (qpPoint.rx() >= qrcRect.left())
                && (qpPoint.rx() <= qrcRect.right())
                && (qpPoint.ry() >= qrcRect.top())
                && (qpPoint.ry() <= qrcRect.bottom()) )
            {
                return iHandle;
            }
        }
    }
    /*Object is not selected*/
    else
    {
        /*if ( qpPoint.rx() >= this->sceneBoundingRect().left()
            && qpPoint.rx() < this->sceneBoundingRect().right()
            && qpPoint.ry() <= this->sceneBoundingRect().top()
            && qpPoint.ry() > this->sceneBoundingRect().bottom() )*/
        if ( qpPoint.rx() >= qrcBondingRect.left()
                 && qpPoint.rx() < qrcBondingRect.right()
                 && qpPoint.ry() <= qrcBondingRect.top()
                 && qpPoint.ry() > qrcBondingRect.bottom() )
        {
            return 1;
        }
    }

    return 0;
}
开发者ID:maqiangddb,项目名称:pc_code,代码行数:48,代码来源:samdrawitembase.cpp

示例14: fromStored

QPointF SymbolDataEditor::fromStored(const QPointF &point) const
{
    QPointF result;
    QRectF symbolRect = scene->items(Qt::AscendingOrder).at(Item::SymbolItem)->boundingRect();
    symbolRect.moveTopLeft(scene->items(Qt::AscendingOrder).at(Item::SymbolItem)->pos());
    result.rx() = point.x() * symbolRect.width();
    result.ry() = point.y() * symbolRect.height();
    result += symbolRect.topLeft();
    return result;
}
开发者ID:aizenbit,项目名称:Scribbler,代码行数:10,代码来源:symboldataeditor.cpp

示例15: groupHeaderRect

QRectF KItemListViewLayouter::groupHeaderRect(int index) const
{
    const_cast<KItemListViewLayouter*>(this)->doLayout();

    const QRectF firstItemRect = itemRect(index);
    QPointF pos = firstItemRect.topLeft();
    if (pos.isNull()) {
        return QRectF();
    }

    QSizeF size;
    if (m_scrollOrientation == Qt::Vertical) {
        pos.rx() = 0;
        pos.ry() -= m_groupHeaderHeight;
        size = QSizeF(m_size.width(), m_groupHeaderHeight);
    } else {
        pos.rx() -= m_itemMargin.width();
        pos.ry() = 0;

        // Determine the maximum width used in the
        // current column. As the scroll-direction is
        // Qt::Horizontal and m_itemRects is accessed directly,
        // the logical height represents the visual width.
        qreal width = minimumGroupHeaderWidth();
        const qreal y = m_itemInfos[index].rect.y();
        const int maxIndex = m_itemInfos.count() - 1;
        while (index <= maxIndex) {
            QRectF bounds = m_itemInfos[index].rect;
            if (bounds.y() != y) {
                break;
            }

            if (bounds.height() > width) {
                width = bounds.height();
            }

            ++index;
        }

        size = QSizeF(width, m_size.height());
    }
    return QRectF(pos, size);
}
开发者ID:blue-shell,项目名称:folderview,代码行数:43,代码来源:kitemlistviewlayouter.cpp


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