本文整理汇总了C++中QRectF::bottom方法的典型用法代码示例。如果您正苦于以下问题:C++ QRectF::bottom方法的具体用法?C++ QRectF::bottom怎么用?C++ QRectF::bottom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QRectF
的用法示例。
在下文中一共展示了QRectF::bottom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: transform
/*!
Transform a rectangle from scale to paint coordinates
\param xMap X map
\param yMap Y map
\param rect Rectangle in scale coordinates
\return Rectangle in paint coordinates
\sa invTransform()
*/
QRectF QwtScaleMap::transform( const QwtScaleMap &xMap,
const QwtScaleMap &yMap, const QRectF &rect )
{
double x1 = xMap.transform( rect.left() );
double x2 = xMap.transform( rect.right() );
double y1 = yMap.transform( rect.top() );
double y2 = yMap.transform( rect.bottom() );
if ( x2 < x1 )
qSwap( x1, x2 );
if ( y2 < y1 )
qSwap( y1, y2 );
if ( qwtFuzzyCompare( x1, 0.0, x2 - x1 ) == 0 )
x1 = 0.0;
if ( qwtFuzzyCompare( x2, 0.0, x2 - x1 ) == 0 )
x2 = 0.0;
if ( qwtFuzzyCompare( y1, 0.0, y2 - y1 ) == 0 )
y1 = 0.0;
if ( qwtFuzzyCompare( y2, 0.0, y2 - y1 ) == 0 )
y2 = 0.0;
return QRectF( x1, y1, x2 - x1 + 1, y2 - y1 + 1 );
}
示例2: datamatrixGeometry
void datamatrixGeometry(QString &inFormat, const QRectF &inQrect,DmtxImage *inImg, qreal *outXo, qreal *outYo, qreal *outPas)
{
*outPas = std::min(inQrect.width()/inImg->width, inQrect.height()/inImg->height);
*outYo = inQrect.bottom();
//alignement left
if(inFormat == "L")
{
*outXo = inQrect.left();
}
//alignement Center
if(inFormat == "C")
{
qreal Xc = (inQrect.left() + inQrect.right()) / 2;
*outXo = Xc - (((qreal)inImg->width) * (*outPas));
}
//alignement Rigth
if(inFormat == "R")
{
*outXo = inQrect.right() - (*outPas * inImg->width);
}
}
示例3: drawBackground
//! [6]
void GraphWidget::drawBackground(QPainter *painter, const QRectF &rect)
{
Q_UNUSED(rect);
// Shadow
QRectF sceneRect = this->sceneRect();
QRectF rightShadow(sceneRect.right(), sceneRect.top() + 5, 5, sceneRect.height());
QRectF bottomShadow(sceneRect.left() + 5, sceneRect.bottom(), sceneRect.width(), 5);
if (rightShadow.intersects(rect) || rightShadow.contains(rect))
painter->fillRect(rightShadow, Qt::darkGray);
if (bottomShadow.intersects(rect) || bottomShadow.contains(rect))
painter->fillRect(bottomShadow, Qt::darkGray);
// Fill
QLinearGradient gradient(sceneRect.topLeft(), sceneRect.bottomRight());
gradient.setColorAt(0, Qt::white);
gradient.setColorAt(1, Qt::lightGray);
painter->fillRect(rect.intersect(sceneRect), gradient);
painter->setBrush(Qt::NoBrush);
painter->drawRect(sceneRect);
// Text
QRectF textRect(sceneRect.left() + 4, sceneRect.top() + 4,
sceneRect.width() - 4, sceneRect.height() - 4);
QString message(tr("Click and drag the nodes around, and zoom with the mouse "
"wheel or the '+' and '-' keys"));
QFont font = painter->font();
font.setBold(true);
font.setPointSize(14);
painter->setFont(font);
painter->setPen(Qt::lightGray);
painter->drawText(textRect.translated(2, 2), message);
painter->setPen(Qt::black);
painter->drawText(textRect, message);
}
示例4: paintRowGrid
void DateTimeGrid::paintRowGrid( QPainter* painter,
const QRectF& /*sceneRect*/,
const QRectF& exposedRect,
AbstractRowController* rowController,
QWidget* /*widget*/ )
{
if ( rowController && rowSeparators() ) {
// First draw the rows
QPen pen = painter->pen();
pen.setBrush( QApplication::palette().dark() );
pen.setStyle( Qt::DashLine );
painter->setPen( pen );
QModelIndex idx = rowController->indexAt( qRound( exposedRect.top() ) );
qreal y = 0;
while ( y < exposedRect.bottom() && idx.isValid() ) {
const Span s = rowController->rowGeometry( idx );
y = s.start()+s.length();
//painter->drawLine( QPointF( sceneRect.left(), y ), QPointF( sceneRect.right(), y ) );
// Is alternating background better?
if ( idx.row()%2 ) painter->fillRect( QRectF( exposedRect.x(), s.start(), exposedRect.width(), s.length() ), QApplication::palette().alternateBase() );
idx = rowController->indexBelow( idx );
}
}
}
示例5: createPixmap
BasepointPixmap OverlayTextLine::createPixmap(QColor col) {
if (qsText.isEmpty()) {
return BasepointPixmap();
}
QRectF qr;
if (qpp.isEmpty()) {
qpp.addText(0.0f, fAscent, qfFont, qsText);
qr = qpp.controlPointRect();
// fit into (0,0)-based coordinates
fXCorrection = 0.0f;
fYCorrection = 0.0f;
if (qr.left() < fEdge) {
fXCorrection = fEdge - static_cast<float>(qr.left());
}
if (qr.top() < fEdge) {
fYCorrection = fEdge - static_cast<float>(qr.top());
}
QMatrix correction;
correction.translate(fXCorrection, fYCorrection);
qpp = correction.map(qpp);
}
qr = qpp.controlPointRect();
return render(
iroundf(qr.right() + 2.0f*fEdge + 0.5f),
iroundf(qr.bottom() + 2.0f*fEdge + 0.5f),
col,
QPoint(iroundf(fXCorrection + 0.5f), iroundf(fYCorrection + fAscent + 0.5f))
);
}
示例6: drawGate
void DynamicController::drawGate(QSGNode * rootNode) {
//Update knobs
if (!this->simple()) {
QObject * gateKnob = knobs[0];
gateKnob->setProperty("x", graphToNodeX(_tempModel["gatex"]));
gateKnob->setProperty("y", graphToNodeY(_tempModel["gatey"]));
}
QSGGeometryNode * lineNode = new QSGGeometryNode();
QSGGeometry * lineGeom = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), (3));
QSGFlatColorMaterial *material = new QSGFlatColorMaterial;
material->setColor(this->curveColor());
material->setFlag(QSGMaterial::Blending);
lineNode->setMaterial(material);
lineNode->setFlag(QSGNode::OwnsGeometry);
lineNode->setFlag(QSGNode::OwnedByParent);
lineNode->setFlag(QSGNode::OwnsMaterial);
lineGeom->setDrawingMode(GL_LINE_STRIP);
glLineWidth(2.0f);
QSGGeometry::Point2D* points = lineGeom->vertexDataAsPoint2D();
QRectF bounds = boundingRect();
points->set(graphToNodeX(_tempModel["gatex"]), bounds.bottom()); points++;
points->set(graphToNodeX(_tempModel["gatex"]), graphToNodeX(_tempModel["gatey"])); points++;
points->set(bounds.right(), bounds.top()); points++;
lineNode->setGeometry(lineGeom);
rootNode->appendChildNode(lineNode);
}
示例7: symbol
/*!
Draw a column for a sample in Columns style().
When a symbol() has been set the symbol is used otherwise the
column is displayed as plain rectangle using pen() and brush().
\param painter Painter
\param rect Rectangle where to paint the column in paint device coordinates
\param sample Sample to be displayed
\note In applications, where different intervals need to be displayed
in a different way ( f.e different colors or even using differnt symbols)
it is recommended to overload drawColumn().
*/
void QwtPlotHistogram::drawColumn( QPainter *painter,
const QwtColumnRect &rect, const QwtIntervalSample &sample ) const
{
Q_UNUSED( sample );
if ( d_data->symbol &&
( d_data->symbol->style() != QwtColumnSymbol::NoStyle ) )
{
d_data->symbol->draw( painter, rect );
}
else
{
QRectF r = rect.toRect();
if ( QwtPainter::roundingAlignment( painter ) )
{
r.setLeft( qRound( r.left() ) );
r.setRight( qRound( r.right() ) );
r.setTop( qRound( r.top() ) );
r.setBottom( qRound( r.bottom() ) );
}
QwtPainter::drawRect( painter, r );
}
}
示例8: paintMarker
void RefactorOverlay::paintMarker(const RefactorMarker& marker, QPainter *painter, const QRect &clip)
{
QPointF offset = m_editor->contentOffset();
QRectF geometry = m_editor->blockBoundingGeometry(marker.cursor.block()).translated(offset);
if (geometry.top() > clip.bottom() + 10 || geometry.bottom() < clip.top() - 10)
return; // marker not visible
QTextCursor cursor = marker.cursor;
QRect r = m_editor->cursorRect(cursor);
QIcon icon = marker.icon;
if (icon.isNull())
icon = m_icon;
QSize sz = icon.actualSize(QSize(m_editor->fontMetrics().width(QLatin1Char(' '))+2, r.height()));
int x = r.right();
marker.rect = QRect(x, r.top(), sz.width(), sz.height());
icon.paint(painter, marker.rect);
m_maxWidth = qMax((qreal)m_maxWidth, x + sz.width() - offset.x());
}
示例9: paintEvent
void QSanCommandProgressBar::paintEvent(QPaintEvent *e) {
m_mutex.lock();
int val = this->m_val;
int max = this->m_max;
m_mutex.unlock();
int width = this->width();
int height = this->height();
QPainter painter(this);
painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
if (orientation() == Qt::Vertical) {
painter.translate(0, height);
qSwap(width, height);
painter.rotate(-90);
}
painter.drawPixmap(0, 0, width, height, m_progBg);
double percent = 1 - (double)val / (double)max;
QRectF rect = QRectF(0, 0, percent * width, height);
//ÒÔrectµÄÓÒ±ßΪÖÐÖᣬ7Ϊ°ë¾¶»Ò»¸öÍÖÔ²
QRectF ellipseRect;
ellipseRect.setTopLeft(QPointF(rect.right() - 7, rect.top()));
ellipseRect.setBottomRight(QPointF(rect.right() + 7, rect.bottom()));
QPainterPath rectPath;
QPainterPath ellipsePath;
rectPath.addRect(rect);
ellipsePath.addEllipse(ellipseRect);
QPainterPath polygonPath = rectPath.united(ellipsePath);
painter.setClipPath(polygonPath);
painter.drawPixmap(0, 0, width, height, m_prog);
}
示例10: drawGrid
void OrthogonalRenderer::drawGrid(QPainter *painter, const QRectF &rect,
QColor gridColor) const
{
const int tileWidth = map()->tileWidth();
const int tileHeight = map()->tileHeight();
if (tileWidth <= 0 || tileHeight <= 0)
return;
const int startX = qMax(0, (int) (rect.x() / tileWidth) * tileWidth);
const int startY = qMax(0, (int) (rect.y() / tileHeight) * tileHeight);
const int endX = qMin(qCeil(rect.right()),
map()->width() * tileWidth + 1);
const int endY = qMin(qCeil(rect.bottom()),
map()->height() * tileHeight + 1);
gridColor.setAlpha(128);
QPen gridPen(gridColor);
gridPen.setCosmetic(true);
gridPen.setDashPattern(QVector<qreal>() << 2 << 2);
if (startY < endY) {
gridPen.setDashOffset(startY);
painter->setPen(gridPen);
for (int x = startX; x < endX; x += tileWidth)
painter->drawLine(x, startY, x, endY - 1);
}
if (startX < endX) {
gridPen.setDashOffset(startX);
painter->setPen(gridPen);
for (int y = startY; y < endY; y += tileHeight)
painter->drawLine(startX, y, endX - 1, y);
}
}
示例11: performance
qreal CompleteCoverageTask::performance(const QList<Position> &positions)
{
//This function is real slow. I should optimize it in the future. Quad trees or binning?
//This function is also assuming flat earth...
const qreal deltaDegrees = 0.001;
const QRectF boundingBox = this->geoPoly().boundingRect();
QSet<QVector3D> toCheck;
for (qreal x = boundingBox.left(); x < boundingBox.right(); x += deltaDegrees)
{
for (qreal y = boundingBox.top(); y < boundingBox.bottom(); y += deltaDegrees)
{
if (this->geoPoly().containsPoint(QPoint(x,y), Qt::OddEvenFill))
continue;
toCheck.insert(Conversions::lla2xyz(y, x, 1500));
}
}
const qreal perHit = 500 / (qreal)toCheck.size();
qreal partials = 0.0;
const qreal maxPartial = perHit / (positions.size() * toCheck.size());
QSet<QVector3D> hits;
foreach(const Position & planePos, positions)
{
QVector3D pos = Conversions::lla2xyz(planePos);
foreach(const QVector3D & sensorPoint, toCheck)
{
const qreal dist = (pos - sensorPoint).length();
if (dist < 10.0)
hits.insert(sensorPoint);
else if (dist < 20.0)
partials += qMin<qreal>(maxPartial, 10*PathTask::normal(dist,20.0));
}
}
示例12: geometry
/*!
Calculate the geometry of the legend on the canvas
\param canvasRect Geometry of the canvas
\return Geometry of the legend
*/
QRect QwtPlotLegendItem::geometry( const QRectF &canvasRect ) const
{
QRect rect;
rect.setSize( d_data->layout->sizeHint() );
int margin = d_data->borderDistance;
if ( d_data->alignment & Qt::AlignHCenter )
{
int x = qRound( canvasRect.center().x() );
rect.moveCenter( QPoint( x, rect.center().y() ) );
}
else if ( d_data->alignment & Qt::AlignRight )
{
rect.moveRight( qFloor( canvasRect.right() - margin ) );
}
else
{
rect.moveLeft( qCeil( canvasRect.left() + margin ) );
}
if ( d_data->alignment & Qt::AlignVCenter )
{
int y = qRound( canvasRect.center().y() );
rect.moveCenter( QPoint( rect.center().x(), y ) );
}
else if ( d_data->alignment & Qt::AlignBottom )
{
rect.moveBottom( qFloor( canvasRect.bottom() - margin ) );
}
else
{
rect.moveTop( qCeil( canvasRect.top() + margin ) );
}
return rect;
}
示例13: repositionOverlays
void PeopleApplication::repositionOverlays()
{
QRectF exposed = m_mainPage->exposedContentRect();
if (m_window->orientation() == M::Landscape) {
m_sliderH->setPos(0, exposed.y());
m_sliderH->show();
m_sliderV->hide();
m_topSpacer->setPreferredHeight(m_sliderH->preferredHeight());
m_mainPage->layout()->setContentsMargins(0, 0, 0, 0);
}
else {
int width = m_sliderV->preferredWidth();
m_sliderV->setPos(exposed.width() - width, exposed.y());
m_sliderV->setPreferredHeight(m_sliderH->preferredWidth()-exposed.y());
m_sliderH->hide();
m_sliderV->show();
m_topSpacer->setPreferredHeight(0);
m_mainPage->layout()->setContentsMargins(0, 0, m_sliderV->preferredWidth(), 0);
}
if (m_searchWidget)
m_searchWidget->setPos(0, exposed.bottom() - m_searchWidget->preferredHeight());
}
示例14: paintEmbryo
void TabSwitcherObject::paintEmbryo(QPainter *painter)
{
painter->setPen(Design::instance()->color(Design::TabLineColor));
painter->setBrush(Design::instance()->color(Design::TabNormalBgColor));
QRectF r = embryoRect();
QPainterPath path;
double radius = Design::instance()->size(Design::TabRadius);
path.moveTo(r.left(), r.top()+radius);
path.arcTo(r.left(), r.top(), radius*2.0, radius*2.0, 180, -90);
path.lineTo(r.left()+radius, r.top());
path.lineTo(r.right()-radius, r.top());
path.arcTo(r.right()-radius*2.0, r.top(), radius*2.0, radius*2.0, 90, -90);
path.lineTo(r.right(), r.top()+radius);
path.lineTo(r.right(), r.bottom()-radius);
path.arcTo(r.right()-radius*2.0, r.bottom()-radius*2.0, radius*2.0, radius*2.0, 0, -90);
path.lineTo(r.right()-radius, r.bottom());
path.lineTo(r.left()+radius, r.bottom());
path.arcTo(r.left(), r.bottom()-radius*2.0, radius*2.0, radius*2.0, -90, -90);
path.lineTo(r.left(), r.bottom()-radius);
path.closeSubpath();
painter->drawPath(path);
}
示例15: fillRectangle
void GLUtils::fillRectangle( const QRectF& r )
{
fillRectangle(r.left(), r.top(), r.right(), r.bottom());
}