MCPcopy Index your code
hub / github.com/Audio4Linux/JDSP4Linux / paintEvent

Method paintEvent

src/interface/WidgetMarqueeLabel.cpp:65–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void ScrollText::paintEvent(QPaintEvent*)
66{
67 QPainter p(this);
68
69 if (scrollEnabled)
70 {
71 buffer.fill(qRgba(0, 0, 0, 0));
72 QPainter pb(&buffer);
73 pb.setPen(p.pen());
74 pb.setFont(p.font());
75
76 int x = qMin(-scrollPos, 0) + leftMargin;
77
78 while (x < width())
79 {
80 pb.drawStaticText(QPointF(x, (height() - wholeTextSize.height()) / 2), staticText);
81 x += wholeTextSize.width();
82 }
83
84 // Apply Alpha Channel
85 pb.setCompositionMode(QPainter::CompositionMode_DestinationIn);
86 pb.setClipRect(width() - 15, 0, 15, height());
87 pb.drawImage(0, 0, alphaChannel);
88 pb.setClipRect(0, 0, 15, height());
89
90 // initial situation: don't apply alpha channel in the left half of the image at all; apply it more and more until scrollPos gets positive
91 if (scrollPos < 0)
92 {
93 pb.setOpacity((qreal) (qMax(-8, scrollPos) + 8) / 8.0);
94 }
95
96 pb.drawImage(0, 0, alphaChannel);
97
98 // pb.end();
99 p.drawImage(0, 0, buffer);
100 }
101 else
102 {
103 p.drawStaticText(QPointF(leftMargin, (height() - wholeTextSize.height()) / 2), staticText);
104 }
105}
106
107void ScrollText::resizeEvent(QResizeEvent*)
108{

Callers

nothing calls this directly

Calls 6

widthFunction · 0.85
heightFunction · 0.85
fillMethod · 0.80
setPenMethod · 0.80
setFontMethod · 0.80
fontMethod · 0.80

Tested by

no test coverage detected