1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Preferences: Add checkboxes to spellcheck language list

This commit is contained in:
David Rosca 2018-05-08 11:56:06 +02:00
parent 4454ac714c
commit 5c557c8484
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
2 changed files with 4 additions and 5 deletions

View File

@ -442,6 +442,8 @@ Preferences::Preferences(BrowserWindow* window)
QListWidgetItem *item = new QListWidgetItem; QListWidgetItem *item = new QListWidgetItem;
item->setText(langName); item->setText(langName);
item->setData(Qt::UserRole, lang); item->setData(Qt::UserRole, lang);
item->setFlags(item->flags() & ~Qt::ItemIsSelectable);
item->setCheckState(Qt::Unchecked);
ui->spellcheckLanguages->addItem(item); ui->spellcheckLanguages->addItem(item);
} }
} }
@ -455,7 +457,7 @@ Preferences::Preferences(BrowserWindow* window)
QListWidgetItem *item = items.at(0); QListWidgetItem *item = items.at(0);
ui->spellcheckLanguages->takeItem(ui->spellcheckLanguages->row(item)); ui->spellcheckLanguages->takeItem(ui->spellcheckLanguages->row(item));
ui->spellcheckLanguages->insertItem(topIndex++, item); ui->spellcheckLanguages->insertItem(topIndex++, item);
ui->spellcheckLanguages->setCurrentItem(item, QItemSelectionModel::Select); item->setCheckState(Qt::Checked);
} }
if (ui->spellcheckLanguages->count() == 0) { if (ui->spellcheckLanguages->count() == 0) {
@ -968,7 +970,7 @@ void Preferences::saveSettings()
QStringList languages; QStringList languages;
for (int i = 0; i < ui->spellcheckLanguages->count(); ++i) { for (int i = 0; i < ui->spellcheckLanguages->count(); ++i) {
QListWidgetItem *item = ui->spellcheckLanguages->item(i); QListWidgetItem *item = ui->spellcheckLanguages->item(i);
if (item->isSelected()) { if (item->checkState() == Qt::Checked) {
languages.append(item->data(Qt::UserRole).toString()); languages.append(item->data(Qt::UserRole).toString());
} }
} }

View File

@ -2405,9 +2405,6 @@
<property name="dragDropMode"> <property name="dragDropMode">
<enum>QAbstractItemView::InternalMove</enum> <enum>QAbstractItemView::InternalMove</enum>
</property> </property>
<property name="selectionMode">
<enum>QAbstractItemView::MultiSelection</enum>
</property>
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="2" column="2">