使用QPalette的方法不行,

ui->le_text->setAutoFillBackground(true);
qDebug() << ui->le_text->palette().color(QPalette::WindowText);
QPalette lette;
QColor color(50,0,255, 255);
lette.setColor(QPalette::WindowText, color);
ui->le_text->setPalette(lette);
qDebug() << ui->le_text->palette().color(QPalette::WindowText);

需要使用stylesheet的方法。

ui->le_text->setStyleSheet("background-color:rgba(0,255,255,255)");

http://blog.csdn.net/zhi379/article/details/12842455

qlineedit设置背景颜色(使用QPalette的方法不行,必须使用QSS)的更多相关文章

  1. Pyqt 设置 背景颜色和背景图片、 QPalette 调色板 与QPainter 画板区别 、 不规则图片

    设置 背景颜色和背景图片 首先设置autoFillBackground属性为真然后定义一个QPalette对象设置QPalette对象的背景属性(颜色或图片)最后设置QWidget对象的Palette ...

  2. cell设置背景颜色为啥不起作用

    利用poi设置背景颜色时,应如下配置, CellStyle cell=workbook.createCellStyle(); cell.setFillForegroundColor(IndexedCo ...

  3. 【VS开发】VS2010 MFC中控件、对话框等背景颜色动态修改的方法

    [VS开发]VS2010 MFC中控件.对话框等背景颜色动态修改的方法 标签(空格分隔):[VS开发] 声明:引用请注明出处http://blog.csdn.net/lg1259156776/ 说明: ...

  4. Aspose.Cells 设置背景颜色

    很多小伙伴设置背景颜色都不起作用,特别提醒需要加入下面一行: style.Pattern = BackgroundType.Solid; Aspose.Cells.Style style = null ...

  5. intellij IDEA15 设置背景颜色

    File--> Settings 2. Appearance & Behavior --> Appearance 设置边框背景颜色 3. Editor --> Colors ...

  6. codeblock 设置背景颜色

    今天觉得codeblock看着刺眼,想了想,能不能跟vs利用dark背景一样可以设置一个舒服的背景.于是就开始各种点击,各种摸索了. 1. 背景和各种颜色设置 不妨先说下vs中的设置是:工具(Tool ...

  7. 怎么给button设置背景颜色?【Android】

    怎么给button设置背景颜色?[Android] 怎么给button设置背景颜色?[Android] 现在我想给按钮添加背景颜色,怎么做 1.android:background="@an ...

  8. Android(java)学习笔记106:Android设置文本颜色的4种方法

    1. Android设置文本颜色的4种方法: (1)利用系统自带的颜色类: tv.setTextColor(android.graphics.Color.RED); (2)数字颜色表示: tv.set ...

  9. IDEA 设置背景颜色及字号

    intellij IDEA 设置背景颜色   File--> Settings 2. Appearance & Behavior --> Appearance 设置边框背景颜色 3 ...

随机推荐

  1. 【BZOJ 1024】 [SCOI2009]生日快乐

    [题目链接]:http://www.lydsy.com/JudgeOnline/problem.php?id=1024 [题意] [题解] 要求恰好分成n个部分;每个部分的面积都一样; 则dfs的时候 ...

  2. SVM明确的解释1__ 线性可分问题

    笔者:liangdas 出处:简单点儿,通俗点儿,机器学习    http://blog.csdn.net/liangdas/article/details/44251469 引言: 1995年Cor ...

  3. Clustering Devices In An Internet Of Things

    Clustering devices in an Internet of Things ('IoT'), including: receiving, by a device clustering mo ...

  4. WPF中 MVVM模式的Slider Binding.

    对于Button的Command的绑定可以通过实现ICommand接口来进行,但是Slider并没有Command属性. 另外如果要实现MVVM模式的话,需要将一些Method和Slider的Even ...

  5. jQuery多库共存处理$.noConflict()

    如果我们需要同时使用jQuery和其他JavaScript库,我们可以使用 $.noConflict()把$的控制权交给其他库.旧引用的$ 被保存在jQuery的初始化; noConflict() 简 ...

  6. σ 代数与测度(measures)

    1. definition Let A be a collection of subsets(集合的集合体,collection of subsets) of a sample space Ω,A i ...

  7. WPF 3D model - Sphere, Cone, and Cylinder

    原文:WPF 3D model - Sphere, Cone, and Cylinder   Extending Visual3D - Sphere, Cone, and Cylinder http: ...

  8. WPF 把图片分割成两份自动翻页 WpfFlipPageControl:CtrlBook 书控件

    原文:WPF 把图片分割成两份自动翻页 WpfFlipPageControl:CtrlBook 书控件 版权声明:本文为博主原创文章,需要转载尽管转载. https://blog.csdn.net/z ...

  9. Matlab随笔之画图函数总结

    原文:Matlab随笔之画图函数总结 MATLAB函数画图 MATLAB不但擅长於矩阵相关的数值运算,也适合用在各种科学目视表示(Scientific visualization).本节将介绍MATL ...

  10. the solution about &quot;messy code&quot; in elicpse

    I use the Elicpse IDE to develope the ansdroid app.Sometime encounter the messy code in the Elicpse ...