Commit Graph

33503 Commits

Author SHA1 Message Date
Thiago Macieira
f77117d6ca QFileSystemEngine/Windows: fix setFileTime when input date is UTC
I was getting a weird 7-hour offset when doing:

    QVERIFY(file.setFileTime(before.addSecs(-10), QFile::FileModificationTime));
    mtime = file.fileTime(QFile::FileModificationTime).toUTC();
    QCOMPARE(mtime, before.addSecs(-10));

Change-Id: I35c4da69d754686a43e675b3d215213e448df7cf
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-08-05 16:41:47 +00:00
Thiago Macieira
a3c71b71e2 QFileSystemEngine::setFileTime/Unix: remove the fallback to futimesat
The use as in the code:
  futimesat(fd, NULL, &tv)

is not documented to work. The file descriptor should be a directory's
one, not an open file (though the Linux source code seems to handle that
case). This call was done as a fallback to futimes, so it's very
unlikely a system would have futimesat and not futimes.

Both the Linux and the FreeBSD man pages say it's deprecated anyway.

Change-Id: I8d96dea9955d4c749b99fffd14cd94068dc7668a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-08-05 16:41:42 +00:00
Thiago Macieira
6c3a3d498a Filesystem: Use "birth time" to avoid confusion with Unix ctime
The Unix stat fields "st_ctime" and "st_ctim" mean "change time", the
last time that the file/inode status fields were changed. It does not
mean "creation time". So this commit splits all of the internal API to
"birth" and "metadata change" instead of "creation" to avoid the
conflict.

Change-Id: I149e0540c00745fe8119fffd1463fe78b619649e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-05 16:41:38 +00:00
Thiago Macieira
db433bdf65 Move platform-specific code from QFSFileEngine to QFileSystemEngine
Change-Id: I8d96dea9955d4c749b99fffd14cd9395174ba005
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-08-05 16:41:35 +00:00
Thiago Macieira
261c6713bd Introduce QFileInfo::birthTime and metadataChangeTime
[ChangeLog][QtCore][QFileInfo] Deprecated created() because it could
return one of three different file times depending on the OS and
filesystem type, without the ability to determine which one is which. It
is replaced by metadataChangeTime() and birthTime().

[ChangeLog][QtCore][QFileInfo] Added QFileInfo::metadataChangeTime(),
which returns the time the file's metadata was last changed, if it is
known, and falling back to the same value as lastModified() otherwise.
On Unix systems, this corresponds to the file's ctime.

[ChangeLog][QtCore][QFileInfo] Added QFileInfo::birthTime(), which
returns the file's birth time if it is known, an invalid QDateTime
otherwise. This function is supported on Windows and on some Unix
systems.

Change-Id: I0031aa609e714ae983c3fffd1467bd8b3e3a593d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-08-05 16:41:32 +00:00
Borgar Ovsthus
8f03656211 Add flowId to messages when logging in TeamCity format
Added flowId='name' to each message when using TeamCity logging format.
This is necessary to distinguish separate processes running in parallel.

[ChangeLog][QtTest] Added flowId to messages when logging in TeamCity
format. FlowId is used to distinguish logging from multiple processes
running in parallel.

Change-Id: I7f5046c1058ff02770404caa2c9b3a5398f97f6b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 18:48:48 +00:00
Jan Murawski
230c293f20 Fix iOS shared builds
Building iOS shared failed with link errors to the CoreGraphics framework
when building without harfbuzz-ng.
This patch adds the missing dependency.

Change-Id: If464417039172c2854e455563153057f0cea2a22
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-08-04 18:48:37 +00:00
Eirik Aavitsland
51edf8a2b2 Fix compilation of manual lance test
Commit 32a94e54 changed the API of the QPS engine (PaintCommands
class). Update the usage accordingly.

Change-Id: Ide57609e636dad0aa434d1049b600b72f731bc30
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-08-04 18:48:29 +00:00
Giuseppe D'Angelo
37af667771 XCB GLX: request OpenGL 4.6 / OpenGL ES 3.2 if possible
Code was lagging a bit behind published standards.

Change-Id: I0fe07c0162a54d9eed8b539887496b9313b37aa4
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2017-08-04 18:48:16 +00:00
Romain Pokrzywka
02b0f44fab Fix race condition in QDBusAbstractInterfacePrivate::initOwnerTracking()
The current code fetches currentOwner in the constructor, then sets up
a connection between a service watcher and _q_serviceOwnerChanged() in
initOwnerTracking(). But an owner change notification could arrive
after we fetch the current owner and before the connection is made.
In this case the owner change notification will be lost, and the
interface will keep reporting being invalid permanently.

The fix is to delay initializing currentOwner until after the connection
is made.

Task-number: QTBUG-62284
Change-Id: I92b9d61004e14fd2ee2543488740a542dc7a9b7a
Reviewed-by: Romain Pokrzywka <romain.pokrzywka@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 18:47:55 +00:00
Thiago Macieira
b22b514140 Bump minimum glibc requirement for sys/eventfd.h to glibc 2.8
The file was added to glibc 2.7 along with the functions we need (Added
2007-10-05). But they forgot to install the file until a month and a
half later (2007-11-17), which means it missed the 2.7 release
(2007-10-19).

Note that EFD_CLOEXEC wasn't added until glibc 2.9, so effectively glibc
2.9 is required.

Change-Id: I3868166e5efc45538544fffd14d773ba576fb793
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-08-04 17:56:34 +00:00
Jake Petroules
8615445835 Fix build error with macOS 10.13 SDK
Several of these variables/macros are no longer defined. We didn't
validate the preconditions on iOS, tvOS, or watchOS, so no
need to bother validating them on macOS either. Nor did we check the
OSStatus result on any platform anyways.

Task-number: QTBUG-62266
Change-Id: Id19ebead5d3a8a08a0a56d798f0173d0d893fc91
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2017-08-04 17:55:48 +00:00
Thiago Macieira
88c30618d5 QFileSystemEngine::renameFile: use calls that don't overwrite
The renameat2(2) Linux system call, new in 3.16, allows for the atomic
renaming of a file if and only if it won't clobber an existing
file. None of the Linux libcs have enabled this syscall as an API, so we
use syscall(3) to place the call.

If your libc has SYS_renameat2 but your kernel doesn't support it, we'll
keep issuing the unknown syscall, every time. Users in that situation
should upgrade (3.16 is from 2014).

On Darwin, there's a similar renameatx_np (guessing "np" stands for
"non-portable"). I haven't found anything similar on the other BSDs.

Change-Id: I1eba2b016de74620bfc8fffd14ccb4e455a3ec9e
Reviewed-by: David Faure <david.faure@kdab.com>
2017-08-04 17:30:33 +00:00
Thiago Macieira
4934138be2 Allow QSettings to synchronize non-atomically
This is required so that one can use QSettings in situations that
temporary files or renaming may not work.

[ChangeLog][QtCore][QSettings] Added setAtomicSyncRequired(), which
allows one to use QSettings with config files in unwriteable directories
or in Alternate Data Streams on NTFS on Windows. This used to work
before Qt 5.4, but remains a non-default behavior due to the potential
of data corruption.

Task-number: QTBUG-47379
Change-Id: I81480fdb578d4d43b3fcfffd14d4f77112f0402f
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2017-08-04 17:30:16 +00:00
Thiago Macieira
66500b9d75 Support Alternate Data Streams in QSaveFile
We can't use MoveFile to do atomic commits on an ADS, so QSaveFile needs
to detect when the target name is ADS and then use the direct fallback
mode.

[ChangeLog][QtCore][QSaveFile] Saving to Alternate Data Streams on NTFS
on Windows is now possible, but requires setDirectWriteFallback(true).

Task-number: QTBUG-47379
Change-Id: I81480fdb578d4d43b3fcfffd14d4bc062ae1750d
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2017-08-04 17:30:13 +00:00
Thiago Macieira
9a3ce25f98 QTemporaryFileName: use the random data more wisely
First, instead of getting 32 bits of random for every character, we can
get reasonable randomness with just 10 bits, so we can replace 3
characters per get32() call. A typical template with six X will only
need 64 bits of random data.

Second, using the PID is not random at all. The reason why mktemp used
to use it is irrelevant (probably because applications failed to seed
rand()). Either way, we don't need nor want the PID anymore. And because
the code is completely rewritten, the UCB copyright no longer applies.

Change-Id: I84e45059a888497fb55ffffd14d2d4cfe159abca
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 17:30:10 +00:00
Thiago Macieira
a06fb55dcb QFile::rename: use QTemporaryFileName instead of QTemporaryFile
This means the workaround for Linux's behavior now works even if
QTemporaryFile is disabled. We also avoid the creation of an otherwise
unused temporary file just so we can take its name.

Tested with tests/manual/filetest. Strace shows:
 renameat2(AT_FDCWD, "a", AT_FDCWD, "/var/run/media/tjmaciei/B852-6088/a.EBG705", RENAME_NOREPLACE) = 0
 renameat2(AT_FDCWD, "/var/run/media/tjmaciei/B852-6088/a.EBG705", AT_FDCWD, "A", RENAME_NOREPLACE) = 0

Before it was:
 open("/var/run/media/tjmaciei/B852-6088/a.VuL412", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0600) = 4
 fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
 lseek(4, 0, SEEK_SET)                   = 0
 rename("a", "/var/run/media/tjmaciei/B852-6088/a.VuL412") = 0
 stat("A", 0x7fff13260f00)               = -1 ENOENT (No such file or directory)
 close(4)                                = 0
 renameat2(AT_FDCWD, "/var/run/media/tjmaciei/B852-6088/a.VuL412", AT_FDCWD, "A", RENAME_NOREPLACE) = 0

(the absolute path comes from fd61059d35
and it seems it was needed for Symbian)

Change-Id: I1eba2b016de74620bfc8fffd14ccc7c4ded009c8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 17:30:07 +00:00
Thiago Macieira
3d6cbe3409 Long live QTemporaryFileName!
So we can use it in QTemporaryFile, QTemporaryDir and QFile::rename()

[ChangeLog][QtCore][QTemporaryDir] The class now supports the "XXXXXX"
replacement token anywhere in the template, not just at the end. This
behavior is similar to what QTemporaryFile supports.

Change-Id: I1eba2b016de74620bfc8fffd14ccb645729de170
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-08-04 17:30:03 +00:00
Thiago Macieira
3981a1f440 QTemporaryFile: split the template parsing and generation
This makes the code more reusable by the unnamed file feature.

This commit removes the backwards compatibility in using sequential file
names if the first one failed. Since 5483b30868,
there are at least three random characters, so the chance of collision
is 1 in 52³ = 140608.

That commit also did not take a system failure into account. If we ended
up getting EEXIST for all attempts, we'd attempt on average 26³*53³ file
creations. For that reason, I've added an upper limit in the number of
attempts to create a file.

Change-Id: I1eba2b016de74620bfc8fffd14cc7e31c6e50558
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-08-04 17:30:01 +00:00
Thiago Macieira
3766265602 QTemporaryFile: give the engine access to the template name
Instead of storing it in d->fileEntry. The QFSFileEngine methods may try
to use it before the file entry is filled with the actual file name and
that's no good. This change is using a reference to avoid keeping an
extra QString reference and to avoid going out of sync.

Change-Id: I1eba2b016de74620bfc8fffd14cca9e340e4b1e2
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-08-04 17:29:57 +00:00
Thiago Macieira
38bc95aece QTemporaryFile: add a simpler rename() (non-virtual) override
Calling the parent version is still ok, but if you call the new one you
get a bit of benefit. Since we control the file name, we don't have to
worry about a case-changing renaming (by choice). We also know that the
file is a regular one, because we created it.

[ChangeLog][Important Behavior Changes][QTemporaryFile] rename() no
longer attempts to do block copying, as that usually indicates a mistake
in the user's code. Instead, either create the temporary file in the
same directory as the new name to be, or use QSaveFile.

Change-Id: I1eba2b016de74620bfc8fffd14ccaac0cdb9fe87
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-08-04 17:29:54 +00:00
Thiago Macieira
363dc9146e QFSFileEngine: make rename() on Unix not overwrite
The rename(2) system call overwrites, so instead of using it, we try to
use the link/unlink pair. This works for regular cases, but can fail if
trying to change case in case-insensitive filesystems, if we're
operating on a non-Unix filesystem (FAT) or, on Linux, if the file
doesn't belong to the calling user (BSDs permit this). For those cases,
we fall back to rename(2).

That means there's a race condition if a new file is created there. But
we at least reduce the likelihood of that happening for regular files.

Change-Id: I1eba2b016de74620bfc8fffd14ccb38fd929e5aa
Reviewed-by: David Faure <david.faure@kdab.com>
2017-08-04 17:29:52 +00:00
Eskil Abrahamsen Blomfeldt
569171f620 Android: Fix push button label duplication with stylesheets
In the Android style, we matched both the full CE_PushButton,
and the individual, decomposed CE_PushButtonBevel and
CE_PushButtonLabel (and similar for other controls) to the
same drawing code which draws both the label and the bevel.
When used together with the style sheet style, this caused
the label of the button to be drawn multiple times in
different locations.

For labels, we now skip the part which draws the actual control,
and for the non-textual parts of the controls, we skip drawing
the label.

[ChangeLog][QtWidgets][Android] Fixed label duplication for
buttons when using style sheets with the Android style.

Task-number: QTBUG-48639
Change-Id: I1a1cdb0a82870cebd0438c5c72199afc3192938c
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2017-08-04 12:19:45 +00:00
Allan Sandfeld Jensen
74197140be Implement conversion from nullptr QVariant to QString and QByteArray
A nullptr QVariant should become a null QString or QByteArray,
since null strings have previous in our APIs represented the null value
in the absence of a dedicated null metatype.

Change-Id: I3b8f6386ece314d7c196959fbcf042c4fe0508a0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 11:19:44 +00:00
Edward Welbourne
fbe84a1a19 Add a test that we can read SQL time-stamps
Based on a test-case from Israel Lins Albuquerque, that my planned
fixes to our parsing of ISODate date-times would break.

Change-Id: I5658df9c7daed59d43aa5574df25d4d9eac4677d
Reviewed-by: Israel Lins Albuquerque <israelins85@yahoo.com.br>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 11:19:39 +00:00
Edward Welbourne
a9c111ed8c Clean-up in QDateTime's parsing of ISODate{,WithMs}
Actually check that there's a T where ISO 8601 wants it (instead of
just skipping over whatever's there), with something after it; move
some declarations later; add some comments; and use the QStringRef API
more cleanly (so that it's easier to see what's going on).  Simplify a
loop condition to avoid the need for a post-loop fix-up.

This incidentally prevents an assertion failure (which brought the
mess to my attention) parsing a short string as an ISO date-time; if
there's a T with nothing after it, we won't try to read at index -1 in
the following text.  (The actual fail seen had a Z where the T should
have been, with nothing after it.)

Add tests for invalid ISOdate cases that triggered the assertion.

Change-Id: Ided9adf62a56d98f144bdf91b40f918e22bd82cd
Reviewed-by: Israel Lins Albuquerque <israelins85@yahoo.com.br>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 11:19:35 +00:00
Kevin Ottens
b6c3f55b93 GLSL 1.00 ES must be selected using "#version 100"
I was mistaken before, the "es" part for that version isn't optional, it
*must* be omitted.

Change-Id: I9e83d2317523fb0a905e40b95a56033cf693b93b
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2017-08-04 11:19:30 +00:00
Allan Sandfeld Jensen
f2c6e10ad5 QVariants of null pointers should be null
Changes the QVariant::isNull() implementation for
pointer types so they return true if null.

[ChangeLog][QVariant] QVariants containing pointers will now return
true on isNull() if the contained pointer is null.

Change-Id: I8aa0dab482403837073fb2f376a46126cc3bc6b2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 11:19:25 +00:00
Gatis Paeglis
341bfcd1ea glib dispatcher: ensure all window system events are flushed
... when QCoreApplication::processEvents() returns. This is the expected
behavior according to the documentation. Checked also the QUnixEventDispatcherQPA
dispatcher, which did work according to the documentation.

The sequence of events that causes the bad behavior:

1) XCB plugin sends a signals whenever there are new XCB events available
for processing. This signal is connected to QXcbConnection::processXcbEvents,
which will cause XCB events to be added to the QWindowSystemInterface (QWSI) event
queue.

2) When QCoreApplication::processEvents() is called, glib event dispatcher does
one iteration on all attached event sources. First it checks which sources are
ready, and after that starts dispatching events from each source that reported
to be ready.

3) In the case when there are no events in QWSI event queue, the source that handles
QWSI event dispatcing returns 'false'; If at the same iteration the source that
sends posted events (via QCoreApplication::sendPostedEvents()) has returned 'true'
and one of the posted events is to call QXcbConnection::processXcbEvents (due to
signal from step 1) then we get an assert in the following code:

QCoreApplication::processEvents();
Q_ASSERT(QWindowSystemInterface::windowSystemEventsQueued() == 0);

This happens because QXcbConnection::processXcbEvents has posted new events, but
they were not dispatched in this iteration. They would be dispatched in the next
iteration. Events being dispatched on subsequent iteration doesn't really matter
for Qt application, but is inconsistent from API point of view. If we were
populating QWSI queue from non-Gui thread, then it would be possible that
windowSystemEventsQueued() != 0, but that is not the case on XCB (don't know
about other platforms).

The issue could be fixed by always returning true from "check source" and then
simply dispatch 0 events at "dispatch" step if there isn't any in the queue. But
a better solution is to remove the event source all together. It is completely
unnecessary to have this indirection, when we can handle QWSI event dispatch
directly from Qt (like we do, for example, in QUnixEventDispatcherQPA and
QWinRTEventDispatcher). Not having Glib event source for QWSI events would have
also avoided issues that were fixed by fbb485d4f6.

Note, after this re-factoring QWindowSystemInterface::nonUserInputEventsQueued is
now unused, but I left it in as the API by itself is all right.

Task-number: QTBUG-62297
Change-Id: Ia245b835676bd87e63bf02b67036b42a3b1593cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 11:19:19 +00:00
Thiago Macieira
b12fd1fa9d Long live qEnvironmentVariable()
[ChangeLog][QtCore] Added qEnvironmentVariable, which returns the value
of an environment variable in a QString, while qgetenv continues to be
used to return it in a QByteArray. For Unix, since most environment
variables seem to contain path names, qEnvironmentVariable will do the
same as QFile::decodeName, which means NFC/NFD conversion on Apple OSes.

I opted not to #include <qfile.h> from qglobal.cpp to implement that
QFile::decodeName functionality, so qglobal.cpp doesn't depend on
corelib/io and to avoid possible recursions.

Task-number: QTBUG-41006
Change-Id: I14839ba5678944c2864bffff141794b8aaa7aa28
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-04 11:19:13 +00:00
Simon Hausmann
1f4fd599a8 Ignore thaiZWJ failure on RHEL 7.2
The test fails when the system harfbuzz (version 1.3.2) is installed.

Change-Id: Id18a5a3c503f64ef56567d71655e433a46908b3f
Task-number: QTQAINFRA-1363
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-08-04 11:18:50 +00:00
Simon Hausmann
b36e5faad4 Ignore thaiZWJ failure on RHEL 7.2
The test fails when the system harfbuzz (version 1.3.2) is installed.

Change-Id: Id18a5a3c503f64ef56567d71655e433a46908b3f
Task-number: QTQAINFRA-1363
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2017-08-04 08:36:36 +00:00
Raschbauer, Reinhard
52c66e8515 QAbstractItemView: fix nullptr violation
If in a slot connected to QAbstractItemView::clicked
QAbstractItemView::setModel(nullptr) is called the method
QAbstractItemView::mouseReleaseEvent will cause a segmentation fault.
The problem is that the method QAbstractItemView::model used in
QAbstractItemView::mouseReleaseEvent will return a nullptr if a null
model was set. The solution is to used d->model since it is always a
valid model. (See line d->model =
(model ? model : QAbstractItemModelPrivate::staticEmptyModel());
in method QAbstractItemView::setModel)

Change-Id: I6f01bdeac64495ee4a76adcc7bf8da8a7719ef4d
Reviewed-by: David Faure <david.faure@kdab.com>
2017-08-04 08:36:29 +00:00
André Klitzing
5169d588a5 Update bundled zlib to version 1.2.11
Also clean up some unused files.
The remaining diff to clean 1.2.11 is archived in the qtpatches.diff file.

[ChangeLog][Third-Party Code] zlib was updated to version 1.2.11.

Task-number: QTBUG-31020
Change-Id: I89f890904af48c6e9ba6eabc5d58f5adbe2c53f0
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2017-08-04 08:36:22 +00:00
Friedemann Kleint
959cc53b61 tst_NoQtEventLoop: Pass with High DPI scaling active
- Determine window sizes according to screen size and turn off
  scrolling.
- Center the window to get it out of the way of taskbars.
- Make the window top-most.
- Turn off scaling so that coordinates passed to the QWindow
  child match device coordinates and the child is positioned
  correctly.
- Make the child window a yellow raster window for easier
  debugging.

Task-number: QTBUG-45956
Change-Id: I05864770f8ed638d0a36f3e3f2afed73d2952436
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-08-04 08:36:16 +00:00
Laszlo Agocs
51446c3c6f Fix Q(Quick)Window on eglfs
The call to QPlatformWindow::setRect (for storing into d->rect) was
in the wrong place. It has to be the potentially-overridden value.

Amends 3a31c70879

Task-number: QTBUG-57608
Change-Id: Id3c35e2dc178f7bd2f9643e8ae4754c8f2f39240
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-08-03 11:23:41 +00:00
Alexander Volkov
d12d2949d1 uic: Add -no-stringliteral option
... and use it when building shared libraries and plugins.
It prevents application crashes in cases when libraries and
plugins are unloaded and their strings are still used by
the main application.

Task-number: QTBUG-51602
Change-Id: I4af79183f18c5ed6142d55af02a36fe4334f3fee
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-08-03 09:59:15 +00:00
Eirik Aavitsland
8ba373361d Support all QImage formats in native pixmap conversion
The conversion fallback did not catch all the more recently added
QImage formats, leading to corrupt pixmaps or crashes. Also alpha
channels were needlessly thrown away if present.

Change-Id: I38588035aa9bf37b77398489981df65201cf0340
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-08-03 09:43:12 +00:00
Laszlo Agocs
4f515815ef Change EDID parsing qCWarnings to qCDebugs
Avoid polluting the output by default. Unfortunately there are various
systems (modern Fedora with XWayland, VMWare) where parsing will fail
for some not yet known reason. Showing warnings on each and every Qt
application startup is not desirable, especially since not having the
EDID data available is far from being critical.

Change-Id: Ibaca7db4d897e705819f7c359f8de41b9be862a6
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2017-08-03 09:30:30 +00:00
Frederik Gladhorn
e5cdb966bf Ignore tests that fail on OpenNebula
These tests need fixing, but they are already partially blacklisted
and need investigation once the switch is completed.

Task-number: QTQAINFRA-1292
Task-number: QTQAINFRA-1355
Task-number: QTQAINFRA-1362
Change-Id: Ic50d0c4a01ee7e72be1129d418eff244ba783185
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-03 09:30:06 +00:00
Alex Trotsenko
8853f2bad4 QSslSocket: stabilize triggering for write
QSslSocket::writeData() accumulates outgoing data. It might be called
multiple times during the event processing (most likely from the long
loops which serialize the data).

As this function produces a notification event on each call, it's
possible to get a huge number of slot invocations on the next event
loop run, when we are interested in a single flush.

So, this patch protects the code against uncontrolled signal emission
that results in the lesser resource usage.

Change-Id: If7cf5b0e239abf0bd88a0dfaa8c1183cbd49e5ed
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
2017-08-03 09:28:11 +00:00
Sérgio Martins
441ad9b938 Improve documentation for {QFile, QFileDevice}::resize()
- Warn that they can fail if used on non-existent files
- Fixed random garbage

Change-Id: Ie58aac4a9f4479332ef07d39aecc136b1cfa58e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-03 08:42:21 +00:00
Joni Jäntti
8561281768 tst_qwidget::activation expect fail on Win 10
This test fails on Windows 10 x64 Creators Update CI builds for unknown reasons.

Change-Id: I766bccfd4dea9ea195c68403018b419e800a7b3b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-03 06:58:35 +00:00
Joni Jäntti
3d5bf00f18 tst_qgraphicswidget expect fail on Win 10
tst_qgraphicswidget::checkReason_ActiveWindow fails on Windows 10
Creators Update. Added expect fail for Windows platform.

