diff options
Diffstat (limited to 'src/controls')
-rw-r--r-- | src/controls/controls.pri | 2 | ||||
-rw-r--r-- | src/controls/qquicktabview.cpp | 236 | ||||
-rw-r--r-- | src/controls/qquicktabview_p.h | 129 |
3 files changed, 0 insertions, 367 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 |