Reputation: 742
This does not work:
def lineError(self):
block= self.firstVisibleBlock()
while block.isValid():
if block.blockNumber() in self.lineError:
block.blockFormat().setBackground(QBrush(self.errorColor))
block.charFormat().setBackground(QBrush(self.errorColor))
block= block.next()
Have you any idea?
Upvotes: 1
Views: 1710
Reputation: 742
The right way:
fmt= QTextBlockFormat()
fmt.setBackground(self.errorColor)
while block.isValid():
if block.blockNumber() in self.lineError:
QTextCursor(block).setBlockFormat(fmt)
block= block.next()
Upvotes: 1