Fix icon removal in icon picker

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2025-02-12 19:04:48 +02:00
parent 0af021fef2
commit 5810032861
2 changed files with 5 additions and 3 deletions

View File

@ -166,7 +166,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;
@ -174,7 +175,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);