Properly set sort indices.

This commit is contained in:
Lukas Brübach 2025-01-11 23:46:26 +01:00
parent 42fda4b01c
commit 8703e03d25
2 changed files with 4 additions and 3 deletions

View file

@ -22,6 +22,7 @@ VisualDeckStorageSortWidget::VisualDeckStorageSortWidget(VisualDeckStorageWidget
sortComboBox->addItem("Sort Alphabetically (Filename)", Alphabetical);
sortComboBox->addItem("Sort by Last Modified", ByLastModified);
sortComboBox->addItem("Sort by Last Loaded", ByLastLoaded);
sortComboBox->setCurrentIndex(SettingsCache::instance().getVisualDeckStorageSortingOrder());
// Connect sorting change signal to refresh the file list
connect(sortComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
@ -40,9 +41,9 @@ void VisualDeckStorageSortWidget::showEvent(QShowEvent *event)
void VisualDeckStorageSortWidget::updateSortOrder()
{
sortOrder = static_cast<SortOrder>(sortComboBox->currentData().toInt());
sortOrder = static_cast<SortOrder>(sortComboBox->currentIndex());
qDebug() << "Sort order updated to: " << sortOrder;
SettingsCache::instance().setVisualDeckStorageSortingOrder(sortComboBox->currentData().toInt());
SettingsCache::instance().setVisualDeckStorageSortingOrder(sortComboBox->currentIndex());
emit sortOrderChanged();
}

View file

@ -27,10 +27,10 @@ signals:
private:
enum SortOrder
{
ByName,
Alphabetical,
ByLastModified,
ByLastLoaded,
ByName,
};
QHBoxLayout *layout;
VisualDeckStorageWidget *parent;