Results 1 to 4 of 4

Thread: [COMPLETION] I am looking for a simple way to ...

  1. #1
    Join Date
    Aug 2007
    Location
    Paris
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question [COMPLETION] I am looking for a simple way to ...

    Hello,

    I am looking for a simple way to do completion on this input:

    (LOGIN )+

    I fetch logins from a database and the user has a QLineEdit in which he can put LOGIN LOGIN LOGIN ...
    I want to provide completion for each LOGIN

    Thank you ;-)

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: [COMPLETION] I am looking for a simple way to ...

    What have you tried already? You need a simple model that will have an unlimited hierarchical list of logins and you need to set the completer to treat the space character as a tree separator. It's all in the docs...

  3. The following user says thank you to wysota for this useful post:

    babali (21st January 2008)

  4. #3
    Join Date
    Aug 2007
    Location
    Paris
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: [COMPLETION] I am looking for a simple way to ...

    In the docs there is two possibility: the one you shown and an other one from an exemple which subclasses the edit widget and takes the word under cursor and popup completion.

    If i follow you proposition i have to subclasses QAbstractItemModel.
    With the second choice i have to subclass QLineEdit.

    I was thinking that there were a simpliest solution because this grammar is very simple to complete. I'll subclass QAbstractItemModel.

    Thank you wysota

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: [COMPLETION] I am looking for a simple way to ...

    The line edit is supposed to contain a single text, thus completion replaces the entire text by default. You can tweak the behaviour if you provide custom slots that will manipulate the completion prefix and the line edit text properly. Otherwise you'll have to preapare such a simple model.

Similar Threads

  1. Simple way to expand all nodes on a QTreeView?
    By cboles in forum Qt Programming
    Replies: 10
    Last Post: 12th April 2014, 16:54
  2. QTextEdit simple question
    By Marcopolo in forum Qt Tools
    Replies: 4
    Last Post: 11th October 2007, 00:01
  3. Simple custom widget won't size properly
    By MrGarbage in forum Qt Tools
    Replies: 2
    Last Post: 9th August 2007, 13:12
  4. Problem with simple Model-View in Qt4.3
    By ccf_h in forum Qt Programming
    Replies: 3
    Last Post: 17th June 2007, 18:57
  5. Creating simple text editor from the eamples code
    By overcast in forum Qt Programming
    Replies: 4
    Last Post: 14th February 2007, 15:46

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.