Add calls to changeKeyboard() to the QWindowsKeyMapper constructor
and the handling of WM_INPUTLANGCHANGE so that the locale is
correctly initialized and changes are processed.
Change-Id: Ia30d8c6434ca85165e4882240ae16f9a75dcf4ff
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Remove the hardcoded mapping from the key table for fallback keys
since the keys are locale-dependent.
Task-number: QTBUG-57992
Change-Id: I016ab5f7f7e8abfd30f6416d2e7597db7deecb9b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
A <br> has a new-line but no text, so be able to handle no lines.
Task-number: QTBUG-60853
Change-Id: I3d4dbd529114bbe8afe760c3622b52446202ec7c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Some of our examples, and perhaps also some applications,
call requestUpdate() immediately after producing a
frame. This can cause Cocoa to immediately start
(trying to) draw a new frame without processing e.g.
input events.
This should (and will) be handled by rate limiting
updates with CVDisplayLink. In the mean time fall back
to using the base class QPlatformWindow implementation,
which is implemented using a timer, which will allow
for input event processing.
Change-Id: Ic2541f344b2f4018d785404a06274959a7bad2df
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
According to Apple's documentation, there's no delegate
in NSFontManager. We set its target instead. The action
is changeFont: by default.
Change-Id: I8c01bfa97c78dd8097f38c27353748d13f51489f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
We also ask the parent style to draw the header label
instead of the base style which is more likely to respect
other text related parameters.
Change-Id: I6dd658fa4d016a76d7c450478dc42f07e4b807c4
Task-number: QTBUG-33855
Task-number: QTBUG-37153
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The NEON implementation uses rsqrt and thus can not be taken on 0, so
replace the minimum with something close to zero instead of zero.
Task-number: QTBUG-59961
Change-Id: Ia39e45be675b056c1e22900495ce9ba4e8b70e5f
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
This was originally added so that you could replace a T with
QAtomicInteger<T> in the same class and still keep ABI. However, for
legacy reasons, on 32-bit x86, types larger than 4 bytes keep an old
1990s alignment of only 4 bytes, but modern std::atomic<T> for those 8-
byte types enforces an alignment of 8 bytes. Therefore, the requirement
to keep alignment is not possible to guarantee.
In other words: you may not replace T with QAtomicInteger<T> or
std::atomic<T> and assume no ABI breakages in all platforms.
This is a requirement to implement atomicity. An 8-byte type aligned to
only a 4-byte boundary could cross a 16-byte boundary or, worse, cross a
cacheline boundary. Crossing the 16-byte boundary could be bad on some
processors, but crossing the cacheline boundary (addresses ending in
0x3C, 0x7C, 0xCC and 0xFC, or 4 out of 64 possible addresses or 6.25%)
is always bad: the CPUs cannot guarantee an atomic load or store
operation.
See also <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71660>.
Task-number: QTBUG-67858
Change-Id: If90a92b041d3442fa0a4fffd15283e4615474582
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
RCC generates code that registers resources automatically on program
startup via global constructors. When linking statically and nothing
references the symbols in the .o file compiled from the RCC generated
code, then the linker will discard the embedded resources and they will
not get initialized. That is why for static linking it is necessary to
explicitly initialize resources using the Q_INIT_RESOURCE macro.
We can avoid the need for the explicit initialization in the context of
plugins that are statically linked into the application. resources.prf
can generate a .cpp file with a helper function that contains all the
Q_INIT_RESOURCE calls for all resources in the plugin. That helper
function in turn is injected into the plugin entry point, which in turn
is guaranteed to be included in the final binary.
Change-Id: If1abf9c85ef92935020af073b989c58c1ae6ca63
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
We need to mark the object as deleted before destroying
it's declarative data, otherwise all sorts of bad things
can happen.
This fixes the qwidgetsinqml autotest in qtdeclarative.
Change-Id: I05a645ebe1ca7a50c8927e3dbd9ebb5aaf369a71
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
(cherry picked from commit 3e91625b58)
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
There had been a fake declaration for qEnvironmentVariable() in qglobal.h
thaqt was only visible to QDoc. It was removed in favor of documenting
both the actual declarations of qEnvironmentVariable(), one with a 2nd
parameter for passing a defualt value and one without that parameter.
But the one without the default value parameter was marked internal, so
it didn't appear in the docs.
When both functions were documented with a shared comment, a bug in
QDoc was revealed, because these functions are global, while the shared
comment functionality had only been implemented for class member functions.
Now the shared comment functionality has been implemented for global
functions, so these two functions are now documented with a shared
comment. We can, of course, reintroduce the #ifdef QCLANG_QDOC trick, if
that is pre3ferred.
Change-Id: I41d85def5daa3215a995d7697d064dfae37e8b2a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Added a few functions to derive keys from passwords. Currently it
supports PBKDF1 and PBKDF2 as defined in
RFC 8018 ( https://tools.ietf.org/html/rfc8018 ).
[ChangeLog][QtNetwork][QPasswordDigestor] Added QPasswordDigestor
Task-number: QTBUG-30550
Change-Id: I2166b518bd8b54e3486514166e76fd9ba2f219c8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This patch adds the ability to decode keys which are encoded with PKCS#8
using the generic back-end (used in winrt and secure transport).
It works on both WinRT and macOS; however QSslKey seems unused in the
WinRT backend and it seems only RSA keys can be used for certificates
on macOS. Meaning that DSA and Ec, which in theory* should represent
their unencrypted versions, can't currently be tested properly.
* Can also be confirmed by loading the key using the ST or WinRT
backend, calling toPem(), writing the output to a file and then loading
the unencrypted key using openssl.
[ChangeLog][QtNetwork][QSslKey] Added support for PKCS#8-encoded keys
in the generic SSL back-end (used for SecureTransport on macOS and for
WinRT). Note that it does not support keys encrypted with a PKCS#12
algorithm.
Task-number: QTBUG-59068
Change-Id: Ib27338edc7dbcb5c5e4b02addfdb4b62ac93a4c3
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
That check is flaky on Windows. It doesn't seem to be testing Qt functionality.
I also don't see CreateFile2() documentation mentioning any guarantees that
opening the same file twice would give the same HANDLE each time.
Change-Id: Ica2e60571ae9fc39bf822803a2a9dd6add8323d7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Creating and sorting a list of bytearrays just to check if one entry is
present, is really overkill. By adding a new virtual method
isTimeZoneIdAvailable() in the backend classes, we can do this much more
efficiently.
Implemented for Utc and Tz backends, the others fall back to the
slow way.
The new benchmark shows, in release mode:
Before: 43 msecs per iteration (total: 86, iterations: 2)
After: 1.1 msecs per iteration (total: 73, iterations: 64)
Change-Id: Ic0d79a41d74e2ce6aa088fa7986c41d33902c36b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This fixes qdoc warnings introduced by 67d5f79fe6.
Change-Id: I4b199e6243d9a7706befe4bc9549c78c11026d9e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
We're relying on C++11 since a while, so lets not advertise creating
lists of strings with operator<<() anymore.
Change-Id: I14a3442ff852ac2c106d90c63504eb9ebb737609
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
When the QHeaderView is resized (e.g. due to setFixedWidth), the views
are not notified about it and the layout is not updated which leads to
a wrong painting. Therefore we have to listen for QEvent::Resize the
same way as when the font or style changes.
Task-number: QTBUG-67532
Task-number: QTBUG-34095
Change-Id: Id70daf083e0dddc2500d8e5aad47513266887a2c
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
We need to take into account the presence of a possible ',_debug' suffix.
Change-Id: I5655394b78723bbc6cc32e56849acc2366d288e2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This patch enhances QTextImageFormat with a property for image quality.
Default will be quality of 100. The user may set different values with
setQuality(int). QTextODFexport will export images as png if quality is
set to 100 and as jpg with the compression quality set to the given value
if smaller than 100.
[ChangeLog][QtGui][QTextImageFormat] Adds two new functions to the class:
setQuality(int=100) and quality(). Is currently used by QTextODFWriter to
determine the image type and quality when exporting images to ODT files.
Change-Id: Iaa8ec0246aaba004d98c9e8c66609795101519a9
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Fix wrong QRegExp in Custom Sort/Filter Model Example and replace it
with QRegularExpression.
Task-number: QTBUG-61129
Change-Id: I515474ee6985d36195d90dcd93876ba28a83bccc
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Once connection is established the socket emits 'connected', and then
you can start writing. But it will end up in the write-buffer and won't
get sent until 'transmit' is called. Some code (e.g. QWebSocket) relies
on QSslSocket transmitting once it's encrypted. This is done in the
OpenSSL backend but was not done in the WinRT backend.
Task-number: QTBUG-56558
Change-Id: I8cf5d3257f3597a4bb80f35369490a3816506a34
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Fixes the default C version used with gcc < 5
Change-Id: I948dece961caed8e6b181e1c6e6b9dc43c46583e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Change the documentation to use nullptr and modify the related code
also while at it.
Change-Id: I6264a254828159cda54e90393835ea04e131350b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
'QPrint::Color' should be returned in case 'ColorModel'
is NOT set to 'Gray'. However, the logic was inverted
before, since 'qstrcmp()' returns 0 if the two strings
match.
Also, eliminate a redundant condition:
The left-hand side of the '||' already makes sure that
'colorModel' is non-null, so there's no need to check again.
(Corresponding cppcheck warning: "Redundant condition: colorModel.
'!A || (A && B)' is equivalent to '!A || B'")
Change-Id: I965c29e8c020bc9c47a53678e23d94f05be3fd53
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Use the match with the least modifiers (prefer Shift+9 over
Alt + Shift + 9) resulting in more missing modifiers.
Task-number: QTBUG-67200
Change-Id: I90463c0dfaadda29dcd24a08ba35c91fac8bd04c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Add utility functions to QWindowsContext input messages sent to
native event filters (event dispatcher and window system interface).
Do not send input and similar events to the event dispatcher since
QEventDispatcherWin32::processEvents() also sends them.
Note though that QEventDispatcherWin32 does not receive all windows
messages.
In QWindowsKeyMapper, send the WM_CHAR/WM_IMECHAR events from
where the messages are removed.
Task-number: QTBUG-67095
Change-Id: I5f61294fcb3aee7e0eacd840a2010d128cd02a5d
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This generalizes what qnsview_cast() does to any Objective-C class.
Notice that this is a loose cast, using isKindOfClass: instead
of isMemberOfClass:.
Change-Id: I745f548e474f2f9eef89f370d7d45496f0c51434
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The manually maintained qrc file was missing corrupt_clut.bmp among
others.
Change-Id: I8916ba76a63950de03f25814d893306d046d273d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
When a key press is received which is not spontaneous then it needs to
be manually sent as a shortcut override event to ensure that any
matching shortcut is triggered first. This enables emulation/playback
of recorded events to still have the same effect.
[ChangeLog][QtWidgets] Sending a key press event with sendEvent() now
sends a ShortCutOverride event first to the widget to trigger any
shortcuts set first.
Task-number: QTBUG-48325
Change-Id: Iafcc2cdb1773bffe89edaeb0abc44cd5a51088e6
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
We use nil for Objective-C null pointers and nullptr everywhere
else, including CoreFoundation and similar opaque types.
Change-Id: Id75c59413dec54bf4d8e83cf7ed0ff7f3d8bb480
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
We extend QCocoaNSMenuItem with separator items capabilities
and use it as any other custom item in the app menu.
Addition and removal of items in the app menu remains very
basic because that menu doesn't exist as such. Instead, it's
hinted through the QAction's menu role.
Change-Id: Ia13bfcc008c75e49fd21705d2528da5a85ed1c73
Task-number: QTBUG-63756
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This is in accordance with the macOS HIG which state that, "in general,
a Preferences menu item should be the first app-specific menu item." See
https://developer.apple.com/macos/human-interface-guidelines/menus/menu-bar-menus/
Change-Id: Ie2b6ce274995a7d0b0e934c6a68241500a39f7aa
Task-number: QTBUG-63756
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
We start by setting the menu item target to nil.
Then, -[qt_itemFired:] action is now in QNSView, which itself is
naturally inserted in the responder chain. This removes the need
to track and change the menu item's target/action when we're
displaying a native dialog. Part of this is possible because we
now derive our own QCocoaNSMenuItem class from NSMenuItem.
We use -[respondsToSelector:] to decide whether the QNSView in
the responder chain should respond to cut:, copy:, etc. And we
only return YES when the view is first responder. The invocation
to these action is forwarded to the same views' -[qt_itemFired:].
Message forwarding is done via forwardInvocation:, but experiments
have shown that it can be done by the sole means of respondsToSelector:
and direct invocation from cut:, copy:, etc. See the usage of the
macro QT_COCOA_DYNAMIC_MENU_ITEM_ACTION.
Menu validation also happens in QNSView and looks for modal windows.
Therefore, -[worksWhenModal] is no longer necessary. Also, since the
target is no longer set, the logic as documented in NSMenuItem.target
won't work anymore.
Most items from QCocoaMenuLoader also become QCocoaNSMenuItem and
get the same target/action, which removes a bit of duplicated (and
outdated) code. A particular case is the Quit item, which gets the
terminate: action set until an actual menu item is added.
Tested with texedit and standard dialogs examples together with
menus, menurama and bigmenucreator manual tests.
We also renamed some functions and variables to reflect common
naming practices.
Change-Id: I9b51d3be3467a666d8c3dcf8585edbc821e0282e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>