Details
-
Bug
-
Resolution: Cannot Reproduce
-
P2: Important
-
4.4.0
-
None
Description
The selection should cover the whole line in the editor (like in Qt 4.3), but instead it stops at the last character of the line.
Test case main.cpp to reproduce:
//---------------------------------------
#include <QtGui>
class Text: public QTextEdit
{
public:
Text(QWidget* pParent = 0);
void paintEvent(QPaintEvent *event);
};
Text::Text(QWidget* pParent) : QTextEdit(pParent)
{
this->setLineWrapMode(NoWrap);
this->setPlainText("Hello World\nOla' Mundo");
}
void Text::paintEvent(QPaintEvent *event)
{
QTextEdit::ExtraSelection highlight;
QList<QTextEdit::ExtraSelection> extras;
QList<QTextCursor*> errorCursors;
QTextCursor originalCursor = this->textCursor();
QTextCursor cursor = this->textCursor();
// Mark current line
highlight.cursor = this->textCursor();
highlight.format.setProperty(QTextFormat::FullWidthSelection, true);
highlight.format.setBackground(QColor(0,255,0));
extras << highlight;
// Add extra selections
this->setExtraSelections(extras);
QTextEdit::paintEvent(event);
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Text widget;
widget.show();
return app.exec();
}
//---------------------------------------