Important: Please read the Qt Code of Conduct -

QTableWidget, CellWidget read only.

  • From google. I found that you can centralize a widget by making a Qwidget, Adding a layout and inserting the widget. This is cool and all but because it's not a QTableWidgetItem I don't know how to set flags and make it 'read only'

    Here's how I insert my widget in the table:

    buttonWidget = QWidget()
    bWidgetLayout = QHBoxLayout(buttonWidget)
    button = QPushButton()
    tableWidget.setCellWidget(0,0, buttonWidget)

  • Lifetime Qt Champion


    Call setEnabled(false).

    Beware of your use of cell widgets. It's not meant as a solution to populate full columns.

Log in to reply