Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Grab gesture with QCompleter, incorrect focus
Qt 6.11 is out! See what's new in the release blog

Grab gesture with QCompleter, incorrect focus

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 905 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DavidArmand
    wrote on last edited by
    #1

    Hi,

    [Qt5.3.1]

    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);
    lineEdit1->setCompleter(completer1);
    QScroller::grabGesture(completer1->popup(), QScroller::LeftMouseButtonGesture);
    completer1->popup()->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
    completer1->setMaxVisibleItems(5);

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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved