aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-04-29 09:54:50 +0200
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-06-11 15:12:53 +0000
commitf944c34757baf145f7018e37bc732d061f0bbf7f (patch)
treefb9447de3a53cbd8ea11e00b8f4aceda7c372704
parentdbf0b858952f57be61dc1b2765c05d25e86db546 (diff)
Remove the old TabView implementation
Change-Id: I8d8aa96f2f37f458577a5a3ec681e3c9174d0918 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
-rw-r--r--src/controls/controls.pri2
-rw-r--r--src/controls/qquicktabview.cpp236
-rw-r--r--src/controls/qquicktabview_p.h129
-rw-r--r--src/imports/controls/TabView.qml91
-rw-r--r--src/imports/controls/controls.pro1
-rw-r--r--src/imports/controls/qmldir1
-rw-r--r--src/imports/controls/qtquickcontrols2plugin.cpp3
-rw-r--r--tests/benchmarks/creationtime/tst_creationtime.cpp3
-rw-r--r--tests/benchmarks/objectcount/tst_objectcount.cpp4
9 files changed, 2 insertions, 468 deletions
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 <QtQuickControls/private/qquickcontainer_p.h>
-
-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<Item> 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 <QtQuickControls/private/qquickswitch_p.h>
#include <QtQuickControls/private/qquicktabbar_p.h>
#include <QtQuickControls/private/qquicktabbutton_p.h>
-#include <QtQuickControls/private/qquicktabview_p.h>
#include <QtQuickControls/private/qquicktextarea_p.h>
#include <QtQuickControls/private/qquicktextfield_p.h>
#include <QtQuickControls/private/qquicktogglebutton_p.h>
@@ -99,7 +98,6 @@ void QtQuickControls2Plugin::registerTypes(const char *uri)
qmlRegisterType<QQuickSwitch>(uri, 2, 0, "AbstractSwitch");
qmlRegisterType<QQuickTabBar>(uri, 2, 0, "AbstractTabBar");
qmlRegisterType<QQuickTabButton>(uri, 2, 0, "AbstractTabButton");
- qmlRegisterType<QQuickTabView>(uri, 2, 0, "AbstractTabView");
qmlRegisterType<QQuickTextArea>(uri, 2, 0, "AbstractTextArea");
qmlRegisterType<QQuickTextField>(uri, 2, 0, "AbstractTextField");
qmlRegisterType<QQuickToggleButton>(uri, 2, 0, "AbstractToggleButton");
@@ -108,7 +106,6 @@ void QtQuickControls2Plugin::registerTypes(const char *uri)
qmlRegisterUncreatableType<QQuickExclusiveAttached>(uri, 2, 0, "Exclusive", "Exclusive is an attached property");
qmlRegisterUncreatableType<QQuickStackAttached>(uri, 2, 0, "Stack", "Stack is an attached property");
qmlRegisterUncreatableType<QQuickTheme>(uri, 2, 0, "Theme", "Theme is an attached property");
- qmlRegisterUncreatableType<QQuickTabAttached>(uri, 2, 0, "Tab", "Tab is an attached property");
qmlRegisterType<QQuickControl>(uri, 2, 0, "Control");
qmlRegisterType<QQuickExclusiveGroup>(uri, 2, 0, "ExclusiveGroup");
diff --git a/tests/benchmarks/creationtime/tst_creationtime.cpp b/tests/benchmarks/creationtime/tst_creationtime.cpp
index 3b051907..4e53b7d3 100644
--- a/tests/benchmarks/creationtime/tst_creationtime.cpp
+++ b/tests/benchmarks/creationtime/tst_creationtime.cpp
@@ -110,8 +110,9 @@ void tst_CreationTime::testControls_data()
#ifndef QT_QUICK_CONTROLS_V1
QTest::newRow("TabBar") << QByteArray("TabBar");
QTest::newRow("TabButton") << QByteArray("TabButton");
-#endif
+#else
QTest::newRow("TabView") << QByteArray("TabView");
+#endif
QTest::newRow("TextArea") << QByteArray("TextArea");
QTest::newRow("TextField") << QByteArray("TextField");
QTest::newRow("ToolBar") << QByteArray("ToolBar");
diff --git a/tests/benchmarks/objectcount/tst_objectcount.cpp b/tests/benchmarks/objectcount/tst_objectcount.cpp
index 2e0f8412..f7432d2e 100644
--- a/tests/benchmarks/objectcount/tst_objectcount.cpp
+++ b/tests/benchmarks/objectcount/tst_objectcount.cpp
@@ -213,10 +213,6 @@ void tst_ObjectCount::testCount_data()
<< QByteArray()
<< QByteArray("import QtQuick.Controls 2.0; TabButton { }");
- QTest::newRow("TabView")
- << QByteArray("import QtQuick.Controls 1.3; TabView { }")
- << QByteArray("import QtQuick.Controls 2.0; TabView { }");
-
QTest::newRow("TextArea")
<< QByteArray("import QtQuick.Controls 1.3; TextArea { }")
<< QByteArray("import QtQuick.Controls 2.0; TextArea { }");