![]() ![]() You're practically translating the widget position by its own global position: mapToGlobal maps a point in local coordinates to a point in global coordinates based on the global position of the widget. Your main issue is within this line: newLoc = self.mapToGlobal(self.pos()) + diffLoc ![]() Window = QMovableResizableWidget(None, WindowTypes.Window | WindowTypes.FramelessWindowHint) But object doesn't moveĮlif ev.type() = : Self.move(newLoc) # x,y location updated in object. NewLoc = self.mapToGlobal(self.pos()) + diffLoc tCursor(CursorShape.DragMoveCursor)ĭiffLoc = ev.globalPos() - self._moveInitLoc tAttribute(Qt.WidgetAttribute.WA_MouseTracking, True)Įv.type() = Īnd ev.button() = Qt.MouseButton.LeftButton # type: (QWidget| None, WindowTypes) -> NoneĬlass QMovableResizableWidget(QCustomWidget): # type: (QWidget | None, WindowTypes) -> None Is there something I'm missing?īelow is a bare bones implementation of QMovableResizableWidget and snippets of it's ancestor classes: import sysįrom PySide6 import QtWidgets, QtCore, QtGui I've searched extensively for this problem but can't find any pointers. Īlso, on calling move, the WA_Moved widget attribute is set to True, as expected. However after I move, the (x,y) position of the widget changes to the position I have moved, but not the widget itself (painted on the screen). setGeometry works as intended but the QMovableResizableWidget refuses to move from its original position. I've been trying to get QMovableResizableWidget().move(x,y) to work. QMovableResizableWidget is given no parent widget, on initialization. It sub-classes another class QResizableWidget, which is a subclass of QCustomWidget, a subclass of QWidget. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |