MCPcopy Create free account
hub / github.com/Liniyous/ElaWidgetTools / paintEvent

Method paintEvent

ElaWidgetTools/ElaText.cpp:157–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155 Q_D(const ElaText);
156 return d->_pTextStyle;
157}
158
159void ElaText::setElaIcon(ElaIconType::IconName elaIcon)
160{
161 Q_D(ElaText);
162 d->_pElaIcon = elaIcon;
163 update();
164 Q_EMIT pElaIconChanged();
165}
166
167ElaIconType::IconName ElaText::getElaIcon() const
168{
169 Q_D(const ElaText);
170 return d->_pElaIcon;
171}
172
173void ElaText::paintEvent(QPaintEvent* event)
174{
175 Q_D(ElaText);
176 if (palette().color(QPalette::WindowText) != ElaThemeColor(d->_themeMode, BasicText))
177 {
178 d->onThemeChanged(d->_themeMode);
179 }
180 if (d->_pElaIcon != ElaIconType::None)
181 {
182 QPainter painter(this);
183 painter.save();
184 painter.setRenderHints(QPainter::SmoothPixmapTransform | QPainter::Antialiasing | QPainter::TextAntialiasing);
185 QFont iconFont = QFont("ElaAwesome");
186 iconFont.setPixelSize(this->font().pixelSize());
187 painter.setFont(iconFont);
188 painter.setPen(ElaThemeColor(d->_themeMode, BasicText));
189 painter.drawText(rect(), Qt::AlignCenter, QChar(d->_pElaIcon));
190 painter.restore();
191 }
192 else
193 {
194 if (wordWrap() && d->_isWrapAnywhere)
195 {

Callers

nothing calls this directly

Calls 1

onThemeChangedMethod · 0.45

Tested by

no test coverage detected