XCB: silence warnings about possibly undefined shifts

The code shifts "1" by a uint32 number. If that number is >= 32,
we're triggering undefined behavior, and Coverity rightfully complains
about that. Add some asserts to silence those warnings.

Change-Id: Ib91085a279b0a2b7ad37afad05ec1d764c0496b1
Reviewed-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Initialize QFileSystemMetaData::size_ data member

There's a code path which reads that member before it got anything
assigned to it, triggering undefined behavior.

The code path goes as follows:

1. an instance is created in QFSFileEngineIterator::advance
2. the instance is passed to QFileSystemIterator::advance, which fills in
   only some members (not size_)
3. the instance is passed to QFileInfoPrivate which does a deep copy,
   reading an uninitialized size_

Change-Id: I6835ee701a83b63ca4bad6235feeb6a23566fcd3
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QMacStyle: save context state before changing to avoid crash

qt_drawFocusRingOnPath was saving the graphics state after setting
a new context. This leads to zombie NSBitmapGraphicsContext access
with QFileDialog.

Task-number: QTBUG-41879
Change-Id: I7fc7d959d2b0f01cb3491d639023083f1b46d175
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
QAbstractItemView: fix CTRL+A select all behavior

The check for Qt::Key_A to handle selectAll was changed to directly
compare to QKeySequence::SelectAll as this will only match Ctrl. The
former implementation also triggered when e.g. Shift was pressed.
Added a check that selectAll is only called when selection is not
disabled, i.e. selectionMode=NoSelection.

Added a unit test for selectAll().

Task-number: QTBUG-26687
Change-Id: I721e7ab590b55d7d754b3b74ef01756fa5aa1315
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
QMacStyle: Fix QPushButton with menu appearance on 10.10

As usual, this includes small and mini control sizes.
Flat and oversized buttons will fall back to the HITheme
rendering for now.

Task-number: QTBUG-40833
Change-Id: I08d67c48b2e72681af4dc4a37ea498f7aac1dca0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Fix QtBearer connman backend report correctly on lte network

Task-number: QTBUG-41813
Change-Id: I977facc2ee59571d24e60ac9d5d41e957403b344
Reviewed-by: Richard J. Moore <rich@kde.org>
Merge remote-tracking branch 'origin/5.3' into 5.4

Change-Id: Ic01820f2390e419a5b286643e7351e85ae032473
Make font hinting and antialiasing size dependent when using FontConfig

Add the pixel size of the font to the search pattern to get size dependent
font settings. This patch allows to take into account KDE settings for
font sizes which should be excluded from antialiasing.

Change-Id: I8bd8b7b3d585009d0a39db631cd02b7970537f5c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Fix use-after-delete bug in tst_QWidget::taskQTBUG_27643_enterEvents()

ASAN report:

  READ of size 8 at 0x606000011990 thread T0
    #0 0x505e3b in EnterTestMainDialog::eventFilter(QObject*, QEvent*) tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp:10294
    [...]

  0x606000011990 is located 48 bytes inside of 56-byte region [0x606000011960,0x606000011998)
  freed by thread T0 here:
    #0 0x2b8df3551c79 in operator delete(void*) ../../../../gcc/libsanitizer/asan/asan_new_delete.cc:92
    #1 0x418ab5 in EnterTestMainDialog::buttonPressed() tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp:10276

  previously allocated by thread T0 here:
    #0 0x2b8df3551739 in operator new(unsigned long) ../../../../gcc/libsanitizer/asan/asan_new_delete.cc:60
    #1 0x4188cf in EnterTestMainDialog::buttonPressed() tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp:10272

EnterTestMainDialog::eventFilter() checks for nullness of 'modal'
before accessing it, but buttonPressed() did not reset 'modal'
to nullptr after deletion.

Change-Id: I65562a29f8264a6996d7d615e06de1d1afb5af53
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
QMacStyle: Add optional block parameter to drawNSViewInRect()

