Is there something like a "cursorForPosition" for QLineEdits?
-
Hi everyone!
Is there something like a "cursorForPosition" for QLineEdits?
I want to implement a QLineEdit with functionality to detect where a mouse click occurred and respond accordingly. Do I need to use QTextEdits for this and make them look like QLineEdits?
Thanks a lot!
-
Hi everyone!
Is there something like a "cursorForPosition" for QLineEdits?
I want to implement a QLineEdit with functionality to detect where a mouse click occurred and respond accordingly. Do I need to use QTextEdits for this and make them look like QLineEdits?
Thanks a lot!
-
Thanks a lot for replying! How do I detect which word was clicked on, though? Or place the text cursor at the position
You cant (out of the box). When you use mousePressEvents, you know where the click happened. The rest is on you what to do with this information.
By default the cursor is going where you click, right?!
LineEdit is a pretty simple input field. If you need further functionality to work with larger texts, you should have a look atQTextEdit
orQPlainTextEdit
. -
Thanks a lot for replying! How do I detect which word was clicked on, though? Or place the text cursor at the position
-
@eyllanesc Thank you so much! I must be going blind. Thanks!
-
@eyllanesc Thank you so much! I must be going blind. Thanks!