summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qabstractitemview.cpp
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2009-12-14 13:55:36 +0200
committerSami Merila <sami.merila@nokia.com>2009-12-14 13:55:36 +0200
commit83d333a2b181cbd5c87219599fdc188757261269 (patch)
treeb7e07a0cea0dd3dd9e648e9d8db7b3ae118c6905 /src/gui/itemviews/qabstractitemview.cpp
parentb2f4c48d5d3096e7c12fd51b8bc6bdabe2c6fd7b (diff)
FEP indicator shown in status pane when it should not
FEP indicator is shown in few cases in statusbar when it should not be. Case a) Application contains item view. QAbstractItemView is initialized as having WA_InputMethodEnabled on, irregardless of functionality of each separate cell. So we need to check the model for the itemview cell about to receive focus, is it editable. If it isn't then, we'll set the WA_InputMethodEnabled as false. This will fix the FEP indicators in a lot of cases: lists with cells, empty lists, combobox lists, ... Case b) Combobox also initializes itself with WA_InputMethodEnabled active. Even if the fix a) fixed the list inside combobox, the widget itself when receiving focus needs also fixing. If we check the editable flag of combobox when initializing the comment, we can set the flag off. Task-number: QTBUG-5705 Reviewed-by: axis
Diffstat (limited to 'src/gui/itemviews/qabstractitemview.cpp')
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index de6e6cb2a7..d0aac2a66b 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -2065,9 +2065,13 @@ void QAbstractItemView::focusInEvent(QFocusEvent *event)
{
Q_D(QAbstractItemView);
QAbstractScrollArea::focusInEvent(event);
- if (selectionModel()
+
+ const QItemSelectionModel* model = selectionModel();
+ const bool currentIndexValid = currentIndex().isValid();
+
+ if (model
&& !d->currentIndexSet
- && !currentIndex().isValid()) {
+ && !currentIndexValid) {
bool autoScroll = d->autoScroll;
d->autoScroll = false;
QModelIndex index = moveCursor(MoveNext, Qt::NoModifier); // first visible index
@@ -2075,6 +2079,17 @@ void QAbstractItemView::focusInEvent(QFocusEvent *event)
selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
d->autoScroll = autoScroll;
}
+
+ if (model && currentIndexValid) {
+ if (currentIndex().flags() != Qt::ItemIsEditable)
+ setAttribute(Qt::WA_InputMethodEnabled, false);
+ else
+ setAttribute(Qt::WA_InputMethodEnabled);
+ }
+
+ if (!currentIndexValid)
+ setAttribute(Qt::WA_InputMethodEnabled, false);
+
d->viewport->update();
}