[tabbox] Fix forwarding grabbed key event to QQuickItem
We need to send the event to a QQuickItem which accepts focus. Just sending it to the Window or to the contentItem doesn't work as there is no activeFocusItem (might be related to having the keyboard grabbed). We try to send the event to all children of the Window's content item. There should hopefully be one item which accepts the event and properly reacts on cursor keys. REVIEW: 118471
This commit is contained in:
parent
17ca566154
commit
d1798202e8
1 changed files with 8 additions and 2 deletions
|
@ -489,10 +489,16 @@ const QModelIndex& TabBoxHandler::currentIndex() const
|
|||
|
||||
void TabBoxHandler::grabbedKeyEvent(QKeyEvent* event) const
|
||||
{
|
||||
if (!d->m_mainItem) {
|
||||
if (!d->m_mainItem || !d->window()) {
|
||||
return;
|
||||
}
|
||||
QApplication::sendEvent(d->window(), event);
|
||||
const QList<QQuickItem*> items = d->window()->contentItem()->findChildren<QQuickItem*>(QString(), Qt::FindDirectChildrenOnly);
|
||||
for (QQuickItem *item : items) {
|
||||
d->window()->sendEvent(item, event);
|
||||
if (event->isAccepted()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool TabBoxHandler::containsPos(const QPoint& pos) const
|
||||
|
|
Loading…
Reference in a new issue