Issue
I was given a codebase in which the labels updates overtime but when it updates, it simply covers on top of the old label.
In general is this a good practice?
def drawAllListeners(self):
row = 1
col = 0
labels = ["Del", "Status", "Name", "Display handler", "Minimum report interval"]
colspans = [1, 1, 1, 1, 2]
for (span, label) in zip(colspans, labels):
label_text = QtGui.QLabel("<b>" + label + "</b>")
label_text.setTextFormat(QtCore.Qt.RichText)
self.main_grid.addWidget(label_text, row, col, 1, span)
col += span
for k, l in self.target_state.getListenersDict().iteritems():
self.drawOneListener(k)
Thanks.
Solution
No this is not a good idea because the number of children widgets increases and increases which will eventually lead to memory problems. Changing the text of the old label widgets is the way to go?
Answered By - Trilarion
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.