Merge remote-tracking branch 'origin/5.14' into 5.15

Conflicts:
	.qmake.conf
	tests/auto/controls/data/tst_combobox.qml

Change-Id: I8471cdac4397f77a8e58140d58c6b50d3c437928
This commit is contained in:
Liang Qi 2019-12-30 11:44:50 +01:00
commit ec686af14f
127 changed files with 12531 additions and 68 deletions

51
dist/changes-5.14.0 vendored Normal file
View File

@ -0,0 +1,51 @@
Qt 5.14 introduces many new features and improvements as well as bugfixes
over the 5.13.x series. For more details, refer to the online documentation
included in this distribution. The documentation is also available online:
https://doc.qt.io/qt-5/index.html
The Qt version 5.14 series is binary compatible with the 5.13.x series.
Applications compiled for 5.13 will continue to run with 5.14.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Controls *
****************************************************************************
- ComboBox:
* Added valueRole, currentValue and indexOfValue(). These allow
convenient management of data for a role associated with the text
role.
- QQuickMenuBar:
* Fixed issue with dynamically menu bar items not losing their highlight
when their menu was dismissed.
- QQuickPopup:
* Fixed the issue that Popup doesn't respond to CloseOnEscape if the
initial value of visible is true
- [QTBUG-79790] Fixed issue where font changes would result in an extra
signal being emitted.
- [QTBUG-59330] The documentation now advises against naming root resource
directories with the same name as a style name.
- [QTBUG-79302] SplitView: fix issue where Repeater items were not created.
- [QTBUG-79302] SplitView: fix cursor shape staying as Split*Cursor in some
cases.
- [QTBUG-79270] Fixed assertion failure when hiding a SplitView with only
one item.
****************************************************************************
* Universal *
****************************************************************************
- TabBar:
* Disabled wrapping. The Universal style TabBar now behaves like TabBar
from other styles.

View File

@ -170,7 +170,6 @@ private:
int m_selectionEnd;
QFont m_font;
int m_fontSize;
QUrl m_fileUrl;
};

View File

@ -46,7 +46,7 @@ class QQuickWeekNumberModelPrivate : public QAbstractItemModelPrivate
Q_DECLARE_PUBLIC(QQuickWeekNumberModel)
public:
QQuickWeekNumberModelPrivate() : month(-1), year(-1)
QQuickWeekNumberModelPrivate() : month(-1), year(-1), weekNumbers{}
{
QDate date = QDate::currentDate();
init(date.month(), date.year(), locale);

View File

@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC_WITH_ARGS(QString, GlobalPath, (QLatin1String("qrc:/qt-project.org/imports/QtQuick/Controls.2/Imagine/images/")))
static const QString ensureSlash(const QString &path)
static QString ensureSlash(const QString &path)
{
const QChar slash = QLatin1Char('/');
return path.endsWith(slash) ? path : path + slash;

View File

@ -119,10 +119,15 @@ static QStringList defaultImportPathList()
{
QStringList importPaths;
importPaths.reserve(3);
#ifndef QT_STATIC
#ifdef Q_OS_ANDROID
// androiddeployqt puts the QML files inside a resource file and they are not
// showing up in the Qml2ImportsPath as a result
importPaths += QStringLiteral(":/android_rcc_bundle/qml");
#else
# ifndef QT_STATIC
importPaths += QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
# endif
#endif
importPaths += envPathList("QML2_IMPORT_PATH");
importPaths += QStringLiteral(":/qt-project.org/imports");
importPaths += QCoreApplication::applicationDirPath();
return importPaths;

View File

@ -1128,7 +1128,7 @@ void QQuickAbstractButton::buttonChange(ButtonChange change)
break;
case ButtonTextChange: {
const QString txt = text();
setAccessibleName(txt);
maybeSetAccessibleName(txt);
#if QT_CONFIG(shortcut)
setShortcut(QKeySequence::mnemonic(txt));
#endif
@ -1154,7 +1154,7 @@ void QQuickAbstractButton::accessibilityActiveChanged(bool active)
Q_D(QQuickAbstractButton);
if (active) {
setAccessibleName(text());
maybeSetAccessibleName(text());
setAccessibleProperty("pressed", d->pressed);
setAccessibleProperty("checked", d->checked);
setAccessibleProperty("checkable", d->checkable);

View File

@ -448,7 +448,7 @@ void QQuickComboBoxPrivate::updateCurrentText()
if (currentText != text) {
currentText = text;
if (!hasDisplayText)
q->setAccessibleName(text);
q->maybeSetAccessibleName(text);
emit q->currentTextChanged();
}
if (!hasDisplayText && displayText != text) {
@ -1012,7 +1012,7 @@ void QQuickComboBox::setDisplayText(const QString &text)
return;
d->displayText = text;
setAccessibleName(text);
maybeSetAccessibleName(text);
emit displayTextChanged();
}
@ -1705,6 +1705,12 @@ bool QQuickComboBox::eventFilter(QObject *object, QEvent *event)
// the user clicked on the popup button to open it, not close it).
d->hidePopup(false);
setPressed(false);
// The focus left the text field, so if the edit text matches an item in the model,
// change our currentIndex to that. This matches widgets' behavior.
const int indexForEditText = find(d->extra.value().editText, Qt::MatchFixedString);
if (indexForEditText > -1)
setCurrentIndex(indexForEditText);
}
break;
#if QT_CONFIG(im)
@ -1945,7 +1951,7 @@ void QQuickComboBox::accessibilityActiveChanged(bool active)
QQuickControl::accessibilityActiveChanged(active);
if (active) {
setAccessibleName(d->hasDisplayText ? d->displayText : d->currentText);
maybeSetAccessibleName(d->hasDisplayText ? d->displayText : d->currentText);
setAccessibleProperty("editable", isEditable());
}
}

View File

@ -2300,11 +2300,13 @@ QString QQuickControl::accessibleName() const
return QString();
}
void QQuickControl::setAccessibleName(const QString &name)
void QQuickControl::maybeSetAccessibleName(const QString &name)
{
#if QT_CONFIG(accessibility)
if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(this))
accessibleAttached->setName(name);
if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(this)) {
if (!accessibleAttached->wasNameExplicitlySet())
accessibleAttached->setNameImplicitly(name);
}
#else
Q_UNUSED(name)
#endif

View File

@ -287,7 +287,7 @@ protected:
// helper functions which avoid to check QT_CONFIG(accessibility)
QString accessibleName() const;
void setAccessibleName(const QString &name);
void maybeSetAccessibleName(const QString &name);
QVariant accessibleProperty(const char *propertyName);
bool setAccessibleProperty(const char *propertyName, const QVariant &value);

View File

@ -219,7 +219,6 @@ void QQuickDialog::setTitle(const QString &title)
{
Q_D(QQuickDialog);
d->popupItem->setTitle(title);
setAccessibleName(title);
}
/*!
@ -536,7 +535,7 @@ void QQuickDialog::accessibilityActiveChanged(bool active)
QQuickPopup::accessibilityActiveChanged(active);
if (active)
setAccessibleName(d->popupItem->title());
maybeSetAccessibleName(d->popupItem->title());
}
#endif

View File

@ -167,7 +167,7 @@ void QQuickGroupBox::setTitle(const QString &title)
return;
d->title = title;
setAccessibleName(title);
maybeSetAccessibleName(title);
emit titleChanged();
}
@ -283,7 +283,7 @@ void QQuickGroupBox::accessibilityActiveChanged(bool active)
QQuickFrame::accessibilityActiveChanged(active);
if (active)
setAccessibleName(d->title);
maybeSetAccessibleName(d->title);
}
#endif

View File

@ -248,9 +248,7 @@ void QQuickLabelPrivate::updatePalette(const QPalette &palette)
void QQuickLabelPrivate::textChanged(const QString &text)
{
#if QT_CONFIG(accessibility)
Q_Q(QQuickLabel);
if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(q))
accessibleAttached->setName(text);
maybeSetAccessibleName(text);
#else
Q_UNUSED(text)
#endif
@ -266,13 +264,24 @@ void QQuickLabelPrivate::accessibilityActiveChanged(bool active)
QQuickAccessibleAttached *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true));
Q_ASSERT(accessibleAttached);
accessibleAttached->setRole(accessibleRole());
accessibleAttached->setName(text);
maybeSetAccessibleName(text);
}
QAccessible::Role QQuickLabelPrivate::accessibleRole() const
{
return QAccessible::StaticText;
}
void QQuickLabelPrivate::maybeSetAccessibleName(const QString &name)
{
Q_Q(QQuickLabel);
auto accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(
qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true));
if (accessibleAttached) {
if (!accessibleAttached->wasNameExplicitlySet())
accessibleAttached->setNameImplicitly(name);
}
}
#endif
static inline QString backgroundName() { return QStringLiteral("background"); }

View File

@ -111,6 +111,7 @@ public:
#if QT_CONFIG(accessibility)
void accessibilityActiveChanged(bool active) override;
QAccessible::Role accessibleRole() const override;
void maybeSetAccessibleName(const QString &name);
#endif
void cancelBackground();

View File

@ -285,7 +285,7 @@ void QQuickPage::setTitle(const QString &title)
return;
d->title = title;
setAccessibleName(title);
maybeSetAccessibleName(title);
emit titleChanged();
}
@ -473,7 +473,7 @@ void QQuickPage::accessibilityActiveChanged(bool active)
QQuickPane::accessibilityActiveChanged(active);
if (active)
setAccessibleName(d->title);
maybeSetAccessibleName(d->title);
}
#endif

View File

@ -2699,10 +2699,10 @@ QString QQuickPopup::accessibleName() const
return d->popupItem->accessibleName();
}
void QQuickPopup::setAccessibleName(const QString &name)
void QQuickPopup::maybeSetAccessibleName(const QString &name)
{
Q_D(QQuickPopup);
d->popupItem->setAccessibleName(name);
d->popupItem->maybeSetAccessibleName(name);
}
QVariant QQuickPopup::accessibleProperty(const char *propertyName)

View File

@ -459,7 +459,7 @@ protected:
#endif
QString accessibleName() const;
void setAccessibleName(const QString &name);
void maybeSetAccessibleName(const QString &name);
QVariant accessibleProperty(const char *propertyName);
bool setAccessibleProperty(const char *propertyName, const QVariant &value);

View File

@ -47,6 +47,10 @@
#endif
#include <QtGui/private/qguiapplication_p.h>
#if QT_CONFIG(accessibility)
#include <QtQuick/private/qquickaccessibleattached_p.h>
#endif
QT_BEGIN_NAMESPACE
class QQuickPopupItemPrivate : public QQuickPagePrivate
@ -403,7 +407,28 @@ QAccessible::Role QQuickPopupItem::accessibleRole() const
void QQuickPopupItem::accessibilityActiveChanged(bool active)
{
Q_D(const QQuickPopupItem);
// Can't just use d->popup->accessibleName() here, because that refers to the accessible
// name of us, the popup item, which is not what we want.
const QQuickAccessibleAttached *popupAccessibleAttached = QQuickControlPrivate::accessibleAttached(d->popup);
const QString oldPopupName = popupAccessibleAttached ? popupAccessibleAttached->name() : QString();
const bool wasNameExplicitlySetOnPopup = popupAccessibleAttached && popupAccessibleAttached->wasNameExplicitlySet();
QQuickPage::accessibilityActiveChanged(active);
QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(this);
const QString ourName = accessibleAttached ? accessibleAttached->name() : QString();
if (wasNameExplicitlySetOnPopup && accessibleAttached && ourName != oldPopupName) {
// The user set Accessible.name on the Popup. Since the Popup and its popup item
// have different accessible attached properties, the popup item doesn't know that
// a name was set on the Popup by the user, and that it should use that, rather than
// whatever QQuickPage sets. That's why we need to do it here.
// To avoid it being overridden by the call to accessibilityActiveChanged() below,
// we set it explicitly. It's safe to do this as the popup item is an internal implementation detail.
accessibleAttached->setName(oldPopupName);
}
// This allows the different popup types to set a name on their popup item accordingly.
// For example: Dialog uses its title and ToolTip uses its text.
d->popup->accessibilityActiveChanged(active);
}
#endif

View File

@ -80,6 +80,9 @@ QT_BEGIN_NAMESPACE
\li \l{SplitHandle::pressed}{SplitHandle.pressed}
\endlist
\note Handles should be purely visual and not handle events, as it can
interfere with their hovered and pressed states.
The preferred size of items in a SplitView can be specified via
\l{Item::}{implicitWidth} and \l{Item::}{implicitHeight} or
\c SplitView.preferredWidth and \c SplitView.preferredHeight:
@ -1091,6 +1094,7 @@ QQuickSplitView::QQuickSplitView(QQuickItem *parent)
d->changeTypes |= QQuickItemPrivate::Visibility;
setAcceptedMouseButtons(Qt::LeftButton);
setFiltersChildMouseEvents(true);
}
QQuickSplitView::QQuickSplitView(QQuickSplitViewPrivate &dd, QQuickItem *parent)
@ -1100,6 +1104,7 @@ QQuickSplitView::QQuickSplitView(QQuickSplitViewPrivate &dd, QQuickItem *parent)
d->changeTypes |= QQuickItemPrivate::Visibility;
setAcceptedMouseButtons(Qt::LeftButton);
setFiltersChildMouseEvents(true);
}
QQuickSplitView::~QQuickSplitView()
@ -1364,6 +1369,20 @@ void QQuickSplitView::hoverMoveEvent(QHoverEvent *event)
d->updateHoveredHandle(hoveredItem);
}
bool QQuickSplitView::childMouseEventFilter(QQuickItem *item, QEvent *event)
{
Q_D(QQuickSplitView);
qCDebug(qlcQQuickSplitViewMouse) << "childMouseEventFilter called with" << item << event;
if (event->type() != QEvent::HoverEnter)
return false;
// If a child item received a hover enter event, then it means our handle is no longer hovered.
// Handles should be purely visual and not accept hover events,
// so we should never get hover events for them here.
d->updateHoveredHandle(nullptr);
return false;
}
void QQuickSplitView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
Q_D(QQuickSplitView);

View File

@ -99,6 +99,7 @@ protected:
void componentComplete() override;
void hoverMoveEvent(QHoverEvent *event) override;
bool childMouseEventFilter(QQuickItem *item, QEvent *event) override;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
void itemAdded(int index, QQuickItem *item) override;

View File

@ -651,6 +651,13 @@ void QQuickStackView::push(QQmlV4Function *args)
void QQuickStackView::pop(QQmlV4Function *args)
{
Q_D(QQuickStackView);
if (d->removingElements) {
d->warn(QStringLiteral("cannot pop while already in the process of removing elements"));
args->setReturnValue(QV4::Encode::null());
return;
}
QScopedValueRollback<bool> removingElements(d->removingElements, true);
QScopedValueRollback<QString> rollback(d->operation, QStringLiteral("pop"));
int argc = args->length();
if (d->elements.count() <= 1 || argc > 2) {
@ -806,6 +813,13 @@ void QQuickStackView::pop(QQmlV4Function *args)
void QQuickStackView::replace(QQmlV4Function *args)
{
Q_D(QQuickStackView);
if (d->removingElements) {
d->warn(QStringLiteral("cannot replace while already in the process of removing elements"));
args->setReturnValue(QV4::Encode::null());
return;
}
QScopedValueRollback<bool> removingElements(d->removingElements, true);
QScopedValueRollback<QString> rollback(d->operation, QStringLiteral("replace"));
if (args->length() <= 0) {
d->warn(QStringLiteral("missing arguments"));
@ -902,6 +916,12 @@ void QQuickStackView::clear(Operation operation)
if (d->elements.isEmpty())
return;
if (d->removingElements) {
d->warn(QStringLiteral("cannot clear while already in the process of removing elements"));
return;
}
QScopedValueRollback<bool> removingElements(d->removingElements, true);
if (operation != Immediate) {
QQuickStackElement *exit = d->elements.pop();
exit->removal = true;

View File

@ -267,7 +267,11 @@ void QQuickStackViewPrivate::viewItemTransitionFinished(QQuickItemViewTransition
element->setStatus(QQuickStackView::Active);
} else if (element->status == QQuickStackView::Deactivating) {
element->setStatus(QQuickStackView::Inactive);
element->setVisible(false);
QQuickStackElement *existingElement = element->item ? findElement(element->item) : nullptr;
// If a different element with the same item is found,
// do not call setVisible(false) since it needs to be visible.
if (!existingElement || element == existingElement)
element->setVisible(false);
if (element->removal || element->isPendingRemoval())
removed += element;
}
@ -275,11 +279,21 @@ void QQuickStackViewPrivate::viewItemTransitionFinished(QQuickItemViewTransition
if (transitioner && transitioner->runningJobs.isEmpty()) {
// ~QQuickStackElement() emits QQuickStackViewAttached::removed(), which may be used
// to modify the stack. Set the status first and make a copy of the destroyable stack
// elements to exclude any modifications that may happen during the loop. (QTBUG-62153)
// elements to exclude any modifications that may happen during qDeleteAll(). (QTBUG-62153)
setBusy(false);
QList<QQuickStackElement*> elements = removed;
QList<QQuickStackElement*> removedElements = removed;
removed.clear();
qDeleteAll(elements);
for (QQuickStackElement *removedElement : qAsConst(removedElements)) {
// If an element with the same item is found in the active stack list,
// forget about the item so that we don't hide it.
if (removedElement->item && findElement(removedElement->item)) {
QQuickItemPrivate::get(removedElement->item)->removeItemChangeListener(removedElement, QQuickItemPrivate::Destroyed);
removedElement->item = nullptr;
}
}
qDeleteAll(removedElements);
}
removing.remove(element);

View File

@ -94,6 +94,7 @@ public:
void depthChange(int newDepth, int oldDepth);
bool busy = false;
bool removingElements = false;
QString operation;
QJSValue initialItem;
QQuickItem *currentItem = nullptr;

View File

@ -188,7 +188,7 @@ void QQuickToolTip::setText(const QString &text)
return;
d->text = text;
setAccessibleName(text);
maybeSetAccessibleName(text);
emit textChanged();
}
@ -351,7 +351,7 @@ void QQuickToolTip::accessibilityActiveChanged(bool active)
QQuickPopup::accessibilityActiveChanged(active);
if (active)
setAccessibleName(d->text);
maybeSetAccessibleName(d->text);
}
#endif

View File

@ -0,0 +1,2 @@
[a11y:Label]
opensuse-leap

View File

@ -0,0 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
AbstractButton {
text: "AbstractButton"
Accessible.name: text + "Override"
}

View File

@ -0,0 +1,6 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
BusyIndicator {
Accessible.name: "BusyIndicatorOverride"
}

View File

@ -0,0 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
Button {
text: "Button"
Accessible.name: text + "Override"
}

View File

@ -0,0 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
CheckBox {
text: "CheckBox"
Accessible.name: text + "Override"
}

View File

@ -0,0 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
CheckDelegate {
text: "CheckDelegate"
Accessible.name: text + "Override"
}

View File

@ -0,0 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
ComboBox {
model: ["ComboBox"]
Accessible.name: model[0] + "Override"
}

View File

@ -0,0 +1,6 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
Container {
Accessible.name: "ContainerOverride"
}

View File

@ -0,0 +1,6 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
Control {
Accessible.name: "ControlOverride"
}

View File

@ -0,0 +1,6 @@
import QtQuick 2.12
import Qt.labs.calendar 1.0
DayOfWeekRow {
Accessible.name: "Override"
}

View File

@ -0,0 +1,6 @@
import QtQuick 2.12
import Qt.labs.calendar 1.0
DayOfWeekRow {
Accessible.name: "DayOfWeekRowOverride"
}

View File

@ -0,0 +1,6 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
Dial {
Accessible.name: "DialOverride"
}

View File

@ -0,0 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
Dialog {
title: "Dialog"
Accessible.name: title + "Override"
}

View File

@ -0,0 +1,6 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
Drawer {
Accessible.name: "DrawerOverride"
}

View File

@ -0,0 +1,6 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
Frame {
Accessible.name: "FrameOverride"
}

View File

@ -0,0 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
GroupBox {
title: "GroupBox"
Accessible.name: title + "Override"
}

View File

@ -0,0 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
ItemDelegate {
text: "ItemDelegate"
Accessible.name: text + "Override"
}

View File

@ -0,0 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
Label {
text: "Label"
Accessible.name: text + "Override"
}

View File

@ -0,0 +1,6 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
Menu {
Accessible.name: "MenuOverride"
}

View File

@ -0,0 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
MenuItem {
text: "MenuItem"
Accessible.name: text + "Override"
}

View File

@ -0,0 +1,7 @@
import QtQuick 2.12
import Qt.labs.calendar 1.0
MonthGrid {
title: "MonthGrid"
Accessible.name: title + "Override"
}

View File

@ -0,0 +1,7 @@
import QtQuick 2.12
import Qt.labs.calendar 1.0
MonthGrid {
title: "MonthGrid"
Accessible.name: title + "Override"
}

View File

@ -0,0 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
Page {
title: "Page"
Accessible.name: title + "Override"
}

View File

@ -0,0 +1,6 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
PageIndicator {
Accessible.name: "PageIndicatorOverride"
}

View File

@ -0,0 +1,6 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
Pane {
Accessible.name: "PaneOverride"
}

View File

@ -0,0 +1,6 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
Popup {
Accessible.name: "PopupOverride"
}

View File

@ -0,0 +1,10 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
ProgressBar {
from: 0
to: 100
value: 50
Accessible.name: "ProgressBarOverride"
}

View File

@ -0,0 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
RadioButton {
text: "RadioButton"
Accessible.name: text + "Override"
}

Some files were not shown because too many files have changed in this diff Show More