GradientPreviewWidget.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #if !defined(Q_MOC_RUN)
  10. #include <QWidget>
  11. #include <GradientSignal/Editor/EditorGradientPreviewRenderer.h>
  12. #endif
  13. class QToolButton;
  14. namespace GradientSignal
  15. {
  16. class GradientPreviewWidget
  17. : public QWidget
  18. , public EditorGradientPreviewRenderer
  19. {
  20. Q_OBJECT
  21. public:
  22. GradientPreviewWidget(QWidget* parent = nullptr, bool enablePopout = false);
  23. ~GradientPreviewWidget() override;
  24. Q_SIGNALS:
  25. void popoutClicked();
  26. protected:
  27. void enterEvent(QEvent* event) override;
  28. void leaveEvent(QEvent* event) override;
  29. void paintEvent(QPaintEvent* paintEvent) override;
  30. void resizeEvent(QResizeEvent* resizeEvent) override;
  31. void OnUpdate() override;
  32. QSize GetPreviewSize() const override;
  33. private:
  34. QToolButton* m_popoutButton = nullptr;
  35. };
  36. } //namespace GradientSignal