<?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[QDialog border inherited by child QCheckBox]]></title><description><![CDATA[<p dir="auto">I create a custom QDialog and specify a border in the stylesheet. The dialog has a QCheckBox that I have increased in size. The dialog border style also gets applied to the QCheckBox .. how can I stop the border being applied to the checkbox?</p>
<pre><code>import sys
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *

class MyDialog(QDialog):

    def __init__(self, parent=None):
        super(MyDialog, self).__init__(parent)
        self.setFixedSize(400, 400)
        self.setStyleSheet("background-color:#4C535D;border-style:solid;border-color: #E1D8FF;border-width:2px;border-radius:6px")
        self.myCheckBox = QCheckBox()
        self.myCheckBox.setStyleSheet("QCheckBox::indicator { width: 30px; height: 30px }")
        layout = QHBoxLayout()
        layout.addWidget(self.myCheckBox)
        self.setLayout(layout)

def window():
    app = QApplication(sys.argv)
    w = QWidget()
    btn = QPushButton(w)
    btn.setText("Choose Me")
    btn.move(100,50)
    btn.clicked.connect(showdialog)
    w.setWindowTitle("PyQt Dialog demo")
    w.show()
    sys.exit(app.exec_())

def showdialog():
    dlg = MyDialog()
    dlg.setWindowTitle("Dialog")
    dlg.setWindowModality(Qt.ApplicationModal)
    dlg.exec_()


if __name__ == '__main__':
    window()

</code></pre>
]]></description><link>https://forum.qt.io/topic/149799/qdialog-border-inherited-by-child-qcheckbox</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 17:38:09 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/149799.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 20 Sep 2023 15:11:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QDialog border inherited by child QCheckBox on Wed, 20 Sep 2023 15:35:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/captain-haddock">@<bdi>Captain-Haddock</bdi></a></p>
<pre><code>self.setStyleSheet("MyDialog { background-color:#4C535D; ... }")
</code></pre>
<p dir="auto">I believe should prevent that inheritance?</p>
]]></description><link>https://forum.qt.io/post/773291</link><guid isPermaLink="true">https://forum.qt.io/post/773291</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Wed, 20 Sep 2023 15:35:58 GMT</pubDate></item></channel></rss>