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


C++ canvasBoundingRect函数代码示例

本文整理汇总了C++中canvasBoundingRect函数的典型用法代码示例。如果您正苦于以下问题:C++ canvasBoundingRect函数的具体用法?C++ canvasBoundingRect怎么用?C++ canvasBoundingRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: r

QRectF BSymbol::drag(EditData& ed)
      {
      QRectF r(canvasBoundingRect());
      foreach(const Element* e, _leafs)
            r |= e->canvasBoundingRect();

      qreal x = ed.delta.x();
      qreal y = ed.delta.y();

      qreal _spatium = spatium();
      if (ed.hRaster) {
            qreal hRaster = _spatium / MScore::hRaster();
            int n = lrint(x / hRaster);
            x = hRaster * n;
            }
      if (ed.vRaster) {
            qreal vRaster = _spatium / MScore::vRaster();
            int n = lrint(y / vRaster);
            y = vRaster * n;
            }

      setUserOff(QPointF(x, y));

      r |= canvasBoundingRect();
      foreach(const Element* e, _leafs)
            r |= e->canvasBoundingRect();
      return r;
      }
开发者ID:CombatCube,项目名称:MuseScore,代码行数:28,代码来源:bsymbol.cpp

示例2: score

bool Articulation::setProperty(P_ID propertyId, const QVariant& v)
      {
      score()->addRefresh(canvasBoundingRect());
      switch (propertyId) {
            case P_DIRECTION:
                  setDirection(MScore::Direction(v.toInt()));
                  break;
            case P_ARTICULATION_ANCHOR:
                  anchorStyle = PropertyStyle::UNSTYLED;
                  setAnchor(ArticulationAnchor(v.toInt()));
                  break;
            case P_TIME_STRETCH:
                  setTimeStretch(v.toDouble());
                  score()->fixTicks();
                  break;
            default:
                  return Element::setProperty(propertyId, v);
            }
      score()->addRefresh(canvasBoundingRect());

      // layout:
      if (chordRest())
            chordRest()->layoutArticulations();
      else if (parent() && parent()->type() == BAR_LINE)
            static_cast<BarLine*>(parent())->layout();

      score()->addRefresh(canvasBoundingRect());
      score()->setLayoutAll(false);       //DEBUG
      return true;
      }
开发者ID:33akash,项目名称:MuseScore,代码行数:30,代码来源:articulation.cpp

示例3: score

bool Stem::setProperty(P_ID propertyId, const QVariant& v)
      {
      score()->addRefresh(canvasBoundingRect());
      switch(propertyId) {
            case P_ID::USER_LEN:  setUserLen(v.toDouble()); break;
            default:
                  return Element::setProperty(propertyId, v);
            }
      score()->addRefresh(canvasBoundingRect());
      layout();
      score()->addRefresh(canvasBoundingRect());
      return true;
      }
开发者ID:xiaojianwu,项目名称:MuseScore,代码行数:13,代码来源:stem.cpp

示例4: score

bool Box::setProperty(P_ID propertyId, const QVariant& v)
      {
      score()->addRefresh(canvasBoundingRect());
      switch(propertyId) {
            case P_BOX_HEIGHT:
                  _boxHeight = Spatium(v.toDouble());
                  break;
            case P_BOX_WIDTH:
                  _boxWidth = Spatium(v.toDouble());
                  break;
            case P_TOP_GAP:
                  _topGap = v.toDouble();
                  break;
            case P_BOTTOM_GAP:
                  _bottomGap = v.toDouble();
                  break;
            case P_LEFT_MARGIN:
                  _leftMargin = v.toDouble();
                  break;
            case P_RIGHT_MARGIN:
                  _rightMargin = v.toDouble();
                  break;
            case P_TOP_MARGIN:
                  _topMargin = v.toDouble();
                  break;
            case P_BOTTOM_MARGIN:
                  _bottomMargin = v.toDouble();
                  break;
            default:
                  return MeasureBase::setProperty(propertyId, v);
            }
      score()->setLayoutAll(true);
      return true;
      }
开发者ID:alexkonradi,项目名称:MuseScore,代码行数:34,代码来源:box.cpp

示例5: canvasBoundingRect

