Important: Please read the Qt Code of Conduct -

[Solved] QTableWidget padding

  • I use setCellWidget() method of the class QTableWidget but It puts A LOT of space between the widget border and the cell border, is there a way to remove this cell padding.

    I tried with a stylesheet:
    border: none;
    padding: 0px;
    margin: 0px;

    but it didn't work

  • Moderators

    Well, maybe check if you're setting the style on right widget. I just checked setting the padding and it "just works".
    With code like this:
    ui->tableWidget->setStyleSheet("QTableWidget::item { padding: 0px }");
    ui->tableWidget_2->setStyleSheet("QTableWidget::item { padding: 10px }");
    i get
    ! padding)!

Log in to reply