How to Align the Custom Widget inside a QTableView



  • In my QTableView, I have to make use of my own custom widgets. I have created my own delegates extending the QStyleItemDelegate. Initially all the widgets are painted using the paint() function. When the user clicks on the Table cell, i want to make these widgets as editable. So in my createEditor() function I am creating my own custom widgets. Whenever I click on the table cell, the custom widgets are created. ie) Editor is created with the custom widget. But, the problem is, the newly created editor doesn't fits the actual size of the table cell. It is created by leaving some space of the table cell and creates the editor. Can anyone please explain why this problem occurs and how to solve it.


  • Lifetime Qt Champion

    Hi,

    IIRC you can re-implement sizeHint to return something more sensible for your editor.

    Hope it helps


Log in to reply
 

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