Hi all,how to set the border's color/style/width of a specified cell in the QTableWidget?
Hi all,how to set the border's color/style/width of a specified cell in the QTableWidget?
You set the row/column width/height by calling QHeaderView::resizeSection() on the horizontalHeader()/verticalheader(). You can have them resize themselves in various ways by using QHeaderView::setResizeMode().
The background, text alignment, font etc. are controlled by data supplied through the model (QTableView) or QTableWidgetItems (QTableWidget). These roles are relevant: Qt::BackgroundRole, Qt::CheckStateRole, Qt::CheckState, Qt:ecorationRole, Qt::FontRole, Qt::TextAlignmentRole, Qt::ForegroundRole
You can implement borders on a cell (separate from the table grid lines) using a QStyledItemDelegate and its paintEvent().
You can implement borders on a cell (separate from the table grid lines) using a QStyledItemDelegate and its paintEvent().
Thanks,I know that we should subclass the QStyleItemDelegate and reimplement the paint() and sizeHint() methods.Since I'm just a beginner of Qt,may you provide me a example program what can set the border's color of the specified cell?
Bookmarks