If a new menu is set via the updateMenu() method, properly unregister
the old menu and register the new one.
Task-number: QTBUG-53676
Change-Id: I8c1ea2d171caec01488f0fe8a565bc9b2f7e431e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Before commit f1e9076809, mousePressEvent
called the virtual method setSelection(const QRect&, SelectionFlags)
with the 1x1 rectangle which contains only the clicked QPoint, unless
the SelectionFlag "Current" was set because Shift was pressed during
the mouse press.
Since that commit, the behavior has been changed such that the
rectangle is the one that is spanned by the center of the clicked item
and the clicked pixel. In theory, the result should be the same (i.e.,
only the clicked item should be selected), but
* the code path in QListView::setSelection for 1x1 QRects is more
efficient, and
* using a larger QRect can cause problems with custom views, see the
comments in QTBUG-18009
This commit ensures that the 1x1 QRect is used again, unless the
SelectionFlag "Current" is used.
Change-Id: I70dd70c083c20a3af6cd6095aa89a489756b505f
Task-number: QTBUG-18009
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Qt::Key_Print is the PrintScreen key-mapping. Instead use
Qt::Key_Printer which is also what VK_PRINT is mapped to.
Change-Id: I60a0181ed118253b6681ae0e5847812f73d63119
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The previous state was not restored completely when adding/removing
paths resulted in a stream start failure.
It also removes an autoreleasepool in restartStream, because both
stopStream and startStream do already create an autoreleasepool of their
own. (So, this pool will always be empty.)
Change-Id: Idc674e9c040f346703ab3ec256957e787a0ade73
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
topLevelChanged() is emitted when the floating property changes.
It's not very well named, it's easy to miss.
Change-Id: Iabaa4fb3dc6190df43d719ed7565f0586816c6de
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
Protection against short reads was already half implemented,
blockSize was being sent by the server but never used by the client.
Also, blockSize was bumped to quint32: If you're in a position where
short reads can happen then quint16 is probably not enough to hold the
size of your data. On Linux I could only reproduce short reads for
messages > 500K.
Change-Id: I191a3d781da1d8a119debbdafae641c8340a1da2
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
... and avoid detach()ing potentially large data for just
preserving the QPlatformPixmap::pixelType().
A QBitmap differs from a QPixmap (its base class, urgh)
by always having a data != nullptr and a Bitmap pixel
type, yet load() was unconditionally setting 'data' to
nullptr on failure, turning a QBitmap into a non-QBitmap.
Fix by move-assigning a null QBitmap instead of resetting
'data'.
Add some tests.
Change-Id: Ida58b3b24d96472a5f9d0f18f81cc763edcf3c16
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Found by UBSan:
qgraphicswidget_p.h:72:5: runtime error: downcast of address 0x2ab6a8021400 which does not point to an object of type 'QGraphicsWidget'
0x2ab6a8021400: note: object is of type 'QGraphicsObject'
00 00 00 00 70 93 5c 91 b6 2a 00 00 f0 c0 01 a8 b6 2a 00 00 e8 81 5c 91 b6 2a 00 00 10 bf 01 a8
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QGraphicsObject'
#0 0x2ab68f2fdd7c in QGraphicsWidgetPrivate::q_func() qgraphicswidget_p.h:72
#1 0x2ab68f2fdd7c in QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget*, QGraphicsScene*, QGraphicsScene*) qgraphicswidget_p.cpp:775
#2 0x2ab68f020d2a in QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem*, QVariant const*, QVariant const*) qgraphicsitem.cpp:1181
#3 0x2ab68f024f73 in QGraphicsItem::setParentItem(QGraphicsItem*) qgraphicsitem.cpp:1781
#4 0x2ab68f168401 in QGraphicsScenePrivate::removeItemHelper(QGraphicsItem*) qgraphicsscene.cpp:620
#5 0x2ab68f02c166 in QGraphicsItem::~QGraphicsItem() qgraphicsitem.cpp:1555
#6 0x2ab68f02ebb8 in QGraphicsObject::~QGraphicsObject() qgraphicsitem.cpp:7766
#7 0x2ab68f2d8888 in QGraphicsWidget::~QGraphicsWidget() qgraphicswidget.cpp:231
#8 0x4bce62 in SubQGraphicsWidget::~SubQGraphicsWidget() /tst_qgraphicswidget.cpp:175
#9 0x4bce62 in SubQGraphicsWidget::~SubQGraphicsWidget() /tst_qgraphicswidget.cpp:175
#10 0x2ab68f02c9ec in QGraphicsItem::~QGraphicsItem() qgraphicsitem.cpp:1550
#11 0x2ab68f02ebb8 in QGraphicsObject::~QGraphicsObject() qgraphicsitem.cpp:7766
#12 0x2ab68f2d8888 in QGraphicsWidget::~QGraphicsWidget() qgraphicswidget.cpp:231
#13 0x4bce62 in SubQGraphicsWidget::~SubQGraphicsWidget() /tst_qgraphicswidget.cpp:175
#14 0x4bce62 in SubQGraphicsWidget::~SubQGraphicsWidget() /tst_qgraphicswidget.cpp:175
#15 0x2ab68f128da4 in QGraphicsScene::clear() qgraphicsscene.cpp:2388
#16 0x2ab68f12936c in QGraphicsScene::~QGraphicsScene() qgraphicsscene.cpp:1682
#17 0x44d44c in tst_QGraphicsWidget::focusWidget() /tst_qgraphicswidget.cpp:435
qgraphicswidget_p.cpp:805:24: runtime error: member call on address 0x2ab6a8021400 which does not point to an object of type 'QGraphicsWidget'
0x2ab6a8021400: note: object is of type 'QGraphicsObject'
00 00 00 00 70 93 5c 91 b6 2a 00 00 f0 c0 01 a8 b6 2a 00 00 e8 81 5c 91 b6 2a 00 00 10 bf 01 a8
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QGraphicsObject'
#0 0x2ab68f2fdc68 in QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget*, QGraphicsScene*, QGraphicsScene*) qgraphicswidget_p.cpp:805
#1 0x2ab68f020d2a in QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem*, QVariant const*, QVariant const*) qgraphicsitem.cpp:1181
[... identical lines omitted ...]
qgraphicswidget_p.cpp:806:23: runtime error: member call on address 0x2ab6a8021400 which does not point to an object of type 'QGraphicsWidget'
0x2ab6a8021400: note: object is of type 'QGraphicsObject'
00 00 00 00 70 93 5c 91 b6 2a 00 00 f0 c0 01 a8 b6 2a 00 00 e8 81 5c 91 b6 2a 00 00 10 bf 01 a8
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QGraphicsObject'
#0 0x2ab68f2fdb6b in QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget*, QGraphicsScene*, QGraphicsScene*) qgraphicswidget_p.cpp:806
#1 0x2ab68f020d2a in QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem*, QVariant const*, QVariant const*) qgraphicsitem.cpp:1181
[... identical lines omitted ...]
qgraphicswidget_p.cpp:827:26: runtime error: member call on address 0x2ab6a8021400 which does not point to an object of type 'QGraphicsWidget'
0x2ab6a8021400: note: object is of type 'QGraphicsObject'
00 00 00 00 70 93 5c 91 b6 2a 00 00 f0 c0 01 a8 b6 2a 00 00 e8 81 5c 91 b6 2a 00 00 10 bf 01 a8
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QGraphicsObject'
#0 0x2ab68f2fdf91 in QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget*, QGraphicsScene*, QGraphicsScene*) qgraphicswidget_p.cpp:827
#1 0x2ab68f020d2a in QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem*, QVariant const*, QVariant const*) qgraphicsitem.cpp:1181
[... identical lines omitted ...]
Fix by moving the setParentItem(nullptr) call up the call stack
into ~QGraphicsWidget(), ensuring that the object is still a
QGraphicsWidget when these calls are made.
Change-Id: I264779e33098e9752de9a312a146fb203578a3cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Unlike layouts and spacer items, a QWidget is-not-a QLayoutItem.
QWidgetItem simply wraps the QWidget, so in QFormLayout::setWidget(),
we allocate a widget item for the widget passed, and hand that down
to Private::setItem() for adding to the various data structures.
Private::setItem() has a bunch of guard clauses, though, that return
without deleting the item.
A test triggered this code path and made asan complain.
This is just one part of a larger problem: QFormLayout::setLayout()
normally takes ownership of the layout passed, because QLayouts own
their QLayoutItems, and QLayout is-a QLayoutItem. But setLayout()
fails to live up to the owner role when it fails to add a layout,
and there's no easy way for the API user to check for success.
A fix for this breaks tst_qformlayout, and while those checks that
break deserve to be broken, I'll refrain from proposing the larger
fix for 5.6 LTS, but will propose it for 5.8 or 5.9 instead.
This fix here only fixes the leak in setWidget() by adding a bool
return to Private::setItem() informing Private::setWidget() of the
need to manually delete the item it allocated for the widget.
Change-Id: I81409c260f9bee2e95c9a98542d8c60bc19a1332
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
QtDBus is compiled with exceptions disabled, but checkers
don't know that, and it's not 100% certain it will stay
that way until eternity.
So do the simple change and hold the new'ed pointer in a
QScopedPointer until handing it off to create().
Coverity-Id: 154477
Change-Id: I91a763ca4e93585c97cb9e794312b53046971161
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If using IM to compose text in QTextEdit, the placeholder text
will show underneath until the text is committed.
This patch will additionally check if the user is currently
composing preedit text before deciding whether or not to draw the
placeholder text.
Task-number: QTBUG-55758
Change-Id: If7943c6c94fb96d46514a81caa118829e6e6a0f9
Reviewed-by: Liang Qi <liang.qi@qt.io>
In some cases, when QNetworkReply::encrypted is emitted,
QNetworkReply::sslConfiguration is not yet initialized, in particular
certificate chain is empty, which breaks the documented usage of
'encrypted' to perform additional checks on certificate chain.
It looks to be caused by the fact that QHttpNetworkReply is originally
associated with 0th QHttpNetworkConnectionChannel, and this association
is not updated if HTTP pipelining is not used. Therefore, a reply on
channel >0 might arrive before reply on channel 0, and then using ssl
configuration from channel 0, which not made it through handshake, is
not usable.
Task-number: QTBUG-49554
Change-Id: Ie5d4b5a0c503d5bdc44761ce8581f6ffe4e3bac2
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
The slot is invoked from QObject::destroyed(), which is emitted
from ~QObject. By that time the object is no longer a QShortcut,
so the static_cast it invalid.
Found by UBSan:
tst_qshortcut.cpp:1210:53: runtime error: downcast of address 0x6020000289d0 which does not point to an object of type 'QShortcut'
0x6020000289d0: note: object is of type 'QObject'
10 00 80 17 c0 ce 63 df 93 2b 00 00 b0 02 00 00 d0 60 00 00 02 00 00 00 ff ff ff 04 04 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QObject'
#0 0x42b3bb in tst_QShortcut::shortcutDestroyed(QObject*) tst_qshortcut.cpp:1210
#1 0x446cc9 in tst_QShortcut::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) .moc/tst_qshortcut.moc:186
#2 0x2b93dba52c86 in QMetaObject::activate(QObject*, int, int, void**) qobject.cpp:3787
#3 0x2b93dba55400 in QObject::destroyed(QObject*) .moc/moc_qobject.cpp:213
#4 0x2b93dba8d80d in QObject::~QObject() qobject.cpp:967
#5 0x2b93c6b6e032 in QShortcut::~QShortcut() qshortcut.cpp:476
#6 0x2b93c6b6e370 in QShortcut::~QShortcut() qshortcut.cpp:481
#7 0x42a5de in void qDeleteAll<QList<QShortcut*>::const_iterator>(QList<QShortcut*>::const_iterator, QList<QShortcut*>::const_iterator) qalgorithms.h:317
#8 0x42a5de in void qDeleteAll<QList<QShortcut*> >(QList<QShortcut*> const&) qalgorithms.h:325
#9 0x42a5de in tst_QShortcut::clearAllShortcuts() tst_qshortcut.cpp:1136
Fix by replacing QVector::replaceAll() with the erase-remove idiom,
which does not require the cast, because it can perform mixed-type
lookups.
Change-Id: I4251c1895fa4398023f489dbfd7108d90c1a6c94
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
To keep the change minimal, keep 'sw' as a pointer variable,
but back it by a stack-allocated QStackedWidget instead of a
heap-allocated one that's never deleted.
Change-Id: I9e2a8c07979b861eb7e7040c144d8e75c90d0bc9
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
In case a project uses C++/CX extensions via /ZW compile flag including
qfunctions_winrt.h resulted in a compile error about duplicate
definition of Started due to namespace usages.
Change-Id: I8913522eafbabae77dd7d17187f202e555b0275f
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Since QCocoaEventDispatcher::processEvents() resets the interrupt
state, this may prevent a higher level event loop from returning.
For example, calling QMenu::exec() and, as a result of an action
being triggered, the application calls QCoreApplication::processEvents()
after QMenu::hideEvent(). In this case, the menu event loop can be
stuck until we run another event loop.
Task-number: QTBUG-53947
Change-Id: If7efe1c3c07f7222c695195cbb4f41715e49b02e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Reviewed-by: Wayne Arnold <wayne.arnold@autodesk.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
In setData(), the old code both called Private::addNode(),
which creates a QFileSystemNode and adds it to the parent's
QHash of children, and also re-purposed the old node by
taking it out of the children hash, adjusting the fileName
member of the node and putting it back into the children
hash under the new name, where it would overwrite the node
just added under the same (new) name in addNode(). Since
the hash stores naked pointers, no-one deletes the node
that was put into the hash first.
Fix by dropping the addNode() call completely.
Change-Id: I0c37917fd0ffd74716393786c69b5bb172aa372e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The QFileInfo 'info' is only used in code conditional on
QT_NO_FILESYSTEMWATCHER, so move the definiton into the
conditionally-compiled block, too.
Turn it into an rvalue while at it.
Change-Id: I9983bfdcd0b32d0abecf7c588973a60df9de8cbc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The old code is broken because it was passing signal.outputArgs as inputArgs
variable of writeArgList, fix can not be passing signal.outputArgs as outputArgs
of writeArgList since that ignores the first of the list, so i added a new function
that does the right thing
Change-Id: If54484e04880d5dcebfedb9d478ee0e9faf37baa
Task-number: QTBUG-21577
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Re-apply change 6e850af09d,
the code for which has gone missing.
This prevents sending tablet events as both mouse
and tablet events, which confuses the double-click
detection code in QGuiApplication::processMouseEvent()
when tablet->mouse event synthesis is enabled.
Task-number: QTBUG-54399
Task-number: QTBUG-51617
Task-number: QTBUG-47007
Change-Id: I6183906d4ce2b8cdc617d34e22a9dcf999eef51d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Added the binary compatibility test data files for Qt 5.7 for QtBase
Change-Id: I5b19571f5e266c52622027d820062afa5fd4fbf3
Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
In tst_QCompleter, two completers were leaked because they
had no parent and setCompleter() calls don't reparent.
Fixed by giving them parents.
In tst_QUndo*, fix lots of leaked QActions by storing them
in a QScopedPointer. There were some half-hearted attempts
to clean them up with manual deletes, but I ported these to
scoped pointers, too, to make the code more robust in the
face of failures.
This fixes the remaining errors in GCC 6.1 Linux ASan runs of
tests/auto/widgets/util.
Change-Id: Icc5248cc9cf4514540915924df1c4d9e09c071fa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
QXcbClipboard failed to delete the various QMimeData instances
it owns.
For m_xClipboard, where the two QXcbClipboardMime instances are
never the same, fix the leak by using a scoped instead of a
naked pointer.
For m_clientClipboard, where the two QMimeData could be identical
objects, keep the naked pointers, but delete the objects manually
in the QXcbClipboard destructor, paying attention to the case
where they're the same object.
Change-Id: I5ce0e3e8fcec068aeb344ca806cdf2667378e946
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It unifies handling of QByteArray's size limit in read(), readLine()
and will be used in a follow-up change which optimizes the performance
of QIODevice::peek() function.
Change-Id: Idb9fbbe14d9632ee267d2a0e47c8a88603c024a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The order in which exclusive builds are added affects the order of
values in SUBTARGETS. xcodebuild.mk parses the value of SUBTARGETS in
the Makefile and selects the first entry, which would always be
release-iphonesimulator regardless of the build type. This obviously
caused -sdk iphoneos builds to fail.
This patch switches the order of in which exclusive builds are added so
that the entries which are not present in a particular build type are
always added last.
Change-Id: I306d6f7430c1dff3d741a8c5182b7af81d000e7f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
(Backport of 5.7/8586ccc).
The original patch was implemented to handle crashes after e78ca787ae.
But the former was pushed to 5.7, and the latter to 5.6. So we need to
backport it, otherwise the same crashes will still happen in 5.6
(e.g when transferring focus from a text edit to a (picker) menu).
Change-Id: I13037735dc316bceadb571e67f38a310c8a1bfae
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
On iPad, a shortcuts bar with extra controls are shown
on top of the keyboard with opertions like cut and copy.
This is unwanted when using the keyboard to show menus.
This patch will add extra private information to IM
platform data when using menus, so that we hide the
shorcuts menu when showing the custom input panel.
Task-number: QTBUG-49893
Change-Id: Iaa8e1ff18acebec8be69699b3fd9470c69ab34d7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
The generated data files for the binary compatibility test
updated for QtBase.
Change-Id: Idae703c83f55ff17cada4419db742ea12b22bf86
Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
The usual:
- delete styles
Either by using QScopedPointer.
This fixes the remaining errors in GCC 6.1 Linux ASan runs of
tests/auto/widgets/styles.
Change-Id: Ifba59085c057d474bf964cbb93010c408d773a61
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
GCC warned:
tst_qabstractslider.cpp:858:89: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
Qt::Orientation orientation = *reinterpret_cast<Qt::Orientation*>(&sliderOrientation);
^
tst_qabstractslider.cpp:867:72: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
orientation = *reinterpret_cast<Qt::Orientation*>(&wheelOrientation);
^
The solution, of course, would be to use a static_cast here, but
why go via int in the first place? Qt::Orientation can perfectly
well be used in QFETCH, as proven by tst_qmainwindow, among other
things.
Change-Id: I97916a50405e16d114837bc52580ce6666d74b17
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Restore Qt::AA_DontUseNativeDialogs that is disabled in the beginning
of the test function.
Change-Id: I4ff8eab4ecc458c478337824e66b5a59fbdd7c65
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
so far, we "downgraded" only explicit error() output, but other errors
may happen as well while doing semi-exact evaluation of .prf files - at
least hypothetically.
amends 08d0cb6f8e.
Change-Id: I32819a569dbed2dbdb37c5c23bf4a5a18d3c64ea
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
(cherry picked from qttools/ea1a5c3534f089c0e704808a0fb029eda8f753b4)
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
that required factoring out the docs installation to a separate project,
as COPIES doesn't work in subdirs projects. it's cleaner this way
anyway.
Change-Id: I594f3ecdae67417511034ab993904c962b86b282
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
Identifiers that match _[A-Z_]* are reserved for use by std
implementations. Qt is not an implementation of the standard,
so it mustn't use such identifiers.
Use plain names for macro arguments and the qt_test_ prefix
for C++ variables declared in expansions of those macros.
Change-Id: I22be167e36676199a5b084df3f4c5ef86c89f000
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QWidget does not inherit QLayoutItem (unlike QLayout and QSpacerItem, which do),
so don't claim that in the docs.
Added a note.
Added cross-references between layout(), widget() and spacerItem().
Change-Id: I518b6842ef76fd1b72226b790dab75f429fae556
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>