TextOverflowWidget.h 1.1 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 <QDialog>
  11. #include <QLabel>
  12. #endif
  13. QT_FORWARD_DECLARE_CLASS(QWidget)
  14. namespace O3DE::ProjectManager
  15. {
  16. class TextOverflowDialog
  17. : public QDialog
  18. {
  19. public:
  20. explicit TextOverflowDialog(const QString& title = {}, const QString& text = {}, QWidget* parent = nullptr);
  21. ~TextOverflowDialog() = default;
  22. };
  23. class TextOverflowLabel
  24. : public QLabel
  25. {
  26. public:
  27. static QString ElideLinkedText(const QString& text, int maxLength);
  28. explicit TextOverflowLabel(const QString& title = {}, const QString& text = {}, QWidget* parent = nullptr);
  29. ~TextOverflowLabel() = default;
  30. private slots:
  31. void OnLinkActivated(const QString& link);
  32. QString m_title;
  33. QString m_fullText;
  34. };
  35. } // namespace O3DE::ProjectManager