Qt World Summit: Register Today!

setView() for QComboBox

  • Hi,

    We are trying to create a custom QTableView for the popUp widget of our subclass of QComboBox. We are currently calling setView() and setModel() using our subclasses of QTableView and QAbstractTableModel. We have had success with getting a QTableView to appear populated and drawn correctly when showPopup() is invoked, but parent QComboBox class only wants to use the row aspect of the indices we generated via pressed() events. I.e., if I select the item with index [2,1] (3rd row, 2nd column), the QComboBox class updates its text with the value at index [2,0] of my model!

    We've also tried specifying a QTableView using a proxy model interfaced to the internal QAbstractItem model object, to leave the internal list-based model with a reliance on rows in place. However, we lost the ability to render the table-view.

    Do we have to override other event processing in our subclass of QComboBox, e.g., event() or mouseReleaseEvent()? Any insight into what we are doing wrong would be appreciated.

Log in to reply