diff options
author | Sami Merila <sami.merila@nokia.com> | 2009-12-14 11:55:36 (GMT) |
---|---|---|
committer | Sami Merila <sami.merila@nokia.com> | 2009-12-14 11:55:36 (GMT) |
commit | 83d333a2b181cbd5c87219599fdc188757261269 (patch) | |
tree | b7e07a0cea0dd3dd9e648e9d8db7b3ae118c6905 /src/gui | |
parent | b2f4c48d5d3096e7c12fd51b8bc6bdabe2c6fd7b (diff) | |
download | Qt-83d333a2b181cbd5c87219599fdc188757261269.zip Qt-83d333a2b181cbd5c87219599fdc188757261269.tar.gz Qt-83d333a2b181cbd5c87219599fdc188757261269.tar.bz2 |
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')
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 19 | ||||
-rw-r--r-- | src/gui/widgets/qcombobox.cpp | 5 |
2 files changed, 21 insertions, 3 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index de6e6cb..d0aac2a 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(); } diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index bd1d8ba..b7dd20c 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -931,7 +931,10 @@ void QComboBoxPrivate::init() QSizePolicy::ComboBox)); setLayoutItemMargins(QStyle::SE_ComboBoxLayoutItem); q->setModel(new QStandardItemModel(0, 1, q)); - q->setAttribute(Qt::WA_InputMethodEnabled); + if (!q->isEditable()) + q->setAttribute(Qt::WA_InputMethodEnabled, false); + else + q->setAttribute(Qt::WA_InputMethodEnabled); } QComboBoxPrivateContainer* QComboBoxPrivate::viewContainer() |