You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to customize my title bar, so I rewrite mousePressEvent and mouseMouseEvent function, it works fine, but after app.setStyleSheet(qdarkstyle.load_sytlesheet_pyqt5(), it will move when the app ui get focus.(I don't find a good software to get the process of this program, but I will give the MWE behind)
Code
#!/usr/bin/env python3importsysfromPyQt5.QtCoreimportQPointimportqdarkstylefromPyQt5.QtWidgetsimportQApplication, QMainWindowclassMyWindow(QMainWindow):
def__init__(self):
super(MyWindow, self).__init__()
self.resize(500, 600)
defmousePressEvent(self, event):
self.oldPos=event.globalPos()
returnsuper().mousePressEvent(event)
defmouseMoveEvent(self, event):
ifnothasattr(self, 'oldPos'):
self.oldPos=event.globalPos()
else:
delta=QPoint(event.globalPos() -self.oldPos)
self.move(self.x() +delta.x(), self.y() +delta.y())
self.oldPos=event.globalPos()
returnsuper().mouseMoveEvent(event)
if__name__=='__main__':
app=QApplication(sys.argv)
# comment it or not to set the differenceapp.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
mywindow=MyWindow()
mywindow.show()
sys.exit(app.exec_())
The text was updated successfully, but these errors were encountered:
I used this Stylesheet in my C++ QCreator Application. Everythink works fine except the MousemoveEvent. If I use this stylesheet enabled, the mousemove event is called all the time, if it is not enabled i have to press the mousebutton in the window to get an mouse event - as i want. The bigger problem of this is, that this leads to a high cpu usage - one core is all the time at 100% usage.
Describe your Environment
QApplications
I want to customize my title bar, so I rewrite
mousePressEvent
andmouseMouseEvent
function, it works fine, but afterapp.setStyleSheet(qdarkstyle.load_sytlesheet_pyqt5()
, it will move when the app ui get focus.(I don't find a good software to get the process of this program, but I will give the MWE behind)Code
The text was updated successfully, but these errors were encountered: