diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/controls/doc/images/qtquickcontrols2-tabbar-flickable.png | bin | 0 -> 3349 bytes | |||
-rw-r--r-- | src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-flickable.qml | 50 | ||||
-rw-r--r-- | src/imports/controls/material/qquickmaterialprogressring.cpp | 22 | ||||
-rw-r--r-- | src/imports/controls/universal/TextArea.qml | 3 | ||||
-rw-r--r-- | src/imports/controls/universal/TextField.qml | 3 | ||||
-rw-r--r-- | src/quicktemplates2/qquickdial.cpp | 10 | ||||
-rw-r--r-- | src/quicktemplates2/qquickoverlay.cpp | 1 | ||||
-rw-r--r-- | src/quicktemplates2/qquickpopup.cpp | 2 | ||||
-rw-r--r-- | src/quicktemplates2/qquickrangeslider.cpp | 2 | ||||
-rw-r--r-- | src/quicktemplates2/qquicktabbar.cpp | 13 | ||||
-rw-r--r-- | src/quicktemplates2/qquicktextarea.cpp | 3 | ||||
-rw-r--r-- | src/quicktemplates2/qquicktextfield.cpp | 3 |
12 files changed, 94 insertions, 18 deletions
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-tabbar-flickable.png b/src/imports/controls/doc/images/qtquickcontrols2-tabbar-flickable.png Binary files differnew file mode 100644 index 00000000..ede59233 --- /dev/null +++ b/src/imports/controls/doc/images/qtquickcontrols2-tabbar-flickable.png diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-flickable.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-flickable.qml new file mode 100644 index 00000000..2a4fac0e --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-flickable.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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 Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +Item { + width: 360 + height: bar.height + +//! [1] +TabBar { + id: bar + width: parent.width + + Repeater { + model: ["First", "Second", "Third", "Fourth", "Fifth"] + + TabButton { + text: modelData + width: Math.max(100, bar.width / 5) + } + } +} +//! [1] +} diff --git a/src/imports/controls/material/qquickmaterialprogressring.cpp b/src/imports/controls/material/qquickmaterialprogressring.cpp index aec92631..a3564c17 100644 --- a/src/imports/controls/material/qquickmaterialprogressring.cpp +++ b/src/imports/controls/material/qquickmaterialprogressring.cpp @@ -74,6 +74,8 @@ public: void afterNodeSync() override; private: + int m_lastStartAngle; + int m_lastEndAngle; qreal m_devicePixelRatio; QSGNode *m_containerNode; QQuickWindow *m_window; @@ -155,6 +157,8 @@ QQuickAnimatorJob *QQuickMaterialRingAnimator::createJob() const } QQuickMaterialRingAnimatorJob::QQuickMaterialRingAnimatorJob() : + m_lastStartAngle(0), + m_lastEndAngle(0), m_devicePixelRatio(1.0), m_containerNode(nullptr), m_window(nullptr) @@ -203,27 +207,25 @@ void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time) const int iteration = time / spanAnimationDuration; int startAngle = 0; int endAngle = 0; - static int lastStartAngle = 0; - static int lastEndAngle = 0; if (iteration % 2 == 0) { - if (lastStartAngle > 360 * oneDegree) { - lastStartAngle -= 360 * oneDegree; + if (m_lastStartAngle > 360 * oneDegree) { + m_lastStartAngle -= 360 * oneDegree; } // The start angle is only affected by the rotation animation for the "grow" phase. - startAngle = lastStartAngle; + startAngle = m_lastStartAngle; QEasingCurve angleCurve(QEasingCurve::OutQuad); const qreal percentage = angleCurve.valueForProgress(spanPercentageComplete); - endAngle = lastStartAngle + minSweepSpan + percentage * (maxSweepSpan - minSweepSpan); - lastEndAngle = endAngle; + endAngle = m_lastStartAngle + minSweepSpan + percentage * (maxSweepSpan - minSweepSpan); + m_lastEndAngle = endAngle; } else { // Both the start angle *and* the span are affected by the "shrink" phase. QEasingCurve angleCurve(QEasingCurve::InQuad); const qreal percentage = angleCurve.valueForProgress(spanPercentageComplete); - startAngle = lastEndAngle - maxSweepSpan + percentage * (maxSweepSpan - minSweepSpan); - endAngle = lastEndAngle; - lastStartAngle = startAngle; + startAngle = m_lastEndAngle - maxSweepSpan + percentage * (maxSweepSpan - minSweepSpan); + endAngle = m_lastEndAngle; + m_lastStartAngle = startAngle; } const int halfPen = pen.width() / 2; diff --git a/src/imports/controls/universal/TextArea.qml b/src/imports/controls/universal/TextArea.qml index 96d3cc13..0e2953ed 100644 --- a/src/imports/controls/universal/TextArea.qml +++ b/src/imports/controls/universal/TextArea.qml @@ -58,8 +58,7 @@ T.TextArea { Universal.theme: activeFocus ? Universal.Light : undefined - color: !enabled ? Universal.chromeDisabledLowColor : - activeFocus ? Universal.chromeBlackHighColor : Universal.foreground + color: !enabled ? Universal.chromeDisabledLowColor : Universal.foreground selectionColor: Universal.accent selectedTextColor: Universal.chromeWhiteColor diff --git a/src/imports/controls/universal/TextField.qml b/src/imports/controls/universal/TextField.qml index ba24a155..88bc4fc9 100644 --- a/src/imports/controls/universal/TextField.qml +++ b/src/imports/controls/universal/TextField.qml @@ -58,8 +58,7 @@ T.TextField { Universal.theme: activeFocus ? Universal.Light : undefined - color: !enabled ? Universal.chromeDisabledLowColor : - activeFocus ? Universal.chromeBlackHighColor : Universal.foreground + color: !enabled ? Universal.chromeDisabledLowColor : Universal.foreground selectionColor: Universal.accent selectedTextColor: Universal.chromeWhiteColor verticalAlignment: TextInput.AlignVCenter diff --git a/src/quicktemplates2/qquickdial.cpp b/src/quicktemplates2/qquickdial.cpp index 3932fd05..de220853 100644 --- a/src/quicktemplates2/qquickdial.cpp +++ b/src/quicktemplates2/qquickdial.cpp @@ -126,9 +126,15 @@ qreal QQuickDialPrivate::valueAt(qreal position) const qreal QQuickDialPrivate::snapPosition(qreal position) const { - if (qFuzzyIsNull(stepSize)) + const qreal range = to - from; + if (qFuzzyIsNull(range)) return position; - return qRound(position / stepSize) * stepSize; + + const qreal effectiveStep = stepSize / range; + if (qFuzzyIsNull(effectiveStep)) + return position; + + return qRound(position / effectiveStep) * effectiveStep; } qreal QQuickDialPrivate::positionAt(const QPoint &point) const diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp index efbc2ce5..850de875 100644 --- a/src/quicktemplates2/qquickoverlay.cpp +++ b/src/quicktemplates2/qquickoverlay.cpp @@ -176,6 +176,7 @@ QQuickOverlayPrivate::QQuickOverlayPrivate() : QQuickOverlay::QQuickOverlay(QQuickItem *parent) : QQuickItem(*(new QQuickOverlayPrivate), parent) { + setZ(1000001); // DefaultWindowDecoration+1 setAcceptedMouseButtons(Qt::AllButtons); setFiltersChildMouseEvents(true); setVisible(false); diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index a5cc09a1..14810c98 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -192,7 +192,7 @@ void QQuickPopupPrivate::prepareEnterTransition(bool notify) QQuickApplicationWindow *applicationWindow = qobject_cast<QQuickApplicationWindow*>(window); if (!applicationWindow) { window->installEventFilter(q); - popupItem->setZ(10001); // DefaultWindowDecoration+1 + popupItem->setZ(1000001); // DefaultWindowDecoration+1 popupItem->setParentItem(window->contentItem()); } else { popupItem->setParentItem(applicationWindow->overlay()); diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp index 52b11dae..b4c3838f 100644 --- a/src/quicktemplates2/qquickrangeslider.cpp +++ b/src/quicktemplates2/qquickrangeslider.cpp @@ -351,7 +351,7 @@ static qreal valueAt(const QQuickRangeSlider *slider, qreal position) static qreal snapPosition(const QQuickRangeSlider *slider, qreal position) { - const qreal range = slider->from() + (slider->to() - slider->from()); + const qreal range = slider->to() - slider->from(); if (qFuzzyIsNull(range)) return position; diff --git a/src/quicktemplates2/qquicktabbar.cpp b/src/quicktemplates2/qquicktabbar.cpp index a980a725..6fe734bb 100644 --- a/src/quicktemplates2/qquicktabbar.cpp +++ b/src/quicktemplates2/qquicktabbar.cpp @@ -60,6 +60,18 @@ QT_BEGIN_NAMESPACE \snippet qtquickcontrols2-tabbar.qml 1 + \section2 Flickable Tabs + + By default, TabBar resizes its buttons to fit the width of the control. + The available space is distributed equally to each button. The default + resizing behavior can be overridden by setting an explicit width for the + buttons. If the total width of the buttons exceeds the available width + of the tab bar, it automatically becomes flickable. + + \image qtquickcontrols2-tabbar-flickable.png + + \snippet qtquickcontrols2-tabbar-flickable.qml 1 + \sa TabButton, {Customizing TabBar}, {Navigation Controls}, {Container Controls} */ @@ -187,6 +199,7 @@ void QQuickTabBar::itemAdded(int index, QQuickItem *item) { Q_D(QQuickTabBar); Q_UNUSED(index); + QQuickItemPrivate::get(item)->setCulled(true); // QTBUG-55129 if (QQuickTabButton *button = qobject_cast<QQuickTabButton *>(item)) QObjectPrivate::connect(button, &QQuickTabButton::checkedChanged, d, &QQuickTabBarPrivate::updateCurrentIndex); if (isComponentComplete()) diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp index 0f78413e..7c2e0f11 100644 --- a/src/quicktemplates2/qquicktextarea.cpp +++ b/src/quicktemplates2/qquicktextarea.cpp @@ -310,6 +310,9 @@ QQuickTextArea::QQuickTextArea(QQuickItem *parent) : setAcceptedMouseButtons(Qt::AllButtons); d->setImplicitResizeEnabled(false); d->pressHandler.control = this; +#ifndef QT_NO_CURSOR + setCursor(Qt::IBeamCursor); +#endif QObjectPrivate::connect(this, &QQuickTextEdit::readOnlyChanged, d, &QQuickTextAreaPrivate::_q_readOnlyChanged); } diff --git a/src/quicktemplates2/qquicktextfield.cpp b/src/quicktemplates2/qquicktextfield.cpp index bc77317b..88450e78 100644 --- a/src/quicktemplates2/qquicktextfield.cpp +++ b/src/quicktemplates2/qquicktextfield.cpp @@ -179,6 +179,9 @@ QQuickTextField::QQuickTextField(QQuickItem *parent) : d->setImplicitResizeEnabled(false); setAcceptedMouseButtons(Qt::AllButtons); setActiveFocusOnTab(true); +#ifndef QT_NO_CURSOR + setCursor(Qt::IBeamCursor); +#endif QObjectPrivate::connect(this, &QQuickTextInput::readOnlyChanged, d, &QQuickTextFieldPrivate::_q_readOnlyChanged); QObjectPrivate::connect(this, &QQuickTextInput::echoModeChanged, |