本文整理汇总了C++中TextLine::continueSymbol方法的典型用法代码示例。如果您正苦于以下问题:C++ TextLine::continueSymbol方法的具体用法?C++ TextLine::continueSymbol怎么用?C++ TextLine::continueSymbol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextLine
的用法示例。
在下文中一共展示了TextLine::continueSymbol方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void TextLineSegment::draw(QPainter* painter) const
{
TextLine* tl = textLine();
qreal _spatium = spatium();
qreal textlineLineWidth = tl->lineWidth().val() * _spatium;
qreal textlineTextDistance = _spatium * .5;
QPointF pp2(pos2());
QColor color;
bool normalColor = false;
if (selected() && !(score() && score()->printing()))
color = MScore::selectColor[0];
else if (!visible())
color = Qt::gray;
else {
color = curColor();
normalColor = true;
}
qreal l = 0.0;
int sym = subtype() == SEGMENT_MIDDLE ? tl->continueSymbol() : tl->beginSymbol();
if (_text) {
SpannerSegmentType st = subtype();
if (
((st == SEGMENT_SINGLE || st == SEGMENT_BEGIN) && (tl->beginTextPlace() == PLACE_LEFT))
|| ((st == SEGMENT_MIDDLE || st == SEGMENT_END) && (tl->continueTextPlace() == PLACE_LEFT))
) {
QRectF bb(_text->bbox());
l = _text->pos().x() + bb.width() + textlineTextDistance;
}
painter->translate(_text->pos());
painter->setPen(normalColor ? _text->curColor() : color);
_text->draw(painter);
painter->translate(-_text->pos());
}
else if (sym != -1) {
const QRectF& bb = symbols[score()->symIdx()][sym].bbox(magS());
qreal h = bb.height() * .5;
QPointF o = tl->beginSymbolOffset() * _spatium;
painter->setPen(color);
symbols[score()->symIdx()][sym].draw(painter, 1.0, QPointF(o.x(), h + o.y()));
l = bb.width() + textlineTextDistance;
}
QPen pen(normalColor ? tl->lineColor() : color, textlineLineWidth);
pen.setStyle(tl->lineStyle());
painter->setPen(pen);
if (subtype() == SEGMENT_SINGLE || subtype() == SEGMENT_END) {
if (tl->endSymbol() != -1) {
int sym = tl->endSymbol();
const QRectF& bb = symbols[score()->symIdx()][sym].bbox(magS());
qreal h = bb.height() * .5;
QPointF o = tl->endSymbolOffset() * _spatium;
pp2.setX(pp2.x() - bb.width() + textlineTextDistance);
symbols[score()->symIdx()][sym].draw(painter, 1.0, QPointF(pp2.x() + textlineTextDistance + o.x(), h + o.y()));
}
}
QPointF pp1(l, 0.0);
if (tl->beginHook() && tl->beginHookType() == HOOK_45)
pp1.rx() += fabs(tl->beginHookHeight().val() * _spatium * .4);
if (tl->endHook() && tl->endHookType() == HOOK_45)
pp2.rx() -= fabs(tl->endHookHeight().val() * _spatium * .4);
painter->drawLine(QLineF(pp1.x(), pp1.y(), pp2.x(), pp2.y()));
if (tl->beginHook()) {
qreal hh = tl->beginHookHeight().val() * _spatium;
if (subtype() == SEGMENT_SINGLE || subtype() == SEGMENT_BEGIN) {
if (tl->beginHookType() == HOOK_45)
painter->drawLine(QLineF(pp1.x(), pp1.y(), pp1.x() - fabs(hh * .4), pp1.y() + hh));
else
painter->drawLine(QLineF(pp1.x(), pp1.y(), pp1.x(), pp1.y() + hh));
}
}
if (tl->endHook()) {
qreal hh = tl->endHookHeight().val() * _spatium;
if (subtype() == SEGMENT_SINGLE || subtype() == SEGMENT_END) {
if (tl->endHookType() == HOOK_45)
painter->drawLine(QLineF(pp2.x(), pp2.y(), pp2.x() + fabs(hh * .4), pp2.y() + hh));
else
painter->drawLine(QLineF(pp2.x(), pp2.y(), pp2.x(), pp2.y() + hh));
}
}
}