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


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

本文整理汇总了C++中QSizeF::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ QSizeF::isValid方法的具体用法?C++ QSizeF::isValid怎么用?C++ QSizeF::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QSizeF的用法示例。


在下文中一共展示了QSizeF::isValid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sizeToChild

bool KWidget::sizeToChild()
{
    QSizeF mins = minimumSize();
    QSizeF maxs = maximumSize();
    if(mins.isValid() && maxs.isValid())
        return false;
    return true;
}
开发者ID:kxtry,项目名称:kxmob,代码行数:8,代码来源:kwidget.cpp

示例2: qwtDrawSvgSymbols

static inline void qwtDrawSvgSymbols( QPainter *painter, 
    const QPointF *points, int numPoints, 
    QSvgRenderer *renderer, const QwtSymbol &symbol )
{
    if ( renderer == NULL || !renderer->isValid() )
        return;

    const QRectF viewBox = renderer->viewBoxF();
    if ( viewBox.isEmpty() )
        return;

    QSizeF sz = symbol.size();
    if ( !sz.isValid() )
        sz = viewBox.size();

    const double sx = sz.width() / viewBox.width();
    const double sy = sz.height() / viewBox.height();

    QPointF pinPoint = viewBox.center();
    if ( symbol.isPinPointEnabled() )
        pinPoint = symbol.pinPoint();

    const double dx = sx * ( pinPoint.x() - viewBox.left() );
    const double dy = sy * ( pinPoint.y() - viewBox.top() );

    for ( int i = 0; i < numPoints; i++ )
    {
        const double x = points[i].x() - dx;
        const double y = points[i].y() - dy;

        renderer->render( painter, 
            QRectF( x, y, sz.width(), sz.height() ) );
    }
}
开发者ID:CaptainFalco,项目名称:OpenPilot,代码行数:34,代码来源:qwt_symbol.cpp

示例3: end

/*!
  Expand the selected rectangle to minZoomSize() and zoom in
  if accepted.

  \sa accept(), minZoomSize()
*/
bool QwtPlotZoomer::end( bool ok )
{
    ok = QwtPlotPicker::end( ok );
    if ( !ok )
        return false;

    QwtPlot *plot = QwtPlotZoomer::plot();
    if ( !plot )
        return false;

    const QPolygon &pa = selection();
    if ( pa.count() < 2 )
        return false;

    QRect rect = QRect( pa[0], pa[int( pa.count() - 1 )] );
    rect = rect.normalized();

    QRectF zoomRect = invTransform( rect ).normalized();

    const QSizeF minSize = minZoomSize();
    if ( minSize.isValid() )
    {
        const QPointF center = zoomRect.center();
        zoomRect.setSize( zoomRect.size().expandedTo( minZoomSize() ) );
        zoomRect.moveCenter( center );
    }

    zoom( zoomRect );

    return true;
}
开发者ID:PrincetonPAVE,项目名称:old_igvc,代码行数:37,代码来源:qwt_plot_zoomer.cpp

示例4: load

bool ContentLoader::load( const QString& filename,
                          const QPointF& windowCenterPosition,
                          const QSizeF& windowSize )
{
    put_flog( LOG_INFO, "opening: '%s'", filename.toLocal8Bit().constData( ));

    ContentPtr content = ContentFactory::getContent( filename );
    if( !content )
    {
        put_flog( LOG_WARN, "ignoring unsupported file: '%s'",
                  filename.toLocal8Bit().constData( ));
        return false;
    }

    ContentWindowPtr contentWindow( new ContentWindow( content ));
    ContentWindowController controller( *contentWindow, *displayGroup_ );

    if( windowSize.isValid( ))
        controller.resize( windowSize );
    else
        controller.adjustSize( SIZE_LARGE );

    if( windowCenterPosition.isNull( ))
        controller.moveCenterTo( displayGroup_->getCoordinates().center( ));
    else
        controller.moveCenterTo( windowCenterPosition );

    displayGroup_->addContentWindow( contentWindow );

    return true;
}
开发者ID:BlueBrain,项目名称:DisplayCluster,代码行数:31,代码来源:ContentLoader.cpp

示例5: findComboButton

QPixmap StylePainterMobile::findComboButton(const QSize& size, bool multiple, bool enabled) const
{
    if (size.isNull())
        return QPixmap();
    QPixmap result;
    KeyIdentifier id;
    id.type = KeyIdentifier::ComboButton;
    id.width = size.width();
    id.height = size.height();
    id.trait1 = multiple;
    id.trait2 = enabled;

    if (!findCachedControl(id, &result)) {
        result = QPixmap(size);
        const qreal border = painterScale(painter);
        const QSizeF padding(2 * border, 2 * border);
        const QSizeF innerSize = size - padding;
        ASSERT(innerSize.isValid());
        result.fill(Qt::transparent);
        QPainter cachePainter(&result);
        cachePainter.translate(border, border);
        if (multiple)
            drawMultipleComboButton(&cachePainter, innerSize, enabled ? darkColor : Qt::lightGray);
        else
            drawSimpleComboButton(&cachePainter, innerSize, enabled ? darkColor : Qt::lightGray);
        insertIntoCache(id, result);
    }
    return result;
}
开发者ID:xiaolu31,项目名称:webkit-node,代码行数:29,代码来源:RenderThemeQtMobile.cpp

示例6: end

bool PlotZoomer::end(bool ok)
{
  // Code here is taken from QwtPlotZoomer. The only modification is around the _zoomMode handling.
  ok = QwtPlotPicker::end(ok);
  if (!ok)
  {
    return false;
  }

  QwtPlot *plot = QwtPlotZoomer::plot();
  if (!plot)
  {
    return false;
  }

  const QPolygon &pa = selection();
  if (pa.count() < 2)
  {
    return false;
  }

  QRect rect = QRect(pa[0], pa[int(pa.count() - 1)]);
  rect = rect.normalized();

  QRectF currentZoomRect = zoomRect();
  QRectF zoomRect = invTransform(rect).normalized();

  switch (_zoomMode)
  {
  default:
  case ZoomBoth:
    // nothing.
    break;

  case ZoomX:
    // Maintain current zoom y and height.
    zoomRect.setY(currentZoomRect.y());
    zoomRect.setHeight(currentZoomRect.height());
    break;

  case ZoomY:
    // Maintain current zoom x and width.
    zoomRect.setX(currentZoomRect.x());
    zoomRect.setWidth(currentZoomRect.width());
    break;
  }

  const QSizeF minSize = minZoomSize();
  if (minSize.isValid())
  {
    const QPointF center = zoomRect.center();
    zoomRect.setSize(zoomRect.size().expandedTo(minZoomSize()));
    zoomRect.moveCenter(center);
  }

  zoom(zoomRect);

  return true;
}
开发者ID:KazNX,项目名称:ocurves,代码行数:59,代码来源:plotzoomer.cpp

示例7: adjustBoxSize

void QgsComposerLegend::adjustBoxSize()
{
  QSizeF size = paintAndDetermineSize( 0 );
  if ( size.isValid() )
  {
    setSceneRect( QRectF( transform().dx(), transform().dy(), size.width(), size.height() ) );
  }
}
开发者ID:cugxiangzhenwei,项目名称:QGIS_174_VS2008,代码行数:8,代码来源:qgscomposerlegend.cpp

示例8: updatePanner

void PhotoView::updatePanner( const QSizeF & vpSize )
{
    QSizeF viewportSize = vpSize;

    if ( ! viewportSize.isValid() )
	viewportSize = size();

    if ( viewportSize.width()  < _panner->size().width()  * 2  ||
	 viewportSize.height() < _panner->size().height() * 2  )
    {
	// If the panner would take up more than half the available space
	// in any direction, don't show it.

	_panner->hide();
    }
    else
    {
	Photo * photo = _photoDir->current();

	if ( ! photo )
	{
	    _panner->hide();
	}
	else
	{
	    QSizeF  origSize   = photo->size();
	    QPointF canvasPos  = _canvas->pos();
	    QSizeF  canvasSize = _canvas->size();

	    qreal   pannerX    = 0.0;
	    qreal   pannerY    = -_panner->size().height();

	    if ( canvasSize.width() < viewportSize.width() )
		pannerX = canvasPos.x();

	    if ( canvasSize.height() < viewportSize.height() )
		pannerY += canvasPos.y() + canvasSize.height();
	    else
		pannerY += viewportSize.height();

	    _panner->setPos( pannerX, pannerY );

	    QPointF visiblePos( -canvasPos.x(), -canvasPos.y() );

	    QSizeF visibleSize( qMin( viewportSize.width(),
				      canvasSize.width()  ),
				qMin( viewportSize.height(),
				      canvasSize.height() ) );

	    QRectF visibleRect( visiblePos  / _zoomFactor,
				visibleSize / _zoomFactor );

	    _panner->updatePanRect( visibleRect, origSize );
	}
    }
}
开发者ID:shundhammer,项目名称:qphotoview,代码行数:56,代码来源:PhotoView.cpp

