Results 1 to 2 of 2

Thread: Finding values in QTableview

  1. #1
    Join Date
    Jun 2010
    Posts
    4
    Thanks
    1

    Default Finding values in QTableview

    Hi

    I have Qtableview with QSqlTablemodel and lineEdit, nextButton and prevButton

    Now when I enter "value" in lineEdit I need to select row in Qtableview which contains %value% in first column How can I simple do this? After clicking nextButton I should found nextRow with %value%

  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: Finding values in QTableview

    QAbstractItemModel::match() will find the model indexes of matching cells for an exact or starts-with match. You could re-implement the match() method if you need some other matching: you seem to using used SQL syntax, a regular expression could cater for this. Depending on exactly what is required you could also approach this using a QSortFilterProxyModel and do away with the Next/Prev buttons.

Similar Threads

  1. Finding Files
    By arbi in forum Qt Programming
    Replies: 4
    Last Post: 21st August 2009, 14:30
  2. [java] finding in a HashSet
    By mickey in forum General Programming
    Replies: 3
    Last Post: 17th November 2008, 14:27
  3. finding data in a qtableview
    By JeanC in forum Newbie
    Replies: 4
    Last Post: 7th March 2008, 19:36
  4. Finding widget by name
    By mkarakaplan in forum Newbie
    Replies: 1
    Last Post: 9th December 2007, 17:38

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.