diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2016-06-27 13:08:42 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2016-07-01 06:19:11 +0000 |
commit | 2c4b2d488291e83bf1a6aac1d59351c1a6e901a3 (patch) | |
tree | 94743b9866e7c6e0a7d20827ff104d0c979eeea2 /src/quicktemplates2/qquicktumbler_p_p.h | |
parent | a5df6b69672afd780433ee8f43d343d1e2251fd4 (diff) |
Tumbler: make wrap property depend on count by default
[ChangeLog][Important Behavior Changes][Tumbler] Changed the default
value of wrap to be false when count is less than visibleItemCount.
Explicitly setting wrap overrides this behavior.
Change-Id: I0089f517a25a606625c245df52b0db5fd859ffc0
Task-number: QTBUG-53587
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquicktumbler_p_p.h')
-rw-r--r-- | src/quicktemplates2/qquicktumbler_p_p.h | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquicktumbler_p_p.h b/src/quicktemplates2/qquicktumbler_p_p.h new file mode 100644 index 00000000..daced3a3 --- /dev/null +++ b/src/quicktemplates2/qquicktumbler_p_p.h @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQUICKTUMBLER_P_P_H +#define QQUICKTUMBLER_P_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtQuick/private/qquickitemchangelistener_p.h> +#include <QtQuickTemplates2/private/qquickcontrol_p_p.h> + +QT_BEGIN_NAMESPACE + +class QQuickTumbler; + +class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTumblerPrivate : public QQuickControlPrivate, public QQuickItemChangeListener +{ + Q_DECLARE_PUBLIC(QQuickTumbler) + +public: + QQuickTumblerPrivate(); + ~QQuickTumblerPrivate(); + + enum ContentItemType { + UnsupportedContentItemType, + PathViewContentItem, + ListViewContentItem + }; + + QQuickItem *determineViewType(QQuickItem *contentItem); + void resetViewData(); + QList<QQuickItem *> viewContentItemChildItems() const; + + static QQuickTumblerPrivate *get(QQuickTumbler *tumbler); + + QVariant model; + QQmlComponent *delegate; + int visibleItemCount; + bool wrap; + bool explicitWrap; + bool ignoreWrapChanges; + QQuickItem *view; + QQuickItem *viewContentItem; + ContentItemType viewContentItemType; + int currentIndex; + int pendingCurrentIndex; + bool ignoreCurrentIndexChanges; + int count; + + void _q_updateItemHeights(); + void _q_updateItemWidths(); + void _q_onViewCurrentIndexChanged(); + void _q_onViewCountChanged(); + + void disconnectFromView(); + void setupViewData(QQuickItem *newControlContentItem); + void syncCurrentIndex(); + + void setCount(int newCount); + void setWrapBasedOnCount(); + void setWrap(bool shouldWrap, bool isExplicit); + void lockWrap(); + void unlockWrap(); + + void itemChildAdded(QQuickItem *, QQuickItem *) override; + void itemChildRemoved(QQuickItem *, QQuickItem *) override; +}; + +QT_END_NAMESPACE + +#endif // QQUICKTUMBLER_P_P_H |