diff options
author | Liang Qi <liang.qi@qt.io> | 2017-10-04 10:41:19 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-10-04 13:41:04 +0200 |
commit | bc5f45052fd8f9a5481a37a6a4d55c7f6cbf037d (patch) | |
tree | 2c20e6c42ccd008e431a8d485450713883eacbb5 /src/widgets/itemviews | |
parent | b8947e9194f0f88f464448ac51f6a05113d36a33 (diff) | |
parent | 3faf8f4d48abd982be8470786cc5f61372519722 (diff) |
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
src/corelib/global/qconfig-bootstrapped.h
src/corelib/global/qglobal.h
src/corelib/tools/qcryptographichash.cpp
src/corelib/tools/qcryptographichash.h
src/corelib/tools/qmessageauthenticationcode.cpp
src/plugins/platforms/windows/qwindowswindow.h
tests/auto/gui/kernel/qwindow/BLACKLIST
tests/auto/widgets/itemviews/qitemdelegate/BLACKLIST
Change-Id: Ib68112de985a3d714c2071f47c10e907e4f0229a
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r-- | src/widgets/itemviews/qabstractitemview.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index fe27be8522..15e6b0eb99 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -2230,7 +2230,7 @@ void QAbstractItemView::focusInEvent(QFocusEvent *event) QAbstractScrollArea::focusInEvent(event); const QItemSelectionModel* model = selectionModel(); - const bool currentIndexValid = currentIndex().isValid(); + bool currentIndexValid = currentIndex().isValid(); if (model && !d->currentIndexSet @@ -2238,19 +2238,16 @@ void QAbstractItemView::focusInEvent(QFocusEvent *event) bool autoScroll = d->autoScroll; d->autoScroll = false; QModelIndex index = moveCursor(MoveNext, Qt::NoModifier); // first visible index - if (index.isValid() && d->isIndexEnabled(index) && event->reason() != Qt::MouseFocusReason) + if (index.isValid() && d->isIndexEnabled(index) && event->reason() != Qt::MouseFocusReason) { selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate); + currentIndexValid = true; + } d->autoScroll = autoScroll; } - if (model && currentIndexValid) { - if (currentIndex().flags() != Qt::ItemIsEditable) - setAttribute(Qt::WA_InputMethodEnabled, false); - else - setAttribute(Qt::WA_InputMethodEnabled); - } - - if (!currentIndexValid) + if (model && currentIndexValid) + setAttribute(Qt::WA_InputMethodEnabled, (currentIndex().flags() & Qt::ItemIsEditable)); + else if (!currentIndexValid) setAttribute(Qt::WA_InputMethodEnabled, false); d->viewport->update(); @@ -3665,6 +3662,7 @@ void QAbstractItemView::currentChanged(const QModelIndex ¤t, const QModelI d->shouldScrollToCurrentOnShow = d->autoScroll; } } + setAttribute(Qt::WA_InputMethodEnabled, (current.isValid() && (current.flags() & Qt::ItemIsEditable))); } #ifndef QT_NO_DRAGANDDROP |