simple delegate example
{
bar->setMaximum(100);
bar->setValue(50);
return bar;
}
{
editor->setGeometry(option.rect);
}
QWidget *MyItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QProgressBar *bar = new QProgressBar(parent);
bar->setMaximum(100);
bar->setValue(50);
return bar;
}
void MyItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/*index*/) const
{
editor->setGeometry(option.rect);
}
To copy to clipboard, switch view to plain text mode
in widget:
...
tw->setItemDelegate(new MyItemDelegate);
...
...
QTableWidget *tw = new QTableWidget(10, 2, this);
tw->setItemDelegate(new MyItemDelegate);
...
To copy to clipboard, switch view to plain text mode
Bookmarks