Unsolved QLabel not being updated in a QTextEdit
-
The following function is supposed to print multiple lines (cursors) with different colors and to change the height of them depending on the size of the characters
void TextEditor::paintCursors() { QTextCursor cursor(document()); for (const std::pair<int, std::pair<int, QLabel*>> &c : cursorMap) { int position = qMin(c.second.first, document()->characterCount()-1); cursor.setPosition(position); QRect cRect = cursorRect(cursor); int width = cRect.width() + 1; int height = cRect.height(); qDebug() << "height" << height; QPixmap pixmap(width, height); pixmap.fill(getUserColor(c.first)); c.second.second->move(cRect.left(), cRect.top()); c.second.second->setPixmap(pixmap); c.second.second->show(); } }
The result is that the label mantains the initial height that will be not changed when altering the font size like in the following gif
I've tried to update() the QTextEdit and the label without any improvements