示例9: effectiveSizeHint

/*!
    Returns the effective size hint for this QGraphicsLayoutItem.

    \a which is the size hint in question.
    \a constraint is an optional argument that defines a special constrain
    when calculating the effective size hint. By default, \a constraint is
    QSizeF(-1, -1), which means there is no constraint to the size hint.

    If you want to specify the widget's size hint for a given width or height,
    you can provide the fixed dimension in \a constraint. This is useful for
    widgets that can grow only either vertically or horizontally, and need to
    set either their width or their height to a special value.

    For example, a text paragraph item fit into a column width of 200 may
    grow vertically. You can pass QSizeF(200, -1) as a constraint to get a
    suitable minimum, preferred and maximum height).

    You can adjust the effective size hint by reimplementing sizeHint()
    in a QGraphicsLayoutItem subclass, or by calling one of the following
    functions: setMinimumSize(), setPreferredSize, or setMaximumSize()
    (or a combination of both).

    This function caches each of the size hints and guarantees that
    sizeHint() will be called only once for each value of \a which - unless
    \a constraint is not specified and updateGeometry() has been called.

    \sa sizeHint()
*/
QSizeF QGraphicsLayoutItem::effectiveSizeHint(Qt::SizeHint which, const QSizeF &constraint) const
{
    Q_D(const QGraphicsLayoutItem);

    if (!d->userSizeHints && constraint.isValid())
        return constraint;

    // ### should respect size policy???
    return d_ptr->effectiveSizeHints(constraint)[which];
}
开发者ID:husninazer,项目名称:qt,代码行数:38,代码来源:qgraphicslayoutitem.cpp

示例10: getMaxContentSize

QSizeF ContentWindowController::getMaxContentSize() const
{
    QSizeF maxContentSize = _contentWindow->getContent()->getMaxDimensions();
    if( maxContentSize.isValid( ))
        return maxContentSize;

    maxContentSize = _contentWindow->getContent()->getDimensions();
    return maxContentSize.scaled( _displayGroup->getCoordinates().size(),
                                  Qt::KeepAspectRatioByExpanding );
}
开发者ID:BlueBrain,项目名称:DisplayCluster,代码行数:10,代码来源:ContentWindowController.cpp

示例11: adjustBoxSize

void QgsComposerLegend::adjustBoxSize()
{
  QgsLegendRenderer legendRenderer( &mLegendModel, mSettings );
  QSizeF size = legendRenderer.minimumSize();
  QgsDebugMsg( QString( "width = %1 height = %2" ).arg( size.width() ).arg( size.height() ) );
  if ( size.isValid() )
  {
    setSceneRect( QRectF( pos().x(), pos().y(), size.width(), size.height() ) );
  }
}
开发者ID:Aladar64,项目名称:QGIS,代码行数:10,代码来源:qgscomposerlegend.cpp

示例12: sizeChanged

void Tagaro::SpriteObjectItem::setSize(const QSizeF& size)
{
	if (d->m_size != size && size.isValid())
	{
		prepareGeometryChange();
		d->m_size = size;
		d->updateTransform();
		emit sizeChanged(size);
		update();
	}
}
开发者ID:KDE,项目名称:libtagaro,代码行数:11,代码来源:spriteobjectitem.cpp

示例13: nativeSizeChanged

void MediaPlayerPrivateQt::nativeSizeChanged(const QSizeF& size)
{
    LOG(Media, "MediaPlayerPrivateQt::naturalSizeChanged(%dx%d)",
            size.toSize().width(), size.toSize().height());

    if (!size.isValid())
        return;

    m_naturalSize = size.toSize();
    m_webCorePlayer->sizeChanged();
}
开发者ID:dslab-epfl,项目名称:warr,代码行数:11,代码来源:MediaPlayerPrivateQt.cpp

示例14:

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

示例15: adjustBoxSize

void QgsComposerLegend::adjustBoxSize()
{
  QgsLegendRenderer legendRenderer( mLegendModel2, mSettings );
  QSizeF size = legendRenderer.minimumSize();
  QgsDebugMsg( QString( "width = %1 height = %2" ).arg( size.width() ).arg( size.height() ) );
  if ( size.isValid() )
  {
    QRectF targetRect = QRectF( pos().x(), pos().y(), size.width(), size.height() );
    //set new rect, respecting position mode and data defined size/position
    setSceneRect( evalItemRect( targetRect, true ) );
  }
}
开发者ID:freightTrein,项目名称:QGIS,代码行数:12,代码来源:qgscomposerlegend.cpp


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