Enforce focus policy in item delegate's editor

Focus policy can be wider in this case given the limited scope of the
editor widget. This helps workaround platform specific focus policies,
like on Mac, were focus can be restricted depending on the widget type.

Task-number: QTBUG-30715
Change-Id: I69acf8ebff4ba16d473964c91680a1cb0235e3cf
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
bb10
Gabriel de Dietrich 2013-04-22 18:14:09 +02:00 committed by The Qt Project
parent 7dd81686e8
commit 3b992f8319
1 changed files with 4 additions and 1 deletions

View File

@ -523,7 +523,10 @@ QWidget *QItemDelegate::createEditor(QWidget *parent,
const QItemEditorFactory *factory = d->f;
if (factory == 0)
factory = QItemEditorFactory::defaultFactory();
return factory->createEditor(index.data(Qt::EditRole).userType(), parent);
QWidget *w = factory->createEditor(index.data(Qt::EditRole).userType(), parent);
if (w)
w->setFocusPolicy(Qt::WheelFocus);
return w;
}
/*!