This fixes a regression introduced in 8e70241dcc.
Task-number: QTBUG-63631
Change-Id: I5a2c23e06b790a482e1542ac2db3dcf25927caf2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
<future> is needed by QThread::create. Instead of a fragile series
of preprocessor tests, move its detection to a configure test.
This dramatically simplifies the code, but on the other hand ties
the availability of QThread::create() to the system used to compile
Qt (rather the one used to compile an application).
Change-Id: If1b06363379bf29126cfa68f2a0651cbb78a67f7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
That was stupid for two reasons. First, applicationName() can be changed
by the user by calling QCoreApplication::setApplicationName(), so if
that happens, we won't be able to properly identify a lock belonging to a
given application because the name changed.
Second, because applicationName() is not what we compare to. Instead,
let's use processNameByPid() on both content creation and verification.
[ChangeLog][QtCore][QLockFile] Fixed a bug that would cause QLockFile
mis-identify valid lock files as stale if the application name was set
with QCoreApplication::setApplicationName().
Change-Id: I0b48fc8e90304e0dacc3fffd14e912a5c98c87e7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
We duplicated both the creation of the contents and the check if the
file was stale. Centralize everything in qlockfile.cpp.
Change-Id: I0b48fc8e90304e0dacc3fffd14e91174af79841f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
F_SETLK is bad. Explanation in the comment. And flock(2) does work with
NFS on Linux, so let's just stick to that, which is simpler.
We only use the file locks when we attempt to delete an apparently stale
lock: that is, for a lock file that is at least staleLockTime old.
Change-Id: I0b48fc8e90304e0dacc3fffd14e908c8c4c9d59b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
It's confusing to keep it along with an unrelated class. Let's keep it
in its own file like for most other platform plugins.
Change-Id: I449ee061ff9fd5dc7ef06cadd633414d6b16358f
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
It's been for years that QMenu's rounded corners in qmacstyle_mac were
done via QWidget::setMask(QRegion). Unfortunately, QRegion mask does not
work well with retina displays and also does not support translucency.
That's why in this change we explicitly make QMenu's background
transparent and then draw a rectangle with rounded corners in
QMacStyle::drawPrimitive(PE_PanelMenu). This not only gives much better
result than the mask-based approach, but also de-HIThemes QMenu.
As a consequence, QComboBoxPrivateContainer doesn't get any mask from
QMacStyle anymore. Therefore, when the mask is empty, we need to paint
PE_PanelMenu before invoking QFrame's paint event handler.
Made-with: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Change-Id: Ia9236176113f23b86e45507fa6ddf77236084ce3
Reviewed-by: Oleg Yadrov <oleg.yadrov@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
The qWaitFor functions themselves can not trigger a test failure, as that
will not result in the test function exiting early, so every single call
to qWaitFor needs to be wrapped in a QVERIFY.
Change-Id: Id15a1549f31d06cdbf788e1d84ea431c28636ec8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The resources allocated by QPlatformBackingStore are owned by the class,
and should be allocated in a context the class also owns. This removes
the asymmetry of having to pass in a context to composeAndFlush, while
having to make the same context current before destroying the platform
backingstore.
The context owned by QPlatformBackingStore is shared with the associated
window though a new QWindowPrivate::shareContext() API.
The result is that on e.g. iOS, the backingstore does not need to tie
the resource allocation of QPlatformBackingStore to the global share
context, but can instead tie them to the per-window context, and hence
clean them up after each window is closed.
Task-number: QTBUG-56653
Change-Id: Ic1bcae50dafeeafaa8d16a7febd83b840ec6367a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
The call to CGImageCreateCopyWithColorSpace took a naked toCGImage(),
which left the resulting CGImageRef without a release, causing the
extra ref by toCGImage() to never be derefed, and a subsequent detach
of the image data on the next paint event.
Wrapping the call in a QCFType<CGImageRef> solves the problem. The code
has also been moved directly into QCocoaBackingStore::flush(), as there
is no need to keep the CGImageRef a member.
A local autorelease pool has been added to QCocoaBackingStore::flush(),
so that the NSImage used for blitting the backingstore is released upon
exit of the function, thereby releasing the corresponding CGImageRef.
Note that for layered mode, the QImage will still detach, as the view's
layer.contents property keeps a reference to the image data until being
replaced in a subsequent flush.
Task-number: QTBUG-63559
Change-Id: I06b9298f65a84deae7cc2eff617ba75c92ec3b87
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
[ChangeLog][iOS] The minimum deployment target for applications is now
iOS 10.0.
Change-Id: Icb37e4eaecbf6f62fd3c9293b2abf19a0954a02d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
A "compound widget" is a widget that has a focus proxy set to an inner
child. This is normal for complex black-box components where focus handling
is delegated to the children. Since the compound can have several
children, a local tab order might exist between them.
The current implementation of setTabOrder had no idea about
compound widgets. As such, when connecting two compounds in the
tab chain, it would just break up their inner tab order and
cause tabbing to ignore children other than the proxy.
The new implementation recognizes compound widgets, and add some
extra code to figure out the correct tab targets. This way, the
local tab order between the children will be preserved.
This implementation was inspired by the patches of Marek Wieckowski posted
in the linked bug report, and later modified by Nikita Krupenko.
[ChangeLog][Widgets] QWidget::setTabOrder() will now preserve the local
tab order inside a widget if it has a focus proxy set to an inner child.
Task-number: QTBUG-10907
Change-Id: I0673d39d70ec8c6bf64af30bf978d67c651b2f3c
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
That's no longer a thing on macOS. We still keep it around for
QMdiSubWindow, but we should support 4-edge resizing there as
do native windows.
In practice, because of WA_MacOpaqueSizeGrip, we were already
rendering the size grip manually instead of relying on HITheme.
Change-Id: If613a14f03dc650b457688f3f2f57631b5fb30a3
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
NSBox is good enough for this and pixel equivalent with
the previous HITheme calls.
Change-Id: I32b2a1cc8a9cd2a6ef17d1e01032540344808ebc
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
That switch following the if looked a bit corny.
Also made cocoaCells hash mutable to get rid of the
const_cast(this) in QMSP::cocoaCell().
Change-Id: I4facec827409314cf1214152c19efb9688715eb2
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
The original test was using QSslSocket::waitForEncrypted function, which
is apparently a bad idea on Windows: connecting to 'www.qt.io' we have
to verify certs and there is no guarantee a given Windows VM has the required
CA certificate ready in its cert store. In such cases we start a background
thread (aka CA fetcher's thread) and it calls a (potentially blocking for
a significant amount of time) function (CryptoAPI). When finished, this
thread reports the results via queued connection, which does not work
if we are sitting in a tiny-loop inside waitForEncrypted. Re-factor
the test to use signals/slots and a normally running event loop.
Also, the last test makes a wrong assumption about Windows - fixed.
Task-number: QTBUG-63481
Change-Id: I4abe9cda2a6c52d841ac858cccb6bf068e550cb8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
When the query is forward-only then nextIndex() is always 0, therefore
the cache values need to be cleared beforehand so that they are not
reused when the next row is retrieved.
Task-number: QTBUG-57765
Change-Id: I49e8427b24ec2d932e5b387699ac7f3496e9a48c
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Window icons on macOS are tied to document windows, and should not show
up unless a represented filename has also been set according to the HIG.
We follow this, and no longer create a document button based on the window
title if one did no exists. We also fall back to using the filename of
the file if a title has not been set, including being able to restore
this default title after setting a custom title.
The icon is no longer reset to nil after setting a QIcon(), which would
remove the icon completely, but instead we restore the default behavior
of showing the default filetype icon of the file.
Finally, the two callbacks in QNSWindowDelegate dealing with the document
icon/title popups and drags have been taught to look for spaces in the
represented filename. This allows clients who really want the old
behavior of setting an icon without caring about the filename to set
the filename to a single space character, which will prevent the
dropdowna and drag from occurring.
The reason for not tying this behavior to the existence of the file in
the filesystem is that being able to represent a file that is yet to
be saved is a valid usecase.
Task-number: QTBUG-63338
Change-Id: I7d4377c6358226fb6058f8c2b3c28588eec77ce5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
It's the one that is more complex - with a text-based 'progress-bar'
and queueing (for some, probably educational, reason) of requests.
Changes:
- update the C++ syntax (mem-initializers, range for, etc.)
- new-style headers
- redirects should not result in creating an empty file. Since we
have no UI, and this example is already complex enough, settle
for just reporting the redirect and removing the empty file.
Task-number: QTBUG-60628
Change-Id: I0b69cd77414ecac7c0bc6b2f8f787befc978de28
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Mainly 'modernizing' - use <c...> c-library includes (<stdio.h> -> <cstdio>),
add appropriate using directive; minor fixes in formatting + removal of a
hated double negation (aka ifndef QT_NO_NOTHING). Also, as our rules
('how to write examples') suggest - replace too many inclusion directives
with module-level headers. Basic redirects handling - do not create empty files
for redirected requests (or even files with some useless html).
Task-number: QTBUG-60628
Change-Id: Ia4398d39126313e6213bc7244d11a55958e64dec
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This is enabled by default with Xcode 9 and would therefore be seen by
anyone calling this function from C or Objective-C.
Task-number: QTBUG-63450
Change-Id: Iecd67017b6774c9f2fce2433002ff852058dd3ed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
MSVC is too stupid for them. Not only will it not inline those functions
if they are in a __declspec(dllimport) class, it will also print an
annoying Level 4 warning:
function 'function' marked as __forceinline not inlined
Task-number: QTBUG-57811
Task-number: QTBUG-55042
Change-Id: I0b48fc8e90304e0dacc3fffd14e8a346d18a9e0c
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
For HTTP/1 it's done when no data expected and response headers received -
protocol handler emits channel->allDone which handles the status code and
sets (if needed) a redirectUrl. HTTP/2 protocol handler cannot emit allDone
(it has many requests multiplexed and actually cannot say allDone yet).
So we set a redirect url if we have the corresponding status code and
found 'location' header.
Task-number: QTBUG-63471
Change-Id: Ibd3438ef918c245a46b8c0128910a89b9a418448
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The highlighted examples list for QQC2 is maintained separately.
Task-number: QTBUG-60647
Change-Id: Ib64ff7a44c6fcaf99058422d76ef6680df310911
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This reverts commit 9e268185bb.
Reasons: must go into 5.9 + the logic in this patch needs fixing, not good as
it is now.
Change-Id: I92516ddb1d2661d85ce77c54a1307f45df1ab635
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
- new screenshot with more up-to-date graphical look
- deleted itemviews-editabletreemodel.png from old folder
doc/src/images
- deleted unnecessary item in qtwidgets.qdocconf
Task-number: QTBUG-60635
Change-Id: I9b82fa027347fb0fd7adb86038abd32853e68c3a
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
access\qnetworkdiskcache.cpp: In member function 'virtual qint64 QNetworkDiskCache::expire()':
access\qnetworkdiskcache.cpp:540:44: warning: 'QDateTime QFileInfo::created() const' is deprecated: Use either birthTime() or metadataChangeTime() [-Wdeprecated-declarations]
cacheItems.insert(info.created(), path);
^
Change-Id: I5705de5cb4b490ef2bd788fb94ceac0e5b6c0d05
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This guarantees that we have proper version checks in place for APIs on
Apple platforms that are not necessarily available on the deployment
target.
Change-Id: I10060f8b910f2bb790aa4a9c6f8c5cdc14d7cf06
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Convert QSysInfo/QOperatingSystemVersion to __builtin_available where
required or possible, or to QOperatingSystemVersion where
__builtin_available cannot be used and is not needed (such as negated
conditions, which are not supported by that construct).
Change-Id: I83c0e7e777605b99ff4d24598bfcccf22126fdda
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Unlike client, this needs a bit more changes:
- remove redundant (and outdated) stdlib.h includes
- use QRandomGenerator (instead of qsrand/qrand pair)
- replace QStringList with QVector<QString>
- Q_NULLPTR->nullptr, ExplicitType * -> auto
- fix some weird indentation
Task-number: QTBUG-60628
Change-Id: I12eed12711b1e622407bd8ecd1afdf56a2cf2097
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
For HTTP/1 it's done when no data expected and response headers received -
protocol handler emits channel->allDone which handles the status code and
sets (if needed) a redirectUrl. HTTP/2 protocol handler cannot emit allDone
(it has many requests multiplexed and actually cannot say allDone yet).
So we set a redirect url if we have the corresponding status code and
found 'location' header. Before it's too late.
Task-number: QTBUG-63471
Change-Id: Icfa871fb999e676650d62c45a20e689596da4028
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
When Cmd+W is used to close a window, check if m_platformWindow is still valid
before accessing window property.
Task-number: QTBUG-63389
Change-Id: I9abda19b8482e7a1fd07b07d8981b6a768e96c2e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Otherwise QWindow::setFilePath() before create() would have no effect.
Change-Id: Ia2171054aa13e21316d525193d330efaf4653dbf
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
QWindowContainer assumed that a widget could never change from
native to non-native. This is not a fact when the window container
is reparented to toplevel and back. In this case, usesNativeWidgets
would be stuck at true, and parentWasChanged() would go down the
native widget path, triggering an assert.
The solution is to always recalculate the usesNativeWidgets bool.
Task-number: QTBUG-63168
Change-Id: I88178259878ace9eb5de2ee45ff5e69b170da71c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>