Results 1 to 4 of 4

Thread: ComboBox Completer Index Problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Posts
    9
    Thanks
    1

    Default Re: ComboBox Completer Index Problem

    Quote Originally Posted by wysota View Post
    Connect to the activated() signal of the completer and set the appropriate index of the combobox as the current one.
    thanks for reply, but activated method of completer content index of model, but combobox have setIndex for row only

  2. #2
    Join Date
    Mar 2009
    Posts
    9
    Thanks
    1

    Default Re: ComboBox Completer Index Problem

    solved:

    if interesting

    Qt Code:
    1. void EventDialog::popUpIndex(QModelIndex s)
    2. {
    3. QCompleter * cl = qobject_cast<QCompleter * >(sender());
    4. QComboBox * cb = qobject_cast<QComboBox * >(sender()->parent());
    5.  
    6. int completer_id=cl->completionModel()->data(cl->completionModel()->index(s.row(),0)).toInt();
    7.  
    8. QModelIndexList indexList = cb->model()->match(cb->model()->index(0,0), Qt::DisplayRole, completer_id, 1, Qt::MatchExactly);
    9. if(indexList.count())
    10. {
    11. QModelIndex index=indexList.first();
    12. cb->setCurrentIndex(index.row());
    13. }
    14. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Problem in displaying the ComboBox list
    By raghvendramisra in forum Qt Tools
    Replies: 4
    Last Post: 28th February 2008, 14:25
  2. [Qt 4.3.1]A problem with combobox style
    By Tamara in forum Qt Programming
    Replies: 3
    Last Post: 19th September 2007, 11:49
  3. color comboBox problem
    By chguy2 in forum Qt Programming
    Replies: 2
    Last Post: 22nd April 2007, 10:57
  4. Problem with a combobox
    By Tindor in forum Qt Programming
    Replies: 2
    Last Post: 22nd November 2006, 20:18
  5. Problem with index in a QTreeView
    By hubert_p in forum Qt Programming
    Replies: 4
    Last Post: 22nd October 2006, 16:54

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
  •  
Qt is a trademark of The Qt Company.