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

Qt QToolTip 控件背景的 QSS 设置方法(摘抄)的更多相关文章

  1. Qt 给控件QLineEdit添加clicked事件方法

    做Qt开发的会知道QLineEdit是默认没有clicked事件的,但是Qt有很好的一套信号/槽机制,而且Qt是基于C++面向对象的思想来设计的,那么我们就很容易通过自己定义一些类,重写QLineEd ...

  2. (转载)C#工具箱Menustrip控件中分割线的设置方法

    最近编C#程序,因为初学,不是太清楚,碰到了toolstripMenu中分割线设置的问题.遍寻中文网页,都是语言不详的,甚是呕人. 上网找了个外文网站,给的答案甚是详细,先贴在下面. http://w ...

  3. QT 窗体控件的透明度设置(三种方法)

    整个窗体 当设置QT的窗体(QMainWindow, QDialog)时,直接用 targetForm->setWindowOpacity()   函数即可实现,效果为窗体及窗体内所有控件都透明 ...

  4. WPF 后台C#设置控件背景图片

    原文:WPF 后台C#设置控件背景图片 以前的程序中有做过,当时只是记得uri很长一大段就没怎么记.今天有人问了也就写下来.   这是一个Button,设置了Background后的效果. 前台的设置 ...

  5. Qt常用控件

    Qt常用控件 QWidget与QFrame QWidget所有图形控件的基类 QFrame与QWidget的区别 QFrame是基本控件的基类, QWidget是QFrame的基类. 因此QFrame ...

  6. Qt报表控件NCReport教程:报表创建示例

    NCReport是 一款10多年时间的老牌报表控件,最初是在2002年时作为qt3的应用程序的一个联合项目,后来就成为了一个独立的GPL项目.现在的NCReport 是一款轻量级.快速.多平台.简单易 ...

  7. UI-UIImageView的图片填充方式(contentMode)_图片作为控件背景图的拉伸方式(stretch)介绍

    常用图片填充方式 这里只介绍三个最常用的图片填充方式 UIViewContentModeScaleToFill模式会导致图片变形.例如: UIViewContentModeScaleAspectFit ...

  8. C#控件背景透明的几种解决方案

    已经很少做winform程序了,最新参与了一个小项目,遇到了控件背景透明的功能要求,特在此总结一下,供有需要的同行参考. 0.背景透明的概念和分类 背景透明是啥意思呢,就是背景透明.哈哈,废话了.其实 ...

  9. Qt入门(4)——Qt常见控件

    Qt提供了大量的内建控件及通用对话框可满足程序员的绝大部分要求.我们将对这些控件和对话框作一个大概的介绍. 1. QLabel 定义 QLabel* m_labelOrdered = newQLabe ...

随机推荐

  1. #include <stdlib.h>

    1 _itoa 2 atoi 3 rand() 4 srand 1 _itoa _itoa(int value,char*string,int radix); int value 被转换的整数,cha ...

  2. SPFA,dijskra,prime,topu四种算法的模板

    ////#include<stdio.h> ////#include<string.h> ////#include<queue> ////#include<a ...

  3. 自学XSL的几个例子

    XSL 指扩展样式表语言(EXtensible Stylesheet Language).XSL用来描述XML文件的格式,类似于我们可以用CSS描述HTML的格式.具体用法请转:http://www. ...

  4. 利用VS自带的命令行工具查看和生产PublicKeyToken (转)

    使用VS2013(或其他版本)命令行工具,键入:SN -T C:\*****.dll 就会显示出该dll具体的PublicKeyToken数值. 如果该程序集没有强命 名,则不会有PublicKeyT ...

  5. 项目中经常用到的reset.css文件

    html,body{width:100%; height: auto;} *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box- ...

  6. caret彻底的理解css的三角形【通过border】

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. 出现java.lang.NoSuchFieldException resourceEntries错误的解决方法

    JSP表单里面的表单输入<input type= "text" name="user">这里面的每一个输入都是一个Attribute,相当于setA ...

  8. leetcode Search in Rotated Sorted Array python

      #Suppose a sorted array is rotated at some pivot unknown to you beforehand. #(i.e., 0 1 2 4 5 6 7  ...

  9. Cookies与保持登录(新浪微博的简单模拟登录)

    Cookies与保持登录(新浪微博的简单登录) .note-content {font-family: "Helvetica Neue",Arial,"Hiragino ...

  10. 在IE6/7下表格td标签没有内容时不显示边框?

    有以下几种方法: 1.在单元格中加入一个空格.这样: <td> </td> 2.直接在table里这样写:<table border="0" cell ...