How to create delegate for QTreeWidget?
问题 Here is what I'm trying to do (all parents and children must have a close button on the right, in the future, only the hovered item will be able to show the **close ** button): My delegate code: class CloseButton : public QItemDelegate { Q_OBJECT public: CloseButton( QObject* parent = 0 ) : QItemDelegate( parent ) {}; QWidget* createEditor( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const { if ( index.column() == 1 ) { QToolButton* button = new QToolButton