Note that there are some explanatory texts on larger screens.

plurals
  1. POPyQt4 object does not display
    text
    copied!<p>I'm developing a tool in PyQt4 which edits config files. It changes the GUI every time a file is loaded. The editor GUI is a QTabWidget containing as many tabs as the number of chapters in the loaded file. On each tab, it has QGroupBoxes corresponding to the subsections in the loaded file and finally the groups hold QLineEdits which correspond to the actual config parameters and values. </p> <p>All this is built up from a large dictionary and works fine up to a point:</p> <ul> <li>all tabs are displayed correctly</li> <li>all groups are displayed correctly in all tabs</li> <li><strong>BUT</strong> LineEdits are displayed only in the first group of the first tab</li> </ul> <p>LineEdit objects are created for the other groups as well, I printed them and they all point to a different memory location - still they are not displayed.</p> <p>Here is the corresponding part of the code:</p> <pre><code>while self.tabWidget.widget(0): self.tabWidget.removeTab(0) for i in data['tabList']: self.log("Adding tab: '%s'" % i, DEBUG) self.data['tabDict'][i]['scrollarea'] = QScrollArea() self.data['tabDict'][i]['vbox'] = QVBoxLayout() for j in self.data['tabDict'][i]['groupList']: self.log("Adding group: '%s'" % j, DEBUG) self.data['tabDict'][i]['groupDict'][j]['groupbox'] = QGroupBox(j) self.data['tabDict'][i]['groupDict'][j]['formlo'] = QFormLayout() print self.data['tabDict'][i]['groupDict'][j]['formlo'] for k in self.data['tabDict'][i]['groupDict'][j]['fields']: self.log("Adding field: '%s'" % k['name']) k['lineedit'] = QLineEdit(k['value']) k['lineedit'].setToolTip('&lt;b&gt;Type:&lt;/b&gt; %s&lt;br&gt;&lt;b&gt;TSDB path:&lt;/b&gt; %s&lt;br&gt;&lt;b&gt;Line:&lt;/b&gt; %d&lt;br&gt;&lt;b&gt;Comment:&lt;/b&gt; %s' % (k['type'],k['path'],k['row'], k['comment'])) self.data['tabDict'][i]['groupDict'][j]['formlo'].addRow(k['name'], k['lineedit']) self.data['tabDict'][i]['groupDict'][j]['groupbox'].setLayout(self.data['tabDict'][i]['groupDict'][j]['formlo']) self.data['tabDict'][i]['vbox'].addWidget(self.data['tabDict'][i]['groupDict'][j]['groupbox']) self.data['tabDict'][i]['scrollarea'].setLayout(self.data['tabDict'][i]['vbox']) self.tabWidget.addTab(self.data['tabDict'][i]['scrollarea'], i) </code></pre> <p>What am I missing here? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload