<legend id='DwgMp'><style id='DwgMp'><dir id='DwgMp'><q id='DwgMp'></q></dir></style></legend>

  • <small id='DwgMp'></small><noframes id='DwgMp'>

      1. <i id='DwgMp'><tr id='DwgMp'><dt id='DwgMp'><q id='DwgMp'><span id='DwgMp'><b id='DwgMp'><form id='DwgMp'><ins id='DwgMp'></ins><ul id='DwgMp'></ul><sub id='DwgMp'></sub></form><legend id='DwgMp'></legend><bdo id='DwgMp'><pre id='DwgMp'><center id='DwgMp'></center></pre></bdo></b><th id='DwgMp'></th></span></q></dt></tr></i><div id='DwgMp'><tfoot id='DwgMp'></tfoot><dl id='DwgMp'><fieldset id='DwgMp'></fieldset></dl></div>

        • <bdo id='DwgMp'></bdo><ul id='DwgMp'></ul>
        <tfoot id='DwgMp'></tfoot>

        Qt设置QLineEdit的背景颜色

        Qt Set Background Color of QLineEdit(Qt设置QLineEdit的背景颜色)
      2. <i id='p6FBR'><tr id='p6FBR'><dt id='p6FBR'><q id='p6FBR'><span id='p6FBR'><b id='p6FBR'><form id='p6FBR'><ins id='p6FBR'></ins><ul id='p6FBR'></ul><sub id='p6FBR'></sub></form><legend id='p6FBR'></legend><bdo id='p6FBR'><pre id='p6FBR'><center id='p6FBR'></center></pre></bdo></b><th id='p6FBR'></th></span></q></dt></tr></i><div id='p6FBR'><tfoot id='p6FBR'></tfoot><dl id='p6FBR'><fieldset id='p6FBR'></fieldset></dl></div>
      3. <tfoot id='p6FBR'></tfoot>

        <small id='p6FBR'></small><noframes id='p6FBR'>

            <legend id='p6FBR'><style id='p6FBR'><dir id='p6FBR'><q id='p6FBR'></q></dir></style></legend>

                <tbody id='p6FBR'></tbody>
                <bdo id='p6FBR'></bdo><ul id='p6FBR'></ul>

                  本文介绍了Qt设置QLineEdit的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试更改 QLineEdit 的背景颜色,但我根本想不通.

                  I'm trying to change the background color of the QLineEdit and I can't figure it out at all.

                  我尝试使用 stylesheets 原来是这样的

                  I tried using stylesheets originally like this

                  QLineEdit *le = new QLineEdit();
                  le->setStyleSheet("background:#000;");
                  

                  但这并没有做任何事情.我尝试像这样使用 QPalette

                  but that didn't do anything. I tried using QPalette like this

                  QPalette palette;
                  palette.setColor(QPalette::Base, Qt::black);
                  palette.setColor(QPalette::Background, Qt::black);
                  le.setPalette(palette);    
                  

                  但这也没有做任何事情.我一直在寻找一整天,找不到任何东西.我做错了什么还是有其他方法可以做到这一点?

                  but this didn't do anything either. I've been looking all day and can't find anything. am I doing something wrong or is there another way to do it?

                  推荐答案

                  对我来说很好:

                  QLineEdit *le = new QLineEdit();
                  le->setStyleSheet("QLineEdit { background: rgb(0, 255, 255); selection-background-color: rgb(233, 99, 0); }");
                  

                  这篇关于Qt设置QLineEdit的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Unable to access non-const member functions of objects in C++ std::set(无法访问 C++ std::set 中对象的非常量成员函数)
                  How should a size-limited stl-like container be implemented?(应该如何实现大小受限的 stl 类容器?)
                  Constructing std::function argument from lambda(从 lambda 构造 std::function 参数)
                  STL BigInt class implementation(STL BigInt 类实现)
                  Sync is unreliable using std::atomic and std::condition_variable(使用 std::atomic 和 std::condition_variable 同步不可靠)
                  Move list element to the end in STL(在 STL 中将列表元素移动到末尾)
                    <tbody id='xkdim'></tbody>

                  <small id='xkdim'></small><noframes id='xkdim'>

                • <legend id='xkdim'><style id='xkdim'><dir id='xkdim'><q id='xkdim'></q></dir></style></legend>
                  • <tfoot id='xkdim'></tfoot>

                          <bdo id='xkdim'></bdo><ul id='xkdim'></ul>

                            <i id='xkdim'><tr id='xkdim'><dt id='xkdim'><q id='xkdim'><span id='xkdim'><b id='xkdim'><form id='xkdim'><ins id='xkdim'></ins><ul id='xkdim'></ul><sub id='xkdim'></sub></form><legend id='xkdim'></legend><bdo id='xkdim'><pre id='xkdim'><center id='xkdim'></center></pre></bdo></b><th id='xkdim'></th></span></q></dt></tr></i><div id='xkdim'><tfoot id='xkdim'></tfoot><dl id='xkdim'><fieldset id='xkdim'></fieldset></dl></div>