Grab gesture with QCompleter, incorrect focus

  • Hi,


    When I use a QCompleter on a QLineEdit with a grab gesture on the LeftMouseButtonGesture, there is a problem of focus. In the QLineEdit, when the completer needs a QScroller to display the values, if I want to put the focus out of the QLineEdit, the completer does not closed. If there is no QScroller, it works.
    If I remove the definition of grab gesture, it works in any case.
    Here a code sample. Write "o" in the first QLineEdit and put the focus in the second one.
    Do you have any idea ?
    Thanks a lot.

    @ QStringList wordList;
    wordList << "alpha" << "omega" << "omicron" << "omicran" << "omicrin" << "omicron" << "omirron" << "omifran" << "olicrin" << "ozicron" << "zeta";

    QLineEdit *lineEdit1 = new QLineEdit(this);
    lineEdit1->setGeometry(50, 50, 100, 25);
    QCompleter *completer1 = new QCompleter(wordList, this);
    QScroller::grabGesture(completer1->popup(), QScroller::LeftMouseButtonGesture);

    QLineEdit *lineEdit2 = new QLineEdit(this);
    lineEdit2->setGeometry(200, 50, 100, 25);
    QCompleter *completer2 = new QCompleter(wordList, this);
    QScroller::grabGesture(completer2->popup(), QScroller::LeftMouseButtonGesture);
    completer2->setMaxVisibleItems(5); @

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.