<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Assign the same font color and the same background color to all QLineEdit components - how does that work?]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">My window is derived from QMainWindow. There are a few in this window<br />
Components of the type QLineEdit.</p>
<p dir="auto">Question<br />
How can I give all components for type QLineEdit the same background color<br />
and assign the same font color?</p>
]]></description><link>https://forum.qt.io/topic/119983/assign-the-same-font-color-and-the-same-background-color-to-all-qlineedit-components-how-does-that-work</link><generator>RSS for Node</generator><lastBuildDate>Thu, 20 Aug 2026 00:56:22 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/119983.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 15 Oct 2020 18:48:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Assign the same font color and the same background color to all QLineEdit components - how does that work? on Fri, 16 Oct 2020 18:05:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/pythonqtmarlem">@<bdi>PythonQTMarlem</bdi></a> said in <a href="/post/622547">Assign the same font color and the same background color to all QLineEdit components - how does that work?</a>:</p>
<blockquote>
<p dir="auto">class QAcccessibilityEdit(QLineEdit):<br />
def focusInEvent(self, QFocusEvent):<br />
self.setStyleSheet("background-color: " + GlobaleEinstellungen.aktbedienelementhintergrundfarbe)</p>
<p dir="auto">...<br />
self.editsuchen = QAcccessibilityEdit(self)<br />
self.editersetzen = QAcccessibilityEdit(self)</p>
</blockquote>
<p dir="auto">You already have a custom class, so now just use it in your code.</p>
<p dir="auto">One note, do note use name starting with Q, it will only confuse people working on that code thinking it's an official Qt class until they find your custom declaration.</p>
]]></description><link>https://forum.qt.io/post/622646</link><guid isPermaLink="true">https://forum.qt.io/post/622646</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 16 Oct 2020 18:05:05 GMT</pubDate></item><item><title><![CDATA[Reply to Assign the same font color and the same background color to all QLineEdit components - how does that work? on Fri, 16 Oct 2020 11:40:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> said in <a href="/post/622553">Assign the same font color and the same background color to all QLineEdit components - how does that work?</a>:</p>
<blockquote>
<p dir="auto">findChildren</p>
</blockquote>
<p dir="auto">thank you, that's what I want.</p>
<p dir="auto">The two solutions of  <a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> I don't understand or I have no idea how to realize it.<br />
perhaps he can make a codeexample.</p>
]]></description><link>https://forum.qt.io/post/622576</link><guid isPermaLink="true">https://forum.qt.io/post/622576</guid><dc:creator><![CDATA[PythonQTMarlem]]></dc:creator><pubDate>Fri, 16 Oct 2020 11:40:24 GMT</pubDate></item><item><title><![CDATA[Reply to Assign the same font color and the same background color to all QLineEdit components - how does that work? on Fri, 16 Oct 2020 08:22:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/pythonqtmarlem">@<bdi>PythonQTMarlem</bdi></a> said in <a href="/post/622487">Assign the same font color and the same background color to all QLineEdit components - how does that work?</a>:</p>
<blockquote>
<p dir="auto">thank you. but my problem is, how get I a list of all Components of the type QLineEdit.</p>
</blockquote>
<p dir="auto">To answer this directly, if I understand you correctly: <code>win.findChildren(QLineEdit)</code> will return a list of all <code>QLineEdit</code>s in your <code>MainWindow</code>, if that's what you want.  However, either of the two solutions suggested by <a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> would be better than writing code to go through each <code>QLineEdit</code> doing something.</p>
]]></description><link>https://forum.qt.io/post/622553</link><guid isPermaLink="true">https://forum.qt.io/post/622553</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Fri, 16 Oct 2020 08:22:36 GMT</pubDate></item><item><title><![CDATA[Reply to Assign the same font color and the same background color to all QLineEdit components - how does that work? on Fri, 16 Oct 2020 07:54:51 GMT]]></title><description><![CDATA[<p dir="auto">sorry, then i don't understand what do you want to know.<br />
i have a new class:</p>
<pre><code>class QAcccessibilityEdit(QLineEdit):
    def focusInEvent(self, QFocusEvent):
        self.setStyleSheet("background-color: " + GlobaleEinstellungen.aktbedienelementhintergrundfarbe)
