DolphinQt: Add utility function for creating label text with a standard icon.

This commit is contained in:
Jordan Woyak
2025-05-15 01:39:17 -05:00
parent 059282df6f
commit a45d00d84d
6 changed files with 46 additions and 53 deletions

View File

@ -13,6 +13,7 @@
#include "Core/Core.h"
#include "Core/System.h"
#include "DolphinQt/QtUtils/QtUtils.h"
#include "DolphinQt/Settings.h"
CheatWarningWidget::CheatWarningWidget(const std::string& game_id, bool restart_required,
@ -33,28 +34,17 @@ CheatWarningWidget::CheatWarningWidget(const std::string& game_id, bool restart_
void CheatWarningWidget::CreateWidgets()
{
auto* icon = new QLabel;
const auto size = 1.5 * QFontMetrics(font()).height();
QPixmap warning_icon = style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(size, size);
icon->setPixmap(warning_icon);
m_text = new QLabel();
m_config_button = new QPushButton(tr("Configure Dolphin"));
m_config_button->setHidden(true);
auto* layout = new QHBoxLayout;
auto* const layout = new QHBoxLayout{this};
layout->addWidget(icon);
layout->addWidget(m_text, 1);
layout->addWidget(QtUtils::CreateIconWarning(this, QStyle::SP_MessageBoxWarning, m_text));
layout->addWidget(m_config_button);
layout->setContentsMargins(0, 0, 0, 0);
setLayout(layout);
}
void CheatWarningWidget::Update(bool running)