Audio plugin host https://kx.studio/carla
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.

48 lines
1.5KB

  1. #!/usr/bin/env python3
  2. # SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com>
  3. # SPDX-License-Identifier: GPL-2.0-or-later
  4. # ------------------------------------------------------------------------------------------------------------
  5. # Imports (Global)
  6. from qt_compat import qt_config
  7. if qt_config == 5:
  8. from PyQt5.QtGui import QColor
  9. from PyQt5.QtWidgets import QGraphicsDropShadowEffect
  10. elif qt_config == 6:
  11. from PyQt6.QtGui import QColor
  12. from PyQt6.QtWidgets import QGraphicsDropShadowEffect
  13. # ------------------------------------------------------------------------------------------------------------
  14. # Imports (Custom)
  15. from . import canvas
  16. # ------------------------------------------------------------------------------------------------------------
  17. class CanvasBoxShadow(QGraphicsDropShadowEffect):
  18. def __init__(self, parent):
  19. QGraphicsDropShadowEffect.__init__(self, parent)
  20. self.m_fakeParent = None
  21. self.setBlurRadius(20)
  22. self.setColor(canvas.theme.box_shadow)
  23. self.setOffset(0, 0)
  24. def setFakeParent(self, fakeParent):
  25. self.m_fakeParent = fakeParent
  26. def setOpacity(self, opacity):
  27. color = QColor(canvas.theme.box_shadow)
  28. color.setAlphaF(opacity)
  29. self.setColor(color)
  30. def draw(self, painter):
  31. if self.m_fakeParent:
  32. self.m_fakeParent.repaintLines()
  33. QGraphicsDropShadowEffect.draw(self, painter)
  34. # ------------------------------------------------------------------------------------------------------------