当前位置: 首页>>代码示例>>C++>>正文


C++ QSizeF::rwidth方法代码示例

本文整理汇总了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();
}
开发者ID:jpleclerc,项目名称:Umbrello-ng2,代码行数:29,代码来源:signalwidget.cpp

示例2: getMaxSize

QSizeF ContentWindowController::getMaxSize() const
{
    QSizeF maxSize = getMaxContentSize();
    maxSize.rwidth() *= _contentWindow->getZoomRect().size().width();
    maxSize.rheight() *= _contentWindow->getZoomRect().size().height();
    return maxSize;
}
开发者ID:BlueBrain,项目名称:DisplayCluster,代码行数:7,代码来源:ContentWindowController.cpp

示例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;
}
开发者ID:TritonSailor,项目名称:livepro,代码行数:29,代码来源:GLImageDrawable.cpp

示例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();
    }
}
开发者ID:theunbelievablerepo,项目名称:dolphin2.1,代码行数:59,代码来源:kstandarditemlistwidget.cpp

示例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();
}
开发者ID:ojschumann,项目名称:clip,代码行数:10,代码来源:resolutioncalculator.cpp

示例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;
}
开发者ID:paulfab,项目名称:QGIS,代码行数:11,代码来源:qgsdiagramrendererv2.cpp

示例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);
}
开发者ID:Afreeca,项目名称:qt,代码行数:12,代码来源:qprintengine_qws.cpp

示例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 );
}
开发者ID:KDE,项目名称:koffice-chartingshape,代码行数:50,代码来源:KDChartAbstractDiagram.cpp

示例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;
}
开发者ID:namhh,项目名称:Quantum-GIS,代码行数:17,代码来源:qgsdiagramrendererv2.cpp

示例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;
}
开发者ID:Tannz0rz,项目名称:GridStarLayout,代码行数:17,代码来源:quickgriddefinition.cpp

示例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];
//.........这里部分代码省略.........
开发者ID:blue-shell,项目名称:folderview,代码行数:101,代码来源:kitemlistviewlayouter.cpp

示例12: combineSize

static inline void combineSize(QSizeF &result, const QSizeF &fallbackSize)
{
    combineHints(result.rwidth(), fallbackSize.width());
    combineHints(result.rheight(), fallbackSize.height());
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:5,代码来源:qquickgridlayoutengine.cpp


注:本文中的QSizeF::rwidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。