Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-77174

QCompleter is broken on Android 8.1

    XMLWordPrintable

Details

    • Android
    • 8

    Description

       
      I'm trying to build an app for both android and desktop with qt 5.13 and facing some problems with QCompleter and QLineEdit on android the completer doesn't popup on android and when I finish insert a word that is in the list of the completer the completer doubles the content of QLineEdit and I can't clear the QLineEdit or do anything with it again , every time I touch it the contents is copied and pasted

      this is the code I'm using QCompleter in :

      in header file :

      namespace Ui {
        class DictionaryGui;
      }
      class DictionaryGui : public QMainWindow{
          Q_OBJECT
      public:
          explicit DictionaryGui(QWidget *parent = nullptr);
          ~DictionaryGui();
      private slots:
          void on_SearchBtn_clicked();
          private:
          Ui::DictionaryGui *ui;
          QStringListModel mdl;
          QCompleter completer;
      };
      

      in cpp file

      DictionaryGui::DictionaryGui(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::DictionaryGui),
          completer(&mdl) {
          ui->setupUi(this);
          QScroller::grabGesture(ui->ResultsList);
          ui->DictionaryWidget->setStyleSheet("QWidget#DictionaryWidget \
              {background-color: rgb(144, 202, 249);}");
          QString input_style = R"##(
      QLineEdit {
                              border: 1px solid #ccc; 
                              border-radius: 10px;
      }
      QLineEdit:focus {
                                     border: 3px solid #55aaff;
      })##";
          ui->InputText->setStyleSheet(input_style);
          int id = QFontDatabase::addApplicationFont(":/icons/gulf-semibold.ttf");
          if (id != -1){QString font_family = QFontDatabase::applicationFontFamilies(id).at(0);
          QFont font(font_family, 14);
              qDebug() << "[*] loaded the font : " << font_family;
              ui->InputText->setFont(font);
          } else {
                  qDebug() << "[!] failed to load the font !\n";
          }
          QStringList list({"word", "man", "human", "test", "world", "wonder", "what", 
                           u8"كلمة", u8"كلام" , u8"كلهم", u8"كلا", u8"كلاهما"});
          mdl.setStringList(list);
          completer.setCaseSensitivity(Qt::CaseInsensitive);    
          completer.setFilterMode(Qt::MatchStartsWith);
          ui->InputText->setCompleter(&completer);
      }
      

      on windows this works well :

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtandroidteam Qt Android Team
              developer-1230 developer-122 developer-321
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes