Commit 221f83d3 authored by Ionut Alexandrescu's avatar Ionut Alexandrescu
Browse files

Fixing webengine spell checker example


The languages submenu was not working corectly,
languages could not be checked

Change-Id: I7221d3527dbd6e071eb8d1585fb6d90812c61f94
Reviewed-by: default avatarMichal Klocek <michal.klocek@qt.io>
Showing with 2 additions and 2 deletions
...@@ -65,7 +65,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) ...@@ -65,7 +65,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
} }
QWebEngineProfile *profile = page()->profile(); QWebEngineProfile *profile = page()->profile();
const QString &language = profile->spellCheckLanguages().first(); const QStringList &languages = profile->spellCheckLanguages();
QMenu *menu = page()->createStandardContextMenu(); QMenu *menu = page()->createStandardContextMenu();
menu->addSeparator(); menu->addSeparator();
...@@ -83,7 +83,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) ...@@ -83,7 +83,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
QAction *action = subMenu->addAction(str); QAction *action = subMenu->addAction(str);
action->setCheckable(true); action->setCheckable(true);
QString lang = m_spellCheckLanguages[str]; QString lang = m_spellCheckLanguages[str];
action->setChecked(language == lang); action->setChecked(languages.contains(lang));
connect(action, &QAction::triggered, this, [profile, lang](){ connect(action, &QAction::triggered, this, [profile, lang](){
profile->setSpellCheckLanguages(QStringList()<<lang); profile->setSpellCheckLanguages(QStringList()<<lang);
}); });
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment