Important: Please read the Qt Code of Conduct -

Make QWidget fit into a QTableView Cell

  • I have a QWidget that i show in a QTableView. For that i have a Delegate and a Model. In the QWidget i set the Margin and Padding to Zero, but i have that Problem shown on the Picture


    Anyone knows how i can make it that it fits to his Content? I dont like the Grey Box around the Widget.

    Finally i got that working by doing this.

    rating->render(painter, painter->deviceTransform().map(option.rect.topLeft()));

    Maybe thats not correct.

  • The Third Argument of render is a QRegion. With it i was able to fix the Size and the Offset.

Log in to reply