I found this bug still exists in Qt 5.6.3 and I came up with a workaround. Here it is, in case anyone needs it:
//--------------------------------------------------------
void QActivatableLineEdit
::mousePressEvent(QMouseEvent* e
) {
if (isReadOnly() == false)
{
return;
}
// Qt5 bug! The cursor is not shown!
int cp = cursorPositionAt(e->pos());
setCursorPosition(cp);
}
//--------------------------------------------------------
void QActivatableLineEdit::mousePressEvent(QMouseEvent* e)
{
if (isReadOnly() == false)
{
QLineEdit::mousePressEvent(e);
return;
}
QLineEdit::setReadOnly(false);
QLineEdit::mousePressEvent(e);
// Qt5 bug! The cursor is not shown!
int cp = cursorPositionAt(e->pos());
QApplication::postEvent(this, new QKeyEvent(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier));
QApplication::postEvent(this, new QKeyEvent(QEvent::KeyRelease, Qt::Key_Right, Qt::NoModifier));
QApplication::processEvents();
setCursorPosition(cp);
}
To copy to clipboard, switch view to plain text mode
Bookmarks