Results 1 to 5 of 5

Thread: QTableView and regexp

  1. #1
    Join Date
    May 2016
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default QTableView and regexp

    Hello,

    I have to port an existing application to Qt (5.6) ... and try to display data (from SQL) in a QTableView.

    The problem is that I want to have an editable row ABOVE the header of the QTableView to type some regexp to filter the content of any column.
    I have no idea how to do that :
    - write a custom QTableView ?
    - write a custom QHeaderView ?
    - other ?

    Thanks for your help ...

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTableView and regexp

    Above the header?

    Couldn't that easily be solved by having a QLineEdit above the table view and within the same QVBoxLayout?

    Cheers,
    _

  3. #3
    Join Date
    May 2016
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTableView and regexp

    Quote Originally Posted by anda_skoa View Post
    Above the header?

    Couldn't that easily be solved by having a QLineEdit above the table view and within the same QVBoxLayout?

    Cheers,
    _
    Thanks for your interest ...

    But with your suggestion I'd need one QLineEdit per column and they all have to resize the same way the columns do !
    Looks quite complicated to manage ... and the only solution I imagined ... :-(

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTableView and regexp

    Ah, hmm.

    Then maybe instead of a single line edit a QHBoxLayout of line edits, each line edit with a fixed width corresponding to the respective section width of the header view.
    Then also connect to the header view's sectionResized() signal and adjust the fixed width of the line edit for that section.

    Cheers,
    _

  5. #5
    Join Date
    Jun 2011
    Posts
    5
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTableView and regexp

    Quote Originally Posted by gnogno35 View Post
    Hello,

    I have to port an existing application to Qt (5.6) ... and try to display data (from SQL) in a QTableView.

    The problem is that I want to have an editable row ABOVE the header of the QTableView to type some regexp to filter the content of any column.
    I have no idea how to do that :
    - write a custom QTableView ?
    - write a custom QHeaderView ?
    - other ?

    Thanks for your help ...
    Hello,

    Its little bit complex way of creating them. You can refer to the sqlitebrowser code, in sqlite browser we have similar functionality of providing a line edits for all the columns below the header which helps in filtering the data. You can find the sqlitebrowser code in the following site (http://sqlitebrowser.org/)

    Hope it helps....

Similar Threads

  1. A problem with RegExp
    By 8Observer8 in forum Newbie
    Replies: 2
    Last Post: 16th August 2013, 04:55
  2. Negative regexp
    By mero in forum Qt Programming
    Replies: 1
    Last Post: 30th January 2013, 21:59
  3. RegExp Question
    By slava in forum Qt Programming
    Replies: 3
    Last Post: 12th July 2010, 19:33
  4. RegExp
    By pucara_faa in forum Qt Programming
    Replies: 2
    Last Post: 15th November 2009, 13:41
  5. RegExp question
    By high_flyer in forum General Programming
    Replies: 1
    Last Post: 26th August 2007, 18:23

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.