| 197 | } |
| 198 | |
| 199 | void OneUseWidget::resizeEvent(QResizeEvent* event) |
| 200 | { |
| 201 | ///Adapt the content |
| 202 | QSize size = event->size(); |
| 203 | |
| 204 | KTextEditor::Range range = m_range->range(); |
| 205 | |
| 206 | int cutOff = 0; |
| 207 | int maxCutOff = m_sourceLine.length() - (range.end().column() - range.start().column()); |
| 208 | |
| 209 | //Reset so we also get more context while up-sizing |
| 210 | m_label->setText(QLatin1String("<a>") + |
| 211 | i18nc("Refers to a line in source code", "Line <b>%1</b>:", range.start().line() + 1) |
| 212 | + QLatin1String("</a> ") + highlightAndEscapeUseText(m_sourceLine, cutOff, range)); |
| 213 | |
| 214 | /// FIXME: this is incredibly ugly and slow... we could simply paint the text ourselves and elide it properly |
| 215 | while (sizeHint().width() > size.width() && cutOff < maxCutOff) { |
| 216 | //We've got to save space |
| 217 | m_label->setText(QLatin1String("<a>") + |
| 218 | i18nc("Refers to a line in source code", "Line <b>%1</b>:", range.start().line() + 1) |
| 219 | + QLatin1String("</a> ") + highlightAndEscapeUseText(m_sourceLine, cutOff, range)); |
| 220 | cutOff += 5; |
| 221 | } |
| 222 | |
| 223 | event->accept(); |
| 224 | |
| 225 | QWidget::resizeEvent(event); |
| 226 | } |
| 227 | |
| 228 | void NavigatableWidgetList::setShowHeader(bool show) |
| 229 | { |
nothing calls this directly
no test coverage detected