PDA

View Full Version : QTreeWidget: widgets in header



Jonny174
23rd April 2012, 06:15
Hi All!
How can I set some widget in QTreeWidget header? I need to place in header QLineEdit and QDoubleSpinBox. I tried this code, but this not work.


QTreeWidget *tree = new QTreeWidget( this );
tree->setColumnCount( 5 );

QLineEdit *edit = new QLineEdit( tree->header() );
QDoubleSpinBox *spin = new QDoubleSpinBox( tree->header() );

tree->header()->setIndexWidget( tree->model()->index( 0, 0 ), edit );
tree->header()->setIndexWidget( tree->model()->index( 0, 1 ), spin );