程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> Qt QToolTip 控件背景的 QSS 設置方法(摘抄),qtooltipqss

Qt QToolTip 控件背景的 QSS 設置方法(摘抄),qtooltipqss

編輯:C++入門知識

Qt QToolTip 控件背景的 QSS 設置方法(摘抄),qtooltipqss


Qt/C++/CSS: QTooltip stylesheet background colour

Hi there,

I've recently come across a problem developing for the Windows platform, relating to Windows own 'themes'. I have been developing a program with Windows Basic display but upon running the program with a Theme enabled (e.g. Windows Aero), my QTooltips change their background colour, even though the font colour remains correct.

I have linked my stylesheets which work 100% in Basic mode where I declare how to display the QTooltip:
@QToolTip{
color: #8f8;
background-repeat:no-repeat;
background-position:center;
background-color: #222;
}@

The background colour when using a Windows theme simply remains white. I have tried declaring this code within my C++ application, both directly before AND after objects are created to no avail. Using a separate .css file and loading the stylesheet to the parent window also doesn't seem to affect the background-colour. I have been looking around for a solution for some time now (returning to the problem on occasion for the last few months) but have not come across anyone with a similar issue.

Any help would be highly appreciated.

Kind Regards,
Kirennian.


----------------------------------------------------------------------------------------------------------------------------------------------
I try your QSS on Linux with KDE and I think that on KDE is similar situation. I found an "old bug with code":https://bugreports.qt-project.org/browse/QTBUG-2849. On my system when I add to QToolTip QSS
@
border-style: none;
/* border-style: outset; works too */
@
then backgorund-color starts working. Maybe this will help you.

 

link: https://forum.qt.io/topic/24023/qt-c-css-qtooltip-stylesheet-background-colour/2

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved