本文整理汇总了C++中TimeSig::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeSig::draw方法的具体用法?C++ TimeSig::draw怎么用?C++ TimeSig::draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeSig
的用法示例。
在下文中一共展示了TimeSig::draw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void ContinuousPanel::draw(QPainter& painter, const QList<Element*>& el) {
painter.save();
painter.setRenderHint(QPainter::Antialiasing, preferences.antialiasedDrawing);
painter.setRenderHint(QPainter::TextAntialiasing, true);
// Draw colored rectangle
painter.setClipping(false);
QPointF pos(_offsetPanel, 0);
painter.translate(pos);
QPen pen;
pen.setWidthF(0.0);
pen.setStyle(Qt::NoPen);
painter.setPen(pen);
painter.setBrush(preferences.fgColor);
QRectF bg(_rect);
bg.setWidth(_widthClef + _widthKeySig + _widthTimeSig + _leftMarginTotal + _panelRightPadding);
QPixmap* fgPixmap = _sv->fgPixmap();
if (fgPixmap == 0 || fgPixmap->isNull())
painter.fillRect(bg, preferences.fgColor);
else {
painter.setMatrixEnabled(false);
painter.drawTiledPixmap(bg, *fgPixmap, bg.topLeft()
- QPoint(lrint(_sv->matrix().dx()), lrint(_sv->matrix().dy())));
painter.setMatrixEnabled(true);
}
painter.setClipRect(_rect);
painter.setClipping(true);
QColor color(MScore::layoutBreakColor);
// Draw measure text number
QString text = _mmRestCount ? QString("#%1-%2").arg(_currentMeasureNo+1).arg(_currentMeasureNo+_mmRestCount) : QString("#%1").arg(_currentMeasureNo+1);
Text* newElement = new Text(_score);
newElement->setTextStyleType(TextStyleType::DEFAULT);
newElement->setFlag(ElementFlag::MOVABLE, false);
newElement->setXmlText(text);
newElement->textStyle().setFamily("FreeSans");
newElement->textStyle().setSizeIsSpatiumDependent(true);
newElement->setColor(color);
newElement->sameLayout();
pos = QPointF(_score->styleP(StyleIdx::clefLeftMargin) + _widthClef, _y + newElement->height());
painter.translate(pos);
newElement->draw(&painter);
pos += QPointF(_offsetPanel, 0);
painter.translate(-pos);
delete newElement;
// This second pass draws the elements spaced evently using the width of the largest element
for (const Element* e : el) {
e->itemDiscovered = 0;
if (!e->visible()) {
if (_score->printing() || !_score->showInvisible())
continue;
}
if (e->type() == Element::Type::STAFF_LINES) {
Staff* currentStaff = _score->staff(e->staffIdx());
Segment* parent = _score->tick2segmentMM(_currentMeasureTick);
pos = QPointF (_offsetPanel, e->pagePos().y());
painter.translate(pos);
// Draw staff lines
StaffLines* newStaffLines = static_cast<StaffLines*>(e->clone());
newStaffLines->setWidth(bg.width());
newStaffLines->setParent(parent);
newStaffLines->setTrack(e->track());
newStaffLines->layout();
newStaffLines->setColor(color);
newStaffLines->draw(&painter);
delete newStaffLines;
// Draw barline
BarLine* newBarLine = new BarLine(_score);
newBarLine->setBarLineType(BarLineType::NORMAL);
newBarLine->setParent(parent);
newBarLine->setTrack(e->track());
newBarLine->setSpan(currentStaff->barLineSpan());
newBarLine->setSpanFrom(currentStaff->barLineFrom());
newBarLine->setSpanTo(currentStaff->barLineTo());
newBarLine->layout();
newBarLine->setColor(color);
newBarLine->draw(&painter);
delete newBarLine;
// Draw the current staff name
QList<StaffName>& staffNamesLong = currentStaff->part()->instrument()->longNames();
QString staffName = staffNamesLong.isEmpty() ? " " : staffNamesLong[0].name();
if (staffName == "") {
QList<StaffName>& staffNamesShort = currentStaff->part()->instrument()->shortNames();
staffName = staffNamesShort.isEmpty() ? "" : staffNamesShort[0].name();
}
Text* newName = new Text(_score);
newName->setXmlText(staffName);
newName->setParent(parent);
newName->setTrack(e->track());
newName->setColor(color);
newName->textStyle().setFamily("FreeSans");
//.........这里部分代码省略.........