MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / sizeHint

Method sizeHint

launcher/ui/instanceview/InstanceDelegate.cpp:322–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320}
321
322QSize ListViewDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const
323{
324 QStyleOptionViewItem opt = option;
325 initStyleOption(&opt, index);
326 opt.features |= QStyleOptionViewItem::WrapText;
327 opt.text = index.data().toString();
328 opt.textElideMode = Qt::ElideRight;
329 opt.displayAlignment = Qt::AlignTop | Qt::AlignHCenter;
330
331 QStyle* style = opt.widget ? opt.widget->style() : QApplication::style();
332 const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, &option, opt.widget) + 1;
333 int height = 48 + textMargin * 2 + 5; // TODO: turn constants into variables
334 QSize szz = viewItemTextSize(&opt);
335 height += szz.height();
336 // FIXME: maybe the icon items could scale and keep proportions?
337 QSize sz(100, height);
338 return sz;
339}
340
341class NoReturnTextEdit : public QTextEdit {
342 Q_OBJECT

Callers 2

geometryRectMethod · 0.45
updateMethod · 0.45

Calls 3

viewItemTextSizeFunction · 0.85
toStringMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected