Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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:
    @
    QTableWidget::item{
    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
    !http://img854.imageshack.us/img854/7120/tablepadding.jpg(table padding)!


Log in to reply