9b14d49f87
* Adds the gem repo screen with the UI built but with mocked data and not connected to the o3de scripts Signed-off-by: nggieber <nggieber@amazon.com> * Changed name of added to enabled, disabled define, removed unused functions Signed-off-by: nggieber <nggieber@amazon.com> * Added Repo Screen Inspector UI Signed-off-by: nggieber <nggieber@amazon.com> * Addressed minor PR feedback Signed-off-by: nggieber <nggieber@amazon.com> * Add some more minor PR changes Signed-off-by: nggieber <nggieber@amazon.com>
55 lines
1.3 KiB
C++
55 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) Contributors to the Open 3D Engine Project.
|
|
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
*
|
|
*/
|
|
|
|
#include <LinkWidget.h>
|
|
#include <QDesktopServices>
|
|
#include <QEvent>
|
|
#include <QMouseEvent>
|
|
#include <QVBoxLayout>
|
|
|
|
namespace O3DE::ProjectManager
|
|
{
|
|
LinkLabel::LinkLabel(const QString& text, const QUrl& url, int fontSize, QWidget* parent)
|
|
: QLabel(text, parent)
|
|
, m_url(url)
|
|
, m_fontSize(fontSize)
|
|
{
|
|
SetDefaultStyle();
|
|
}
|
|
|
|
void LinkLabel::mousePressEvent([[maybe_unused]] QMouseEvent* event)
|
|
{
|
|
if (m_url.isValid())
|
|
{
|
|
QDesktopServices::openUrl(m_url);
|
|
}
|
|
|
|
emit clicked();
|
|
}
|
|
|
|
void LinkLabel::enterEvent([[maybe_unused]] QEvent* event)
|
|
{
|
|
setStyleSheet(QString("font-size: %1px; color: #94D2FF; text-decoration: underline;").arg(m_fontSize));
|
|
}
|
|
|
|
void LinkLabel::leaveEvent([[maybe_unused]] QEvent* event)
|
|
{
|
|
SetDefaultStyle();
|
|
}
|
|
|
|
void LinkLabel::SetUrl(const QUrl& url)
|
|
{
|
|
m_url = url;
|
|
}
|
|
|
|
void LinkLabel::SetDefaultStyle()
|
|
{
|
|
setStyleSheet(QString("font-size: %1px; color: #94D2FF;").arg(m_fontSize));
|
|
}
|
|
} // namespace O3DE::ProjectManager
|