本文整理汇总了C++中QPointF::rx方法的典型用法代码示例。如果您正苦于以下问题:C++ QPointF::rx方法的具体用法?C++ QPointF::rx怎么用?C++ QPointF::rx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPointF
的用法示例。
在下文中一共展示了QPointF::rx方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wheelEvent
void QtViewportInteractionEngine::wheelEvent(QWheelEvent* ev)
{
if (scrollAnimationActive() || scaleAnimationActive() || pinchGestureActive())
return; // Ignore.
int delta = ev->delta();
QPointF newPos = -m_content->pos();
// A delta that is not mod 120 indicates a device that is sending
// fine-resolution scroll events, so use the delta as number of wheel ticks
// and number of pixels to scroll. See also webkit.org/b/29601
bool fullTick = !(delta % 120);
static const int cDefaultQtScrollStep = 20;
static const int wheelScrollLines = 3;
int scrollLines = (fullTick) ? wheelScrollLines * cDefaultQtScrollStep : 1;
delta = (fullTick) ? delta / 120.0f : delta;
delta *= scrollLines;
if (ev->orientation() == Qt::Horizontal)
newPos.rx() += delta;
else
newPos.ry() += delta;
QRectF endPosRange = computePosRangeForItemAtScale(m_content->contentsScale());
m_content->setPos(-boundPosition(endPosRange.topLeft(), newPos, endPosRange.bottomRight()));
emit visibleContentRectAndScaleChanged();
}
示例2: 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);
}
}
示例3: 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 );
}
示例4: 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;
}
}
示例5: adjustReadPos
void Marker::adjustReadPos()
{
if (!readPos().isNull()) {
QPointF uo;
if (score()->mscVersion() <= 114) {
// rebase from Measure to Segment
uo = userOff();
uo.rx() -= segment()->pos().x();
// 1.2 is always HCENTER aligned
if ((align() & ALIGN_HMASK) == 0) // ALIGN_LEFT
uo.rx() -= bbox().width() * .5;
}
else
uo = readPos() - ipos();
setUserOff(uo);
setReadPos(QPointF());
}
}
示例6: 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);
}
示例7: 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);
}
示例8: svgLineToHorizontal
void KoPathShapeLoaderPrivate::svgLineToHorizontal(qreal x, bool abs)
{
if (abs)
lastPoint.setX(x);
else
lastPoint.rx() += x;
path->lineTo(lastPoint);
}
示例9:
QPointF
ViewerNode::getWipeCenter() const
{
KnobDoublePtr wipeCenter = _imp->wipeCenter.lock();
QPointF r;
r.rx() = wipeCenter->getValue();
r.ry() = wipeCenter->getValue(DimIdx(1));
return r;
}
示例10: getPageRect
QRectF BbScene::getPageRect(int pageIndex)
{
QPointF pt = sceneRect().topLeft();
return QRectF(pt.rx(),
pt.y() + pageIndex * getPageHeight(),
getPageWidth(),
getPageHeight());
}
示例11: getForcedRect
QRectF TrajectoryFinder::getForcedRect(const QPointF& p, double radius) const
{
Q_ASSERT(radius > 0);
QPointF br = p;
br.rx() -= radius;
br.ry() -= radius;
return QRectF(br, QSizeF(radius*2, radius*2));
}
示例12: 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;
}
示例13: 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;
}
示例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;
}
示例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);
}