void ItemDocument::resizeCanvasToItems() {
	QRect bound = canvasBoundingRect();

	m_viewList.remove((View*)0);
	const ViewList::iterator end = m_viewList.end();

	for (ViewList::iterator it = m_viewList.begin(); it != end; ++it) {
		ItemView * iv = static_cast<ItemView*>((View*) * it);
		CVBEditor * cvbEditor = iv->cvbEditor();

		QPoint topLeft = iv->mousePosToCanvasPos(QPoint(0, 0));
		int width = int(cvbEditor->visibleWidth() / iv->zoomLevel());
		int height = int(cvbEditor->visibleHeight() / iv->zoomLevel());
		QRect r(topLeft, QSize(width, height));

		bound |= r;

// 		kdDebug() << "r="<<r<<endl;
// 		kdDebug() << "bound="<<bound<<endl;
	}

	// Make it so that the rectangular offset is a multiple of 8
	bound.setLeft(bound.left() - (bound.left() % 8));
	bound.setTop(bound.top() - (bound.top() % 8));
	m_pUpdateItemViewScrollbarsTimer->start(10, true);

	bool changedSize = canvas()->rect() != bound;
	if (changedSize) {
		canvas()->resize(bound);
		requestEvent(ItemDocumentEvent::ResizeCanvasToItems);
	} else if (ICNDocument * icnd = dynamic_cast<ICNDocument*>(this)) {
		icnd->createCellMap();
	}
}
开发者ID:zoltanp,项目名称:ktechlab-0.3,代码行数:34,代码来源:itemdocument.cpp

示例6: QPointF

QLineF Text::dragAnchor() const
      {
      QPointF p1;

      if (parent()->type() == MEASURE) {
            Measure* m     = static_cast<Measure*>(parent());
            System* system = m->system();
            qreal yp       = system->staff(staffIdx())->y() + system->y() + system->page()->pos().x();
            qreal xp       = m->canvasPos().x(); // m->tick2pos(tick()) + m->canvasPos().x();
            p1 = QPointF(xp, yp);
            }
      else {
            p1 = QPointF(parent()->canvasBoundingRect().topLeft());
            if (parent()->type() == SEGMENT) {
                  Segment* s = static_cast<Segment*>(parent());
                  p1.ry() += s ? s->measure()->system()->staff(staffIdx())->y() : 0.0;
                  }
            }
      qreal tw = width();
      qreal th = height();
      qreal x  = 0.0;
      qreal y  = 0.0;
      if (align() & ALIGN_BOTTOM)
            y = th;
      else if (align() & ALIGN_VCENTER)
            y = (th * .5);
      else if (align() & ALIGN_BASELINE)
            y = baseLine();
      if (align() & ALIGN_RIGHT)
            x = tw;
      else if (align() & ALIGN_HCENTER)
            x = (tw * .5);
      return QLineF(p1, canvasBoundingRect().topLeft() + QPointF(x, y));
      }
开发者ID:guifre2,项目名称:MuseScore,代码行数:34,代码来源:text.cpp

示例7: score

bool Image::setProperty(P_ID propertyId, const QVariant& v)
      {
      bool rv = true;
      score()->addRefresh(canvasBoundingRect());
      switch(propertyId) {
            case P_AUTOSCALE:
                  setAutoScale(v.toBool());
                  break;
            case P_SIZE:
                  setSize(v.toSizeF());
                  break;
            case P_SCALE:
                  setScale(v.toSizeF());
                  break;
            case P_LOCK_ASPECT_RATIO:
                  setLockAspectRatio(v.toBool());
                  break;
            case P_SIZE_IS_SPATIUM:
                  setSizeIsSpatium(v.toBool());
                  break;
            default:
                  rv = Element::setProperty(propertyId, v);
                  break;
            }
      setGenerated(false);
      score()->setLayoutAll(true);
      return rv;
      }
开发者ID:Jon0,项目名称:MuseScore,代码行数:28,代码来源:image.cpp

示例8: score

bool Image::setProperty(Pid propertyId, const QVariant& v)
      {
      bool rv = true;
      score()->addRefresh(canvasBoundingRect());
      switch(propertyId) {
            case Pid::AUTOSCALE:
                  setAutoScale(v.toBool());
                  break;
            case Pid::SIZE:
                  setSize(v.toSizeF());
                  break;
            case Pid::LOCK_ASPECT_RATIO:
                  setLockAspectRatio(v.toBool());
                  break;
            case Pid::SIZE_IS_SPATIUM:
                  {
                  QSizeF s = size2pixel(_size);
                  setSizeIsSpatium(v.toBool());
                  _size = pixel2size(s);
                  }
                  break;
            default:
                  rv = Element::setProperty(propertyId, v);
                  break;
            }
      setGenerated(false);
      _dirty = true;
      triggerLayout();
      return rv;
      }
