13

I want to show the tooltip with the text and the time when user selects the item in list view (hovers the mouse on the item in the list view) of QCombobox.

I'm using a custom QComboBox with QItemDelegate.

Mosh Feu
  • 28,354
  • 16
  • 88
  • 135
Wagmare
  • 1,354
  • 1
  • 24
  • 58

2 Answers2

28

Are you looking for this? For example:

 ui->comboBox->setItemData(0, "This is a tooltip for item[0]", Qt::ToolTipRole);

enter image description here

Tay2510
  • 5,748
  • 7
  • 39
  • 58
7

Since I did not find an example, I'll post this here.

The way to do this on Python (PyQt5) is:

from PyQt5 import QtGui, QtCore
...
combobox.setItemData(0, "This is a tooltip for item[0]",QtCore.Qt.ToolTipRole);
thlik
  • 401
  • 6
  • 12