mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-19 13:01:32 +01:00
Display item info in playlist view only if text displayed is elided
This commit is contained in:
parent
2623a170a4
commit
e8720f5bda
@ -226,9 +226,20 @@ bool PlaylistDelegateBase::helpEvent(QHelpEvent *event, QAbstractItemView *view,
|
||||
if (text.isEmpty() || !he)
|
||||
return false;
|
||||
|
||||
QRect displayed_text;
|
||||
QSize real_text;
|
||||
bool is_elided = false;
|
||||
|
||||
switch (event->type()) {
|
||||
case QEvent::ToolTip:
|
||||
QToolTip::showText(he->globalPos(), text, view);
|
||||
real_text = sizeHint(option, index);
|
||||
displayed_text = view->visualRect(index);
|
||||
is_elided = displayed_text.width() < real_text.width();
|
||||
if(is_elided) {
|
||||
QToolTip::showText(he->globalPos(), text, view);
|
||||
} else { // in case that another text was previously displayed
|
||||
QToolTip::hideText();
|
||||
}
|
||||
return true;
|
||||
|
||||
case QEvent::QueryWhatsThis:
|
||||
|
Loading…
Reference in New Issue
Block a user