How to prohibit user from changing the cursor position in QLineEdit in touch based user interface



  • Dear All,

    I have made the blinking cursor invisible in QLineEdit by using QProxyStyle [by setting the width=0]
    Now i don't want the user to change the cursor location by touching the QLineEdit widget.

    Since the cursor is already invisible to user but some how if user touch the QLineEdit widget at some empty space then the cursor location gets changed and characters get inserted at wrong place. Is there any easy way to prohibit the user from changing the cursor location?

    Kindly provide me some hints to achieve the same.

    Thanks


  • Lifetime Qt Champion

    Hi,

    What do you want to do with that line edit ?



  • Dear @SGaist, Thanks for the reply. Actually i do not want user to change the cursor position. I got one work around. I have connected the cursor position changed signal to one slot which automatically sets the cursor position to the end. The slot first calculate the text length and then moves the cursor to the last position. So in this case even if user tries to change the cursor location, cursor automatically comes at the end and whatever the user types is appended to the end.

    Regards
    Sid


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.