| 155 | Q_D(const ElaText); |
| 156 | return d->_pTextStyle; |
| 157 | } |
| 158 | |
| 159 | void ElaText::setElaIcon(ElaIconType::IconName elaIcon) |
| 160 | { |
| 161 | Q_D(ElaText); |
| 162 | d->_pElaIcon = elaIcon; |
| 163 | update(); |
| 164 | Q_EMIT pElaIconChanged(); |
| 165 | } |
| 166 | |
| 167 | ElaIconType::IconName ElaText::getElaIcon() const |
| 168 | { |
| 169 | Q_D(const ElaText); |
| 170 | return d->_pElaIcon; |
| 171 | } |
| 172 | |
| 173 | void 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 | { |
nothing calls this directly
no test coverage detected