<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的背景颜色

        时间:2024-08-13
      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的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:捕捉“堆栈溢出"递归 C++ 函数中的异常 下一篇:std::unordered_map 是如何实现的

                  相关文章

                  <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>