How to tell if a user is _currently_ mouse-selecting text in QPlainTextEdit?
Unsolved
General and Desktop
-
I can get the cursor and check hasSelection(), but this only tells me if there is text selected. Not whether the user is currently in the process of selecting something. I would like something that evaluates to
currentlySelecting
:hasSelection = false currentlySelecting = false // user holds mouse button hasSelection = false currentlySelecting = false // user drags mouse to select text hasSelection = true currentlySelecting = true // user releases mouse hasSelection = true currentlySelecting = false
I tried hooking into mousePressEvent/mouseReleaseEvent for the QPlainTextEdit, but mouseReleaseEvent doesn't get fired when another app takes focus and then the mouse is released, leaving me in a bad state. Is there a more reliable way to check whether the user is currently mouse-selecting text in a QPlainTextEdit?
-
@Drew-W Maybe https://doc.qt.io/qt-5/qwidget.html#leaveEvent could help in the case other app gets focus?