本文整理汇总了C++中QRectF::setCoords方法的典型用法代码示例。如果您正苦于以下问题:C++ QRectF::setCoords方法的具体用法?C++ QRectF::setCoords怎么用?C++ QRectF::setCoords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QRectF
的用法示例。
在下文中一共展示了QRectF::setCoords方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paint
void GModelComponent::paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget)
{
QPen pen = m_pen;
QBrush brush = m_brush;
QPainterPath m_path = QPainterPath();
QRectF bRect = m_textItem->boundingRect();
bRect.setCoords(0, 0, bRect.width() + 2 * m_margin, bRect.height() + 2 * m_margin);
m_path.addRoundedRect(bRect, m_cornerRadius, m_cornerRadius, Qt::SizeMode::AbsoluteSize);
if (option->state & QStyle::State_Selected)
{
pen = s_selectedPen;
brush = s_selectedBrush;
}
else if (m_isTrigger)
{
pen = s_triggerPen;
brush = s_triggerBrush;
}
painter->setPen(pen);
painter->setBrush(brush);
painter->drawPath(m_path);
if (option->state & QStyle::State_Selected)
{
GDefaultSelectionGraphic::paint(bRect, painter);
}
}
示例2: mouseMoveEvent
void ImageScene::mouseMoveEvent(QGraphicsSceneMouseEvent* in_mEvent) {
if (m_pPixmap == NULL) {
return;
}
qreal x = in_mEvent->scenePos().x(), y = in_mEvent->scenePos().y();
if ( x < m_pPixmap->offset().x() ) {
x = m_pPixmap->offset().x();
} else if ( x - m_pPixmap->offset().x() >= m_pPixmap->pixmap().rect().width() ) {
x = m_pPixmap->pixmap().rect().width() + m_pPixmap->offset().x() - 1;
}
if ( y < m_pPixmap->offset().y() ) {
y = m_pPixmap->offset().y();
} else if ( y - m_pPixmap->offset().y() >= m_pPixmap->pixmap().rect().height() ) {
y = m_pPixmap->pixmap().rect().height() + m_pPixmap->offset().y() - 1;
}
if (m_pSelection != NULL) {
QRectF rect;
rect.setCoords ( m_SelectionPosition.x(),
m_SelectionPosition.y(),
x,y );
m_pSelection->setRect ( rect.normalized());
} else {
m_pSelection = QGraphicsScene::addRect (x,y,0,0, m_SelectionPen, m_SelectionBrush);
m_pSelection->setParentItem (m_pPixmap);
m_SelectionPosition = m_pSelection->rect().topLeft();
}
if ( m_pSelection->rect().width() < 1 ||
m_pSelection->rect().height() < 1 )
{
m_pSelection->setVisible(false);
} else {
m_pSelection->setVisible(true);
}
}
示例3:
QRectF
SeriesData::boundingRect() const
{
QRectF rect;
rect.setCoords( range_x_.first, range_y_.first, range_x_.second, range_y_.second );
return rect;
}
示例4: on_copyPointsButton_clicked
void BSplineVisDialog::on_copyPointsButton_clicked() {
m_Algo = ((MainWindow*) parent())->GetImageParticlesAlgorithm();
// select the current slice of the first image as reference image
ImageContainer::Pointer img = m_Algo->GetImage(0);
m_RefImage = img->GetSlice();
// reset grid and checkerboard
CreateGridAndCheckerboards(m_RefImage);
// clear current landmarks
m_VectorList.clear();
const OptimizerParametersType& particles = m_Algo->GetCurrentParams();
const int nPoints = m_Algo->GetNumberOfPoints();
const int nParams = m_Algo->GetNumberOfParams();
// copy landmarks from the first and second
for (int i = 0; i < nPoints; i++) {
QRectF rect;
rect.setCoords(particles[SDim*i], particles[SDim*i+1], particles[nParams+SDim*i], particles[nParams+SDim*i+1]);
m_VectorList.push_back(rect);
}
updateScene();
}
示例5: on_addPairButton_clicked
void BSplineVisDialog::on_addPairButton_clicked() {
QRectF rect;
rect.setCoords(10, 10, 20, 20);
m_VectorList.push_back(rect);
updateScene();
}
示例6: enlarge
void DockScatterPlot::enlarge(QRectF& r,double dRatio)
{
double dX=r.width();
double dY=r.height();
QPointF c=r.center();
r.setCoords( c.x()-dX*dRatio/2., c.y()-dY*dRatio/2., c.x()+dX*dRatio/2., c.y()+dY*dRatio/2.);
}
示例7: zoom
virtual void zoom (QRectF const & rect)
{
QRectF newRect;
QRectF const & baseRect = zoomBase();
newRect.setCoords(rect.left(), baseRect.top(), rect.right(), baseRect.bottom());
QwtPlotZoomer::zoom(newRect);
}
示例8: getBounds
QRectF PositionableJPanel::getBounds(QRectF r)
{
if(r.isNull())
return QRectF(getX(), getY(), /*getWidth()*/_itemGroup->boundingRect().width(), /*getHeight()*/_itemGroup->boundingRect().height());
//return QRectF(getX(), getY(), _itemGroup->boundingRect().width(), _itemGroup->boundingRect().height());
r.setCoords(getX(), getY(), getWidth(), getHeight());
return r;
}
示例9:
/*! Find a minimal rectangle that encapsulates the polygon. The
rectangle is returned in the QRectF object.
*/
QRectF Polygon2D::GetSurroundingRectangle() const
{
QRectF rc;
if(m_vecV.size()) {
Point2D pt1, pt2;
GetSurroundingRectangle(pt1, pt2);
rc.setCoords(
pt1.GetX(), pt2.GetY(), // left, top
pt2.GetX(), pt1.GetY() // right, bottom.
);
}
return rc.normalized();
}
示例10: calculateTileRectangle
void OsmAndMapView::calculateTileRectangle(QRect& pixRect, float cx, float cy, float ctilex, float ctiley, QRectF& tileRect) const{
float x1 = calcDiffTileX(pixRect.left() - cx, pixRect.top() - cy);
float x2 = calcDiffTileX(pixRect.left() - cx, pixRect.bottom() - cy);
float x3 = calcDiffTileX(pixRect.right() - cx, pixRect.top() - cy);
float x4 = calcDiffTileX(pixRect.right() - cx, pixRect.bottom() - cy);
float y1 = calcDiffTileY(pixRect.left() - cx, pixRect.top() - cy);
float y2 = calcDiffTileY(pixRect.left() - cx, pixRect.bottom() - cy);
float y3 = calcDiffTileY(pixRect.right() - cx, pixRect.top() - cy);
float y4 = calcDiffTileY(pixRect.right() - cx, pixRect.bottom() - cy);
float l = qMin(qMin(x1, x2), qMin(x3, x4)) + ctilex;
float r = qMax(qMax(x1, x2), qMax(x3, x4)) + ctilex;
float t = qMin(qMin(y1, y2), qMin(y3, y4)) + ctiley;
float b = qMax(qMax(y1, y2), qMax(y3, y4)) + ctiley;
tileRect.setCoords(l, t, r, b);
}
示例11: setCornerRects
void setCornerRects( const QPainterPath &path )
{
QPointF pos( 0.0, 0.0 );
for ( int i = 0; i < path.elementCount(); i++ )
{
QPainterPath::Element el = path.elementAt(i);
switch( el.type )
{
case QPainterPath::MoveToElement:
case QPainterPath::LineToElement:
{
pos.setX( el.x );
pos.setY( el.y );
break;
}
case QPainterPath::CurveToElement:
{
QRectF r( pos, QPointF( el.x, el.y ) );
clipRects += r.normalized();
pos.setX( el.x );
pos.setY( el.y );
break;
}
case QPainterPath::CurveToDataElement:
{
if ( clipRects.size() > 0 )
{
QRectF r = clipRects.last();
r.setCoords(
qMin( r.left(), el.x ),
qMin( r.top(), el.y ),
qMax( r.right(), el.x ),
qMax( r.bottom(), el.y )
);
clipRects.last() = r.normalized();
}
break;
}
}
}
}
示例12: plotLinesToPainter
void plotLinesToPainter(QPainter& painter,
const Numpy1DObj& x1, const Numpy1DObj& y1,
const Numpy1DObj& x2, const Numpy1DObj& y2,
const QRectF* clip, bool autoexpand)
{
const int maxsize = min(x1.dim, x2.dim, y1.dim, y2.dim);
// if autoexpand, expand rectangle by line width
QRectF clipcopy;
if ( clip != 0 && autoexpand )
{
const qreal lw = painter.pen().widthF();
qreal x1, y1, x2, y2;
clip->getCoords(&x1, &y1, &x2, &y2);
clipcopy.setCoords(x1, y1, x2, y2);
clipcopy.adjust(-lw, -lw, lw, lw);
}
if( maxsize != 0 )
{
QVector<QLineF> lines;
for(int i = 0; i < maxsize; ++i)
{
QPointF pt1(x1(i), y1(i));
QPointF pt2(x2(i), y2(i));
if( clip != 0 )
{
if( clipLine(clipcopy, pt1, pt2) )
lines << QLineF(pt1, pt2);
}
else
lines << QLineF(pt1, pt2);
}
painter.drawLines(lines);
}
}
示例13: coordinateBounds
QRectF QPScrollingCurve::coordinateBounds() const
{
QRectF bounds;
bounds.setCoords(0, yMax(), numPoints(), yMin());
return bounds;
}