summaryrefslogtreecommitdiff
path: root/ui/qt5/inputpage.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ui/qt5/inputpage.cc')
-rw-r--r--ui/qt5/inputpage.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/ui/qt5/inputpage.cc b/ui/qt5/inputpage.cc
index 11d9993..5e1958e 100644
--- a/ui/qt5/inputpage.cc
+++ b/ui/qt5/inputpage.cc
@@ -41,7 +41,8 @@ InputPage::InputPage(QWidget *parent) : HorizonWizardPage(parent) {
layoutList->setWhatsThis(tr("This is a list of keyboard layouts. Select one to choose the layout of the keyboard you will be using on your Adélie Linux computer."));
for(auto &map : valid_keymaps) {
QIcon myIcon = QIcon::fromTheme("input-keyboard");
- new QListWidgetItem(myIcon, map.c_str(), layoutList);
+ auto widgetItem = new QListWidgetItem(myIcon, map.second.c_str(), layoutList);
+ widgetItem->setData(Qt::ToolTipRole, QVariant(QString::fromStdString(map.first)));
}
registerField("keymap*", layoutList);
@@ -81,8 +82,13 @@ void InputPage::initializePage() {
if(dpy != nullptr) {
XkbRF_VarDefsRec vardefs{};
XkbRF_GetNamesProp(dpy, nullptr, &vardefs);
- QList<QListWidgetItem *> items = layoutList->findItems(vardefs.layout, Qt::MatchExactly);
- if(!items.empty()) layoutList->setCurrentItem(items.at(0));
+ QList<QListWidgetItem *> items = layoutList->items();
+ for(int idx = 0; idx < items.size(); ++idx) {
+ if(items.at(idx)->data(Qt::ToolTipRole).toString == vardefs.layout) {
+ layoutList->setCurrentItem(items.at(idx));
+ break;
+ }
+ }
free(vardefs.model);
free(vardefs.layout);
free(vardefs.variant);