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. [Solved]QSortFilterProxyModel dont find in the "folder"
Forum Updated to NodeBB v4.3 + New Features

[Solved]QSortFilterProxyModel dont find in the "folder"

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 2.5k 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.
  • R Offline
    R Offline
    Ruzik
    wrote on last edited by
    #1

    Hellow!
    I use this code:
    @ searchModel.setSourceModel(itemModel);
    connect(searchLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(findInModel(const QString&)));@
    @void RizekFaster::findInModel(const QString& str)
    {
    if(str.isEmpty())
    {
    dataTreeView->setModel(itemModel);
    return;
    }
    searchModel.setFilterWildcard(str);
    dataTreeView->setModel(&searchModel);
    }@
    But my sort model dont find items in "folders", it find only items which have not parents
    For example:
    This is my program with all item in my item model
    !http://s1.hostingkartinok.com/uploads/images/2012/02/28e3848a1f4e041e2af0461851dde433.jpg(1)!
    And it is my program with QSortFilterProxyModel
    !http://s1.hostingkartinok.com/uploads/images/2012/02/58a21d47c6552e76ea79e8b186f40874.jpg(2)!
    How can i do that my sort model find all items?
    And other question:
    How can i do that my QSortFilterProxyModel find items in all columns simultaneously?
    In advance many thank for your help!

    1 Reply Last reply
    0
    • L Offline
      L Offline
      luisvaldes88
      wrote on last edited by
      #2

      Hi,

      Did you try

      @
      QSortFilterProxyModel::setFilterKeyColumn(int)
      @

      ?

      filterKeyColumn : int

      This property holds the column where the key used to filter the contents of the source model is read from.
      The default value is 0. If the value is -1, the keys will be read from all columns.

      By default it is only searching in the column 0

      @
      void RizekFaster::findInModel(const QString& str)
      {
      if(str.isEmpty())
      {
      dataTreeView->setModel(itemModel);
      return;
      }
      searchModel.setFilterWildcard(str);
      searchModel.setFilterKeyColumn(-1); /this solves/
      dataTreeView->setModel(&searchModel);
      }
      @

      Muchos quieren, pocos pueden, algunos consiguen.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Ruzik
        wrote on last edited by
        #3

        I try to do it, but it is only mean that program will found items in difetent columns, but it is dont find in the "folders"(like Friends and My Friends in my screen)

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          I wrote a proxy you might use as inspiration. Depending on the size of your model, it might need serious performance enhancements, but it is a start. Check "this":http://developer.qt.nokia.com/forums/viewthread/7782 topic for details.

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Ruzik
            wrote on last edited by
            #5

            Thank you for all your help!

            1 Reply Last reply
            0
            • L Offline
              L Offline
              luisvaldes88
              wrote on last edited by
              #6

              [quote author="Andre" date="1329732295"]I wrote a proxy you might use as inspiration. Depending on the size of your model, it might need serious performance enhancements, but it is a start. Check "this":http://developer.qt.nokia.com/forums/viewthread/7782 topic for details.

              [/quote]

              Great information.
              Thanks.

              Muchos quieren, pocos pueden, algunos consiguen.

              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