aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates/qquicktabbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/templates/qquicktabbar.cpp')
-rw-r--r--src/templates/qquicktabbar.cpp44
1 files changed, 42 insertions, 2 deletions
diff --git a/src/templates/qquicktabbar.cpp b/src/templates/qquicktabbar.cpp
index 58d68058..00567019 100644
--- a/src/templates/qquicktabbar.cpp
+++ b/src/templates/qquicktabbar.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-navigation
\ingroup qtlabscontrols-containers
- \brief A tab bar control.
+ \brief A bar with icons allowing to switch between different views or subtasks.
TabBar provides a tab-based navigation model.
@@ -69,11 +69,19 @@ class QQuickTabBarPrivate : public QQuickContainerPrivate
Q_DECLARE_PUBLIC(QQuickTabBar)
public:
+ QQuickTabBarPrivate();
+
void updateCurrentItem();
void updateCurrentIndex();
void updateLayout();
+
+ QQuickTabBar::Position position;
};
+QQuickTabBarPrivate::QQuickTabBarPrivate() : position(QQuickTabBar::Header)
+{
+}
+
void QQuickTabBarPrivate::updateCurrentItem()
{
QQuickTabButton *button = qobject_cast<QQuickTabButton *>(contentModel->get(currentIndex));
@@ -86,7 +94,7 @@ void QQuickTabBarPrivate::updateCurrentIndex()
Q_Q(QQuickTabBar);
QQuickTabButton *button = qobject_cast<QQuickTabButton *>(q->sender());
if (button && button->isChecked())
- q->setCurrentIndex(contentModel->indexOf(button, Q_NULLPTR));
+ q->setCurrentIndex(contentModel->indexOf(button, nullptr));
}
void QQuickTabBarPrivate::updateLayout()
@@ -117,6 +125,38 @@ QQuickTabBar::QQuickTabBar(QQuickItem *parent) :
QObjectPrivate::connect(this, &QQuickTabBar::currentIndexChanged, d, &QQuickTabBarPrivate::updateCurrentItem);
}
+/*!
+ \qmlproperty enumeration Qt.labs.controls::TabBar::position
+
+ This property holds the position of the tab bar.
+
+ \note If the tab bar is assigned as a header or footer of ApplicationWindow
+ or Page, the appropriate position is set automatically.
+
+ Possible values:
+ \value TabBar.Header The tab bar is at the top, as a window or page header.
+ \value TabBar.Footer The tab bar is at the bottom, as a window or page footer.
+
+ The default value is style-specific.
+
+ \sa ApplicationWindow::header, ApplicationWindow::footer, Page::header, Page::footer
+*/
+QQuickTabBar::Position QQuickTabBar::position() const
+{
+ Q_D(const QQuickTabBar);
+ return d->position;
+}
+
+void QQuickTabBar::setPosition(Position position)
+{
+ Q_D(QQuickTabBar);
+ if (d->position == position)
+ return;
+
+ d->position = position;
+ emit positionChanged();
+}
+
void QQuickTabBar::updatePolish()
{
Q_D(QQuickTabBar);