Browse Source

- Fix crash on start introduced in last commit

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
af5c1096b5
  1. 12
      src/transferlistfilterswidget.h

12
src/transferlistfilterswidget.h

@ -174,11 +174,6 @@ public:
QListWidgetItem *noLabel = new QListWidgetItem(labelFilters); QListWidgetItem *noLabel = new QListWidgetItem(labelFilters);
noLabel->setData(Qt::DisplayRole, tr("Unlabeled") + " (0)"); noLabel->setData(Qt::DisplayRole, tr("Unlabeled") + " (0)");
noLabel->setData(Qt::DecorationRole, QIcon(":/Icons/oxygen/folder.png")); noLabel->setData(Qt::DecorationRole, QIcon(":/Icons/oxygen/folder.png"));
foreach(const QString& label, customLabels) {
QListWidgetItem *newLabel = new QListWidgetItem(labelFilters);
newLabel->setText(label + " (0)");
newLabel->setData(Qt::DecorationRole, QIcon(":/Icons/oxygen/folder.png"));
}
// Load settings // Load settings
loadSettings(); loadSettings();
@ -217,6 +212,11 @@ public:
for(int i=0; i<customLabels.size(); ++i) { for(int i=0; i<customLabels.size(); ++i) {
labelCounters << 0; labelCounters << 0;
} }
foreach(const QString& label, customLabels) {
QListWidgetItem *newLabel = new QListWidgetItem(labelFilters);
newLabel->setText(label + " (0)");
newLabel->setData(Qt::DecorationRole, QIcon(":/Icons/oxygen/folder.png"));
}
labelFilters->setCurrentRow(settings.value("selectedLabelIndex", 0).toInt()); labelFilters->setCurrentRow(settings.value("selectedLabelIndex", 0).toInt());
//labelFilters->selectionModel()->select(labelFilters->model()->index(0,0), QItemSelectionModel::Select); //labelFilters->selectionModel()->select(labelFilters->model()->index(0,0), QItemSelectionModel::Select);
} }
@ -339,8 +339,10 @@ protected slots:
} }
// Update label counter // Update label counter
int i = customLabels.indexOf(label); int i = customLabels.indexOf(label);
Q_ASSERT(i >= 0);
int new_count = labelCounters[i]+1; int new_count = labelCounters[i]+1;
labelCounters.replace(i, new_count); labelCounters.replace(i, new_count);
Q_ASSERT(labelFilters->item(i+2));
labelFilters->item(i+2)->setText(label + " ("+ QString::number(new_count) +")"); labelFilters->item(i+2)->setText(label + " ("+ QString::number(new_count) +")");
++nb_labeled; ++nb_labeled;
} }

Loading…
Cancel
Save