| 217 | } |
| 218 | |
| 219 | void TextLabel::handleResize(double horizontalRatio, double verticalRatio, bool /*pageResize*/) { |
| 220 | DEBUG(Q_FUNC_INFO); |
| 221 | |
| 222 | double ratio = 0; |
| 223 | if (horizontalRatio > 1.0 || verticalRatio > 1.0) |
| 224 | ratio = std::max(horizontalRatio, verticalRatio); |
| 225 | else |
| 226 | ratio = std::min(horizontalRatio, verticalRatio); |
| 227 | |
| 228 | Q_D(TextLabel); |
| 229 | d->teXFont.setPointSizeF(d->teXFont.pointSizeF() * ratio); |
| 230 | d->updateText(); |
| 231 | |
| 232 | // TODO: doesn't seem to work |
| 233 | QTextDocument doc; |
| 234 | doc.setHtml(d->textWrapper.text); |
| 235 | QTextCursor cursor(&doc); |
| 236 | cursor.select(QTextCursor::Document); |
| 237 | QTextCharFormat fmt = cursor.charFormat(); |
| 238 | QFont font = fmt.font(); |
| 239 | font.setPointSizeF(font.pointSizeF() * ratio); |
| 240 | fmt.setFont(font); |
| 241 | cursor.setCharFormat(fmt); |
| 242 | } |
| 243 | |
| 244 | /*! |
| 245 | Returns an icon to be used in the project explorer. |
nothing calls this directly
no test coverage detected