QCompleter with keyboard accents
-
Hi,
When using a QLineEdit with QCompleter, it is not possible to use keyboard accents while the popup with the suggested text is visisble.
Is there a workaround for this, or is it a Qt bug?I made a simple program here to demonstrate it: https://github.com/jonaski/completertest
When you enter test, the popup is shown, it is not possible to enter "ALT GR" + ; + a to get 'á', you instead get a regular character 'a'.I get the same result with both Qt 6.0.3 and Qt 5.15.2. It's on Linux/X11.
Code:
#include <QMainWindow> #include "mainwindow.h" #include "completer.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui_(new Ui_MainWindow) { ui_->setupUi(this); show(); Completer *completer = new Completer(); ui_->lineedit->setCompleter(completer); } MainWindow::~MainWindow() { delete ui_; } #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include "ui_mainwindow.h" class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); private: Ui_MainWindow *ui_; }; #endif // MAINWINDOW_H #include <QCompleter> #include "completer.h" Completer::Completer() { setModel(new CompleterModel()); setCaseSensitivity(Qt::CaseInsensitive); } Completer::~Completer() {} CompleterModel::CompleterModel() { setStringList(QStringList() << "Test1" << "Test2"); } CompleterModel::~CompleterModel() {} #ifndef COMPLETER_H #define COMPLETER_H #include <QCompleter> #include <QStringListModel> class Completer : public QCompleter { Q_OBJECT public: explicit Completer(); ~Completer(); private: }; class CompleterModel : public QStringListModel { Q_OBJECT public: explicit CompleterModel(); ~CompleterModel(); private: }; #endif // COMPLETER_H
-
Hi,
Which distribution are you using ?
Which locale is configured ? -
I'm using openSUSE tumbleweed.
The locale is set to "en_US.UTF-8" with English US keyboard.
But I've tested multiple keyboard layouts.
So it works for you? -
Having the same issue (in fact I reported it to Johan) on Debian unstable with Qt 5.15.2, my locale is set to
sv_SE.UTF-8
but I encountered the problem while typing with a greek keyboard layout.