From f944c34757baf145f7018e37bc732d061f0bbf7f Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 29 Apr 2015 09:54:50 +0200 Subject: Remove the old TabView implementation Change-Id: I8d8aa96f2f37f458577a5a3ec681e3c9174d0918 Reviewed-by: J-P Nurmi --- src/controls/controls.pri | 2 - src/controls/qquicktabview.cpp | 236 ------------------------ src/controls/qquicktabview_p.h | 129 ------------- src/imports/controls/TabView.qml | 91 --------- src/imports/controls/controls.pro | 1 - src/imports/controls/qmldir | 1 - src/imports/controls/qtquickcontrols2plugin.cpp | 3 - 7 files changed, 463 deletions(-) delete mode 100644 src/controls/qquicktabview.cpp delete mode 100644 src/controls/qquicktabview_p.h delete mode 100644 src/imports/controls/TabView.qml (limited to 'src') diff --git a/src/controls/controls.pri b/src/controls/controls.pri index 0205a03e..9a7efe97 100644 --- a/src/controls/controls.pri +++ b/src/controls/controls.pri @@ -27,7 +27,6 @@ HEADERS += \ $$PWD/qquickswitch_p.h \ $$PWD/qquicktabbar_p.h \ $$PWD/qquicktabbutton_p.h \ - $$PWD/qquicktabview_p.h \ $$PWD/qquicktextarea_p.h \ $$PWD/qquicktextfield_p.h \ $$PWD/qquicktogglebutton_p.h \ @@ -56,7 +55,6 @@ SOURCES += \ $$PWD/qquickswitch.cpp \ $$PWD/qquicktabbar.cpp \ $$PWD/qquicktabbutton.cpp \ - $$PWD/qquicktabview.cpp \ $$PWD/qquicktextarea.cpp \ $$PWD/qquicktextfield.cpp \ $$PWD/qquicktogglebutton.cpp \ diff --git a/src/controls/qquicktabview.cpp b/src/controls/qquicktabview.cpp deleted file mode 100644 index 4b2485b0..00000000 --- a/src/controls/qquicktabview.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Quick Controls 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$ -** -****************************************************************************/ - -#include "qquicktabview_p.h" -#include "qquicktabbar_p.h" -#include "qquickcontainer_p_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \qmltype TabView - \inherits Container - \instantiates QQuickTabView - \inqmlmodule QtQuick.Controls - \ingroup tabs - \brief A tab view control. - - TODO -*/ - -class QQuickTabViewPrivate : public QQuickContainerPrivate -{ -public: - QQuickTabViewPrivate() : currentIndex(0), bar(Q_NULLPTR) { } - - int currentIndex; - QQuickTabBar *bar; -}; - -QQuickTabView::QQuickTabView(QQuickItem *parent) : - QQuickContainer(*(new QQuickTabViewPrivate), parent) -{ - setFlag(ItemIsFocusScope); - setActiveFocusOnTab(true); -} - -/*! - \qmlproperty int QtQuickControls2::TabView::currentIndex - - TODO -*/ -int QQuickTabView::currentIndex() const -{ - Q_D(const QQuickTabView); - return d->currentIndex; -} - -void QQuickTabView::setCurrentIndex(int index) -{ - Q_D(QQuickTabView); - if (d->currentIndex != index) { - d->currentIndex = index; - emit currentIndexChanged(index); - } -} - -/*! - \qmlproperty TabBar QtQuickControls2::TabView::tabBar - - TODO -*/ -QQuickTabBar *QQuickTabView::tabBar() const -{ - Q_D(const QQuickTabView); - return d->bar; -} - -void QQuickTabView::setTabBar(QQuickTabBar *bar) -{ - Q_D(QQuickTabView); - if (d->bar != bar) { - if (d->bar) { - disconnect(this, &QQuickTabView::currentIndexChanged, d->bar, &QQuickTabBar::setCurrentIndex); - disconnect(d->bar, &QQuickTabBar::currentIndexChanged, this, &QQuickTabView::setCurrentIndex); - if (d->bar->parentItem() == this) - delete d->bar; - } - d->bar = bar; - if (bar) { - connect(this, &QQuickTabView::currentIndexChanged, d->bar, &QQuickTabBar::setCurrentIndex); - connect(bar, &QQuickTabBar::currentIndexChanged, this, &QQuickTabView::setCurrentIndex); - if (!bar->parentItem()) - bar->setParentItem(this); - - int barIndex = bar->currentIndex(); - if (d->currentIndex != barIndex) { - if (d->currentIndex != -1) - bar->setCurrentIndex(d->currentIndex); - else if (barIndex != -1) - setCurrentIndex(barIndex); - } - } - emit tabBarChanged(); - } -} - -void QQuickTabView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) -{ - Q_D(QQuickTabView); - QQuickContainer::geometryChanged(newGeometry, oldGeometry); - if (d->bar) { - QQuickItemPrivate *p = QQuickItemPrivate::get(d->bar); - if (!p->widthValid) { - d->bar->setWidth(newGeometry.width()); - p->widthValid = false; - } - } -} - -/*! - \qmltype Tab - \inherits QtObject - \instantiates QQuickTabAttached - \inqmlmodule QtQuick.Controls - \ingroup tabs - \brief TODO - - TODO -*/ - -QQuickTabAttached::QQuickTabAttached(QObject *parent) : - QObject(parent), m_index(-1), m_visible(true), m_view(Q_NULLPTR) -{ -} - -QQuickTabAttached *QQuickTabAttached::qmlAttachedProperties(QObject *object) -{ - return new QQuickTabAttached(object); -} - -/*! - \qmlattachedproperty int QtQuickControls2::Tab::index - - TODO -*/ -int QQuickTabAttached::index() const -{ - return m_index; -} - -void QQuickTabAttached::setIndex(int index) -{ - if (m_index != index) { - m_index = index; - emit indexChanged(); - } -} - -/*! - \qmlattachedproperty string QtQuickControls2::Tab::title - - TODO -*/ -QString QQuickTabAttached::title() const -{ - return m_title; -} - -void QQuickTabAttached::setTitle(const QString &title) -{ - if (m_title != title) { - m_title = title; - emit titleChanged(); - } -} - -/*! - \qmlattachedproperty bool QtQuickControls2::Tab::visible - - TODO -*/ -bool QQuickTabAttached::isVisible() const -{ - return m_visible; -} - -void QQuickTabAttached::setVisible(bool visible) -{ - if (m_visible != visible) { - m_visible = visible; - emit visibleChanged(); - } -} - -/*! - \qmlattachedproperty TabView QtQuickControls2::Tab::view - - TODO -*/ -QQuickTabView *QQuickTabAttached::view() const -{ - return m_view; -} - -void QQuickTabAttached::setView(QQuickTabView *view) -{ - if (m_view != view) { - m_view = view; - emit viewChanged(); - } -} - -QT_END_NAMESPACE diff --git a/src/controls/qquicktabview_p.h b/src/controls/qquicktabview_p.h deleted file mode 100644 index 2b2b00b2..00000000 --- a/src/controls/qquicktabview_p.h +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Quick Controls 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 QQUICKTABVIEW_P_H -#define QQUICKTABVIEW_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 - -QT_BEGIN_NAMESPACE - -class QQuickTabBar; -class QQuickTabViewPrivate; - -class Q_QUICKCONTROLS_EXPORT QQuickTabView : public QQuickContainer -{ - Q_OBJECT - Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL) - Q_PROPERTY(QQuickTabBar *tabBar READ tabBar WRITE setTabBar NOTIFY tabBarChanged FINAL) - -public: - explicit QQuickTabView(QQuickItem *parent = Q_NULLPTR); - - int currentIndex() const; - - QQuickTabBar *tabBar() const; - void setTabBar(QQuickTabBar *bar); - -public Q_SLOTS: - void setCurrentIndex(int index); - -Q_SIGNALS: - void currentIndexChanged(int index); - void tabBarChanged(); - -protected: - void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; - -private: - Q_DISABLE_COPY(QQuickTabView) - Q_DECLARE_PRIVATE(QQuickTabView) -}; - -class Q_QUICKCONTROLS_EXPORT QQuickTabAttached : public QObject -{ - Q_OBJECT - Q_PROPERTY(int index READ index WRITE setIndex NOTIFY indexChanged FINAL) - Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL) - Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL) - Q_PROPERTY(QQuickTabView *view READ view WRITE setView NOTIFY viewChanged FINAL) - -public: - explicit QQuickTabAttached(QObject *parent = Q_NULLPTR); - - static QQuickTabAttached *qmlAttachedProperties(QObject *object); - - int index() const; - void setIndex(int index); - - QString title() const; - void setTitle(const QString &title); - - bool isVisible() const; - void setVisible(bool visible); - - QQuickTabView *view() const; - void setView(QQuickTabView *view); - -Q_SIGNALS: - void indexChanged(); - void titleChanged(); - void visibleChanged(); - void viewChanged(); - -private: - int m_index; - bool m_visible; - QString m_title; - QQuickTabView *m_view; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPEINFO(QQuickTabAttached, QML_HAS_ATTACHED_PROPERTIES) - -#endif // QQUICKTABVIEW_P_H diff --git a/src/imports/controls/TabView.qml b/src/imports/controls/TabView.qml deleted file mode 100644 index 0fb6840b..00000000 --- a/src/imports/controls/TabView.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Quick Controls 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$ -** -****************************************************************************/ - -import QtQuick 2.6 -import QtQuick.Controls 2.0 -import QtQml.Models 2.1 - -AbstractTabView { - id: control - - default property alias items: listView.items - readonly property alias currentItem: listView.currentItem - property alias spacing: listView.spacing - property alias count: listView.count - - contentWidth: listView.implicitWidth - contentHeight: listView.contentHeight - - implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding) - - topPadding: tabBar && tabBar.parent === control ? tabBar.height : 0 - - tabBar: TabBar { } - - Accessible.role: Accessible.PageTabList - - Binding { target: tabBar; property: "items"; value: control.items } - - contentItem: ListView { - id: listView - - property list items - - Binding { target: control; property: "currentIndex"; value: listView.currentIndex } - Binding { target: listView; property: "currentIndex"; value: control.currentIndex } - - orientation: Qt.Horizontal - snapMode: ListView.SnapOneItem - boundsBehavior: Flickable.StopAtBounds - highlightRangeMode: ListView.StrictlyEnforceRange - preferredHighlightBegin: 0 - preferredHighlightEnd: 0 - highlightMoveDuration: 250 - - model: items - - delegate: Item { - id: delegate - width: listView.width - height: listView.height - visible: modelData.Tab.visible - Binding { target: modelData; property: "parent"; value: delegate } - Binding { target: modelData; property: "Tab.index"; value: index } - Binding { target: modelData; property: "Tab.view"; value: control } - } - } -} diff --git a/src/imports/controls/controls.pro b/src/imports/controls/controls.pro index f5636d2d..4ce56211 100644 --- a/src/imports/controls/controls.pro +++ b/src/imports/controls/controls.pro @@ -26,7 +26,6 @@ QML_FILES = \ Switch.qml \ TabBar.qml \ TabButton.qml \ - TabView.qml \ TextArea.qml \ TextField.qml \ ToggleButton.qml \ diff --git a/src/imports/controls/qmldir b/src/imports/controls/qmldir index eaedbbb5..5de9450a 100644 --- a/src/imports/controls/qmldir +++ b/src/imports/controls/qmldir @@ -18,7 +18,6 @@ StackView 2.0 StackView.qml Switch 2.0 Switch.qml TabBar 2.0 TabBar.qml TabButton 2.0 TabButton.qml -TabView 2.0 TabView.qml TextArea 2.0 TextArea.qml TextField 2.0 TextField.qml ToggleButton 2.0 ToggleButton.qml diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp index 9bfc6652..8c8c2121 100644 --- a/src/imports/controls/qtquickcontrols2plugin.cpp +++ b/src/imports/controls/qtquickcontrols2plugin.cpp @@ -54,7 +54,6 @@ #include #include #include -#include #include #include #include @@ -99,7 +98,6 @@ void QtQuickControls2Plugin::registerTypes(const char *uri) qmlRegisterType(uri, 2, 0, "AbstractSwitch"); qmlRegisterType(uri, 2, 0, "AbstractTabBar"); qmlRegisterType(uri, 2, 0, "AbstractTabButton"); - qmlRegisterType(uri, 2, 0, "AbstractTabView"); qmlRegisterType(uri, 2, 0, "AbstractTextArea"); qmlRegisterType(uri, 2, 0, "AbstractTextField"); qmlRegisterType(uri, 2, 0, "AbstractToggleButton"); @@ -108,7 +106,6 @@ void QtQuickControls2Plugin::registerTypes(const char *uri) qmlRegisterUncreatableType(uri, 2, 0, "Exclusive", "Exclusive is an attached property"); qmlRegisterUncreatableType(uri, 2, 0, "Stack", "Stack is an attached property"); qmlRegisterUncreatableType(uri, 2, 0, "Theme", "Theme is an attached property"); - qmlRegisterUncreatableType(uri, 2, 0, "Tab", "Tab is an attached property"); qmlRegisterType(uri, 2, 0, "Control"); qmlRegisterType(uri, 2, 0, "ExclusiveGroup"); -- cgit v1.2.3