Compare commits

..

No commits in common. "56fdcd9114ad09631b752d18e227b63c9bdcfb94" and "aa44fcc7f64bd3bc212d4e51c9236b44899cfa4b" have entirely different histories.

View file

@ -1,6 +1,6 @@
import sys import sys
from PySide6.QtCore import Qt, QSize from PySide6.QtCore import QSize
from PySide6.QtWidgets import ( from PySide6.QtWidgets import (
QApplication, QApplication,
QLabel, QLabel,
@ -20,7 +20,6 @@ class leekMainWindow(QMainWindow):
self.setWindowTitle("Leek!") self.setWindowTitle("Leek!")
self.label = QLabel() self.label = QLabel()
self.mouse_label = QLabel()
self.input = QLineEdit() self.input = QLineEdit()
self.input.textChanged.connect(self.label.setText) self.input.textChanged.connect(self.label.setText)
@ -33,7 +32,6 @@ class leekMainWindow(QMainWindow):
layout = QVBoxLayout() layout = QVBoxLayout()
layout.addWidget(self.input) layout.addWidget(self.input)
layout.addWidget(self.label) layout.addWidget(self.label)
layout.addWidget(self.mouse_label)
layout.addWidget(button) layout.addWidget(button)
self.setMaximumSize(QSize(800,600)) self.setMaximumSize(QSize(800,600))
@ -51,44 +49,12 @@ class leekMainWindow(QMainWindow):
def button_toggled(self, checked): def button_toggled(self, checked):
print("Checked?", checked ) print("Checked?", checked )
def mouseMoveEvent(self, e):
self.mouse_label.setText("mouseMoveEvent")
def mousePressEvent(self, e):
button = ""
if e.button() == Qt.MouseButton.LeftButton:
button = "left"
elif e.button() == Qt.MouseButton.MiddleButton:
button = "middle"
elif e.button() == Qt.MouseButton.RightButton:
button = "right"
self.mouse_label.setText("mousePressEvent " + button)
def mouseReleaseEvent(self, e):
button = ""
if e.button() == Qt.MouseButton.LeftButton:
button = "left"
elif e.button() == Qt.MouseButton.MiddleButton:
button = "middle"
elif e.button() == Qt.MouseButton.RightButton:
button = "right"
self.mouse_label.setText("mouseReleaseEvent " + button)
def mouseDoubleClickEvent(self, e):
button = ""
if e.button() == Qt.MouseButton.LeftButton:
button = "left"
elif e.button() == Qt.MouseButton.MiddleButton:
button = "middle"
elif e.button() == Qt.MouseButton.RightButton:
button = "right"
self.mouse_label.setText("mouseDoubleClickEvent " + button)
def main(): def main():
# If you know you won't use command line arguments QApplication([]) works too. # If you know you won't use command line arguments QApplication([]) works too.
app = QApplication(sys.argv) app = QApplication(sys.argv)
# Create a Qt widget, which will be our window. # Create a Qt widget, which will be our window.
window = leekMainWindow() window = leekMainWindow()
window.show() # IMPORTANT!!!!! Windows are hidden by default. window.show() # IMPORTANT!!!!! Windows are hidden by default.