本文整理汇总了C++中QRectF::setBottom方法的典型用法代码示例。如果您正苦于以下问题:C++ QRectF::setBottom方法的具体用法?C++ QRectF::setBottom怎么用?C++ QRectF::setBottom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QRectF
的用法示例。
在下文中一共展示了QRectF::setBottom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adjustScrollBars
void AbstractScrollArea::adjustScrollBars()
{
if (m_horizontalScrollBarPolicy == Qt::ScrollBarAlwaysOff) {
m_horizontalScrollBar->hide();
} else {
m_horizontalScrollBar->show();
QRectF sbgeom = boundingRect();
sbgeom.setTop(sbgeom.bottom() - m_horizontalScrollBar->boundingRect().height());
sbgeom.setRight(sbgeom.right() - m_verticalScrollBar->boundingRect().width());
m_horizontalScrollBar->setGeometry(sbgeom);
}
if (m_verticalScrollBarPolicy == Qt::ScrollBarAlwaysOff) {
m_verticalScrollBar->hide();
QRectF sbgeom = boundingRect();
sbgeom.setLeft(sbgeom.right());
sbgeom.setBottom(sbgeom.bottom());
m_verticalScrollBar->setGeometry(sbgeom);
} else {
m_verticalScrollBar->show();
QRectF sbgeom = boundingRect();
sbgeom.setLeft(sbgeom.right() - m_verticalScrollBar->boundingRect().width());
if (m_horizontalScrollBarPolicy != Qt::ScrollBarAlwaysOff)
sbgeom.setBottom(sbgeom.bottom() - m_horizontalScrollBar->boundingRect().height());
m_verticalScrollBar->setGeometry(sbgeom);
}
}
示例2: 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);
}
示例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: 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;
}
示例5: 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;
}
}
示例6: setBoundries
void StaffScene::setBoundries()
{
QRectF rec = sceneRect();
rec.setTop(rec.top() - noteProperties::noteDiameter);
rec.setBottom(rec.bottom() + noteProperties::noteDiameter);
setSceneRect(rec);
}
示例7: expandByChildren
void ResizeHandler::expandByChildren(QRectF &contents) const
{
QVector<int> const sizeOfForestalling = mElementType.sizeOfForestalling();
for (const QGraphicsItem * const childItem : mTargetNode.childItems()) {
QRectF curChildItemBoundingRect = childBoundingRect(childItem, contents);
if (curChildItemBoundingRect.width() == 0 || curChildItemBoundingRect.height() == 0) {
continue;
}
// it seems to be more appropriate to use childItem->pos() but it causes
// bad behaviour when dropping one element to another
curChildItemBoundingRect.translate(childItem->scenePos() - mTargetNode.scenePos());
contents.setLeft(qMin(curChildItemBoundingRect.left() - sizeOfForestalling[0]
, contents.left()));
contents.setRight(qMax(curChildItemBoundingRect.right() + sizeOfForestalling[2]
, contents.right()));
contents.setTop(qMin(curChildItemBoundingRect.top() - sizeOfForestalling[1]
, contents.top()));
contents.setBottom(qMax(curChildItemBoundingRect.bottom() + sizeOfForestalling[3]
, contents.bottom()));
}
}
示例8: fm
TimelineBar::Marker *TimelineBar::findMarker(QVector<Marker> &markers, QRectF markerRect, QPointF pos)
{
QFontMetrics fm(Formatter::PreferredFont());
for(Marker &m : markers)
{
QRectF r = markerRect;
r.setLeft(qMax(m_markerRect.left() + borderWidth * 2, offsetOf(m.eidStart)));
r.setRight(qMin(m_markerRect.right() - borderWidth, offsetOf(m.eidEnd + 1)));
r.setHeight(fm.height() + borderWidth * 2);
if(r.width() <= borderWidth * 2)
continue;
if(r.contains(pos))
{
return &m;
}
if(!m.children.isEmpty() && m.expanded)
{
QRectF childRect = r;
childRect.setTop(r.bottom() + borderWidth * 2);
childRect.setBottom(markerRect.bottom());
Marker *res = findMarker(m.children, childRect, pos);
if(res)
return res;
}
}
return NULL;
}
示例9: boundingRect
/*!
\return Bounding rectangle of all samples.
For an empty series the rectangle is invalid.
*/
QRectF QwtPlotHistogram::boundingRect() const
{
QRectF rect = d_series->boundingRect();
if ( !rect.isValid() )
return rect;
if ( orientation() == Qt::Horizontal )
{
rect = QRectF( rect.y(), rect.x(),
rect.height(), rect.width() );
if ( rect.left() > d_data->baseline )
rect.setLeft( d_data->baseline );
else if ( rect.right() < d_data->baseline )
rect.setRight( d_data->baseline );
}
else
{
if ( rect.bottom() < d_data->baseline )
rect.setBottom( d_data->baseline );
else if ( rect.top() > d_data->baseline )
rect.setTop( d_data->baseline );
}
return rect;
}
示例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: 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);
}
}
}
示例12: 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());
}
}
示例13: 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);
}
示例14: drawForeground
void QGraphVizPIP::drawForeground(QPainter *painter, const QRectF &rect)
{
if(!rect.intersects(m_ViewPortRect)) {
return;
}
if(m_ViewPortRect.contains(scene()->sceneRect())) {
return;
}
QColor color(Qt::red);
QPen pen;
pen.setColor(color);
painter->setPen(pen);
QBrush brush;
color.setAlphaF(.1);
brush.setColor(color);
brush.setStyle(Qt::SolidPattern);
painter->setBrush(brush);
QRectF sceneRect = this->sceneRect().adjusted(-10,-10,20,20);
QRectF viewPortRect;
viewPortRect.setLeft(qMax(sceneRect.left(), m_ViewPortRect.left()));
viewPortRect.setTop(qMax(sceneRect.top(), m_ViewPortRect.top()));
viewPortRect.setRight(qMin(sceneRect.right(), m_ViewPortRect.right()));
viewPortRect.setBottom(qMin(sceneRect.bottom(), m_ViewPortRect.bottom()));
painter->drawRect(viewPortRect);
}
示例15: 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()));
}