aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/qquickaccessibleattached.cpp3
-rw-r--r--src/quick/items/qquickitem.cpp9
-rw-r--r--src/quick/items/qquickitemview_p_p.h2
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp4
-rw-r--r--src/quick/items/qquicktableview.cpp4
-rw-r--r--src/quick/items/qquicktextcontrol.cpp2
-rw-r--r--src/quick/items/qquicktextedit.cpp13
-rw-r--r--src/quick/items/qquicktextinput.cpp16
-rw-r--r--src/quick/items/qquicktreeview.cpp4
9 files changed, 40 insertions, 17 deletions
diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp
index 865fb8bf11..b0c55b4653 100644
--- a/src/quick/items/qquickaccessibleattached.cpp
+++ b/src/quick/items/qquickaccessibleattached.cpp
@@ -430,6 +430,9 @@ void QQuickAccessibleAttached::setIgnored(bool ignored)
{
if (this->ignored() != ignored && item()) {
item()->d_func()->isAccessible = !ignored;
+ QAccessibleEvent event(item(),
+ ignored ? QAccessible::ObjectDestroyed : QAccessible::ObjectCreated);
+ QAccessible::updateAccessibility(&event);
emit ignoredChanged();
}
}
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index ec339ccc3b..239b512b9b 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -6425,10 +6425,11 @@ void QQuickItem::setVisible(bool v)
This property holds whether the item receives mouse and keyboard events.
By default this is true.
- Setting this property directly affects the \c enabled value of child
- items. When set to \c false, the \c enabled values of all child items also
- become \c false. When set to \c true, the \c enabled values of child items
- are returned to \c true, unless they have explicitly been set to \c false.
+ Setting this property affects the \e effective \c enabled states of child items.
+ When an item's parent is not enabled, the (child) item is effectively disabled and
+ does not receive input events, even if its own \c enabled property is explicitly
+ set to \c true. The child \c enabled property keeps its value, but becomes
+ effective again only if all its ancestor items are enabled.
Setting this property to \c false automatically causes \l activeFocus to be
set to \c false, and this item will no longer receive keyboard events.
diff --git a/src/quick/items/qquickitemview_p_p.h b/src/quick/items/qquickitemview_p_p.h
index c1188ac4d7..684aa8f98e 100644
--- a/src/quick/items/qquickitemview_p_p.h
+++ b/src/quick/items/qquickitemview_p_p.h
@@ -42,7 +42,7 @@ public:
};
-class Q_AUTOTEST_EXPORT QQuickItemViewChangeSet
+class Q_QUICK_EXPORT QQuickItemViewChangeSet
{
public:
QQuickItemViewChangeSet();
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index b0b99334a2..33d801a2a3 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -660,8 +660,8 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event, RemapEventPoints
for (const QEventPoint &p : std::as_const(touchPoints)) {
if (p.state() == QEventPoint::State::Released)
continue;
- const QPointF &currentPos = p.scenePosition();
- const QPointF &startPos = p.scenePressPosition();
+ const QPointF currentPos = mapFromScene(p.scenePosition());
+ const QPointF startPos = mapFromScene(p.scenePressPosition());
if (qAbs(currentPos.x() - startPos.x()) > dragThreshold)
offerGrab = true;
else if (qAbs(currentPos.y() - startPos.y()) > dragThreshold)
diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp
index 3cc63cece0..dbbdfec6cc 100644
--- a/src/quick/items/qquicktableview.cpp
+++ b/src/quick/items/qquicktableview.cpp
@@ -4866,8 +4866,8 @@ bool QQuickTableViewPrivate::canEdit(const QModelIndex tappedIndex, bool warn)
return false;
}
- if (auto const qaim = model->abstractItemModel()) {
- if (!(qaim->flags(tappedIndex) & Qt::ItemIsEditable)) {
+ if (auto const sourceModel = qaim(modelImpl())) {
+ if (!(sourceModel->flags(tappedIndex) & Qt::ItemIsEditable)) {
if (warn)
qmlWarning(q) << "cannot edit: QAbstractItemModel::flags(index) doesn't contain Qt::ItemIsEditable";
return false;
diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp
index 510ece726a..c5b87a7c30 100644
--- a/src/quick/items/qquicktextcontrol.cpp
+++ b/src/quick/items/qquicktextcontrol.cpp
@@ -742,7 +742,7 @@ void QQuickTextControl::processEvent(QEvent *e, const QTransform &transform)
case QEvent::ShortcutOverride:
if (d->interactionFlags & Qt::TextEditable) {
- QKeyEvent* ke = static_cast<QKeyEvent *>(e);
+ QKeyEvent *ke = static_cast<QKeyEvent *>(e);
ke->setAccepted(isCommonTextEditShortcut(ke));
}
break;
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index 4471d6e4b9..57c12d2825 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -1751,12 +1751,15 @@ QRectF QQuickTextEdit::cursorRectangle() const
bool QQuickTextEdit::event(QEvent *event)
{
Q_D(QQuickTextEdit);
- if (event->type() == QEvent::ShortcutOverride) {
- d->control->processEvent(event, QPointF(-d->xoff, -d->yoff));
- if (event->isAccepted())
- return true;
+ bool state = QQuickImplicitSizeItem::event(event);
+ if (event->type() == QEvent::ShortcutOverride && !event->isAccepted()) {
+ QQuickItemPrivate *itemPriv = QQuickItemPrivate::get(this);
+ if (!itemPriv->extra.isAllocated() || !itemPriv->extra->keyHandler) {
+ d->control->processEvent(event, QPointF(-d->xoff, -d->yoff));
+ }
+ state = true;
}
- return QQuickImplicitSizeItem::event(event);
+ return state;
}
/*!
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 08713eb026..495f99505f 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -49,6 +49,13 @@ Q_LOGGING_CATEGORY(lcQuickTextInput, "qt.quick.textInput")
and setting \l echoMode to an appropriate value enables TextInput to be used for
a password input field.
+ To react to the user accepting text via the Return or Enter keys, handle
+ the \l accepted() signal. When Return or Enter are pressed and the text
+ input loses focus, \l editingFinished() will be emitted. When the text is
+ edited in any way by the user, \l textEdited() is emitted. These signals
+ \l {Property change signals}{should be preferred} over \c textChanged()
+ in most cases.
+
On \macos, the Up/Down key bindings for Home/End are explicitly disabled.
If you want such bindings (on any platform), you will need to construct them in QML.
@@ -96,7 +103,8 @@ void QQuickTextInput::componentComplete()
the \l preeditText property. To get whole text displayed in the TextInput
use \l displayText property.
- \sa clear(), displayText, preeditText
+ \sa clear(), displayText, preeditText, accepted(), editingFinished(),
+ textEdited()
*/
QString QQuickTextInput::text() const
{
@@ -1184,6 +1192,8 @@ bool QQuickTextInput::hasAcceptableInput() const
Note that if there is a \l validator or \l inputMask set on the text
input, the signal will only be emitted if the input is in an acceptable
state.
+
+ \sa editingFinished(), textEdited()
*/
/*!
@@ -1195,6 +1205,8 @@ bool QQuickTextInput::hasAcceptableInput() const
inputMask set on the text input and enter/return is pressed, this
signal will only be emitted if the input follows
the inputMask and the validator returns an acceptable state.
+
+ \sa accepted(), textEdited()
*/
/*!
@@ -1204,6 +1216,8 @@ bool QQuickTextInput::hasAcceptableInput() const
This signal is emitted whenever the text is edited. Unlike \c textChanged(),
this signal is not emitted when the text is changed programmatically, for example,
by changing the value of the \c text property or by calling \c clear().
+
+ \sa accepted(), editingFinished()
*/
#if QT_CONFIG(im)
diff --git a/src/quick/items/qquicktreeview.cpp b/src/quick/items/qquicktreeview.cpp
index 88373a1706..17e21a75f4 100644
--- a/src/quick/items/qquicktreeview.cpp
+++ b/src/quick/items/qquicktreeview.cpp
@@ -650,8 +650,10 @@ void QQuickTreeView::keyPressEvent(QKeyEvent *event)
break;
}
- if (!event->isAccepted())
+ if (!event->isAccepted()) {
+ event->accept();
QQuickTableView::keyPressEvent(event);
+ }
}
QT_END_NAMESPACE