mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-10-01 14:47:02 -05:00
Merge pull request #14519 from cristian64/registers_widget_font_fixes
DolphinQt: Size adjustments in **Registers** widget based on selected debug font.
This commit is contained in:
@@ -80,10 +80,10 @@ void RegisterWidget::CreateWidgets()
|
||||
m_table->setColumnCount(9);
|
||||
|
||||
m_table->verticalHeader()->setVisible(false);
|
||||
m_table->verticalHeader()->setDefaultSectionSize(24);
|
||||
m_table->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
m_table->setSelectionMode(QAbstractItemView::NoSelection);
|
||||
m_table->setFont(Settings::Instance().GetDebugFont());
|
||||
|
||||
OnDebugFontChanged(Settings::Instance().GetDebugFont());
|
||||
|
||||
QStringList empty_list;
|
||||
|
||||
@@ -106,7 +106,8 @@ void RegisterWidget::ConnectWidgets()
|
||||
connect(m_table, &QTableWidget::customContextMenuRequested, this,
|
||||
&RegisterWidget::ShowContextMenu);
|
||||
connect(m_table, &QTableWidget::itemChanged, this, &RegisterWidget::OnItemChanged);
|
||||
connect(&Settings::Instance(), &Settings::DebugFontChanged, m_table, &RegisterWidget::setFont);
|
||||
connect(&Settings::Instance(), &Settings::DebugFontChanged, this,
|
||||
&RegisterWidget::OnDebugFontChanged);
|
||||
}
|
||||
|
||||
void RegisterWidget::OnItemChanged(QTableWidgetItem* item)
|
||||
@@ -115,6 +116,20 @@ void RegisterWidget::OnItemChanged(QTableWidgetItem* item)
|
||||
static_cast<RegisterColumn*>(item)->SetValue();
|
||||
}
|
||||
|
||||
void RegisterWidget::OnDebugFontChanged(const QFont& font)
|
||||
{
|
||||
if (m_table)
|
||||
{
|
||||
m_table->setFont(font);
|
||||
const auto fontHeight = m_table->fontMetrics().height();
|
||||
m_table->verticalHeader()->setDefaultSectionSize(fontHeight);
|
||||
|
||||
// Header height doesn't have to be great. As there are no labels, its only purpose is to make
|
||||
// columns resizable.
|
||||
m_table->horizontalHeader()->setFixedHeight(fontHeight * 5 / 4);
|
||||
}
|
||||
}
|
||||
|
||||
void RegisterWidget::ShowContextMenu()
|
||||
{
|
||||
QMenu* menu = new QMenu(this);
|
||||
|
||||
@@ -46,6 +46,7 @@ private:
|
||||
|
||||
void ShowContextMenu();
|
||||
void OnItemChanged(QTableWidgetItem* item);
|
||||
void OnDebugFontChanged(const QFont& font);
|
||||
|
||||
void AddRegister(int row, int column, RegisterType type, std::string register_name,
|
||||
std::function<u64()> get_reg, std::function<void(u64)> set_reg);
|
||||
|
||||
Reference in New Issue
Block a user