Browse Source

Fix basename and margins

Signed-off-by: crueter <crueter@eden-emu.dev>
pull/3472/head
crueter 4 days ago
parent
commit
2b73470ab7
No known key found for this signature in database GPG Key ID: 425ACD2D4830EBC6
  1. 14
      src/yuzu/configuration/addon/mod_select_dialog.cpp

14
src/yuzu/configuration/addon/mod_select_dialog.cpp

@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#include <filesystem>
#include <QFileInfo>
#include <qnamespace.h>
#include "mod_select_dialog.h"
@ -14,12 +13,12 @@ ModSelectDialog::ModSelectDialog(const QStringList& mods, QWidget* parent)
item_model = new QStandardItemModel(ui->treeView);
ui->treeView->setModel(item_model);
// We must register all custom types with the Qt Automoc system so that we are able to use it
// with signals/slots. In this case, QList falls under the umbrella of custom types.
// We must register all custom types with the Qt Automoc system so that we are able to use it
// with signals/slots. In this case, QList falls under the umbrella of custom types.
qRegisterMetaType<QList<QStandardItem*>>("QList<QStandardItem*>");
for (const auto& mod : mods) {
const auto basename = QFileInfo(mod).baseName();
const auto basename = QFileInfo(mod).fileName();
auto* const first_item = new QStandardItem;
first_item->setText(basename);
@ -35,7 +34,8 @@ ModSelectDialog::ModSelectDialog(const QStringList& mods, QWidget* parent)
ui->treeView->resizeColumnToContents(0);
int rows = item_model->rowCount();
int height = ui->treeView->contentsMargins().top() + ui->treeView->contentsMargins().bottom();
int height =
ui->treeView->contentsMargins().top() * 4 + ui->treeView->contentsMargins().bottom() * 4;
int width = 0;
for (int i = 0; i < rows; ++i) {
@ -43,7 +43,7 @@ ModSelectDialog::ModSelectDialog(const QStringList& mods, QWidget* parent)
width = qMax(width, item_model->item(i)->sizeHint().width());
}
width += ui->treeView->contentsMargins().left() + ui->treeView->contentsMargins().right();
width += ui->treeView->contentsMargins().left() * 4 + ui->treeView->contentsMargins().right() * 4;
ui->treeView->setMinimumHeight(qMin(height, 600));
ui->treeView->setMinimumWidth(qMin(width, 700));
adjustSize();
@ -52,7 +52,7 @@ ModSelectDialog::ModSelectDialog(const QStringList& mods, QWidget* parent)
QStringList selected_mods;
for (qsizetype i = 0; i < item_model->rowCount(); ++i) {
auto *const item = item_model->item(i);
auto* const item = item_model->item(i);
if (item->checkState() == Qt::Checked)
selected_mods << item->data().toString();
}

Loading…
Cancel
Save