MCPcopy Create free account
hub / github.com/KDE/kdevelop / resizeEvent

Method resizeEvent

kdevplatform/language/duchain/navigation/useswidget.cpp:199–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199void 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
228void NavigatableWidgetList::setShowHeader(bool show)
229{

Callers

nothing calls this directly

Calls 11

sizeHintFunction · 0.85
sizeMethod · 0.45
rangeMethod · 0.45
lengthMethod · 0.45
columnMethod · 0.45
endMethod · 0.45
startMethod · 0.45
setTextMethod · 0.45
lineMethod · 0.45
acceptMethod · 0.45

Tested by

no test coverage detected