MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / paintEvent

Method paintEvent

Gui/AnimatedCheckBox.cpp:135–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135void
136AnimatedCheckBox::paintEvent(QPaintEvent* e)
137{
138 QFrame::paintEvent(e);
139 QStyleOption opt;
140
141 opt.initFrom(this);
142 QPainter p(this);
143 QRectF bRect = rect();
144 double fw = frameWidth();
145 QPen pen = p.pen();
146 QColor activeColor;
147
148 ///Draw bg
149 QRectF bgRect = bRect.adjusted(fw / 2., fw / 2., -fw, -fw);
150 //bRect.adjust(fw, fw, -fw, -fw);
151 double bgR = 0., bgG = 0., bgB = 0.;
152 if (animation == 0) {
153 getBackgroundColor(&bgR, &bgG, &bgB);
154 } else if (animation == 1) {
155 appPTR->getCurrentSettings()->getInterpolatedColor(&bgR, &bgG, &bgB);
156 } else if (animation == 2) {
157 appPTR->getCurrentSettings()->getKeyframeColor(&bgR, &bgG, &bgB);
158 } else if (animation == 3) {
159 appPTR->getCurrentSettings()->getExprColor(&bgR, &bgG, &bgB);
160 }
161 activeColor.setRgbF(bgR, bgG, bgB);
162 pen.setColor(activeColor);
163 p.setPen(pen);
164
165 p.fillRect(bgRect, activeColor);
166
167
168 ///Draw tick
169 if (checked) {
170 if (animation == 3) {
171 activeColor = Qt::black;
172 } else if (readOnly) {
173 activeColor.setRgbF(0.5, 0.5, 0.5);
174 } else if (altered) {
175 double r, g, b;
176 appPTR->getCurrentSettings()->getAltTextColor(&r, &g, &b);
177 activeColor.setRgbF(r, g, b);
178 } else if (dirty) {
179 activeColor = Qt::black;
180 } else {
181 double r, g, b;
182 appPTR->getCurrentSettings()->getTextColor(&r, &g, &b);
183 activeColor.setRgbF(r, g, b);
184 }
185
186 pen.setColor(activeColor);
187 p.setRenderHint(QPainter::Antialiasing);
188 p.setPen(pen);
189 p.drawLine( bRect.topLeft(), bRect.bottomRight() );
190 p.drawLine( bRect.bottomLeft(), bRect.topRight() );
191 }
192

Callers

nothing calls this directly

Calls 8

getInterpolatedColorMethod · 0.80
getCurrentSettingsMethod · 0.80
getKeyframeColorMethod · 0.80
getExprColorMethod · 0.80
getAltTextColorMethod · 0.80
getTextColorMethod · 0.80
getSelectionColorMethod · 0.80
setColorMethod · 0.45

Tested by

no test coverage detected