Limit the size of directory icons, fix text when icon size is none

This commit is contained in:
fearlessTobi 2019-07-11 23:02:18 +02:00 committed by FearlessTobi
parent 13891fd62d
commit 053da44ecd
2 changed files with 3 additions and 4 deletions

View file

@ -230,7 +230,7 @@ void GameList::onUpdateThemedIcons() {
for (int i = 0; i < item_model->invisibleRootItem()->rowCount(); i++) {
QStandardItem* child = item_model->invisibleRootItem()->child(i);
const int icon_size = UISettings::values.icon_size;
const int icon_size = std::min(static_cast<int>(UISettings::values.icon_size), 64);
switch (child->data(GameListItem::TypeRole).value<GameListItemType>()) {
case GameListItemType::SdmcDir:
child->setData(
@ -300,7 +300,6 @@ GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvide
tree_view->setHorizontalScrollMode(QHeaderView::ScrollPerPixel);
tree_view->setSortingEnabled(true);
tree_view->setEditTriggers(QHeaderView::NoEditTriggers);
tree_view->setUniformRowHeights(true);
tree_view->setContextMenuPolicy(Qt::CustomContextMenu);
tree_view->setStyleSheet(QStringLiteral("QTreeView{ border: none; }"));

View file

@ -221,7 +221,7 @@ public:
UISettings::GameDir* game_dir = &directory;
setData(QVariant::fromValue(game_dir), GameDirRole);
const int icon_size = UISettings::values.icon_size;
const int icon_size = std::min(static_cast<int>(UISettings::values.icon_size), 64);
switch (dir_type) {
case GameListItemType::SdmcDir:
setData(
@ -272,7 +272,7 @@ public:
explicit GameListAddDir() {
setData(type(), TypeRole);
const int icon_size = UISettings::values.icon_size;
const int icon_size = std::min(static_cast<int>(UISettings::values.icon_size), 64);
setData(QIcon::fromTheme(QStringLiteral("plus"))
.pixmap(icon_size)
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),