From 2d8b80bb9c623c246c3815c3fd32cbd6392dc27b Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 12 Sep 2019 11:03:07 +0200 Subject: QList: make cast from ptrdiff_t to int explicit Amends ffc2d5722317fcab86865b11491d7bf7fef3e16d. Fixes: QTBUG-78235 Change-Id: Ie91d8d71c92bb62e3268847407b7b252c382d700 Reviewed-by: Marc Mutz --- src/corelib/tools/qlist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 74b57f7ad4..a98a9147d6 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -1031,7 +1031,7 @@ int lastIndexOf(const QList &list, const U &u, int from) Node *n = reinterpret_cast(list.p.at(from + 1)); while (n-- != b) { if (n->t() == u) - return typename QList::difference_type(n - b); + return int(n - b); } } return -1; -- cgit v1.2.3 From e02293a76d21e7077f1952d4ed8af6c6d1970190 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 30 Sep 2019 08:26:36 +0200 Subject: Always update the pressed position when pressing on an item If there is an item already selected then the pressed position needs to be updated regardless when selecting a new one even if it is not made current as this will be used to determine the drag distance. Otherwise it will start a drag within one pixel of moving due to the fact it is doing it relative to the first item to be pressed rather than the last. Fixes: QTBUG-78797 Change-Id: I853041b278b2e92ccf20660f7ced945fef72527a Reviewed-by: Samuel Gaist Reviewed-by: Christian Ehrlicher --- src/widgets/itemviews/qabstractitemview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index cb99214d4e..7d5e014dd5 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -1775,8 +1775,8 @@ void QAbstractItemView::mousePressEvent(QMouseEvent *event) QItemSelectionModel::SelectionFlags command = selectionCommand(index, event); d->noSelectionOnMousePress = command == QItemSelectionModel::NoUpdate || !index.isValid(); QPoint offset = d->offset(); + d->pressedPosition = pos + offset; if ((command & QItemSelectionModel::Current) == 0) { - d->pressedPosition = pos + offset; d->currentSelectionStartIndex = index; } else if (!d->currentSelectionStartIndex.isValid()) -- cgit v1.2.3 From 7d73d4b9a93b3132c1a24aa3ae77f0a307e821fd Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 20 Aug 2019 10:53:53 +0200 Subject: Remove the unregistered recognizer from the main list This amends 1320b2f64412f0d86bd09c66c22df845e13a94a1 to keep the behavior of removing from the main list but without re-introducing the memory leak. Fixes: QTBUG-77770 Change-Id: I91fa6cb71fab8d60baa35417fdb34322af11dbbb Reviewed-by: Friedemann Kleint Reviewed-by: Richard Moe Gustavsen --- src/widgets/kernel/qgesturemanager.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp index cd27c9c5be..5d2adc1e1c 100644 --- a/src/widgets/kernel/qgesturemanager.cpp +++ b/src/widgets/kernel/qgesturemanager.cpp @@ -143,6 +143,7 @@ Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *r void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type) { QList list = m_recognizers.values(type); + m_recognizers.remove(type); foreach (QGesture *g, m_gestureToRecognizer.keys()) { QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g); if (list.contains(recognizer)) { -- cgit v1.2.3 From 5aa13ea144cff4dbadf12c08b7aa49646347e186 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 12 Sep 2019 15:22:24 +0200 Subject: QTreeWidget: Don't assume the selected indexes include the first column If the first column is hidden in a QTreeWidget then when doing a drag then the selected indexes will not include any that have a column of 0. Therefore it has to account for this use std::unique to ensure that there is only one instance of the selected items represented by the selected indexes. Fixes: QTBUG-35511 Change-Id: I39dff596959f30db7378ff946735ee2866778524 Reviewed-by: Richard Moe Gustavsen --- src/widgets/itemviews/qtreewidget.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index d2dc91b18c..be7ddd8b30 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -748,11 +748,14 @@ QMimeData *QTreeModel::internalMimeData() const QMimeData *QTreeModel::mimeData(const QModelIndexList &indexes) const { - QList items; - for (const auto &index : indexes) { - if (index.column() == 0) // only one item per row - items << item(index); - } + QList items; + std::transform(indexes.begin(), indexes.end(), std::back_inserter(items), + [this](const QModelIndex &idx) -> QTreeWidgetItem * { return item(idx); }); + + // Ensure we only have one item as an item may have more than + // one index selected if there is more than one column + std::sort(items.begin(), items.end()); + items.erase(std::unique(items.begin(), items.end()), items.end()); // cachedIndexes is a little hack to avoid copying from QModelIndexList to // QList and back again in the view -- cgit v1.2.3 From 932805807123833bb8f5ae9abda7e946f48d9f0c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 2 Oct 2019 07:56:16 -0700 Subject: Fix crash when running QtCore: Stack is misaligned on x86-64 When our ELF entry point function is started by the kernel, the stack is aligned at 16 bytes. However, the stack is expected to be off by 8, due to a preceding CALL instruction which didn't exist. This cauases a crash further down as the compiler may generate aligned stack access. Change-Id: I1496b069cc534f1a838dfffd15c9dc4ef9e3869e Reviewed-by: Edward Welbourne --- src/corelib/global/qlibraryinfo.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 5634d6e6c3..f2ada4ab30 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -709,10 +709,14 @@ QT_END_NAMESPACE #include "private/qcoreapplication_p.h" +QT_WARNING_DISABLE_GCC("-Wattributes") +QT_WARNING_DISABLE_CLANG("-Wattributes") +QT_WARNING_DISABLE_INTEL(2621) + extern const char qt_core_interpreter[] __attribute__((section(".interp"))) = ELF_INTERPRETER; -extern "C" void qt_core_boilerplate(); +extern "C" void qt_core_boilerplate() __attribute__((force_align_arg_pointer)); void qt_core_boilerplate() { printf("This is the QtCore library version " QT_BUILD_STR "\n" -- cgit v1.2.3