Keep cursor shape when clicked when it moves outside of its MouseArea

I use narrow resizing handles that annoy behavior. The shape of the cursor, as expected, when the mouse is directly above the handle, but as soon as the handle is dragged, the shape of the cursor becomes inconsistent. These are two reasons:

  • when the cursor moves quickly and goes in front of the handle until the handle “catches up” (or when the “qml liquid” is too liquid) - this is especially unpleasant, as the shape of the cursor changes rapidly and blinks

  • when the cursor moves beyond the permissible degree of freedom for the handle

I looked through the document, but it does not seem to contain anything about locking the cursor until it releases the press.

I managed to find a hack to fix it - using a dummy overlay MouseAreawith acceptedButtons: Qt.NoButton- it really helps to fake cursor consistency, but has its own problem. The presence of a mouse overlap area does not allow the cursor to resize the shape when it is above the handle, since the handle is below the mouse area with the caption, it does not modify the shape of the cursor at all. Thus, the form of resizing works only after pressing the handle, which is far from ideal. Setting the mouse overlay area on enabled: falsewill not change it - it still retains the lock on changes to the cursor shape from the base areas of the mouse. There is a workaround for this, for example, setting the size of the mouse overlay area to 0x0, but this is kind of ugly.

, , , , . , , , . - , , , , , .

, MouseArea - , , .

+4

Source: https://habr.com/ru/post/1656118/


All Articles