summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qcolumnview.cpp
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-07-07 13:13:44 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-07-07 13:14:58 (GMT)
commite5e2f9fd5c1554337a576374ec6744f953d2404d (patch)
treef64fffb41f469a5318267d233cad4890b860006a /src/gui/itemviews/qcolumnview.cpp
parentf5392a4290e5f7ae2bdf268c1fa8c037e776fdae (diff)
downloadQt-e5e2f9fd5c1554337a576374ec6744f953d2404d.zip
Qt-e5e2f9fd5c1554337a576374ec6744f953d2404d.tar.gz
Qt-e5e2f9fd5c1554337a576374ec6744f953d2404d.tar.bz2
QColumnView: didn't react to addition of rows/cols in the current view
Task-number: 246999
Diffstat (limited to 'src/gui/itemviews/qcolumnview.cpp')
-rw-r--r--src/gui/itemviews/qcolumnview.cpp45
1 files changed, 44 insertions, 1 deletions
diff --git a/src/gui/itemviews/qcolumnview.cpp b/src/gui/itemviews/qcolumnview.cpp
index 1662fa8..ff20163 100644
--- a/src/gui/itemviews/qcolumnview.cpp
+++ b/src/gui/itemviews/qcolumnview.cpp
@@ -52,7 +52,6 @@
#include <qscrollbar.h>
#include <qpainter.h>
#include <qdebug.h>
-#include <qpainterpath.h>
QT_BEGIN_NAMESPACE
@@ -896,6 +895,15 @@ QList<int> QColumnView::columnWidths() const
/*!
\reimp
*/
+void QColumnView::rowsInserted(const QModelIndex &parent, int start, int end)
+{
+ QAbstractItemView::rowsInserted(parent, start, end);
+ d_func()->checkColumnCreation(parent);
+}
+
+/*!
+ \reimp
+*/
void QColumnView::currentChanged(const QModelIndex &current, const QModelIndex &previous)
{
Q_D(QColumnView);
@@ -1048,6 +1056,41 @@ QColumnViewPrivate::~QColumnViewPrivate()
/*!
\internal
+
+ */
+void QColumnViewPrivate::_q_columnsInserted(const QModelIndex &parent, int start, int end)
+{
+ QAbstractItemViewPrivate::_q_columnsInserted(parent, start, end);
+ checkColumnCreation(parent);
+}
+
+/*!
+ \internal
+
+ Makes sure we create a corresponding column as a result of changing the model.
+
+ */
+void QColumnViewPrivate::checkColumnCreation(const QModelIndex &parent)
+{
+ if (parent == q_func()->currentIndex() && model->hasChildren(parent)) {
+ //the parent has children and is the current
+ //let's try to find out if there is already a mapping that is good
+ for (int i = 0; i < columns.count(); ++i) {
+ QAbstractItemView *view = columns.at(i);
+ if (view->rootIndex() == parent) {
+ if (view == previewColumn) {
+ //let's recreate the parent
+ closeColumns(parent, false);
+ createColumn(parent, true /*show*/);
+ }
+ break;
+ }
+ }
+ }
+}
+
+/*!
+ \internal
Place all of the columns where they belong inside of the viewport, resize as necessary.
*/
void QColumnViewPrivate::doLayout()