本文整理汇总了C++中QSizeF::rwidth方法的典型用法代码示例。如果您正苦于以下问题:C++ QSizeF::rwidth方法的具体用法?C++ QSizeF::rwidth怎么用?C++ QSizeF::rwidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSizeF
的用法示例。
在下文中一共展示了QSizeF::rwidth方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateGeometry
/**
* Reimplemented from UMLWidget::updateGeometry to calculate
* minimum size for signal widget based on the current signal type.
*/
void SignalWidget::updateGeometry()
{
QSizeF minSize = textItemGroupAt(GroupIndex)->minimumSize();
if (minSize.width() < SignalWidget::MinimumSize.width()) {
minSize.setWidth(SignalWidget::MinimumSize.width());
}
if (m_signalType == SignalWidget::Accept) {
// We need 1/3rd part for the '>' shape.(hollow or convex)
minSize.rwidth() += minSize.width() / 3 + margin();
}
else if (m_signalType == SignalWidget::Send) {
// Add one third for the '>' shape.
minSize.rwidth() += minSize.width() / 3 + margin();
}
else if (m_signalType == SignalWidget::Time) {
// In case of SignalWidget::Time add minimum height to
// calculated as the text appears below drawing.
minSize.rheight() += SignalWidget::MinimumSize.height();
}
setMinimumSize(minSize);
UMLWidget::updateGeometry();
}
示例2: getMaxSize
QSizeF ContentWindowController::getMaxSize() const
{
QSizeF maxSize = getMaxContentSize();
maxSize.rwidth() *= _contentWindow->getZoomRect().size().width();
maxSize.rheight() *= _contentWindow->getZoomRect().size().height();
return maxSize;
}
示例3: applyBorder
QImage GLImageDrawable::applyBorder(const QImage& sourceImg)
{
if(renderBorder() &&
m_borderWidth > 0.001)
{
QSizeF originalSizeWithBorder = sourceImg.size();
double x = m_borderWidth * 2;
originalSizeWithBorder.rwidth() += x;
originalSizeWithBorder.rheight() += x;
QImage cache(originalSizeWithBorder.toSize(),QImage::Format_ARGB32_Premultiplied);
memset(cache.scanLine(0),0,cache.byteCount());
QPainter p(&cache);
int bw = (int)(m_borderWidth / 2);
p.drawImage(bw,bw,sourceImg); //drawImage(bw,bw,sourceImg);
p.setPen(QPen(m_borderColor,m_borderWidth));
p.drawRect(sourceImg.rect().adjusted(bw,bw,bw,bw)); //QRectF(sourceImg.rect()).adjusted(-bw,-bw,bw,bw));
m_imageWithBorder = cache;
return cache;
}
if(!m_imageWithBorder.isNull())
m_imageWithBorder = QImage();
return sourceImg;
}
示例4: updateTextsCache
void KStandardItemListWidget::updateTextsCache()
{
QTextOption textOption;
switch (m_layout) {
case IconsLayout:
textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
textOption.setAlignment(Qt::AlignHCenter);
break;
case CompactLayout:
case DetailsLayout:
textOption.setAlignment(Qt::AlignLeft);
textOption.setWrapMode(QTextOption::NoWrap);
break;
default:
Q_ASSERT(false);
break;
}
qDeleteAll(m_textInfo);
m_textInfo.clear();
for (int i = 0; i < m_sortedVisibleRoles.count(); ++i) {
TextInfo* textInfo = new TextInfo();
textInfo->staticText.setTextFormat(Qt::PlainText);
textInfo->staticText.setPerformanceHint(QStaticText::AggressiveCaching);
textInfo->staticText.setTextOption(textOption);
m_textInfo.insert(m_sortedVisibleRoles[i], textInfo);
}
switch (m_layout) {
case IconsLayout: updateIconsLayoutTextCache(); break;
case CompactLayout: updateCompactLayoutTextCache(); break;
case DetailsLayout: updateDetailsLayoutTextCache(); break;
default: Q_ASSERT(false); break;
}
const TextInfo* ratingTextInfo = m_textInfo.value("rating");
if (ratingTextInfo) {
// The text of the rating-role has been set to empty to get
// replaced by a rating-image showing the rating as stars.
const KItemListStyleOption& option = styleOption();
QSizeF ratingSize = preferredRatingSize(option);
const qreal availableWidth = (m_layout == DetailsLayout)
? columnWidth("rating") - columnPadding(option)
: size().width();
if (ratingSize.width() > availableWidth) {
ratingSize.rwidth() = availableWidth;
}
m_rating = QPixmap(ratingSize.toSize());
m_rating.fill(Qt::transparent);
QPainter painter(&m_rating);
const QRect rect(0, 0, m_rating.width(), m_rating.height());
const int rating = data().value("rating").toInt();
KRatingPainter::paintRating(&painter, rect, Qt::AlignJustify | Qt::AlignVCenter, rating);
} else if (!m_rating.isNull()) {
m_rating = QPixmap();
}
}
示例5: on_acceptButton_clicked
void ResolutionCalculator::on_acceptButton_clicked()
{
if ((hRes>0) && (vRes>0)) {
QSizeF s = image->data()->getTransformedSizeData(ImageDataStore::PixelSize);
s.rwidth() *= hRes;
s.rheight() *= vRes;
image->data()->setTransformedSizeData(ImageDataStore::PhysicalSize, s);
}
rulers.clear();
}
示例6:
void QgsDiagramRendererV2::convertSizeToMapUnits( QSizeF& size, const QgsRenderContext& context ) const
{
if ( !size.isValid() )
{
return;
}
double pixelToMap = context.scaleFactor() * context.mapToPixel().mapUnitsPerPixel();
size.rwidth() *= pixelToMap;
size.rheight() *= pixelToMap;
}
示例7: paperRect
QRect QtopiaPrintEngine::paperRect() const
{
QSizeF s = qt_paperSizeToQSizeF(d_func()->paperSize);
s.rwidth() = MM(s.width());
s.rheight() = MM(s.height());
int w = qRound(s.width()*d_func()->resolution/72.);
int h = qRound(s.height()*d_func()->resolution/72.);
if (d_func()->orientation == QPrinter::Portrait)
return QRect(0, 0, w, h);
else
return QRect(0, 0, h, w);
}
示例8: paintMarker
void AbstractDiagram::paintMarker( QPainter* painter,
const DataValueAttributes& a,
const QModelIndex& index,
const QPointF& pos )
{
if ( !checkInvariants() || !a.isVisible() ) return;
const MarkerAttributes ma = a.markerAttributes();
if ( !ma.isVisible() ) return;
const PainterSaver painterSaver( painter );
QSizeF maSize = ma.markerSize();
const qreal diagramWidth = d->diagramSize.width();
const qreal diagramHeight = d->diagramSize.height();
switch( ma.markerSizeMode() ) {
case MarkerAttributes::AbsoluteSize:
// Unscaled, i.e. without the painter's "zoom"
maSize.rwidth() /= painter->matrix().m11();
maSize.rheight() /= painter->matrix().m22();
break;
case MarkerAttributes::AbsoluteSizeScaled:
// Keep maSize as is. It is specified directly in pixels and desired
// to be effected by the painter's "zoom".
break;
case MarkerAttributes::RelativeToDiagramWidth:
maSize *= diagramWidth;
break;
case MarkerAttributes::RelativeToDiagramHeight:
maSize *= diagramHeight;
break;
case MarkerAttributes::RelativeToDiagramWidthHeightMin:
maSize *= qMin( diagramWidth, diagramHeight );
break;
}
QBrush indexBrush( brush( index ) );
QPen indexPen( ma.pen() );
if ( ma.markerColor().isValid() )
indexBrush.setColor( ma.markerColor() );
paintMarker( painter, ma, indexBrush, indexPen, pos, maSize );
// workaround: BC cannot be changed, otherwise we would pass the
// index down to next-lower paintMarker function. So far, we
// basically save a circle of radius maSize at pos in the
// reverseMapper. This means that ^^^ this version of paintMarker
// needs to be called to reverse-map the marker.
d->reverseMapper.addCircle( index.row(), index.column(), pos, 2 * maSize );
}
示例9: dpiPaintDevice
void QgsDiagramRendererV2::convertSizeToMapUnits( QSizeF& size, const QgsRenderContext& context ) const
{
if ( !size.isValid() )
{
return;
}
int dpi = dpiPaintDevice( context.constPainter() );
if ( dpi < 0 )
{
return;
}
double pixelToMap = dpi / 25.4 * context.mapToPixel().mapUnitsPerPixel();
size.rwidth() *= pixelToMap;
size.rheight() *= pixelToMap;
}
示例10: cellSize
QSizeF QuickGridDefinition::cellSize(QRectF rect, int row, int column, int rowSpan, int columnSpan)
{
QSizeF
size;
for(int end = qMin(row + rowSpan, rowCount()); row < end; row++)
{
size.rheight() += rowWeight(row) * rect.height();
}
for(int end = qMin(column + columnSpan, columnCount()); column < end; column++)
{
size.rwidth() += columnWeight(column) * rect.width();
}
return size;
}
示例11: doLayout
void KItemListViewLayouter::doLayout()
{
if (m_dirty) {
#ifdef KITEMLISTVIEWLAYOUTER_DEBUG
QElapsedTimer timer;
timer.start();
#endif
m_visibleIndexesDirty = true;
QSizeF itemSize = m_itemSize;
QSizeF itemMargin = m_itemMargin;
QSizeF size = m_size;
const bool grouped = createGroupHeaders();
const bool horizontalScrolling = (m_scrollOrientation == Qt::Horizontal);
if (horizontalScrolling) {
// Flip everything so that the layout logically can work like having
// a vertical scrolling
itemSize.transpose();
itemMargin.transpose();
size.transpose();
if (grouped) {
// In the horizontal scrolling case all groups are aligned
// at the top, which decreases the available height. For the
// flipped data this means that the width must be decreased.
size.rwidth() -= m_groupHeaderHeight;
}
}
m_columnWidth = itemSize.width() + itemMargin.width();
const qreal widthForColumns = size.width() - itemMargin.width();
m_columnCount = qMax(1, int(widthForColumns / m_columnWidth));
m_xPosInc = itemMargin.width();
const int itemCount = m_model->count();
if (itemCount > m_columnCount && m_columnWidth >= 32) {
// Apply the unused width equally to each column
const qreal unusedWidth = widthForColumns - m_columnCount * m_columnWidth;
if (unusedWidth > 0) {
const qreal columnInc = unusedWidth / (m_columnCount + 1);
m_columnWidth += columnInc;
m_xPosInc += columnInc;
}
}
int rowCount = itemCount / m_columnCount;
if (itemCount % m_columnCount != 0) {
++rowCount;
}
m_itemInfos.resize(itemCount);
qreal y = m_headerHeight + itemMargin.height();
int row = 0;
int index = 0;
while (index < itemCount) {
qreal x = m_xPosInc;
qreal maxItemHeight = itemSize.height();
if (grouped) {
if (horizontalScrolling) {
// All group headers will always be aligned on the top and not
// flipped like the other properties
x += m_groupHeaderHeight;
}
if (m_groupItemIndexes.contains(index)) {
// The item is the first item of a group.
// Increase the y-position to provide space
// for the group header.
if (index > 0) {
// Only add a margin if there has been added another
// group already before
y += m_groupHeaderMargin;
} else if (!horizontalScrolling) {
// The first group header should be aligned on top
y -= itemMargin.height();
}
if (!horizontalScrolling) {
y += m_groupHeaderHeight;
}
}
}
int column = 0;
while (index < itemCount && column < m_columnCount) {
qreal requiredItemHeight = itemSize.height();
if (m_sizeHintResolver) {
const QSizeF sizeHint = m_sizeHintResolver->sizeHint(index);
const qreal sizeHintHeight = horizontalScrolling ? sizeHint.width() : sizeHint.height();
if (sizeHintHeight > requiredItemHeight) {
requiredItemHeight = sizeHintHeight;
}
}
ItemInfo& itemInfo = m_itemInfos[index];
//.........这里部分代码省略.........
示例12: combineSize
static inline void combineSize(QSizeF &result, const QSizeF &fallbackSize)
{
combineHints(result.rwidth(), fallbackSize.width());
combineHints(result.rheight(), fallbackSize.height());
}