Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show tooltip when the user selects item in QComboBox

Tags:

qt

qcombobox

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.

like image 450
Wagmare Avatar asked Apr 30 '14 05:04

Wagmare


2 Answers

Are you looking for this? For example:

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

enter image description here

like image 138
Tay2510 Avatar answered Oct 20 '22 05:10

Tay2510


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);
like image 30
thlik Avatar answered Oct 20 '22 03:10

thlik