void FormEditorItem::paintBoundingRect(QPainter *painter) const { if (!m_boundingRect.isValid() || (QGraphicsItem::parentItem() == scene()->formLayerItem() && qFuzzyIsNull(m_borderWidth))) return; if (m_boundingRect.width() < 8 || m_boundingRect.height() < 8) return; QPen pen; pen.setJoinStyle(Qt::MiterJoin); QColor frameColor("#AAAAAA"); if (scene()->showBoundingRects()) { if (m_highlightBoundingRect) { pen.setColor(frameColor); } else { pen.setColor(frameColor.darker(150)); pen.setStyle(Qt::DotLine); } } else { if (m_highlightBoundingRect) { pen.setColor(frameColor); } else { pen.setColor(Qt::transparent); pen.setStyle(Qt::DotLine); } } painter->setPen(pen); // int offset = m_borderWidth / 2; painter->drawRect(m_boundingRect.adjusted(0., 0., -1., -1.)); }
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 FormEditorItem::paintBoundingRect(QPainter *painter) const { if (!boundingRect().isValid() || (QGraphicsItem::parentItem() == scene()->formLayerItem() && qFuzzyIsNull(m_borderWidth))) return; if (boundingRect().width() < 8 || boundingRect().height() < 8) return; QPen pen; pen.setJoinStyle(Qt::MiterJoin); pen.setStyle(Qt::DotLine); switch(scene()->paintMode()) { case FormEditorScene::AnchorMode: { pen.setColor(Qt::black); pen.setWidth(m_borderWidth); } break; case FormEditorScene::NormalMode: { QColor frameColor("#AAAAAA"); if (scene()->showBoundingRects()) { if (m_highlightBoundingRect) pen.setColor(frameColor); else pen.setColor(frameColor.darker(150)); } else { if (m_highlightBoundingRect) pen.setColor(frameColor); else pen.setColor(Qt::transparent); } } break; } painter->setPen(pen); // int offset = m_borderWidth / 2; painter->drawRect(boundingRect().adjusted(0., 0., -1., -1.)); }
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); } }
//----------------------------------------------------------------------------- CScrollbar::CScrollbar (const CRect& size, IControlListener* listener, int32_t tag, ScrollbarDirection direction, const CRect& scrollSize) : CControl (size, listener, tag, 0) , direction (direction) , scrollSize (scrollSize) , scrollerArea (size) , stepValue (0.1f) , scrollerLength (0) , overlayStyle (false) , mouseIsInside (false) , drawer (0) , timer (0) { setTransparency (true); setWheelInc (0.05f); scrollerArea.inset (2, 2); calculateScrollerLength (); frameColor (0, 0, 0, 255); scrollerColor (0, 0, 255, 255); backgroundColor (255, 255, 255, 200); }