MCPcopy Create free account
hub / github.com/baumgarr/nixnote2 / helpEvent

Method helpEvent

gui/ntagviewdelegate.cpp:85–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83
84
85bool NTagViewDelegate::helpEvent(QHelpEvent *e, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index) {
86 if ( !e || !view )
87 return false;
88
89 if ( e->type() == QEvent::ToolTip ) {
90 QRect rect = view->visualRect( index );
91 QSize size = sizeHint( option, index );
92 if ( rect.width() < size.width() ) {
93 QVariant tooltip = index.data( Qt::DisplayRole );
94 if ( tooltip.canConvert<QString>() ) {
95 QToolTip::showText( e->globalPos(), QString( "<div>%1</div>" )
96 .arg( Qt::escape( tooltip.toString() ) ), view );
97 return true;
98 }
99 }
100 if ( !QStyledItemDelegate::helpEvent( e, view, option, index ) )
101 QToolTip::hideText();
102 return true;
103 }
104
105 return QStyledItemDelegate::helpEvent( e, view, option, index );
106}

Callers

nothing calls this directly

Calls 4

typeMethod · 0.80
dataMethod · 0.80
QStringClass · 0.50
toStringMethod · 0.45

Tested by

no test coverage detected