I agree. It would be better to subclass QLineEdit and reimplement paintEvent() but also more difficult. If you do so, take a look at the source code of qlineedit.cpp. At the end of paintEvent() you have:
if (d->cursorVisible && !d->readOnly && !d->hideCursor)
d
->textLayout.
drawCursor(&p, topLeft, cursor, style
()->pixelMetric
(QStyle::PM_TextCursorWidth));
if (d->cursorVisible && !d->readOnly && !d->hideCursor)
d->textLayout.drawCursor(&p, topLeft, cursor, style()->pixelMetric(QStyle::PM_TextCursorWidth));
To copy to clipboard, switch view to plain text mode
You would remove d->cursorVisible from the if(). Keep in mind you can't access the private object so you may either find another way to get that information or copy its implementation an rename it.
Bookmarks