<div class="gmail_quote"><div>Hurray.. it worked.. Many thanks to you nickgeans and pyqt mailing list..<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Try to change the style sheet string:<br>
<br>
from: self.groupBox.setStyleSheet(&quot;background-color: rgb(255, 255,<br>
255); border:1px solid rgb(255, 170, 255);&quot;)<br>
to: self.groupBox.setStyleSheet(&quot;QGroupBox { background-color: rgb(255, 255,<br>
255); border:1px solid rgb(255, 170, 255); }&quot;)<br>
<br>
Thus adding QGroupBox and acolades..<br>
<br>
On Wed, Mar 10, 2010 at 2:51 PM, Jebagnana Das &lt;<a href="mailto:jebagnanadas@gmail.com">jebagnanadas@gmail.com</a>&gt;wrote:<br>
<br>
&gt; Thanks for your quick reply.. Have a look at this minimal example.. In the<br>
&gt; example i&#39;ve applied stylesheet only for groupbox not to any of it&#39;s<br>
&gt; components.. Since i&#39;ve set the parent as groupbox for button,label and<br>
&gt; combo box it also reflects the style sheet properties that is applied for<br>
&gt; group box.. In the combo box after clicking when you hover a menu item it&#39;ll<br>
&gt; not be visible since the focus is also in white color and it doesn&#39;t look<br>
&gt; good (esp. in linux).. In button too all it&#39;s properties are lost including<br>
&gt; click feel(in windows).. How can i prevent this.. Please help me..<br>
&gt;<br>
&gt; from PyQt4 import QtCore, QtGui<br>
&gt;<br>
&gt; class Ui_Dialog(object):<br>
&gt;<br>
&gt;     def setupUi(self, Dialog):<br>
&gt;<br>
&gt;         Dialog.setObjectName(&quot;Dialog&quot;)<br>
&gt;         Dialog.resize(399, 309)<br>
&gt;         Dialog.setWindowTitle(QtGui.QApplication.translate(&quot;Dialog&quot;,<br>
&gt; &quot;Dialog&quot;, None, QtGui.QApplication.UnicodeUTF8))<br>
&gt;<br>
&gt;         self.groupBox = QtGui.QGroupBox(Dialog)<br>
&gt;         self.groupBox.setGeometry(QtCore.QRect(10, 10, 381, 291))<br>
&gt;         self.groupBox.setStyleSheet(&quot;background-color: rgb(255, 255,<br>
&gt; 255);\n&quot;<br>
&gt;                                     &quot;border:1px solid rgb(255, 170, 255);&quot;)<br>
&gt;         self.groupBox.setObjectName(&quot;groupBox&quot;)<br>
&gt;<br>
&gt;         self.pushButton = QtGui.QPushButton(self.groupBox)<br>
&gt;         self.pushButton.setGeometry(QtCore.QRect(110, 130, 92, 28))<br>
&gt;         self.pushButton.setObjectName(&quot;pushButton&quot;)<br>
&gt;         self.pushButton.setText(QtGui.QApplication.translate(&quot;Dialog&quot;,<br>
&gt; &quot;Click Me&quot;, None, QtGui.QApplication.UnicodeUTF8))<br>
&gt;<br>
&gt;         self.label = QtGui.QLabel(self.groupBox)<br>
&gt;         self.label.setGeometry(QtCore.QRect(50, 30, 81, 18))<br>
&gt;         self.label.setObjectName(&quot;label&quot;)<br>
&gt;         self.label.setText(QtGui.QApplication.translate(&quot;Dialog&quot;, &quot;Name :&quot;,<br>
&gt; None, QtGui.QApplication.UnicodeUTF8))<br>
&gt;<br>
&gt;         self.lineEdit = QtGui.QLineEdit(self.groupBox)<br>
&gt;         self.lineEdit.setGeometry(QtCore.QRect(140, 30, 191, 26))<br>
&gt;         self.lineEdit.setObjectName(&quot;lineEdit&quot;)<br>
&gt;<br>
&gt;         self.comboBox = QtGui.QComboBox(self.groupBox)<br>
&gt;         self.comboBox.setGeometry(QtCore.QRect(140, 70, 85, 27))<br>
&gt;         self.comboBox.setObjectName(&quot;comboBox&quot;)<br>
&gt;         self.comboBox.addItem(&quot;&quot;)<br>
&gt;         self.comboBox.addItem(&quot;&quot;)<br>
&gt;         self.comboBox.addItem(&quot;&quot;)<br>
&gt;         self.comboBox.addItem(&quot;&quot;)<br>
&gt;         self.comboBox.addItem(&quot;&quot;)<br>
&gt;         self.comboBox.setItemText(0, QtGui.QApplication.translate(&quot;Dialog&quot;,<br>
&gt; &quot;2&quot;, None, QtGui.QApplication.UnicodeUTF8))<br>
&gt;         self.comboBox.setItemText(1, QtGui.QApplication.translate(&quot;Dialog&quot;,<br>
&gt; &quot;20&quot;, None, QtGui.QApplication.UnicodeUTF8))<br>
&gt;         self.comboBox.setItemText(2, QtGui.QApplication.translate(&quot;Dialog&quot;,<br>
&gt; &quot;12&quot;, None, QtGui.QApplication.UnicodeUTF8))<br>
&gt;         self.comboBox.setItemText(3, QtGui.QApplication.translate(&quot;Dialog&quot;,<br>
&gt; &quot;15&quot;, None, QtGui.QApplication.UnicodeUTF8))<br>
&gt;         self.comboBox.setItemText(4, QtGui.QApplication.translate(&quot;Dialog&quot;,<br>
&gt; &quot;234&quot;, None, QtGui.QApplication.UnicodeUTF8))<br>
&gt;<br>
&gt;<br>
&gt;         self.label_2 = QtGui.QLabel(self.groupBox)<br>
&gt;         self.label_2.setGeometry(QtCore.QRect(50, 70, 81, 18))<br>
&gt;         self.label_2.setObjectName(&quot;label_2&quot;)<br>
&gt;         self.label_2.setText(QtGui.QApplication.translate(&quot;Test Dialog&quot;,<br>
&gt; &quot;Number :&quot;, None, QtGui.QApplication.UnicodeUTF8))<br>
&gt;<br>
&gt;         QtCore.QMetaObject.connectSlotsByName(Dialog)<br>
&gt;<br>
&gt;<br>
&gt; if __name__ == &quot;__main__&quot;:<br>
&gt;     import sys<br>
&gt;     app = QtGui.QApplication(sys.argv)<br>
&gt;     Dialog = QtGui.QDialog()<br>
&gt;     ui = Ui_Dialog()<br>
&gt;     ui.setupUi(Dialog)<br>
&gt;     Dialog.show()<br>
&gt;     sys.exit(app.exec_())<br>
&gt;<br>
&gt; P.S: I&#39;ve used qt designer for quick designing.. Even if i hand code it the<br>
&gt; result will be the same..<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;&gt; You might take a look at so called &quot;Selector types&quot; (<br>
&gt;&gt; <a href="http://qt.nokia.com/doc/4.3/stylesheet-syntax.html#selector-types" target="_blank">http://qt.nokia.com/doc/4.3/stylesheet-syntax.html#selector-types</a>). Given<br>
&gt;&gt; a<br>
&gt;&gt; QDialog and its children (e.g. QPushButtons), this can prevent this<br>
&gt;&gt; cascading behaviour of styles, although I&#39;ve never had any problems with<br>
&gt;&gt; that without using this way of &quot;selecting&quot; matching objects..<br>
&gt;&gt;<br>
&gt;&gt; Can you show a small piece of code (small stylesheet and the way you apply<br>
&gt;&gt; it) please?<br>
&gt;&gt;<br>
&gt;&gt; On Tue, Mar 9, 2010 at 9:05 PM, Jebagnana Das &lt;<a href="mailto:jebagnanadas@gmail.com">jebagnanadas@gmail.com</a><br>
&gt;&gt; &gt;wrote:<br>
&gt;&gt;<br>
&gt;&gt; &gt; Hello all,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; If i apply a property to a parent widget it is automatically applied for<br>
&gt;&gt; &gt; child widgets too.. Is there any way of preventing this??<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; For example if i set background color as white in a dialog then any<br>
&gt;&gt; &gt; button,combo boxes and scroll bars(within the dialog) looks white and it<br>
&gt;&gt; &gt; lacks it&#39;s native look(have to say it&#39;s unpleasant to the eyes(esp. in<br>
&gt;&gt; unix)<br>
&gt;&gt; &gt; &amp; ugly).. Is there any way that i can apply the stylesheets only to a<br>
&gt;&gt; parent<br>
&gt;&gt; &gt; widget not to it&#39;s children? can i exclude specifically some child<br>
&gt;&gt; widgets<br>
&gt;&gt; &gt; from not inheriting parent SS properties??<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt; PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
&gt;&gt; &gt; <a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;<br>
<br>
<br>
--<br>
Nick Gaens<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: &lt;<a href="http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100310/1cace5cc/attachment.html" target="_blank">http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100310/1cace5cc/attachment.html</a>&gt;<br>

<br>
------------------------------<br>
<br>
_______________________________________________<br>
PyQt mailing list<br>
<a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br>
<br>
End of PyQt Digest, Vol 68, Issue 24<br>
************************************<br>
</blockquote></div><br>