BranchWatchDialog: Resolve Linux FIXME

This stopped being an issue for me with a recent package update, so I guess Qt6 was fixed upstream?
This commit is contained in:
mitaclaw 2024-05-24 16:44:43 -07:00
parent 4a2ec86a9a
commit 3b214a4978
2 changed files with 6 additions and 11 deletions

View File

@ -207,7 +207,6 @@ BranchWatchDialog::BranchWatchDialog(Core::System& system, Core::BranchWatch& br
{ {
setWindowTitle(tr("Branch Watch Tool")); setWindowTitle(tr("Branch Watch Tool"));
setWindowFlags((windowFlags() | Qt::WindowMinMaxButtonsHint) & ~Qt::WindowContextHelpButtonHint); setWindowFlags((windowFlags() | Qt::WindowMinMaxButtonsHint) & ~Qt::WindowContextHelpButtonHint);
SetQWidgetWindowDecorations(this);
setLayout([this, &ppc_symbol_db]() { setLayout([this, &ppc_symbol_db]() {
auto* main_layout = new QVBoxLayout; auto* main_layout = new QVBoxLayout;
@ -241,6 +240,11 @@ BranchWatchDialog::BranchWatchDialog(Core::System& system, Core::BranchWatch& br
table_view->setEditTriggers(QAbstractItemView::NoEditTriggers); table_view->setEditTriggers(QAbstractItemView::NoEditTriggers);
table_view->setCornerButtonEnabled(false); table_view->setCornerButtonEnabled(false);
table_view->verticalHeader()->hide(); table_view->verticalHeader()->hide();
table_view->setColumnWidth(Column::Instruction, 50);
table_view->setColumnWidth(Column::Condition, 50);
table_view->setColumnWidth(Column::OriginSymbol, 250);
table_view->setColumnWidth(Column::DestinSymbol, 250);
// The default column width (100 units) is fine for the rest.
QHeaderView* const horizontal_header = table_view->horizontalHeader(); QHeaderView* const horizontal_header = table_view->horizontalHeader();
horizontal_header->restoreState( // Restore column visibility state. horizontal_header->restoreState( // Restore column visibility state.
@ -502,16 +506,6 @@ BranchWatchDialog::BranchWatchDialog(Core::System& system, Core::BranchWatch& br
return main_layout; return main_layout;
}()); }());
// FIXME: On Linux, Qt6 has recently been resetting column widths to their defaults in many
// unexpected ways. This affects all kinds of QTables in Dolphin's GUI, so to avoid it in
// this QTableView, I have deferred this operation. Any earlier, and this would be undone.
// SetQWidgetWindowDecorations was moved to before these operations for the same reason.
m_table_view->setColumnWidth(Column::Instruction, 50);
m_table_view->setColumnWidth(Column::Condition, 50);
m_table_view->setColumnWidth(Column::OriginSymbol, 250);
m_table_view->setColumnWidth(Column::DestinSymbol, 250);
// The default column width (100 units) is fine for the rest.
const auto& settings = Settings::GetQSettings(); const auto& settings = Settings::GetQSettings();
restoreGeometry(settings.value(QStringLiteral("branchwatchdialog/geometry")).toByteArray()); restoreGeometry(settings.value(QStringLiteral("branchwatchdialog/geometry")).toByteArray());
} }

View File

@ -206,6 +206,7 @@ void CodeWidget::OnBranchWatchDialog()
m_branch_watch_dialog = new BranchWatchDialog(m_system, m_system.GetPowerPC().GetBranchWatch(), m_branch_watch_dialog = new BranchWatchDialog(m_system, m_system.GetPowerPC().GetBranchWatch(),
m_ppc_symbol_db, this, this); m_ppc_symbol_db, this, this);
} }
SetQWidgetWindowDecorations(m_branch_watch_dialog);
m_branch_watch_dialog->show(); m_branch_watch_dialog->show();
m_branch_watch_dialog->raise(); m_branch_watch_dialog->raise();
m_branch_watch_dialog->activateWindow(); m_branch_watch_dialog->activateWindow();