aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktableview.cpp
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-06-21 10:28:02 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-06-21 13:55:30 +0000
commitaeb521054fdc070e3480f30c6595155075c10136 (patch)
tree37311367eb1cd67f78f13d73bf82f69a335523a0 /src/quick/items/qquicktableview.cpp
parent77cb60e0c071f9762f565f1f38859421c928dd4a (diff)
QQmlDelegateModel: even for QAIM, only use first column by default
In 2f9afadd5d9b4899397dca, we introduced a change in QQmlAdaptorModel so that a QAIM model report that it contains "rows * cols" number of model items, and not just "rows". This was needed, otherwise TableView would only display the first column of such models. It turns out, however, that also ListView will now detect that a QAIM contain more items than just the items in the first column. The result will be that it ends up adding all the other columns underneath the first column in the view. To avoid this unforseen change, this patch will revert this logic, and instead add a private variable that can be set if the new behavior is wanted (e.g by TableView). Change-Id: I8c13da99f05e2f922362e498d1fa1779cdbd0d72 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quick/items/qquicktableview.cpp')
-rw-r--r--src/quick/items/qquicktableview.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp
index 8c092c5894..bcdc06a783 100644
--- a/src/quick/items/qquicktableview.cpp
+++ b/src/quick/items/qquicktableview.cpp
@@ -42,6 +42,7 @@
#include <QtCore/qtimer.h>
#include <QtQml/private/qqmldelegatemodel_p.h>
+#include <QtQml/private/qqmldelegatemodel_p_p.h>
#include <QtQml/private/qqmlincubator_p.h>
#include <QtQml/private/qqmlchangeset_p.h>
#include <QtQml/qqmlinfo.h>
@@ -1392,6 +1393,7 @@ void QQuickTableView::setModel(const QVariant &newModel)
} else {
if (!d->delegateModel)
d->createWrapperModel();
+ QQmlDelegateModelPrivate::get(d->delegateModel)->m_useFirstColumnOnly = false;
d->delegateModel->setModel(effectiveModelVariant);
}