</code></pre>
<p dir="auto">...</p>
<pre><code>self.editsuchen = QAcccessibilityEdit(self)
self.editersetzen = QAcccessibilityEdit(self)
</code></pre>
<p dir="auto">I hope that is the correct answer for your question</p>
]]></description><link>https://forum.qt.io/post/622547</link><guid isPermaLink="true">https://forum.qt.io/post/622547</guid><dc:creator><![CDATA[PythonQTMarlem]]></dc:creator><pubDate>Fri, 16 Oct 2020 07:54:51 GMT</pubDate></item><item><title><![CDATA[Reply to Assign the same font color and the same background color to all QLineEdit components - how does that work? on Thu, 15 Oct 2020 20:53:07 GMT]]></title><description><![CDATA[<p dir="auto">There's not a single QLineEdit in your GUI and you did not answer my questions.</p>
]]></description><link>https://forum.qt.io/post/622501</link><guid isPermaLink="true">https://forum.qt.io/post/622501</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 15 Oct 2020 20:53:07 GMT</pubDate></item><item><title><![CDATA[Reply to Assign the same font color and the same background color to all QLineEdit components - how does that work? on Thu, 15 Oct 2020 19:12:09 GMT]]></title><description><![CDATA[<p dir="auto">so:</p>
<pre><code>class MainWindow(QMainWindow):
    def __init__(self):
        # Konstruktor von QMainWindow aufrufen
        super().__init__()

        self.setWindowTitle("Marlems barrierefreier PQT-Texteditor")
        self.setMinimumSize(QSize(900, 370))
        self.setWindowIcon(QIcon("PQT-Texteditor.png"))
        self.showNormal()
        self.statusBar().showMessage("Willkommen bei Marlems barrierefreier PQT-Texteditor")

---

def main():
    app = QtWidgets.QApplication([])
    win = MainWindow()
</code></pre>
<p dir="auto">Code in PyCharm.</p>
]]></description><link>https://forum.qt.io/post/622491</link><guid isPermaLink="true">https://forum.qt.io/post/622491</guid><dc:creator><![CDATA[PythonQTMarlem]]></dc:creator><pubDate>Thu, 15 Oct 2020 19:12:09 GMT</pubDate></item><item><title><![CDATA[Reply to Assign the same font color and the same background color to all QLineEdit components - how does that work? on Thu, 15 Oct 2020 18:55:58 GMT]]></title><description><![CDATA[<p dir="auto">How are you building your GUI ?<br />
Which technique are you going to use ?</p>
]]></description><link>https://forum.qt.io/post/622488</link><guid isPermaLink="true">https://forum.qt.io/post/622488</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 15 Oct 2020 18:55:58 GMT</pubDate></item><item><title><![CDATA[Reply to Assign the same font color and the same background color to all QLineEdit components - how does that work? on Thu, 15 Oct 2020 18:55:06 GMT]]></title><description><![CDATA[<p dir="auto">thank you. but my problem is, how get I a list of all Components of the type QLineEdit.</p>
]]></description><link>https://forum.qt.io/post/622487</link><guid isPermaLink="true">https://forum.qt.io/post/622487</guid><dc:creator><![CDATA[PythonQTMarlem]]></dc:creator><pubDate>Thu, 15 Oct 2020 18:55:06 GMT</pubDate></item><item><title><![CDATA[Reply to Assign the same font color and the same background color to all QLineEdit components - how does that work? on Thu, 15 Oct 2020 18:50:52 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">One way is to use a stylesheet.<br />
The other is to create a derived class that provides the visual you want and use that one in place of the original QLineEdit.</p>
]]></description><link>https://forum.qt.io/post/622484</link><guid isPermaLink="true">https://forum.qt.io/post/622484</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 15 Oct 2020 18:50:52 GMT</pubDate></item></channel></rss>