<div dir="ltr"><div><div>Dear Guys,<br><br></div>Recently i was learning how to combine the python code and the generated code from Qt Designer.<br><br></div>From the following page, my friend Jimmy Kuu points out there are errors inside the demo code, more specificly(see the red fonts below):<br>
<br><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/designer.html">http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/designer.html</a><br><h2>Using the Generated Code</h2>=================<br>
<p>The third example shows the multiple inheritance approach:</p>
<div class=""><div class=""><pre><span class="">from</span> <span class="">PyQt4.QtGui</span> <span class="">import</span> <span class="">QDialog</span>
<span class="">from</span> <span class="">ui_imagedialog</span> <span class="">import</span> <span class="">Ui_ImageDialog</span>
<span class="">class</span> <span class="">ImageDialog</span><span class="">(</span><span class="">QDialog</span><span class="">,</span> <span class="">Ui_ImageDialog</span><span class="">):</span>
<span class="">def</span> <span class="">__init__</span><span class="">(</span><span class="">self</span><span class="">):</span>
<span class="">QDialog</span><span class="">.</span><span class="">__init__</span><span class="">(</span><span class="">self</span><span class="">)</span>
<span class=""># Set up the user interface from Designer.</span>
<span class="">self</span><span class="">.</span><span class="">setupUi</span><span class="">(</span><span class="">self</span><span class="">)</span>
<span class=""># Make some local modifications.</span>
<span class="">self</span><span class="">.</span><span class="">colorDepthCombo</span><span class="">.</span><span class="">addItem</span><span class="">(</span><span class="">"2 colors (1 bit per pixel)"</span><span class="">)</span>
<span style="color:rgb(255,0,0)"> <span class=""># Connect up the buttons.</span>
<span class="">self</span><span class="">.</span><span class="">ui</span><span class="">.</span><span class="">okButton</span><span class="">.</span><span class="">clicked</span><span class="">.</span><span class="">connect</span><span class="">(</span><span class="">self</span><span class="">.</span><span class="">accept</span><span class="">)</span>
<span class="">self</span><span class="">.</span><span class="">ui</span><span class="">.</span><span class="">cancelButton</span><span class="">.</span><span class="">clicked</span><span class="">.</span><span class="">connect</span><span class="">(</span><span class="">self</span><span class="">.</span><span class="">reject</span><span class="">)</span>
</span></pre></div><span style="color:rgb(255,0,0)">
</span></div><br>=================<br><div><div><div><br></div><div>After verification, we think: <br><b>self.ui.okButton</b> should be<b> self.okButton</b>, and the same to self.ui.cancelButton.<br><br></div><div>Hope someone fix this issue.<br>
</div><div>Thanks,<br></div></div></div></div>