void PositionCursor::paint(QPainter* p) { if (!visible()) return; QPointF points[3]; qreal h = _sv->score()->spatium() * 2; qreal x = _rect.left(); qreal y = _rect.top(); switch(_type) { case CursorType::LOOP_IN: // draw a right-pointing triangle { qreal tx = x - 1.0; p->setPen(QPen(_color, 2.0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin)); p->drawLine(x, y, x, _rect.bottom()); points[0] = QPointF(tx, y); points[1] = QPointF(tx, y + h); points[2] = QPointF(tx + h, y + h * .5); p->setBrush(_color); p->drawConvexPolygon(points, 3); } break; case CursorType::LOOP_OUT: // draw a left-pointing triangle p->setPen(QPen(_color, 2.0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin)); p->drawLine(x, y, x, _rect.bottom()); points[0] = QPointF(x, y); points[1] = QPointF(x, y + h); points[2] = QPointF(x - h, y + h * .5); p->setBrush(_color); p->drawConvexPolygon(points, 3); break; default: // fill the rectangle and add TAB string marks, if required p->fillRect(_rect, color()); if (_sv->score()->noteEntryMode()) { int track = _sv->score()->inputTrack(); if (track >= 0) { Staff* staff = _sv->score()->staff(track2staff(track)); StaffType* staffType = staff->staffType(); if (staffType && staffType->group() == StaffGroup::TAB) staffType->drawInputStringMarks(p, _sv->score()->inputState().string(), track2voice(track), _rect); } } break; } }
void Ambitus::setTrack(int t) { Segment* segm = segment(); Staff* stf = score()->staff(track2staff(t)); Element::setTrack(t); // if not initialized and there is a segment and a staff, // initialize pitches and tpc's to first and last staff line // (for use in palettes) if (_topPitch == INVALID_PITCH || _topTpc == Tpc::TPC_INVALID || _bottomPitch == INVALID_PITCH ||_bottomTpc == Tpc::TPC_INVALID) { if (segm && stf) { updateRange(); _topAccid.setTrack(t); _bottomAccid.setTrack(t); } // else { // _topPitch = _bottomPitch = INVALID_PITCH; // _topTpc = _bottomTpc = Tpc::TPC_INVALID; } }