- Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbase.py
More file actions
Latest commit
23 lines (19 loc) · 954 Bytes
/
Copy pathbase.py
File metadata and controls
23 lines (19 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# _*_ coding:utf-8 _*_
fromPyQt5.QtCoreimportQt
fromPyQt5.QtWidgetsimportQWidget, QApplication
classBase(QWidget):
def__init__(self):
super(Base, self).__init__()
self.mMoveing=True
self.mMovePosition=self.pos()
self.setWindowFlags(Qt.FramelessWindowHint|Qt.WindowStaysOnTopHint)
defmousePressEvent(self, QMouseEvent):
self.mMoveing=True
self.mMovePosition=QMouseEvent.globalPos() -self.pos()
returnsuper().mousePressEvent(QMouseEvent)
defmouseMoveEvent(self, QMouseEvent):
ifself.mMoveingand (QMouseEvent.buttons() andQt.LeftButton) and (
QMouseEvent.globalPos() -self.mMovePosition).manhattanLength() >QApplication.startDragDistance():
self.move(QMouseEvent.globalPos() -self.mMovePosition)
self.mMovePosition=QMouseEvent.globalPos() -self.pos()
returnsuper().mouseMoveEvent(QMouseEvent)