Excel autofilter-like feature possible with QTableView



  • I want to add a permanent button to my horizontal headers in the QTableView objects that will act like the Excel or Libre Office Calc "AutoFilter" feature. ("Permanent" meaning it is always on.)

    I've searched around and found a few hints at how to add this feature, but I'm still confused as where to start.

    I've found someone mention subclassing QHeaderView, rewrite the paintEvent method and then assigning it via QTableView::setHorizontalHeader.

    Otherwise, I have no idea how to

    add the filter button/icon to the header's right hand side,

    catch clicks in that part of the header versus the rest of the header which will catch sort clicks,

    and display a combo box/list view of the contents that is painted over the other rows, rather than expanding the height of the row to accommodate the list.

    I have an idea of how to populate the combo box, so that is not a problem (yet.)

    Any ideas would be appreciated. Otherwise, I plan on having a filter button/Text Box in QDialog to accomplish filters.

    Thanks!



  • jetimms,

    i would like to put same type of solution , QTableview header should have combobox, editbox, ..has you already have solution for this ..could you plz share ....since i m new to Qt...if minimalist runnable project is share would be good

    thankx in advance



  • jetimms,

    i would like to put same type of solution , QTableview header should have combobox, editbox, ..has you already have solution for this ..could you plz share ....since i m new to Qt...if minimalist runnable project is share would be good

    thankx in advance


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.