Пример #1
0
Embellishment::Embellishment( const PitchList *pitchList, const QPen *pen )
    :MelodySymbol(pitchList, pen)
{
    m_pitchList = pitchList;
    m_pen = pen;
    m_preceedPitch = 0;
    m_followPitch = 0;
    m_alternative = Embellishment::Regular;
    m_embellishTop = m_pitchList->baseLine()-m_pitchList->lineHeight()*2.5;
    m_graceHeight = pitchList->lineHeight() * 0.5;
    m_contextMenuActions = new QList<QAction *>;

    m_svgRenderer = new QSvgRenderer(QString(":/mainwindow/images/melody_notes_and_flags.svg"), this);
    QString item("melody_fill");
    m_graceRect = getBoundsForId(item, 0.0, m_graceHeight );
    item = "melody_fill_line";
    m_graceWithLineRect = getBoundsForId(item, 0.0, m_graceHeight);
    item = "flag3_up";
    m_flagRect = getBoundsForId(item, m_graceRect.width()*0.8);

    m_graceWidth = m_graceRect.width();
    m_graceSpace = m_graceWidth / 4;
    m_spaceForLine = m_graceWithLineRect.width() - m_graceRect.width();

    m_neighborsOk = false;
    updateBoundingRect();
    /*! @todo Caching is done by every Item itself. Use QPixmapCache. */
    setCacheMode(QGraphicsItem::DeviceCoordinateCache);
    setFlags( QGraphicsItem::ItemIsFocusable |
              QGraphicsItem::ItemIsSelectable);
}
void MirrorGraphicsEffect::setReflectionOffset(float value)
{
	if(_reflectionOffset != value){
		_reflectionOffset = value; 
		updateBoundingRect(); // we have to call this function to inform everybody who interested that boundings of control has changed
	}
}
Пример #3
0
/*!
    Store a path command in the command list
    \sa QPaintEngine::drawPath()
*/
void QwtGraphic::drawPath( const QPainterPath &path )
{
    const QPainter *painter = paintEngine()->painter();
    if ( painter == NULL )
        return;

    d_data->commands += QwtPainterCommand( path );

    if ( !path.isEmpty() )
    {
        const QPainterPath scaledPath = painter->transform().map( path );

        QRectF pointRect = scaledPath.boundingRect();
        QRectF boundingRect = pointRect;

        if ( painter->pen().style() != Qt::NoPen 
            && painter->pen().brush().style() != Qt::NoBrush )
        {
            boundingRect = qwtStrokedPathRect( painter, path );
        }

        updateControlPointRect( pointRect );
        updateBoundingRect( boundingRect );

        d_data->pathInfos += PathInfo( pointRect, 
            boundingRect, qwtHasScalablePen( painter ) );
    }
}
Пример #4
0
void QgsAnnotationItem::setFrameSize( QSizeF size )
{
  QSizeF frameSize = minimumFrameSize().expandedTo( size ); //don't allow frame sizes below minimum
  mFrameSize = frameSize;
  updateBoundingRect();
  updateBalloon();
}
Пример #5
0
void BrushItem::setTileRegion(const QRegion &region) {
    if (mTileRegion == region)
        return;

    mTileRegion = region;
    updateBoundingRect();
}
Пример #6
0
void QgsComposerShape::setSceneRect( const QRectF& rectangle )
{
  // Reimplemented from QgsComposerItem as we need to call updateBoundingRect after the shape's size changes
  QgsComposerItem::setSceneRect( rectangle );
  updateBoundingRect();
  update();
}
Пример #7
0
void VlcQmlVideoObject::paint(QPainter *painter)
{
    lock();
    if( _frame.inited )
    {
        if (!_graphicsPainter)
            _graphicsPainter = new GlslPainter;

        Q_ASSERT(_graphicsPainter);

        if (!_gotSize || _frameSize.isNull()) {
            // TODO: do scaling ourselfs?
            _gotSize = true;
            _frameSize = QSize(_frame.width, _frame.height);
            updateBoundingRect();
        }

        if (!_paintedOnce) {
            painter->fillRect(_boundingRect, Qt::black);
            _paintedOnce = true;
        } else {
            Q_ASSERT(_graphicsPainter);
            _graphicsPainter->setFrame(&_frame);
            if (!_graphicsPainter->inited())
                _graphicsPainter->init();
            _graphicsPainter->paint(painter, _boundingRect, this);
        }
    }

    unlock();
}
Пример #8
0
void ImageMarker::setRect(int x, int y, int w, int h) {
  if (d_pos == QPoint(x, y) && d_size == QSize(w, h)) return;

  d_pos = QPoint(x, y);
  d_size = QSize(w, h);
  updateBoundingRect();
}
void QgsMapCanvasAnnotationItem::updatePosition()
{
  if ( !mAnnotation )
    return;

  if ( mAnnotation->hasFixedMapPosition() )
  {
    QgsCoordinateTransform t( mAnnotation->mapPositionCrs(), mMapCanvas->mapSettings().destinationCrs(), QgsProject::instance() );
    QgsPointXY coord = mAnnotation->mapPosition();
    try
    {
      coord = t.transform( coord );
    }
    catch ( QgsCsException & )
    {}
    setPos( toCanvasCoordinates( coord ) );
  }
  else
  {
    //relative position

    double x = mAnnotation->relativePosition().x() * mMapCanvas->width();
    double y = mAnnotation->relativePosition().y() * mMapCanvas->height();
    setPos( x, y );
  }
  updateBoundingRect();
}
Пример #10
0
void QgsLayoutItemGroup::resetBoundingRect()
{
  mBoundingRectangle = QRectF();
  for ( QgsLayoutItem *item : qgis::as_const( mItems ) )
  {
    updateBoundingRect( item );
  }
}
Пример #11
0
void VlcQmlVideoObject::geometryChanged(const QRectF &newGeometry,
                                          const QRectF &oldGeometry)
{
    _geometry = newGeometry;
    updateBoundingRect();

    QQuickPaintedItem::geometryChanged(newGeometry, oldGeometry);
}
Пример #12
0
void QgsComposerShape::refreshSymbol()
{
  mMaxSymbolBleed = QgsSymbolLayerUtils::estimateMaxSymbolBleed( mShapeStyleSymbol );
  updateBoundingRect();

  update();
  emit frameChanged();
}
Пример #13
0
void ScaleItem::setZoom(int z)
{
	prepareGeometryChange();
	_zoom = z;
	computeScale();
	updateBoundingRect();
	update();
}
Пример #14
0
void ScaleItem::setUnits(enum Units units)
{
	prepareGeometryChange();
	_units = units;
	computeScale();
	updateBoundingRect();
	update();
}
Пример #15
0
void ScaleItem::setZoom(int z, qreal lat)
{
	prepareGeometryChange();
	_zoom = z;
	_lat = lat;
	computeScale();
	updateBoundingRect();
	update();
}
Пример #16
0
void BrushItem::setMapEditor(MapEditor *editor) {
    if (mMapEditor == editor)
        return;

    mMapEditor = editor;

    setTilelayer(0);
    updateBoundingRect();
}
Пример #17
0
void SliderInfoItem::setSide(Side side)
{
	if (side == _side)
		return;

	prepareGeometryChange();
	_side = side;
	updateBoundingRect();
}
Пример #18
0
void QGraphicsDropShadowEffect::setBlurRadius(qreal blurRadius)
{
    Q_D(QGraphicsDropShadowEffect);
    if (qFuzzyCompare(d->filter->blurRadius(), blurRadius))
        return;

    d->filter->setBlurRadius(blurRadius);
    updateBoundingRect();
    emit blurRadiusChanged(blurRadius);
}
Пример #19
0
void QGraphicsBlurEffect::setBlurRadius(qreal radius)
{
    Q_D(QGraphicsBlurEffect);
    if (qFuzzyCompare(d->filter->radius(), radius))
        return;

    d->filter->setRadius(radius);
    updateBoundingRect();
    emit blurRadiusChanged(radius);
}
Пример #20
0
void QgsComposerShape::refreshSymbol()
{
  QgsRenderContext rc = QgsComposerUtils::createRenderContextForMap( mComposition->referenceMap(), nullptr, mComposition->printResolution() );
  mMaxSymbolBleed = ( 25.4 / mComposition->printResolution() ) * QgsSymbolLayerUtils::estimateMaxSymbolBleed( mShapeStyleSymbol, rc );

  updateBoundingRect();

  update();
  emit frameChanged();
}
Пример #21
0
void ShadowEffect::setBlurRadius(qreal value)
{
    if (qFuzzyCompare(m_blurRadius, value)) {
        return;
    }
    m_blurRadius = value;
    m_shadow = QImage();
    updateBoundingRect();
    blurRadiusChanged(m_blurRadius);
}
Пример #22
0
void ShadowEffect::setYOffset(qreal value)
{
    if (qFuzzyCompare(m_yOffset, value)) {
        return;
    }
    m_yOffset = value;
    m_shadow = QImage();
    updateBoundingRect();
    yOffsetChanged(m_yOffset);
}
Пример #23
0
void QGraphicsDropShadowEffect::setOffset(const QPointF &offset)
{
    Q_D(QGraphicsDropShadowEffect);
    if (d->filter->offset() == offset)
        return;

    d->filter->setOffset(offset);
    updateBoundingRect();
    emit offsetChanged(offset);
}
Пример #24
0
void QgsComposerShape::setSceneRect( const QRectF& rectangle )
{
  // Reimplemented from QgsComposerItem as we need to call updateBoundingRect after the shape's size changes

  //update rect for data defined size and position
  QRectF evaluatedRect = evalItemRect( rectangle );
  QgsComposerItem::setSceneRect( evaluatedRect );

  updateBoundingRect();
  update();
}
Пример #25
0
void ImageMarker::setOrigin(const QPoint &p) {
  d_pos = p;

  if (!plot()) return;

  setXValue(plot()->invTransform(xAxis(), p.x()));
  setYValue(plot()->invTransform(yAxis(), p.y()));

  d_size = size();
  updateBoundingRect();
}
Пример #26
0
void QgsLayoutItemShape::refreshSymbol()
{
  if ( layout() )
  {
    QgsRenderContext rc = QgsLayoutUtils::createRenderContextForLayout( layout(), nullptr, layout()->renderContext().dpi() );
    mMaxSymbolBleed = ( 25.4 / layout()->renderContext().dpi() ) * QgsSymbolLayerUtils::estimateMaxSymbolBleed( mShapeStyleSymbol.get(), rc );
  }

  updateBoundingRect();

  update();
  emit frameChanged();
}
Пример #27
0
void BrushItem::setTilelayerPosition(const QPoint &pos) {
    if (!mTilelayer)
        return;

    const QPoint oldPosition(mTilelayer->x(), mTilelayer->y());
    if (oldPosition == pos)
        return;

    mTileRegion.translate(pos - oldPosition);
    mTilelayer->setX(pos.x());
    mTilelayer->setY(pos.y());
    updateBoundingRect();
}
Пример #28
0
/*!
    Store a image command in the command list
    \sa QPaintEngine::drawPixmap()
*/
void QwtGraphic::drawPixmap( const QRectF &rect, 
    const QPixmap &pixmap, const QRectF &subRect )
{
    const QPainter *painter = paintEngine()->painter();
    if ( painter == NULL )
        return;

    d_data->commands += QwtPainterCommand( rect, pixmap, subRect );

    const QRectF r = painter->transform().mapRect( rect );
    updateControlPointRect( r );
    updateBoundingRect( r );
}
Пример #29
0
/*!
    Store a image command in the command list
    \sa QPaintEngine::drawImage()
 */
void QwtGraphic::drawImage( const QRectF &rect, const QImage &image,
    const QRectF &subRect, Qt::ImageConversionFlags flags)
{
    const QPainter *painter = paintEngine()->painter();
    if ( painter == NULL )
        return;

    d_data->commands += QwtPainterCommand( rect, image, subRect, flags );

    const QRectF r = painter->transform().mapRect( rect );

    updateControlPointRect( r );
    updateBoundingRect( r );
}
Пример #30
0
void BrushItem::setTilelayer(const Tilelayer *tilelayer) {
    delete mTilelayer;

    if (tilelayer) {
        mTilelayer = static_cast<Tilelayer*>(tilelayer->clone());
        mTileRegion = mTilelayer->region();
    } else {
        mTilelayer = 0;
        mTileRegion = QRegion();
    }

    updateBoundingRect();
    update();
}