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