mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-13 18:04:32 +00:00
Qt: Resize fixed columns on theme change
Fixes columns being too small after change on MacOS.
This commit is contained in:
@@ -1469,6 +1469,9 @@ void GameListWidget::cancelRefresh()
|
||||
void GameListWidget::onThemeChanged()
|
||||
{
|
||||
m_model->reloadThemeSpecificImages();
|
||||
|
||||
// Resize columns, since the text size can change with themes.
|
||||
m_list_view->updateFixedColumnWidths();
|
||||
}
|
||||
|
||||
void GameListWidget::setBackgroundPath(const std::string_view path)
|
||||
@@ -1856,7 +1859,7 @@ GameListListView::GameListListView(GameListModel* model, GameListSortModel* sort
|
||||
QHeaderView* const horizontal_header = horizontalHeader();
|
||||
horizontal_header->setHighlightSections(false);
|
||||
horizontal_header->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
setFixedColumnWidths();
|
||||
updateFixedColumnWidths();
|
||||
|
||||
horizontal_header->setSectionResizeMode(GameListModel::Column_Title, QHeaderView::Stretch);
|
||||
horizontal_header->setSectionResizeMode(GameListModel::Column_FileTitle, QHeaderView::Stretch);
|
||||
@@ -1921,7 +1924,7 @@ void GameListListView::setFixedColumnWidth(const QFontMetrics& fm, int column, i
|
||||
setFixedColumnWidth(column, width);
|
||||
}
|
||||
|
||||
void GameListListView::setFixedColumnWidths()
|
||||
void GameListListView::updateFixedColumnWidths()
|
||||
{
|
||||
const QFontMetrics fm = fontMetricsForHorizontalHeader();
|
||||
const auto width_for = [&fm](const QString& text) { return fm.size(0, text).width(); };
|
||||
|
||||
@@ -176,6 +176,7 @@ public:
|
||||
QFontMetrics fontMetricsForHorizontalHeader() const;
|
||||
void setFixedColumnWidth(const QFontMetrics& fm, int column, int str_width);
|
||||
void setAndSaveColumnHidden(int column, bool hidden);
|
||||
void updateFixedColumnWidths();
|
||||
|
||||
void adjustIconSize(int delta);
|
||||
|
||||
@@ -184,7 +185,6 @@ protected:
|
||||
|
||||
private:
|
||||
void setFixedColumnWidth(int column, int width);
|
||||
void setFixedColumnWidths();
|
||||
|
||||
void loadColumnVisibilitySettings();
|
||||
void loadColumnSortSettings();
|
||||
|
||||
Reference in New Issue
Block a user