1,使用QComboBox的setToolTip方法
当鼠标悬停在该comboBox上时,显示该Tooltip
QComboBox*comboBox=new 0comboBox();
comboBox->setToolTip("This is a tooltip for the combo box.");
2,QCombox设置Tooltip 取消tooltip
这将删除comboBox的Tooltip,当鼠标悬停在该comboBox上时,将不再显示Tooltip。
comboBox->setToolTip("");
3,QComboBox的特定项
使用QComboBox的setltemData方法将特定项的Tooltip设置为空字符串,以取消Tooltip。
以下是一个示例代码段:
index是设置的项的索引。指定项的Tooltip设置为空字符串,从而取消Tooltip.
comboBox->setItemData(index,"",Qt::ToolTipRole);