Hi,
With the property showgrid can enable and disable the grid in a QTableView. How can I do to display a grid with only horizontal lines? Is it possible?
Thanks,
Marcelo E. Geyer
Printable View
Hi,
With the property showgrid can enable and disable the grid in a QTableView. How can I do to display a grid with only horizontal lines? Is it possible?
Thanks,
Marcelo E. Geyer
AFAIK, it's not possible but you can create a custom delegate where you paint it the way you want.
Code:
class CustomDelegate : public QStyledItemDelegate { Q_OBJECT public: }; void CustomDelegate::paint(QPainter *painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const { // Paint the line painter->save(); painter->drawLine(option.rect.bottomLeft(), option.rect.bottomRight()); painter->restore(); // Now paint the normal cell contents this->QStyledItemDelegate::paint(painter, option, index); }