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

Method helpEvent

gui/nnotebookviewdelegate.cpp:112–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110
111
112bool NNotebookViewDelegate::helpEvent(QHelpEvent *e, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index) {
113 if ( !e || !view )
114 return false;
115
116 if ( e->type() == QEvent::ToolTip ) {
117 QRect rect = view->visualRect( index );
118 QSize size = sizeHint( option, index );
119 if ( rect.width() < size.width() ) {
120 QVariant tooltip = index.data( Qt::DisplayRole );
121 if ( tooltip.canConvert<QString>() ) {
122 QToolTip::showText( e->globalPos(), QString( "<div>%1</div>" )
123 .arg( Qt::escape( tooltip.toString() ) ), view );
124 return true;
125 }
126 }
127 if ( !QStyledItemDelegate::helpEvent( e, view, option, index ) )
128 QToolTip::hideText();
129 return true;
130 }
131
132 return QStyledItemDelegate::helpEvent( e, view, option, index );
133}

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