In Qt, a created lineEdit shows a text using the setText() method.
-
But the cursor is movable for the default text. I want the cursor should not be movable for the default text.
-
My
lineEdittype has been set as password. Hence the default text(‘Password’) is also displayed as ‘********’. Whenever user types the type has to be changed as password and when there is no text or until the user have not typed any text, thelineEditshould display the plain text ‘password’
Any idea to fix the above two issues?

I managed to do what you want by deriving a class from
QLineEditas per following..Constructor..
Override
keyPressEvent..Cursor position change event..
Text change event..
I have written it very hastily to just show you. Test it yourself and feel free to point any mistake(s) or optimization(s). Hope this helps.