diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-01-20 13:53:35 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-01-20 15:26:24 +0000 |
commit | fa388f4a5986ae243d9d50ea26b320cb76619377 (patch) | |
tree | 82860eb1f9b1e0dba395e054327cd9910b2b3a34 | |
parent | bc29da5c224d277dfa94ae4e188df1db325ae83a (diff) |
Move QQuickScrollBar(Attached)Private to a private header
To make the private classes accessible for the upcoming ScrollView.
Change-Id: Iae1d7f9b136a99ac5892418c52071a902e665476
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r-- | src/quicktemplates2/qquickscrollbar.cpp | 93 | ||||
-rw-r--r-- | src/quicktemplates2/qquickscrollbar_p.h | 1 | ||||
-rw-r--r-- | src/quicktemplates2/qquickscrollbar_p_p.h | 124 | ||||
-rw-r--r-- | src/quicktemplates2/quicktemplates2.pri | 1 |
4 files changed, 144 insertions, 75 deletions
diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp index ea3a71dd..d2d9a194 100644 --- a/src/quicktemplates2/qquickscrollbar.cpp +++ b/src/quicktemplates2/qquickscrollbar.cpp @@ -35,11 +35,10 @@ ****************************************************************************/ #include "qquickscrollbar_p.h" -#include "qquickcontrol_p_p.h" +#include "qquickscrollbar_p_p.h" #include <QtQml/qqmlinfo.h> #include <QtQuick/private/qquickflickable_p.h> -#include <QtQuick/private/qquickitemchangelistener_p.h> QT_BEGIN_NAMESPACE @@ -155,51 +154,19 @@ static const QQuickItemPrivate::ChangeTypes changeTypes = QQuickItemPrivate::Geo static const QQuickItemPrivate::ChangeTypes horizontalChangeTypes = changeTypes | QQuickItemPrivate::ImplicitHeight; static const QQuickItemPrivate::ChangeTypes verticalChangeTypes = changeTypes | QQuickItemPrivate::ImplicitWidth; -class QQuickScrollBarPrivate : public QQuickControlPrivate -{ - Q_DECLARE_PUBLIC(QQuickScrollBar) - -public: - QQuickScrollBarPrivate() - : size(0), - position(0), - stepSize(0), - offset(0), - active(false), - pressed(false), - moving(false), - interactive(true), - orientation(Qt::Vertical), - snapMode(QQuickScrollBar::NoSnap) - { - } - - static QQuickScrollBarPrivate *get(QQuickScrollBar *bar) - { - return bar->d_func(); - } - - qreal snapPosition(qreal position) const; - qreal positionAt(const QPointF &point) const; - void updateActive(); - void resizeContent() override; - - void handlePress(const QPointF &point); - void handleMove(const QPointF &point); - void handleRelease(const QPointF &point); - void handleUngrab(); - - qreal size; - qreal position; - qreal stepSize; - qreal offset; - bool active; - bool pressed; - bool moving; - bool interactive; - Qt::Orientation orientation; - QQuickScrollBar::SnapMode snapMode; -}; +QQuickScrollBarPrivate::QQuickScrollBarPrivate() + : size(0), + position(0), + stepSize(0), + offset(0), + active(false), + pressed(false), + moving(false), + interactive(true), + orientation(Qt::Vertical), + snapMode(QQuickScrollBar::NoSnap) +{ +} qreal QQuickScrollBarPrivate::snapPosition(qreal position) const { @@ -603,34 +570,12 @@ QAccessible::Role QQuickScrollBar::accessibleRole() const } #endif -class QQuickScrollBarAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener +QQuickScrollBarAttachedPrivate::QQuickScrollBarAttachedPrivate() + : flickable(nullptr), + horizontal(nullptr), + vertical(nullptr) { -public: - QQuickScrollBarAttachedPrivate() - : flickable(nullptr), - horizontal(nullptr), - vertical(nullptr) - { - } - - void activateHorizontal(); - void activateVertical(); - void scrollHorizontal(); - void scrollVertical(); - void mirrorVertical(); - - void layoutHorizontal(bool move = true); - void layoutVertical(bool move = true); - - void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override; - void itemImplicitWidthChanged(QQuickItem *item) override; - void itemImplicitHeightChanged(QQuickItem *item) override; - void itemDestroyed(QQuickItem *item) override; - - QQuickFlickable *flickable; - QQuickScrollBar *horizontal; - QQuickScrollBar *vertical; -}; +} void QQuickScrollBarAttachedPrivate::activateHorizontal() { diff --git a/src/quicktemplates2/qquickscrollbar_p.h b/src/quicktemplates2/qquickscrollbar_p.h index 512e0b06..b447694a 100644 --- a/src/quicktemplates2/qquickscrollbar_p.h +++ b/src/quicktemplates2/qquickscrollbar_p.h @@ -52,7 +52,6 @@ QT_BEGIN_NAMESPACE -class QQuickFlickable; class QQuickScrollBarAttached; class QQuickScrollBarPrivate; diff --git a/src/quicktemplates2/qquickscrollbar_p_p.h b/src/quicktemplates2/qquickscrollbar_p_p.h new file mode 100644 index 00000000..20d66716 --- /dev/null +++ b/src/quicktemplates2/qquickscrollbar_p_p.h @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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 QQUICKSCROLLBAR_P_P_H +#define QQUICKSCROLLBAR_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 <QtQuickTemplates2/private/qquickscrollbar_p.h> +#include <QtQuickTemplates2/private/qquickcontrol_p_p.h> +#include <QtQuick/private/qquickitemchangelistener_p.h> + +QT_BEGIN_NAMESPACE + +class QQuickFlickable; + +class QQuickScrollBarPrivate : public QQuickControlPrivate +{ + Q_DECLARE_PUBLIC(QQuickScrollBar) + +public: + QQuickScrollBarPrivate(); + + static QQuickScrollBarPrivate *get(QQuickScrollBar *bar) + { + return bar->d_func(); + } + + qreal snapPosition(qreal position) const; + qreal positionAt(const QPointF &point) const; + void updateActive(); + void resizeContent() override; + + void handlePress(const QPointF &point); + void handleMove(const QPointF &point); + void handleRelease(const QPointF &point); + void handleUngrab(); + + qreal size; + qreal position; + qreal stepSize; + qreal offset; + bool active; + bool pressed; + bool moving; + bool interactive; + Qt::Orientation orientation; + QQuickScrollBar::SnapMode snapMode; +}; + +class QQuickScrollBarAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener +{ +public: + QQuickScrollBarAttachedPrivate(); + + static QQuickScrollBarAttachedPrivate *get(QQuickScrollBarAttached *attached) + { + return attached->d_func(); + } + + void activateHorizontal(); + void activateVertical(); + void scrollHorizontal(); + void scrollVertical(); + void mirrorVertical(); + + void layoutHorizontal(bool move = true); + void layoutVertical(bool move = true); + + void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override; + void itemImplicitWidthChanged(QQuickItem *item) override; + void itemImplicitHeightChanged(QQuickItem *item) override; + void itemDestroyed(QQuickItem *item) override; + + QQuickFlickable *flickable; + QQuickScrollBar *horizontal; + QQuickScrollBar *vertical; +}; + +QT_END_NAMESPACE + +#endif // QQUICKSCROLLBAR_P_P_H diff --git a/src/quicktemplates2/quicktemplates2.pri b/src/quicktemplates2/quicktemplates2.pri index e8f02d62..8ef1ef28 100644 --- a/src/quicktemplates2/quicktemplates2.pri +++ b/src/quicktemplates2/quicktemplates2.pri @@ -52,6 +52,7 @@ HEADERS += \ $$PWD/qquickrangeslider_p.h \ $$PWD/qquickroundbutton_p.h \ $$PWD/qquickscrollbar_p.h \ + $$PWD/qquickscrollbar_p_p.h \ $$PWD/qquickscrollindicator_p.h \ $$PWD/qquickshortcutcontext_p_p.h \ $$PWD/qquickslider_p.h \ |