Skip to main content

A expand about pyside6

Project description

English

PySide6-Expand Usage Guide

0. Installation

Install PySide6-Expand using pip:

pip install pyside6-expand

Then import the required module in your code:

from pyside6_expand.expand_signal import mouse_signal

1. Extension - Mouse Signals

Apply the @mouse_signal decorator to classes that inherit from QWidget to dynamically bind mouse event signals at runtime.

Supported Signals

  • left_clicked: Left button click
  • left_double_clicked: Left button double click
  • left_long_press: Left button long press
  • right_clicked: Right button click
  • right_double_clicked: Right button double click
  • right_long_press: Right button long press

These signals operate independently and do not interfere with each other.

Notes

  • The @mouse_signal decorator overrides the methods mouseDoubleClickEvent, mousePressEvent, and mouseReleaseEvent.
  • When handling mouse press events, mousePressEvent is called first, followed by the corresponding signal.
  • When handling mouse release events, mouseReleaseEvent is called first, followed by the logic of the respective signal.
  • Do not override mouseDoubleClickEvent again, otherwise the left_double_clicked and right_double_clicked signals will fail to work.

Example Code

from pyside6_expand.expand_signal import mouse_signal
from PySide6.QtWidgets import QWidget, QApplication

@mouse_signal
class CustomWidget(QWidget):
    def __init__(self):
        super().__init__()

if __name__ == '__main__':
    app = QApplication([])
    widget = CustomWidget()
    
    # Connect signals to slots
    widget.left_clicked.connect(lambda: print("Left button clicked"))
    widget.left_double_clicked.connect(lambda: print("Left button double clicked"))
    widget.left_long_press.connect(lambda: print("Left button long pressed"))
    widget.right_clicked.connect(lambda: print("Right button clicked"))
    widget.right_double_clicked.connect(lambda: print("Right button double clicked"))
    widget.right_long_press.connect(lambda: print("Right button long pressed"))

    widget.show()
    app.exec()

Additional Features

This project is actively developing new features, so stay tuned for updates.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyside6_expand-1.0.2.tar.gz (3.0 kB view details)

Uploaded Source

File details

Details for the file pyside6_expand-1.0.2.tar.gz.

File metadata

  • Download URL: pyside6_expand-1.0.2.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for pyside6_expand-1.0.2.tar.gz
Algorithm Hash digest
SHA256 ddebdc7c73e1ecbf731cdf32b309e3f86c67a20043d4ff82ce139322526b4341
MD5 30e24b3a9ab18c50ca2814e8a4d0bc6e
BLAKE2b-256 66121005c5e763d1c966009fa7be49c4cb6763bc8ea9629e9a12131e72193b9c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page