Fix icon removal in icon picker (#3410)

This commit is contained in:
Alexandru Ionut Tripon 2025-04-15 16:58:13 +03:00 committed by GitHub
commit 8f54a8c8dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -165,7 +165,8 @@ void IconList::directoryChanged(const QString& path)
for (const MMCIcon& it : m_icons) {
if (!it.has(IconType::FileBased))
continue;
currentSet.insert(it.m_images[IconType::FileBased].filename);
QFileInfo icon(it.getFilePath());
currentSet.insert(icon.absoluteFilePath());
}
QSet<QString> toRemove = currentSet - newSet;
QSet<QString> toAdd = newSet - currentSet;
@ -173,7 +174,8 @@ void IconList::directoryChanged(const QString& path)
for (const QString& removedPath : toRemove) {
qDebug() << "Removing icon " << removedPath;
QFileInfo removedFile(removedPath);
QString key = m_dir.relativeFilePath(removedFile.absoluteFilePath());
QString relativePath = m_dir.relativeFilePath(removedFile.absoluteFilePath());
QString key = QFileInfo(relativePath).completeBaseName();
int idx = getIconIndex(key);
if (idx == -1)

View File

@ -58,7 +58,7 @@ IconPickerDialog::IconPickerDialog(QWidget* parent) : QDialog(parent), ui(new Ui
contentsWidget->setTextElideMode(Qt::ElideRight);
contentsWidget->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
contentsWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
contentsWidget->setItemDelegate(new ListViewDelegate());
contentsWidget->setItemDelegate(new ListViewDelegate(contentsWidget));
// contentsWidget->setAcceptDrops(true);
contentsWidget->setDropIndicatorShown(true);