Collection of tools useful for audio production
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.3KB

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Clickable Label, a custom Qt4 widget
  4. # Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com>
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # For a full copy of the GNU General Public License see the COPYING file
  17. # Imports (Global)
  18. from PyQt4.QtCore import pyqtSlot, Qt, QTimer, SIGNAL, SLOT
  19. from PyQt4.QtGui import QLabel
  20. # Widget Class
  21. class ClickableLabel(QLabel):
  22. def __init__(self, parent):
  23. QLabel.__init__(self, parent)
  24. self.setCursor(Qt.PointingHandCursor)
  25. def mousePressEvent(self, event):
  26. self.emit(SIGNAL("clicked()"))
  27. # Use busy cursor for 2 secs
  28. self.setCursor(Qt.WaitCursor)
  29. QTimer.singleShot(2000, self, SLOT("slot_setNormalCursor()"))
  30. QLabel.mousePressEvent(self, event)
  31. @pyqtSlot()
  32. def slot_setNormalCursor(self):
  33. self.setCursor(Qt.PointingHandCursor)