本文整理汇总了C++中QRectF::setRight方法的典型用法代码示例。如果您正苦于以下问题:C++ QRectF::setRight方法的具体用法?C++ QRectF::setRight怎么用?C++ QRectF::setRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QRectF
的用法示例。
在下文中一共展示了QRectF::setRight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateAnimation
void UIGraphicsZoomButton::updateAnimation()
{
QRectF oldRect = geometry();
QRectF newRect = oldRect;
if (m_iDirection & UIGraphicsZoomDirection_Top)
newRect.setTop(newRect.top() - m_iIndent);
if (m_iDirection & UIGraphicsZoomDirection_Bottom)
newRect.setBottom(newRect.bottom() + m_iIndent);
if (m_iDirection & UIGraphicsZoomDirection_Left)
newRect.setLeft(newRect.left() - m_iIndent);
if (m_iDirection & UIGraphicsZoomDirection_Right)
newRect.setRight(newRect.right() + m_iIndent);
if (!(m_iDirection & UIGraphicsZoomDirection_Left) &&
!(m_iDirection & UIGraphicsZoomDirection_Right))
{
newRect.setLeft(newRect.left() - m_iIndent / 2);
newRect.setRight(newRect.right() + m_iIndent / 2);
}
if (!(m_iDirection & UIGraphicsZoomDirection_Top) &&
!(m_iDirection & UIGraphicsZoomDirection_Bottom))
{
newRect.setTop(newRect.top() - m_iIndent / 2);
newRect.setBottom(newRect.bottom() + m_iIndent / 2);
}
m_pForwardAnimation->setStartValue(oldRect);
m_pForwardAnimation->setEndValue(newRect);
m_pBackwardAnimation->setStartValue(newRect);
m_pBackwardAnimation->setEndValue(oldRect);
}
示例2: doLayout
/**
* 功能
* 当前单元格子元素布局
*/
void WinDigitalDelegate::doLayout(const QStyleOptionViewItem & option, QRectF &valRect, QRectF &unitRect, QRectF &tagRect, QRectF &alarmRect, qreal &alarmSpan) const
{
/***********测量值***********/
valRect = option.rect;
valRect.setHeight(valRect.height()/3);
valRect.moveTop(valRect.bottom());
valRect.setRight(valRect.right() - valRect.width()/18- 3);
/************标记**********/
tagRect = valRect;
tagRect.moveBottom(tagRect.top());
tagRect.setTop(tagRect.top() + option.rect.height()/10);
/************单位***********/
unitRect = valRect;
unitRect.moveTop(unitRect.bottom());
unitRect.setRight(unitRect.right() - 15);
/*************报警标记**********/
alarmRect = unitRect;
alarmRect.setHeight(alarmRect.height()/3);
alarmRect.moveTop(alarmRect.bottom());
alarmRect.setLeft(alarmRect.center().x() - 4*alarmRect.height());
alarmRect.setWidth(alarmRect.height());
alarmSpan = alarmRect.width() * 2;
}
示例3: addBBox
QRectF addBBox(QRectF r1, QRectF r2)
{
// Find smallest QRectF containing given rectangles
QRectF n;
// Set left border
if (r1.left() <= r2.left() )
n.setLeft(r1.left() );
else
n.setLeft(r2.left() );
// Set top border
if (r1.top() <= r2.top() )
n.setTop(r1.top() );
else
n.setTop(r2.top() );
// Set right border
if (r1.right() <= r2.right() )
n.setRight(r2.right() );
else
n.setRight(r1.right() );
// Set bottom
if (r1.bottom() <= r2.bottom() )
n.setBottom(r2.bottom() );
else
n.setBottom(r1.bottom() );
return n;
}
示例4: blitTexture
static void blitTexture(QGLContext *ctx, GLuint texture, const QSize &viewport, const QSize &texSize, const QRect &targetRect, const QRect &sourceRect)
{
glDisable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
glDisable(GL_BLEND);
glViewport(0, 0, viewport.width(), viewport.height());
QGLShaderProgram *blitProgram =
QGLEngineSharedShaders::shadersForContext(ctx)->blitProgram();
blitProgram->bind();
blitProgram->setUniformValue("imageTexture", 0 /*QT_IMAGE_TEXTURE_UNIT*/);
// The shader manager's blit program does not multiply the
// vertices by the pmv matrix, so we need to do the effect
// of the orthographic projection here ourselves.
QRectF r;
qreal w = viewport.width();
qreal h = viewport.height();
r.setLeft((targetRect.left() / w) * 2.0f - 1.0f);
if (targetRect.right() == (viewport.width() - 1))
r.setRight(1.0f);
else
r.setRight((targetRect.right() / w) * 2.0f - 1.0f);
r.setBottom((targetRect.top() / h) * 2.0f - 1.0f);
if (targetRect.bottom() == (viewport.height() - 1))
r.setTop(1.0f);
else
r.setTop((targetRect.bottom() / w) * 2.0f - 1.0f);
drawTexture(r, texture, texSize, sourceRect);
}
示例5: setOpacityTransferFunction
void QOpacityTransferFunctionGraphicalView::setOpacityTransferFunction(const OpacityTransferFunction &opacityTransferFunction)
{
scene()->clear();
QList<double> keys = opacityTransferFunction.keys();
QRectF rect;
bool first = true;
QOpacityTransferFunctionGraphicalViewNode *previousNode = 0;
foreach (double x, keys)
{
double opacity = opacityTransferFunction.get(x);
QOpacityTransferFunctionGraphicalViewNode *node = new QOpacityTransferFunctionGraphicalViewNode();
node->setX(x);
node->setY(opacity);
node->setToolTip(QString("(%1, %2)").arg(x).arg(opacity));
scene()->addItem(node);
if (previousNode)
{
QOpacityTransferFunctionGraphicalViewLine *line = new QOpacityTransferFunctionGraphicalViewLine();
line->setLeftNode(previousNode);
line->setRightNode(node);
previousNode->setRightLine(line);
node->setLeftLine(line);
scene()->addItem(line);
}
if (first)
{
first = false;
rect.setLeft(x);
rect.setRight(x);
rect.setTop(opacity);
rect.setBottom(opacity);
}
else
{
if (x < rect.left())
{
rect.setLeft(x);
}
if (x > rect.right())
{
rect.setRight(x);
}
if (opacity < rect.top())
{
rect.setTop(opacity);
}
if (opacity > rect.bottom())
{
rect.setBottom(opacity);
}
}
previousNode = node;
}
示例6: redraw
void RenderedItemInterface::redraw(bool withChildren)
{
QRectF itemPixelRect = convertUnit(d_ptr->rect, Millimeter, Pixel, d_ptr->dpi);
#if QT_VERSION >= 0x050000
itemPixelRect.setBottom(itemPixelRect.bottom() -1);
itemPixelRect.setRight(itemPixelRect.right() -1);
#endif
QPointF absPos = absolutePixelPos();
QPointF pos;
if (parentItem()) {
pos = parentItem()->mapFromScene(absPos);
// qDebug() << "parentPos" << parentItem()->pos();
} else {
pos = absPos;
}
// qDebug() << "pos" << pos;
setRect(0,0, itemPixelRect.width(), itemPixelRect.height());
setRotation(-d_ptr->rotation);
QPointF transPos = BaseItemInterface::transformedPos(d_ptr, QRectF(pos, itemPixelRect.size()));
setPos(transPos);
if (withChildren) {
QList<QGraphicsItem *> list = childItems();
foreach (QGraphicsItem * item, list) {
if (item->parentItem() == this && item->type() == RenderedItemInterface::Type) {
RenderedItemInterface * rendItem = static_cast<RenderedItemInterface *>(item);
rendItem->redraw(true);
}
}
}
}
示例7: mergeCoordinates
void CallbackBoundingRects::mergeCoordinates (const QPointF &pos,
QRectF &boundingRect)
{
bool newGraphLeft = m_isEmpty;
bool newGraphTop = m_isEmpty;
bool newGraphRight = m_isEmpty;
bool newGraphBottom = m_isEmpty;
if (!newGraphLeft) {
newGraphLeft = (pos.x() < boundingRect.left());
}
if (!newGraphTop) {
newGraphTop = (pos.y() < boundingRect.top());
}
if (!newGraphRight) {
newGraphRight = (boundingRect.right() < pos.x());
}
if (!newGraphBottom) {
newGraphBottom = (boundingRect.bottom() < pos.y());
}
if (newGraphLeft) {
boundingRect.setLeft (pos.x());
}
if (newGraphTop) {
boundingRect.setTop (pos.y());
}
if (newGraphRight) {
boundingRect.setRight (pos.x());
}
if (newGraphBottom) {
boundingRect.setBottom (pos.y());
}
}
示例8: mouseMoveEvent
void BlurItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
QGraphicsRectItem::mouseMoveEvent(event);
const QPointF pos = event->scenePos();
QRectF r;
r.setTopLeft(m_point);
r.setBottomRight(event->scenePos());
if (r.width() < 0) {
r.setLeft(pos.x());
r.setRight(m_point.x());
}
if (r.height() < 0) {
r.setTop(pos.y());
r.setBottom(m_point.y());
}
r = r.intersected(m_item->scene()->sceneRect());
setRect(r);
setSelected(true);
m_item->setOffset(r.topLeft());
reload(m_pixmap);
}
示例9: copy
void PDFSelection::copy()
{
if(d->textReply) {
d->textReply->close();
delete d->textReply;
d->textReply = 0;
}
PDFPage *page = d->currentPage;
if(!page) {
qDebug() << "Invalid page";
return;
}
QRectF geom = geometry();
geom.setLeft(geom.left() + d->documentOffset.x());
geom.setRight(geom.right() + d->documentOffset.x());
geom.setTop((geom.top() + d->documentOffset.y()) - page->positionInDocument() );
geom.setBottom((geom.bottom() + d->documentOffset.y()) - page->positionInDocument() );
QRectF sel(QPointF(geom.left() / page->width(), geom.top() / page->height()), QPointF(geom.right() / page->width(), geom.bottom() / page->height()));
QString arguments = QString("page=%1&top=%2&right=%3&bottom=%4&left=%5").arg(page->pageNumber()).arg(sel.top()).arg(sel.right()).arg(sel.bottom()).arg(sel.left());
d->textReply = d->document->networkManager()->get(d->document->buildRequest("text", arguments));
connect(d->textReply, SIGNAL(finished()), SLOT(textRequestFinished()));
}
示例10: closestAcceptableGeometry
QRectF QWidgetWindowPrivate::closestAcceptableGeometry(const QRectF &rect) const
{
Q_Q(const QWidgetWindow);
const QWidget *widget = q->widget();
if (!widget->isWindow() || !widget->hasHeightForWidth())
return QRect();
const QSize oldSize = rect.size().toSize();
const QSize newSize = QLayout::closestAcceptableSize(widget, oldSize);
if (newSize == oldSize)
return QRectF();
const int dw = newSize.width() - oldSize.width();
const int dh = newSize.height() - oldSize.height();
QRectF result = rect;
const QRectF currentGeometry(widget->geometry());
const qreal topOffset = result.top() - currentGeometry.top();
const qreal bottomOffset = result.bottom() - currentGeometry.bottom();
if (qAbs(topOffset) > qAbs(bottomOffset))
result.setTop(result.top() - dh); // top edge drag
else
result.setBottom(result.bottom() + dh); // bottom edge drag
const qreal leftOffset = result.left() - currentGeometry.left();
const qreal rightOffset = result.right() - currentGeometry.right();
if (qAbs(leftOffset) > qAbs(rightOffset))
result.setLeft(result.left() - dw); // left edge drag
else
result.setRight(result.right() + dw); // right edge drag
return result;
}
示例11: addValue
void VLCStatsView::addValue( float value )
{
value /= 1000;
QPolygonF shape = totalbitrateShape->polygon();
if ( shape.count() > ( STATS_LENGTH + 2 ) ) /* keep only STATS_LENGTH samples */
{
shape.remove( 1 );
for(int i=1; i<( STATS_LENGTH + 2 ); i++)
( (QPointF &) shape.at(i) ).setX( i - 1 ); /*move back values*/
}
int count = shape.count();
if ( count == 0 )
{
shape << QPointF( 0, 0 ); /* begin and close shape */
shape << QPointF( count, 0 );
}
shape.insert( shape.end() - 1, QPointF( count, value ) );
( (QPointF &) shape.last() ).setX( count );
totalbitrateShape->setPolygon( shape );
addHistoryValue( value );
QRectF maxsizes = scene()->itemsBoundingRect();
maxsizes.setRight( STATS_LENGTH );
fitInView( maxsizes ); /* fix viewport */
drawRulers( maxsizes );
}
示例12: cacheAllAssemblies
/** If needed, recalculate the cached bounding rectangles of all assemblies. */
void UnwrappedSurface::cacheAllAssemblies() {
if (!m_assemblies.empty())
return;
for (size_t i = 0; i < m_unwrappedDetectors.size(); ++i) {
const UnwrappedDetector &udet = m_unwrappedDetectors[i];
if (!udet.detector)
continue;
// Get the BARE parent (not parametrized) to speed things up.
const Mantid::Geometry::IComponent *bareDet =
udet.detector->getComponentID();
const Mantid::Geometry::IComponent *parent = bareDet->getBareParent();
if (parent) {
QRectF detRect;
detRect.setLeft(udet.u - udet.width);
detRect.setRight(udet.u + udet.width);
detRect.setBottom(udet.v - udet.height);
detRect.setTop(udet.v + udet.height);
Mantid::Geometry::ComponentID id = parent->getComponentID();
QRectF &r = m_assemblies[id];
r |= detRect;
calcAssemblies(parent, r);
}
}
}
示例13: getRect
QRectF ODrawClient::getRect(const MSO::OfficeArtClientAnchor& clientAnchor)
{
const MSO::XlsOfficeArtClientAnchor* anchor = clientAnchor.anon.get<MSO::XlsOfficeArtClientAnchor>();
if (anchor) {
QRectF r;
qreal colWidth = columnWidth(m_sheet, anchor->colL);
r.setLeft(offset(colWidth, anchor->dxL, 1024));
if (anchor->colR == anchor->colL) {
r.setRight(offset(colWidth, anchor->dxR, 1024));
} else {
qreal width = colWidth - r.left();
for (int col = anchor->colL + 1; col < anchor->colR; ++col) {
width += columnWidth(m_sheet, col);
}
width += offset(columnWidth(m_sheet, anchor->colR), anchor->dxR, 1024);
r.setWidth(width);
}
qreal rowHgt = rowHeight(m_sheet, anchor->rwT);
r.setTop(offset(rowHgt, anchor->dyT, 256));
if (anchor->rwT == anchor->rwB) {
r.setBottom(offset(rowHgt, anchor->dyB, 256));
} else {
qreal height = rowHgt - r.top();
for (int row = anchor->rwT + 1; row < anchor->rwB; ++row) {
height += rowHeight(m_sheet, row);
}
height += offset(rowHeight(m_sheet, anchor->rwB), anchor->dyB, 256);
r.setHeight(height);
}
return r;
} else {
qDebug() << "Invalid client anchor!";
}
return QRectF();
}
示例14: run
void SearchDocumentJob::run()
{
Q_ASSERT(m_document);
for (int i = 0; i < m_document->numPages(); ++i) {
int ipage = (startPage + i) % m_document->numPages();
Poppler::Page *page = m_document->page(ipage);
double sLeft, sTop, sRight, sBottom;
float scaleW = 1.f / page->pageSizeF().width();
float scaleH = 1.f / page->pageSizeF().height();
bool found;
found = page->search(m_search, sLeft, sTop, sRight, sBottom,
Poppler::Page::FromTop,
Poppler::Page::IgnoreCase);
while (found) {
QRectF result;
result.setLeft(sLeft * scaleW);
result.setTop(sTop * scaleH);
result.setRight(sRight * scaleW);
result.setBottom(sBottom * scaleH);
m_matches.append(QPair<int, QRectF>(ipage, result));
found = page->search(m_search, sLeft, sTop, sRight, sBottom,
Poppler::Page::NextResult,
Poppler::Page::IgnoreCase);
}
delete page;
}
}
示例15: QLineF
void
FormCheckBox::draw( QPainter * painter, const QPen & pen, const QFont & font,
const QRectF & rect, qreal width, bool isChecked, const QString & text )
{
painter->setPen( pen );
painter->drawRect( rect );
if( isChecked )
{
painter->drawLine( QLineF( rect.topLeft().x() + 4.0,
rect.topLeft().y() + rect.height() / 2.0,
rect.topLeft().x() + rect.width() / 2.0,
rect.bottomLeft().y() - 4.0 ) );
painter->drawLine( QLineF(
rect.topLeft().x() + rect.width() / 2.0,
rect.bottomLeft().y() - 4.0,
rect.topRight().x() - 4.0,
rect.topRight().y() + 4.0 ) );
}
painter->setFont( font );
QRectF r = rect;
r.setRight( rect.x() + width );
r.moveLeft( rect.x() + rect.height() + 4.0 );
painter->drawText( r, Qt::AlignLeft | Qt::AlignVCenter, text );
}