开发者ID:IsaacWeiss,项目名称:MuseScore,代码行数:30,代码来源:image.cpp

示例9: createDoc

void Text::startEdit(MuseScoreView*, const QPointF& p)
      {
      _editMode = true;
      if (styled()) {
            createDoc();
            setUnstyledText(SimpleText::getText());
            layout();
            }
      _cursor = new QTextCursor(_doc);
      _cursor->setVisualNavigation(true);
      setCursor(p);

      if (_cursor->position() == 0 && align()) {
            QTextBlockFormat bf = _cursor->blockFormat();
            Qt::Alignment alignment = 0;
            if (align() & ALIGN_HCENTER)
                  alignment |= Qt::AlignHCenter;
            else if (align() & ALIGN_LEFT)
                  alignment |= Qt::AlignLeft;
            else if (align() & ALIGN_RIGHT)
                  alignment |= Qt::AlignRight;
            bf.setAlignment(alignment);
            setBlockFormat(bf);
            }
      qreal w = 2.0; // 8.0 / view->matrix().m11();
      score()->addRefresh(canvasBoundingRect().adjusted(-w, -w, w, w));
      }
开发者ID:guifre2,项目名称:MuseScore,代码行数:27,代码来源:text.cpp

示例10: r

QRectF HBox::drag(const EditData& data)
      {
      QRectF r(canvasBoundingRect());
      qreal diff = data.delta.x();
      qreal x1   = userOff().x() + diff;
      if (parent()->type() == VBOX) {
            VBox* vb = static_cast<VBox*>(parent());
            qreal x2 = parent()->width() - width() - (vb->leftMargin() + vb->rightMargin()) * MScore::DPMM;
            if (x1 < 0.0)
                  x1 = 0.0;
            else if (x1 > x2)
                  x1 = x2;
            }
      setUserOff(QPointF(x1, 0.0));
      setStartDragPosition(data.pos);
      return canvasBoundingRect() | r;
      }
开发者ID:alexkonradi,项目名称:MuseScore,代码行数:17,代码来源:box.cpp

示例11: score

void TextBase::movePosition(EditData& ed, QTextCursor::MoveOperation op)
      {
      TextEditData* ted = static_cast<TextEditData*>(ed.getData(this));
      TextCursor* _cursor = &ted->cursor;
      _cursor->movePosition(op);
      score()->addRefresh(canvasBoundingRect());
      score()->update();
      }
开发者ID:CombatCube,项目名称:MuseScore,代码行数:8,代码来源:textedit.cpp

示例12: score

void TextBase::endEdit(EditData& ed)
      {
      TextEditData* ted = static_cast<TextEditData*>(ed.getData(this));
      score()->undoStack()->remove(ted->startUndoIdx);           // remove all undo/redo records

      // replace all undo/redo records collected during text editing with
      // one property change

      QString actualText = xmlText();
      if (ted->oldXmlText.isEmpty()) {
            UndoStack* us = score()->undoStack();
            UndoCommand* ucmd = us->last();
            if (ucmd) {
                  const QList<UndoCommand*>& cl = ucmd->commands();
                  const UndoCommand* cmd = cl.back();
                  if (strncmp(cmd->name(), "Add:", 4) == 0) {
                        const AddElement* ae = static_cast<const AddElement*>(cmd);
                        if (ae->getElement() == this) {
                              if (actualText.isEmpty()) {
                                    // we just created this empty text, rollback that operation
                                    us->rollback();
                                    score()->update();
                                    ed.element = 0;
                                    }
                              else {
                                    setXmlText(ted->oldXmlText);  // reset text to value before editing
                                    us->reopen();
                                    // combine undo records of text creation with text editing
                                    undoChangeProperty(Pid::TEXT, actualText);
                                    layout1();
                                    score()->endCmd();
                                    }
                              return;
                              }
                        }
                  }
            }
      if (actualText.isEmpty()) {
            qDebug("actual text is empty");
            score()->startCmd();
            score()->undoRemoveElement(this);
            ed.element = 0;
            score()->endCmd();
            return;
            }
      setXmlText(ted->oldXmlText);                    // reset text to value before editing
      score()->startCmd();
      undoChangeProperty(Pid::TEXT, actualText);      // change property to set text to actual value again
                                                      // this also changes text of linked elements
      layout1();
      triggerLayout();                                // force relayout even if text did not change
      score()->endCmd();

      static const qreal w = 2.0;
      score()->addRefresh(canvasBoundingRect().adjusted(-w, -w, w, w));
      }
