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

Method sizeHint

plugins/quickopen/expandingtree/expandingdelegate.cpp:121–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121QSize ExpandingDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const
122{
123 const QModelIndex sourceIndex = model()->mapToSource(index);
124 QSize s = QItemDelegate::sizeHint(option, index);
125 if (model()->isExpanded(sourceIndex) && model()->expandingWidget(sourceIndex)) {
126 QWidget* widget = model()->expandingWidget(sourceIndex);
127 QSize widgetSize = widget->size();
128
129 s.setHeight(widgetSize.height() + s.height() + 10); //10 is the sum that must match exactly the offsets used in ExpandingWidgetModel::placeExpandingWidgets
130 } else if (model()->isPartiallyExpanded(sourceIndex) != ExpandingWidgetModel::ExpansionType::NotExpanded) {
131 s.setHeight(s.height() + 30 + 10);
132 }
133 return s;
134}
135
136void ExpandingDelegate::adjustStyle(const QModelIndex& index, QStyleOptionViewItem& option) const
137{

Callers

nothing calls this directly

Calls 7

modelFunction · 0.85
sizeHintFunction · 0.85
isExpandedMethod · 0.80
isPartiallyExpandedMethod · 0.80
mapToSourceMethod · 0.45
expandingWidgetMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected