The most common use case for QTextStream::readLine() is reading
a file line by line in a loop. The existing readLine() method
allocates new memory for each line, that results in a loss of
speed. The introduced overload can use already allocated memory.
Besides it allows you to not think about filesystem specifics.
The current QFile documentation suggests a separate way to read
files from /proc filesystem. With this overload it's possible
to use the same idiom in all cases:
QTextStream in(&file);
QString line;
while (in.readLine(&line)) {
process_line(line);
}
The idea was inspired by the blog post of Ivan Čukić:
http://ivan.fomentgroup.org/blog/2014/10/03/api-design-and-impact-on-the-performance-qt-vs-stl-example/
Change-Id: I0c62b4a52681870589bc099905e83ed69e03dd40
Reviewed-by: Martin Smith <martin.smith@digia.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Expose the same kind of TLS PSK client support we already have set
in place for QSslSocket.
[ChangeLog][QtNetwork][QNetworkAccessManager] It is now possible to use
TLS PSK ciphersuites when using HTTPS (or similar protocols working over
SSL).
Change-Id: I56a048e9f4f841f886758c781af2867d18538a3e
Reviewed-by: Richard J. Moore <rich@kde.org>
The call to QPlatformWindow::setVisible() will trigger flushing
of the window system events. Depending on the events, this could
lead to the window being hidden. Since platformScreen()->addWindow()
and removeWindow() was done *after* this flush, you could get the
remove for a window before it had been added, whereas the logic
in these functions were written under the assumption that there
is exactly one remove per add, and that add always precedes the
remove.
This has only been seen when running the QCompleter test so far.
This patch reorders the statements to make sure the events are flushed
after the window stack has been updated. In addition, it adds asserts
for the assumptions in the addWindow/removeWindow code to catch bugs
there earlier.
Change-Id: Ic67b03afbf7acbcb78be86bffa4c26360dc5832f
Task-number: QTBUG-43836
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
rawMode only has an effect under X11 in pre-QPA times.
Change-Id: Iaff8fed8f4ae5af5dd0399bb3ebd9d590a39a758
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Properly check QFont::WordSpacingResolved when use setFont()
with QTextCharFormat::FontPropertiesSpecifiedOnly
Change-Id: I72f1641ef7587cbaf8fcf5fef2f3c44393b0ebfc
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This was available before but was protected with the wrong define for OS
X, so this is changed to the right define.
Task-number: QTBUG-23696
QTBUG-23703
Change-Id: I669a6cf2ff7c01020693adff9f04a4b8b9404d02
Reviewed-by: David Faure <david.faure@kdab.com>
QDebug does not have noquote() in Qt 5.3.
Task-number: QTBUG-44021
Change-Id: If35b926d6b1e5bb9ad3534357630533dfcecd076
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
When checking for completion on the file system, we need to check
for directories that actually exists.
Change-Id: Id83e3802abcd40355dcd8cd47f2d55061eacd117
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
This reverts commit 8456adf0ee.
The change introduces a massive slowdown of the application
startup caused by the inner enumeration.
Task-number: QTBUG-43774
Task-number: QTBUG-40828
Change-Id: I694938eab93ea409d97537b55e8a025bb7a0e393
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Endian conversion needs to be done on aligned data, but the data is
stored unaligned in the QByteArray. So the new qFromUnaligned()
function is needed.
Change-Id: I12f9e52cea81d06129b306709bb9d2cd004f04e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
22px is not always large enough: KDE5 seems to like to make icons up to
28px, and they could be even larger on high-DPI screens.
Change-Id: Ifa8e0d49b310e4b4304207596f0f32c36a5db6a7
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Sometimes KDE doesn't render non-square icons properly when they have
been received over the D-Bus protocol.
Change-Id: Icc6fa3d64a1598ea8f719192ae18d32f287d6a79
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
If StatusNotifier is working, then QSystemTrayIcon::showMessage() will
send notifications using the org.freedesktop.Notifications protocol.
https://developer.gnome.org/notification-spec/
Task-number: QTBUG-4011
Task-number: QTBUG-31762
Change-Id: Ia1925ec3dd81b1b7b8f3b490b6364aaf8f93f395
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
At startup or when a new UIWindow has been created but not associated
with a UIScreen yet, its geometry will be invalid, and cause the wrong
geometry for its corresponding QScreen when we use it to map geometry.
Instead we explicitly use the status bar orientation to map to the
correct geometry.
Change-Id: If37b3ab2ad5db65e20a7e3af5c3854b3e3ddff0d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
We set the parent of the window as part of constructing it, which will
cause a layout of the QIOSDesktopManagerView's subviews, but in this
case we don't need to re-set the window state as that's taken care of
later on in the QIOSWindow constructor.
Change-Id: Ic197c9a50394908c8aa2155abdc97bc322937a85
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Change-Id: I78c47c6ccdb53045f3fa412b1489e08691d3e195
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Auxiliary screens are always in their primaryOrientation.
Change-Id: I078151ccbdb8a78eb095a05672f7804ab608ff24
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
[ChangeLog][QtNetwork][QSslSocket] It is now possible to use TLS PSK
ciphersuites in client sockets.
Task-number: QTBUG-39077
Change-Id: I5523a2be33d46230c6f4106c322fab8a5afa37b4
Reviewed-by: Richard J. Moore <rich@kde.org>
The "Fixed CE build of sqlite3" patch is preserved in this change,
which causes sqlite's own localtime implementation to be used for
wince. This is extended by #undef HAVE_LOCALTIME_S to override the
new assumption that localtime_s is available on wince and should be
used. Also, removed HAVE_LOCALTIME_S=0 since this must now be
undefined instead of 0.
Change-Id: I418e138ddc47d1bfbb80de0f4e4205a79c425f10
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
This fixes a bug when submenus are shown as simple actions when
a platform system tray icon is used.
To correctly handle submenus, we need to set platform menus on
all submenus, and only then on a parent menu.
Change-Id: If2bfcc703b938dbb14ba4b9aa810039ced07e946
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Dimitrios Glentadakis <dglent@free.fr>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
On platforms like Windows (and presumably on mobile devices too)
the loss of the context (e.g. the underlying D3D device in case of
ANGLE) is an event that can happen randomly and needs sufficient
handling.
Enhance QOpenGLContext::isValid() with the purpose of indicating
context loss.
Currently only the Windows EGL backend (ANGLE) has support for it.
Other platforms may be added later.
Task-number: QTBUG-43263
Change-Id: I8177694c1ee7cebbd5d330e34757fd94c563e6d6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
For windows that were shown on an external screen (not a virtual sibling
of the primary screen), eg. on iOS, it doesn't make sense to re-show the
window when moved back to the primary screen.
By moving the logic into the QScreen destructor, we ensure that the code
path is hit both for the old and unsupported style way of destroying
QPlatformScreen by deleting it directly, and the new and safe way
of using QPlatformIntegration::destroyScreen(), while still allowing
clients to manage the windows themselves by emitting screenRemoved()
before applying our fallback logic.
[ChangeLog][QtGui][Important Behavior Changes] QWindows will no longer
be re-shown automatically when moved from a destroyed QScreen, unless
that QScreen was a virtual sibling of the primary screen.
Change-Id: If1105bc5ef41a5392854bb97d121c998bffa3606
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Implementing org.kde.StatusNotifier DBus interface
http://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/
as well as org.canonical.dbusmenu for the limited purpose of showing
the tray icon's context menu. If a desktop environment (such as
KDE or Unity) has a StatusNotifierWatcher listening, then tray icon
information is sent to be displayed by the tray implementation
instead of being rendered directly in an XEmbed window. This is
necessary because some modern tray implementations no longer provide
XEmbed "hosting".
[ChangeLog][QPA][Xcb] QSystemTrayIcon uses StatusNotifier D-Bus
protocol when the desktop environment supports it
Task-number: QTBUG-31762
Done-with: Marco Martin <mart@kde.org>
Change-Id: I3b1f744d621eefc7e9c61d1469460ebfcc77fc54
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
When run in single-exec mode, QDoc constructs only one instance
of HelpProjectWriter, even though it generates documentation for
multiple modules in one go.
This change adds a reset() function for the help project writer,
allowing new parameters to be passed to the existing writer
instance, thus ensuring that all .qhp files are correctly
generated.
Task-number: QTBUG-43815
Change-Id: I1d1c9f713eb5f574a6f8e56616cf5f61bb3e8ff8
Reviewed-by: Martin Smith <martin.smith@digia.com>
Equivalent of gluProject and gluUnproject.
[ChangeLog][QtCore][QVector3D] add convenience project and unproject methods
to use like gluProject and gluUnproject
Change-Id: I6e4e3e79ea6e34d1fb0c375e15185c950b699ef0
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Implemented handling of GID_DirectManipulation for WinCE.
Derive touch information out of gesture event
directmanipulation.
Task-number: QTBUG-31216
Change-Id: I74e90f32d2384fc3550b47af0b72edf0292dea8f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
The note is already in setItemWidget where it makes sense.
This looks like a copy/paste error; this method doesn't change
anything in terms of ownership, it's a getter.
Change-Id: Idc963787b81f53fb37bbe59e9bf35f47d3441b34
Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Gets rid of warning that the file is missing, but probably doesn't
have any other effect since the file in question does not require
moc-ing.
Change-Id: I22085a55c212b6285341d61462dfaf548787e11c
Reviewed-by: BogDan Vatra <bogdan@kde.org>
When we supported platforms < android-9, we needed to include
some headers which were introduced in android-9 to compile the
QPA plugin. This is no longer needed, and also creates problems
when you pick e.g. android-21 as your platform, since some
definitions (specifically fd_set) are different in the two sets
of headers, giving us an undefined reference to
QEventDispatcherUNIX::select().
Change-Id: Ifd28479b4bf3be0e9e62200a01fc4cf2cc855215
Reviewed-by: BogDan Vatra <bogdan@kde.org>
Setting the stretch of a QFont did not work correctly on OS X or
iOS.
Two things are needed to make it work: First of all, we need to
properly set the transform when creating the CTFont.
In addition, we need to manually scale the advances, as
CTRunGetPositions() does not do this for us. On OS X 10.6, however,
there was a regression and CTRunGetPositions() would return scaled
positions, so we exclude the step to scale the advances on this
particular version.
This is an adaptation of bc25cfdd65452efa226cbd544c9ae9803eb6748a
in Qt 4.
[ChangeLog][QtGui][OS X/iOS] Fixed a bug when rendering fonts that
were set to be stretched.
Task-number: QTBUG-43801
Change-Id: I4902a9f5e29299761e3c2c5c6d6d80ee1dea1a25
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Only happens with active signal spy callbacks. The Connection object can
be deleted when returning from the slot here, so accessing it for the
method index for the signal end callback will access invalid memory.
Change-Id: I44643a171863c35a94e7a5ffa096fcaac5abd509
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
When creating a temporary directory but failing to set its permissions,
we need to remove the directory we created to avoid leaving 256 empty,
unused directories in the destination folder.
This happens on Android if you try creating a QTemporaryDir in the
download path on the sdcard.
Task-number: QTBUG-43352
Change-Id: Ic88fb7572f1abd65e5c7d8882b59c95f4b22ed72
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
ChildWindowFromPoint does not work properly under
wince, so lets use the plain old WindowFromPoint.
Task-number: QTBUG-44022
Change-Id: I49bae6409f2d11ddc01bea01f4c2f91a02b90892
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
bec1854cc0 introduced a regression:
when sorting a tree model, children items would not follow the sorted
parents any more (they wouldn't be remapped correctly), resulting
in crashes.
So, the fix needs more reasoning; let's revert the fix,
but leave the original test around for any subsequent attempt, and
introduce a new test which looks for the right behavior when
sorting trees.
This commit partially reverts bec1854cc0.
Task-number: QTBUG-43827
Change-Id: Ic83ac53aef639f870f6c36a8b4b2992f5b485b13
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Volker Krause <volker.krause@kdab.com>
(cherry-picked from qtbase/e9ad46ed412987e3e46c5a641e5f30408b97ac90)
QmlClassNode is renamed to QmlTypeNode. This is done
in preparation for implementing qdoc support for
documenting javascript code. Next, QmlTypeNode will
be renamed to JsTypeNode, and a new QmlTypeNode will
be declared that will inherit JsTypeNode.
Change-Id: Ia5d0c367d06c26cb43f887927bbcb096afcb7301
Task-number: QTBUG-43715
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
The documentation says that QUdpSocket emits readyRead() only for one
datagram and that if you don't read it, the class will not emit again.
That should be implemented by disabling of the socket notifier once we
have the datagram already read, but was broken.
In turn, that breakage caused a live-lock of the event loop: since we
didn't disable the notifier nor read the pending datagram, the event
loop would fire every time for the same datagram.
The re-enabling of the notifier was already working.
Task-number: QTBUG-43857
Change-Id: Ic5d393bfd36e48a193fcffff13bb32ad390b5fe8
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
The selection update is not implemented on other platforms (if needed at
all).
Task-number: QTBUG-39440
Change-Id: I8eb8c4eb1c23ba2d246bc95f1c77dc9da9e22495
Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
At startup, iOS will report UIDeviceOrientationUnknown for the device
orientation, which toQtScreenOrientation() maps to portrait. We can be
smarter than that, by falling back to the orientation of the statusbar,
which in most cases match the physical orientation of the screen at
startup, unless the Info.plist file has been modified to limit the
possible orientations. See also:
https://gist.github.com/torarnv/40c1931205e33d2b1ed3
Change-Id: I5c78fbe5c670ed2909a51b478bd4814e2433554f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Allows the helpers to be used at QPlatformScreen construction time, before
it has been associated with a QScreen.
Change-Id: Iab8f863ef5c9339ef6e88b3d844915c03cacda74
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Left-shifting of negative values is undefined ([expr.shift]/2).
Use multiplication with 64 instead.
There are probably more instances in this class, but this patch
already gets rid of vast amounts of ubsan errors in
tests/auto/gui/text.
Found by UBSan.
Change-Id: I89b8bb61e4decba605fe4fb3efea68b1f1eacf1a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>