In some cases we want to do something different than just calling
- [NSView drawRect:].

Change-Id: I7db704daa39611f33f270b0192c4301de62ec1bf
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
QMacStyle: Fix QSlider appearance on Yosemite

First, we adjust the min and max positions, which HITheme has been
unable to render properly for years. This involves separating the
knob and track rendering. Also, on Yosemite, the tickmarks-less
slider shows a blue progress fill in the track, on the knob's left
side. Finaly, and this is valid for all versions, the tickmarks are
being drawn before the knob (or the whole slider for OS X versions
before 10.10)

Change-Id: I6fce2e298a80858a18fd9fe1e799b65265a8aefd
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Merge "Merge remote-tracking branch 'origin/5.3' into 5.4" into refs/staging/5.4
Bump default deployment target to 10.7

10.6 is no longer supported.

Change-Id: I4c799ba2a9622aa1dd8a79ff70608b50b2bbd26a
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
OS X: Emit QClipboard::dataChanged when activating application

The QClipboard documentation states that on OS X it will emit
dataChanged() when activating the application, if the system clipboard
had changed. It wasn't doing this in Qt5.

Task-number: QTBUG-34941
Change-Id: I7f34e757876757691f0a6c94dd2ae76a60146291
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
iOS: ensure edit menu works on iOS6

Method "- (id)targetForAction:(SEL)action withSender:(id)sender" is
only available from iOS7. So change implementation to use
whats available on iOS 6.

Change-Id: I4e21495073364e83ef396dfab47a7ea2a23bbead
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
CoreText font database: Use dynamic type on iOS to resolve theme fonts

Use Dynamic Type to resolve theme fonts, so that we get the
correct font sizes and styling based on user preferences
in Settings app.

Change-Id: I2222199a5ba21badb2e3696993eee503e720c476
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
iOS: ignore sender of actions for edit menu

The reason is that the sender is sometimes 'NULL', so
we cannot rely on it. But the current test with our
prefix should suffice.

Change-Id: Ie58bf062cbade08feda622bda753d63e1d811a8d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
iOS: ensure we have a valid focusObject before sending it IM events

Should not really happen, but since we don't store the focus
object given to us, we should do a check.

A crash was seen from this when running the "Application"
example for widgets.

Change-Id: I9c4121766d7028a4eceede7d7b15c8c53d34e16e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
QSizePolicy: remind to mark as Q_PRIMITIVE_TYPE in Qt 6

Change-Id: I1f18b4cd99f37aadf199e70d3acade9c8f5f9799
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add qHash(QSslCertificate) overload

qsslsocket_winrt.cpp defined it locally, which runs the risk of
clashes with a potential user-defined qHash(QSslCertificate), so
make it public.

Also, the implementation in qsslsocket_winrt.cpp simply hashed
the handle(), which violates the principle that equal instances
must hash to the same value. Also, for some platforms, the
implementation returns nullptr unconditionally, which, while not
violating the above-mentioned principle, will make all users of
the hash have worst-case complexity.

To calculate a meaningful hash, therefore, the certificate needs
to be inspected deeper than just the handle.

For OpenSSL, we use X509::sha1_hash, which also X509_cmp uses
internally to determine inequality (it checks more stuff, but
if X059::sha1_hash is different, X509_cmp() returns non-zero,
which is sufficient for the purposes of qHash()). sha1_hash may
not be up-to-date, though, so we call X509_cmp to make it valid.
Ugh.

For WinRT/Qt, we use the DER encoding, as that is the native
storage format used in QSslCertificate. This is not equivalent
to the implementation used in qsslsocket_winrt.cpp before, but
since handle() == handle() => toDer() == toDer(), it should not
be a problem.

[ChangeLog][QtNetwork][QSslCertificate] Can now be used as a key in QSet/QHash.

Change-Id: I10858fe648c70fc9535af6913dd3b7f3b2cf0eba
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>