diff options
author | Rohan McGovern <rohan@mcgovern.id.au> | 2010-03-06 23:44:26 (GMT) |
---|---|---|
committer | Rohan McGovern <rohan@mcgovern.id.au> | 2010-03-06 23:44:26 (GMT) |
commit | ad341d612129287793620bc84d3077afd64f97a4 (patch) | |
tree | 3d62b038c34985046ad1f3ff56c1c4e85a194ed2 /src/gui/itemviews | |
parent | b20ef0ade0aec89b969bd0ae7f754c680e390c67 (diff) | |
parent | 2458cb45665b0fe3144266122f876bd541de9c42 (diff) | |
download | Qt-ad341d612129287793620bc84d3077afd64f97a4.zip Qt-ad341d612129287793620bc84d3077afd64f97a4.tar.gz Qt-ad341d612129287793620bc84d3077afd64f97a4.tar.bz2 |
Merge remote branch 'origin/4.6' into qt-4.7-from-4.6
Conflicts:
configure.exe
examples/multimedia/audioinput/audioinput.cpp
src/corelib/io/qfsfileengine.cpp
src/gui/egl/qegl_wince.cpp
src/gui/egl/qeglproperties.cpp
src/gui/egl/qeglproperties_p.h
src/gui/embedded/directfb.pri
src/gui/kernel/qapplication_win.cpp
src/gui/painting/qdrawutil.cpp
src/opengl/qgl_p.h
src/sql/drivers/odbc/qsql_odbc.cpp
src/sql/drivers/odbc/qsql_odbc.h
tests/auto/auto.pro
tests/auto/qgl/tst_qgl.cpp
translations/assistant_adp_ru.ts
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 9 | ||||
-rw-r--r-- | src/gui/itemviews/qitemdelegate.cpp | 8 | ||||
-rw-r--r-- | src/gui/itemviews/qstyleditemdelegate.cpp | 7 | ||||
-rw-r--r-- | src/gui/itemviews/qtableview.cpp | 14 |
4 files changed, 20 insertions, 18 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index bc6db90..2faf755 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2568,6 +2568,7 @@ void QAbstractItemView::updateEditorGeometries() QStyleOptionViewItemV4 option = d->viewOptionsV4(); QList<QEditorInfo>::iterator it = d->editors.begin(); QWidgetList editorsToRelease; + QWidgetList editorsToHide; while (it != d->editors.end()) { QModelIndex index = it->index; QWidget *editor = it->editor; @@ -2579,7 +2580,7 @@ void QAbstractItemView::updateEditorGeometries() if (delegate) delegate->updateEditorGeometry(editor, option, index); } else { - editor->hide(); + editorsToHide << editor; } ++it; } else { @@ -2588,8 +2589,11 @@ void QAbstractItemView::updateEditorGeometries() } } - //we release the editor outside of the loop because it might change the focus and try + //we hide and release the editor outside of the loop because it might change the focus and try //to change the d->editors list. + for (int i = 0; i < editorsToHide.count(); ++i) { + editorsToHide.at(i)->hide(); + } for (int i = 0; i < editorsToRelease.count(); ++i) { d->releaseEditor(editorsToRelease.at(i)); } @@ -3046,6 +3050,7 @@ void QAbstractItemView::setIndexWidget(const QModelIndex &index, QWidget *widget if (!d->isIndexValid(index)) return; if (QWidget *oldWidget = indexWidget(index)) { + d->persistent.remove(oldWidget); d->removeEditor(oldWidget); oldWidget->deleteLater(); } diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp index 9069ce4..7d8e103 100644 --- a/src/gui/itemviews/qitemdelegate.cpp +++ b/src/gui/itemviews/qitemdelegate.cpp @@ -1297,14 +1297,8 @@ bool QItemDelegate::editorEvent(QEvent *event, return false; } - Qt::CheckState state; - if ( flags & Qt::ItemIsTristate ) { - state = static_cast<Qt::CheckState>( (value.toInt() + 1) % 3 ); - } else { - state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked + Qt::CheckState state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked ? Qt::Unchecked : Qt::Checked); - } - return model->setData(index, state, Qt::CheckStateRole); } diff --git a/src/gui/itemviews/qstyleditemdelegate.cpp b/src/gui/itemviews/qstyleditemdelegate.cpp index 9aac554..880f8ab 100644 --- a/src/gui/itemviews/qstyleditemdelegate.cpp +++ b/src/gui/itemviews/qstyleditemdelegate.cpp @@ -747,13 +747,8 @@ bool QStyledItemDelegate::editorEvent(QEvent *event, return false; } - Qt::CheckState state; - if ( flags & Qt::ItemIsTristate ) { - state = static_cast<Qt::CheckState>( (value.toInt() + 1) % 3 ); - } else { - state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked + Qt::CheckState state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked ? Qt::Unchecked : Qt::Checked); - } return model->setData(index, state, Qt::CheckStateRole); } diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index bdc1205..46fd9d0 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -1908,6 +1908,7 @@ QRegion QTableView::visualRegionForSelection(const QItemSelection &selection) co width, rowHeight(r))); } } else { // nothing moved + const int gridAdjust = showGrid() ? 1 : 0; for (int i = 0; i < selection.count(); ++i) { QItemSelectionRange range = selection.at(i); if (range.parent() != d->root || !range.isValid()) @@ -1916,9 +1917,16 @@ QRegion QTableView::visualRegionForSelection(const QItemSelection &selection) co const int rtop = rowViewportPosition(range.top()); const int rbottom = rowViewportPosition(range.bottom()) + rowHeight(range.bottom()); - const int rleft = columnViewportPosition(range.left()); - const int rright = columnViewportPosition(range.right()) + columnWidth(range.right()); - selectionRegion += QRect(QPoint(rleft, rtop), QPoint(rright, rbottom)); + int rleft; + int rright; + if (isLeftToRight()) { + rleft = columnViewportPosition(range.left()); + rright = columnViewportPosition(range.right()) + columnWidth(range.right()); + } else { + rleft = columnViewportPosition(range.right()); + rright = columnViewportPosition(range.left()) + columnWidth(range.left()); + } + selectionRegion += QRect(QPoint(rleft, rtop), QPoint(rright - 1 - gridAdjust, rbottom - 1 - gridAdjust)); if (d->hasSpans()) { foreach (QSpanCollection::Span *s, d->spans.spansInRect(range.left(), range.top(), range.width(), range.height())) { |