Results 1 to 3 of 3

Thread: QCompleter with QLineEdit->setText()

  1. #1
    Join Date
    Feb 2015
    Posts
    17
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default QCompleter with QLineEdit->setText()

    Hi, how can i use Completer with lineEdit when i setText in line by my custom button ?
    Completer wont popup with my custom button, and with keyboard it popup.
    Thanks a lot.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QCompleter with QLineEdit->setText()

    At a guess you need to call:
    Qt Code:
    1. edit->setText(text);
    2. edit->completer()->setCompletionPrefix(text); // might not be needed
    3. edit->completer()->complete();
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    May 2024
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QCompleter with QLineEdit->setText()

    Hi,
    I have the same problem.
    I have a QLineEdit which is filled with a virtual keyboard.
    With your method the completer is pop upped but when I select an item in the completer list, the selected item does not appear in the QLineEdit.
    Thank you !

Similar Threads

  1. Qt 4.8: How to use setText() of QLineEdit.
    By amitahire in forum Newbie
    Replies: 4
    Last Post: 26th June 2012, 07:03
  2. Closing QCompleter when QLineEdit loses focus
    By mathieuS in forum Qt Programming
    Replies: 2
    Last Post: 26th July 2011, 18:14
  3. QLineEdit + QCompleter: returnPressed signal
    By thefriedc in forum Qt Programming
    Replies: 2
    Last Post: 21st September 2010, 16:21
  4. Problem with QLineEdit and setText
    By Elmo23x in forum Qt Programming
    Replies: 8
    Last Post: 12th April 2007, 12:35
  5. Replies: 1
    Last Post: 26th November 2006, 09:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.