void SimpleText::drawFrame(QPainter* painter) const { if (!textStyle().hasFrame()) return; QColor color(frameColor()); if (!visible()) color = Qt::gray; else if (selected()) color = Qt::blue; if (frameWidth().val() != 0.0) { QPen pen(color, frameWidth().val() * spatium()); painter->setPen(pen); } else painter->setPen(Qt::NoPen); QColor bg(backgroundColor()); painter->setBrush(bg.alpha() ? QBrush(bg) : Qt::NoBrush); if (circle()) painter->drawArc(frame, 0, 5760); else { int r2 = frameRound() * lrint((frame.width() / frame.height())); if (r2 > 99) r2 = 99; painter->drawRoundRect(frame, frameRound(), r2); } }
void Text::draw(Painter* p) const { Font f = style().font(spatium()); p->drawText(f, QPointF(), _text); #if 0 QAbstractTextDocumentLayout::PaintContext c; c.cursorPosition = -1; if (cursor && !(score() && score()->printing())) { if (cursor->hasSelection()) { QAbstractTextDocumentLayout::Selection selection; selection.cursor = *cursor; selection.format.setBackground(c.palette.brush(QPalette::Active, QPalette::Highlight)); selection.format.setForeground(c.palette.brush(QPalette::Active, QPalette::HighlightedText)); c.selections.append(selection); } c.cursorPosition = cursor->position(); } Color color = p->pen().color(); c.palette.setColor(QPalette::Text, color); _doc->documentLayout()->draw(p->painter(), c); // draw frame if (hasFrame()) { Color color(frameColor()); if (!visible()) color = Qt::gray; else if (selected()) color = preferences.selectColor[track() == -1 ? 0 : voice()]; p->setPen(Pen(QBrush(color), frameWidth() * DPMM)); p->setBrush(QBrush(Qt::NoBrush)); if (circle()) p->drawArc(frame, 0, 5760); else { int r2 = frameRound() * lrint((frame.width() / frame.height())); if (r2 > 99) r2 = 99; p->drawRoundRect(frame, frameRound(), r2); } } #endif }
void SimpleText::drawFrame(QPainter* painter) const { if (!style().hasFrame()) return; QColor color(frameColor()); if (!visible()) color = Qt::gray; QPen pen(curColor(), frameWidth() * DPMM); painter->setPen(pen); painter->setBrush(Qt::NoBrush); if (circle()) painter->drawArc(frame, 0, 5760); else { int r2 = frameRound() * lrint((frame.width() / frame.height())); if (r2 > 99) r2 = 99; painter->drawRoundRect(frame, frameRound(), r2); } }