Results 1 to 3 of 3

Thread: QCompleter does not call data method from model

  1. #1
    Join Date
    May 2016
    Posts
    10
    Qt products
    Qt5

    Default QCompleter does not call data method from model

    Hi,

    I done a model inherited from QStandardItemModel. It has QVector of items and overloads data and rowCount methods.
    I fiil this model with some items and then i used setModel on QCompleter and setCompleter on a QLineEdit.

    When i write some letters to QLineEdit the model does not work, it means that the data method is never call. Do you know what could be a reason of that behaviour?

    BR,
    Luca

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,491
    Thanks
    252
    Thanked 717 Times in 707 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QCompleter does not call data method from model

    it means that the data method is never call
    How do you know? Did you run your program in the debugger and set a breakpoint at the start of the data() method?

    By default, QCompleter calls data() only for column 0 of the model, and for the EditRole. Does your data method handle these?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QCompleter does not call data method from model

    Maybe a stupid question, but why inherit from QStandardItemModel if you have your own data vector?

    Cheers,
    _

Similar Threads

  1. Call method of Object in different Thread
    By Qiieha in forum Qt Programming
    Replies: 3
    Last Post: 26th July 2012, 13:14
  2. C++ method call
    By ^NyAw^ in forum General Programming
    Replies: 4
    Last Post: 19th November 2011, 12:19
  3. Replies: 0
    Last Post: 13th May 2011, 08:11
  4. Replies: 0
    Last Post: 17th September 2010, 12:19
  5. Replies: 1
    Last Post: 12th October 2008, 08:21

Tags for this Thread

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.