void DeckViewCardContainer::rearrangeItems(const QList<QPair<int, int> > &rowsAndCols) { currentRowsAndCols = rowsAndCols; int totalCols = 0, totalRows = 0; qreal yUntilNow = separatorY + paddingY; qreal x = (qreal) getCardTypeTextWidth(); for (int i = 0; i < rowsAndCols.size(); ++i) { const int tempRows = rowsAndCols[i].first; const int tempCols = rowsAndCols[i].second; totalRows += tempRows; if (tempCols > totalCols) totalCols = tempCols; QList<QString> cardTypeList = cardsByType.uniqueKeys(); QList<DeckViewCard *> row = cardsByType.values(cardTypeList[i]); qSort( row.begin(), row.end(), DeckViewCardContainer::sortCardsByName); for (int j = 0; j < row.size(); ++j) { DeckViewCard *card = row[j]; card->setPos(x + (j % tempCols) * CARD_WIDTH, yUntilNow + (j / tempCols) * CARD_HEIGHT); } yUntilNow += tempRows * CARD_HEIGHT + paddingY; } prepareGeometryChange(); QSizeF bRect = calculateBoundingRect(rowsAndCols); width = bRect.width(); height = bRect.height(); }
void SliceRenderer::setupFrameInWorld(int animationId, int animationFrame, Vector3 position, float facing, float scale) { _position = position; _facing = facing; _scale = scale; loadFrame(animationId, animationFrame); calculateBoundingRect(); }
QRectF PlotInstanceSampler::boundingRect() const { if (_boundingRect.width() == 0 || _lastRingHead != _curve->ringHead() || _lastRingSize != _curve->data().size()) { _boundingRect = calculateBoundingRect(); } _lastRingHead = _curve->ringHead(); _lastRingSize = _curve->data().size(); return _boundingRect; }
void PluckerGenerator::generatePixmap( Okular::PixmapRequest * request ) { const QSizeF size = mPages[ request->pageNumber() ]->size(); QPixmap *pixmap = new QPixmap( request->width(), request->height() ); pixmap->fill( Qt::white ); QPainter p; p.begin( pixmap ); qreal width = request->width(); qreal height = request->height(); p.scale( width / (qreal)size.width(), height / (qreal)size.height() ); mPages[ request->pageNumber() ]->drawContents( &p ); p.end(); request->page()->setPixmap( request->id(), pixmap ); if ( !mLinkAdded.contains( request->pageNumber() ) ) { QLinkedList<Okular::ObjectRect*> objects; for ( int i = 0; i < mLinks.count(); ++i ) { if ( mLinks[ i ].page == request->pageNumber() ) { QTextDocument *document = mPages[ request->pageNumber() ]; QRectF rect; calculateBoundingRect( document, mLinks[ i ].start, mLinks[ i ].end, rect ); objects.append( new Okular::ObjectRect( rect.left(), rect.top(), rect.right(), rect.bottom(), false, Okular::ObjectRect::Action, mLinks[ i ].link ) ); } } if ( !objects.isEmpty() ) request->page()->setObjectRects( objects ); mLinkAdded.insert( request->pageNumber() ); } signalPixmapRequestDone( request ); }