LinkWidget.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 <QLabel>
  11. #include <QUrl>
  12. #endif
  13. QT_FORWARD_DECLARE_CLASS(QEvent)
  14. QT_FORWARD_DECLARE_CLASS(QMouseEvent)
  15. QT_FORWARD_DECLARE_CLASS(QWidget)
  16. namespace O3DE::ProjectManager
  17. {
  18. class LinkLabel
  19. : public QLabel
  20. {
  21. Q_OBJECT // AUTOMOC
  22. public:
  23. LinkLabel(const QString& text = {}, const QUrl& url = {}, int fontSize = 10, QWidget* parent = nullptr);
  24. void SetUrl(const QUrl& url);
  25. signals:
  26. void clicked();
  27. private:
  28. void mousePressEvent(QMouseEvent* event) override;
  29. void enterEvent(QEvent* event) override;
  30. void leaveEvent(QEvent* event) override;
  31. void SetDefaultStyle();
  32. private:
  33. QUrl m_url;
  34. int m_fontSize;
  35. };
  36. } // namespace O3DE::ProjectManager