Hi,
in a sublassed QItemDelegate I create an editor which is higher than the normal item height (tested with QListWidget and QTreeVeiw). Therefore I also reimplement updateEditorGeometry() which updates the editor geometry to the adjusted size of my widget. But the problem is, that the other items don't moved down. So the editor hides the items below. How to move the positions of the other items?
Lykurg
myDelegate
::myDelegate( QObject *_parent
) :{
}
myDelegate::~myDelegate()
{
}
{
editorWidget *ed = new editorWidget( parent );
ed->adjustSize();
return ed;
}
{
r.setX( 30 ); // just for showing the overlay
r.setSize( editor->sizeHint() );
editor->setGeometry( r );
}
myDelegate::myDelegate( QObject *_parent ) :
QItemDelegate( _parent )
{
tw = (QListWidget*) _parent;
}
myDelegate::~myDelegate()
{
}
QWidget * myDelegate::createEditor( QWidget *parent, const QStyleOptionViewItem &, const QModelIndex & ) const
{
editorWidget *ed = new editorWidget( parent );
ed->adjustSize();
return ed;
}
void myDelegate::updateEditorGeometry( QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/*index*/) const
{
QRect r = option.rect;
r.setX( 30 ); // just for showing the overlay
r.setSize( editor->sizeHint() );
editor->setGeometry( r );
}
To copy to clipboard, switch view to plain text mode
Bookmarks