Task-number: QTBUG-62244
Change-Id: I71868a496659e7136af9a5b74684ba39edaf03ae
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-03 06:58:27 +00:00
Joni Jäntti
b091472f44 tst_qfocusevent activateWindow for Win 10
This workaround was created to make tst_qfocusevent test pass on Windows
10 x64 Creators Update.

Task-number: QTBUG-61467
Change-Id: I63eb149ae850174fb5de99761a6001e000a151a2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-03 06:58:19 +00:00
Oswald Buddenhagen
d61ac601d8 unbreak tst_qresourceengine for prefix builds
don't try to execute a binary from the install dir.

amends 8e776d39f.

Change-Id: I37990bc83b295379f0c93f4ca712e1bbf980fd44
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-08-03 04:54:56 +00:00
Gatis Paeglis
5a1f1345aa xcb: don't rely on _NET_WORKAREA for available geometry on multi-head systems
On X11, QScreen::availableGeometry() is broken with multi-head systems,
and there doesn't seem to be a real fix for this due to limitation in
the protocol and therefore support in WMs (more details in the
patch). In Gnome this issue is more visible because on this DE the
 _NET_WORKAREA rectangle represents the intersection of the available
geometries on all monitors. This results in a big area of "dead space"
on the secondary screen, when primary screen is positioned lower in the
virtual space. If menu is opened by clicking in this dead space, the menu
is awfully misplaced (qmenu uses availableGeometry() to calculate the
position of menu).

On Ubuntu with Unity (same is true for KDE Neon+Kwin and LUbuntu+Openbox),
_NET_WORKAREA returns a bounding rectangle containing all monitors.
Which does not cause the menu misplacement as "dead space" is outside
clickable area. But this does not mean that the QScreen::availableGeometry()
reported values are correct. With the same setup as described above,
QScreen::availableGeometry() thinks that we have a tool panel on the
right screen, when in reality it is on the left screen.

AwesomeWM for example does not set _NET_WORKAREA at all, which means
QScreen::availableGeometry() == QScreen::geometry(). I am not aware that it
would cause any issues for popup/menu window positioning in Qt (Qt positions
these windows manually by bypassing WM (via Qt::BypassWindowManagerHint) and
using availableGeometry for calculations. With this patch, we would take the
same code path as if _NET_WORKAREA was not set (where we know that_NET_WORKAREA
is cleary wrong). The solution here is to recognize _NET_WORKAREA as true
available geometry only in specific cases (cases where the meaning is cleary
defined by the specification) and adjust the documentation accordingly.

Not knowing the true available geometry on X11 is mitigated by WMs. Window
manager can position windows as it wants. WMs are smart enough not to place
windows on top of reserved areas at edges (even if user has explicitly requested
this via setGeometry based on inaccurate information from availableGeometry()).

[ChangeLog][Platform Specific Changes][Linux] The _NET_WORKAREA atom is
used for calculating QScreen::availableGeometry() only on systems with one
monitor. In all other cases QScreen::availableGeometry() is equal to
QScreen::geometry(). To restore the legacy behavior with untrustworthy
values in QScreen::availableGeometry() set QT_RELY_ON_NET_WORKAREA_ATOM=1
environment variable.

Task-number: QTBUG-60513
Task-number: QTBUG-29278
Task-number: QTBUG-43768
Task-number: QTBUG-18380
Change-Id: I7e0f62f81d1444991b8a6c007c2527d8f96088c2
Reviewed-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-08-02 23:15:32 +00:00
Frederik Gladhorn
6c2bfbf88e Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/dev 2017-08-02 23:15:27 +00:00
Timur Pocheptsov
72cf2339ed Introduce QHstsStore - the permanent store for HSTS policies
The store is using QSettings under the hood. A user can enable/disable
storing HSTS policies (via QNAM's setter method) and we take care of
the rest - filling QHstsCache from the store, writing updated/observed
targets, removing expired policies.

Change-Id: I26e4a98761ddfe5005fedd18be56a6303fe7b35a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-08-02 22:01:47 +00:00
Morten Johan Sørvig
37dc5bb46c Correct QThread::idealThreadCount() docs
QThread::idealThreadCount() now returns 1 if the number
of CPU cores could not be detected.

Change-Id: I60b75c46fbfa2891c28e71fed65589e2ce5a5c17
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-08-02 21:59:01 +00:00