2015-12-10 206 views

回答

1

可能最好的方法是使用樣式表。您可以通過這種方式設置任何文本顏色/背景顏色和文本樣式。

根據您的QT版本,請參閱文檔:

Qt5 Style Sheet Documentation

+0

非常感謝!雖然是詳盡的,但上述文件有很好的幫助。我添加了以下代碼來添加自定義工具提示到我的qtablewidget => ui.ansTable-> setStyleSheet(「QToolTip {border:2px solid orange; padding:5px; border-radius:3px; opacity:200;}」); ui.ansTable是一個qtablewidget。 –

0

可以使用QtoolTip靜態methodes更新調色板:

QPalette palette = QToolTip::palette(); 
palette.setColor(QPalette::ToolTipBase,QColor("#F6F6F6")); // light grey 
palette.setColor(QPalette::ToolTipText,QColor("#706F6F"));//dark grey for text 
QToolTip::setPalette(palette); 
相關問題