Hi,
I'm trying to move a frameless widget with the mouse. It works well if the mouse is on a line edit or on the widget itself, but doesn't work well on a button and not at all on a deactivated button. I've attached a screenshot of the widget.
I've reimplemented mousePressEvent() and mouseMoveEvent() in the widget. The first one is for getting the mouse position (otherwise the widget would jump to the mouse position) and the second is for actually moving the widget.
I have to problems with the PushButtons:
On the activeted one I'm getting a mouseMoveEvent but not mousePressEvent. So the widget is still jumping if you grab it at a push button. I've figured out, that I can reimplement the mousePressEvent() method in the QPushButton. But then I would have to compute the position of the widget, add it to the local position and finaly send it to the parent. That's a little bit of work and I don't think it is the best way to do it.
On the deactiveted push buttons I even don't get a mouseMoveEvent. Do I realy have to reimplement the QPushButton::event() method? Shouldn't it be possible to handle these events in the parent object/widget?
Bookmarks