开发者ID:MarcSabatella,项目名称:MuseScore,代码行数:56,代码来源:textedit.cpp

示例13: score

bool Articulation::setProperty(P_ID propertyId, const QVariant& v)
      {
      score()->addRefresh(canvasBoundingRect());
      switch (propertyId) {
            case P_ID::DIRECTION:
                  setDirection(MScore::Direction(v.toInt()));
                  break;
            case P_ID::ARTICULATION_ANCHOR:
                  anchorStyle = PropertyStyle::UNSTYLED;
                  setAnchor(ArticulationAnchor(v.toInt()));
                  break;
            case P_ID::PLAY:
                  setPlayArticulation(v.toBool());
                  break;
            case P_ID::ORNAMENT_STYLE:
                  setOrnamentStyle(MScore::OrnamentStyle(v.toInt()));
                  break;
            case P_ID::TIME_STRETCH:
                  setTimeStretch(v.toDouble());
                  score()->fixTicks();
                  break;
            case P_ID::USER_OFF:
                  setUserOff(v.toPointF());
                  if (_articulationType == ArticulationType::Tenuto) {
                        // moving a tenuto may move slurs:
                        score()->setLayoutAll(true);
                        }
                  return true;
            default:
                  return Element::setProperty(propertyId, v);
            }

      // layout:
      if (chordRest())
            chordRest()->layoutArticulations();
      else if (parent() && parent()->type() == Element::Type::BAR_LINE)
            static_cast<BarLine*>(parent())->layout();

      score()->addRefresh(canvasBoundingRect());
      score()->setLayoutAll(false);       // DEBUG
      canvasBoundingRectChanged();        // rebuild bsp tree
      return true;
      }
开发者ID:FryderykChopin,项目名称:MuseScore,代码行数:43,代码来源:articulation.cpp

示例14: metrics

void ItemDocument::print() {
	static KPrinter *printer = new KPrinter;

	if (! printer->setup(KTechlab::self()))
		return;

	// setup the printer.  with Qt, you always "print" to a
	// QPainter.. whether the output medium is a pixmap, a screen,
	// or paper
	QPainter p;
	p.begin(printer);

	// we let our view do the actual printing
	QPaintDeviceMetrics metrics(printer);

	// Round to 16 so that we cut in the middle of squares
	int w = metrics.width();
	w = (w & 0xFFFFFFF0) + ((w << 1) & 0x10);

	int h = metrics.height();
	h = (h & 0xFFFFFFF0) + ((h << 1) & 0x10);

	p.setClipping(true);
	p.setClipRect(0, 0, w, h, QPainter::CoordPainter);

	// Send off the painter for drawing
	m_canvas->setBackgroundPixmap(0);
	QRect bounding = canvasBoundingRect();

	unsigned int rows = (unsigned) std::ceil(double(bounding.height()) / double(h));
	unsigned int cols = (unsigned) std::ceil(double(bounding.width()) / double(w));

	int offset_x = bounding.x();
	int offset_y = bounding.y();

	for (unsigned row = 0; row < rows; ++row) {
		for (unsigned col = 0; col < cols; ++col) {
			if (row != 0 || col != 0)
				printer->newPage();

			QRect drawArea(offset_x + (col * w), offset_y + (row * h), w, h);

			m_canvas->drawArea(drawArea, & p);

			p.translate(-w, 0);
		}

		p.translate(w * cols, -h);
	}

	updateBackground();

	// and send the result to the printer
	p.end();
}
开发者ID:zoltanp,项目名称:ktechlab-0.3,代码行数:55,代码来源:itemdocument.cpp

示例15: QTextCursor

void Text::startEdit(MuseScoreView* view, const QPointF& p)
      {
      if (styled()) {
            SimpleText::startEdit(view, p);
            return;
            }
      _cursor = new QTextCursor(_doc);
      _cursor->setVisualNavigation(true);
      setCursor(p);
      qreal w = 2.0; // 8.0 / view->matrix().m11();
      score()->rebuildBspTree();
      score()->addRefresh(canvasBoundingRect().adjusted(-w, -w, w, w));
      }
开发者ID:fivearrows,项目名称:MuseScore,代码行数:13,代码来源:text.cpp


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