The code coerced a -123 into a QFormLayout::ItemFlags, which, however,
being an enum with enumeration values 0..2, only has valid numerical
values 0..3.
Fix by using 3 as the value to represent the invalid enum value, and
store this in a constant so as not to distribute this magic number
all around the test class.
Change-Id: Ie5e93a69ef5a3acdde43030b022e0cce8aec484d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The logo (microsoft.windows.softwarelogo.showdesktop.exe) is otherwise
not found.
Change-Id: Ic52329462612a027e2928922a1f9a541dcbc67a3
Reviewed-by: Jesus Fernandez <jesus.fernandez@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The time stamp is added at the end of the node information and
consequently this also bumps the version.
Task-number: QTBUG-57182
Change-Id: Ia10e006f28c0b168b2bcd74ed8b7098f84d10af3
Reviewed-by: hjk <hjk@qt.io>
Change the main window to contain a QTabWidget and add a log widget
logging relevant events on the top level widgets for testing changes.
In the preview window, add new window flags of Qt 5 and output
geometry, margins and window state in addition.
Change-Id: Icec366223b6c163d58a69034687f3d9323a91533
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Chaining hooks together was mentioned by Ossi in the comments of
d953d9a4. This patch justs add a test that verifies that it works, and
also serves as an informal example for developers looking how to do it.
Change-Id: I53a014d5663c289ea0559e0926ed301f4e5110e6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
A test was directly accessing the .text member of QDateTimeParser
(which presently has nothing private). Use the virtual .displayText()
method of this base instead, to let the base have some hope of
data-hiding (maybe, some day).
Change-Id: I8b6e39fba130de56f117bffb2aec346197969c5b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This test fails on Windows occasionally with values just short of 800, the lowest
observed being 791. It is probably rounding somehow to 10ms segments, so allow
it to be up to 10 ms too fast.
Change-Id: Ie28e9f61588b68a9060a006f78eedc3a26d05155
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
QModelIndex is not safe to be used to store an index as it is designed
to be discarded right after use as the index information can change.
Therefore a QPersistentModelIndex should be used instead to store the
index. Subsequently the m_index does not need to be updated whenever
the model changes anymore as this is already done for us.
Task-number: QTBUG-49907
Change-Id: Icc93e410de2821c503ea15a7a1dd9ae32634914e
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
GCC warned:
tst_qtablewidget.cpp:30:
tst_qtablewidget.cpp: In member function ‘void tst_QTableWidget::mimeData()’:
qtestcase.h:66:52: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if (!QTest::qVerify(static_cast<bool>(statement), #statement, "", __FILE__, __LINE__))\
^
tst_qtablewidget.cpp:1523:5: note: in expansion of macro ‘QVERIFY’
QVERIFY(data = table.mimeData(tableWidgetItemList));
^~~~~~~
Fix by adding the extra parentheses, as usual.
Change-Id: I2826d7a865b4113b468d5a958ede06e03aa0e278
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
When a menu item's enabled state changes after
-[QCocoaMenuDelegate menuWillOpen:] is invoked, i.e.,
during or after QMenu::aboutToShow() is emitted, that
state change may not be taken into account. This is
because the automatic menu validation, upon which Qt
relies, is not made aware of any such change.
By calling -[NSMenu update] when syncing the QPA menu
item, we induce Cocoa to invoke -[QCocoaMenuDelegate
validateMenuItem:] and ensure that previously synced
items, whose state may have changed, will be properly
updated. This, however, has a small side effect, namely
that menu-holding items will also go through the automatic
menu enabling path and may appear disabled since, until
now, they were not properly configured. In order to solve
this, we set the action on those items as well, and make
sure that both of QCocoaMenuDelegate's relevant methods,
validateMenuItem: and itemFired:, properly process
menu-holding items.
Menurama manual test updated accordingly.
Change-Id: I62f955538b8be09b8494ea0ce87fca7910148d38
Task-number: QTBUG-56850
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
when the file's effects are discarded, the mention of the file should be
as well.
Change-Id: I894b7e2b887dd34d18533b197bfa9d0d84d647e7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
We can not improve the result from JSON parsing without changing API,
so instead recalculate the line and column based on input and offset.
Change-Id: I54149233f71023aa5d30deff854d6f3406c5c48c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Do not consume white-space after a token before the token has been
parsed, otherwise we end up with misleading offsets. This also fixes
a wrong error of illegal number in several cases.
Change-Id: I492ca4de0346a1d0ab73b1c23d7a72dba812664c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
The test relied on the file created being automatically selected,
which sometimes does not happen when executing the entire test.
Explicitly select the file and check the selection.
Use the temporary directory for testing.
Change-Id: Ia58641c1ac32ba21effa8a5ace9623eb5d48a1c2
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Change qtConfig(opengl(es2)?) to qtConfig(opengl) as that covers
the case without any regular expression.
Change-Id: I935e3150f87e195e8bd3d0e55b4ed43572b131cf
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
The test created a Windows shortcut (.lnk) and checked on its existence.
It was not found in the first test since QFileSystemModel returned
the resolved file name (linktarget.txt). When fixing this by querying
QFileSystemModel::fileInfo()::fileName(), the 2nd test failed since
shortcut files are not considered system files.
Amends change 3b093034b6.
Task-number: QTBUG-53890
Task-number: QTBUG-20968
Task-number: QTBUG-29403
Change-Id: Iec58b52532b44d12759eaa6c8d63a8a4dc8d1bc3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
the autotest was also broken, because it was created by pasting the
bogus message into the result ...
Change-Id: I02b8663b96c7d96cdb3c19639e2213e49fd2bcec
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Tests are not supposed to write into the build/application directory,
but rather should output to the temp directory.
Change-Id: Idcdf51226a2d547514aea2fbb2054998d8a3437e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Add better boundary checks and catch (hopefully all)
cases where invalid binary JSON could cause crashes.
Change-Id: I206510b7c5e3ba953802a5f46645878e65704ecc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
On Mac, we use QComboMenuDelegate specifically as
item delegate for the popup list. It happens that
the order of resolving the font for each item
individually would prioritize QComboBox's font
instead of whatever the assigned model's FontRole
would specify.
The fix only requires checking whether FontRole is
valid before falling back QComboBox's properties.
Change-Id: I7208ad1911b30cc52c826c1884a1e19f5acd9fb4
Task-number: QTBUG-56693
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
No-break-spaces should not be counted in the space data, but rather
be treated as any other non-breakable character. We were already
taking care of this in the loop we reach if the item starts with
a character which isn't whitespace, but there is a second loop for
items that begin with whitespace characters.
The result of this was that in certain circumstances where you gave
the nbsp its own format and made the line wrap, the previous line
would count an extra trailing space and it would swallow the first
character in its following line.
[ChangeLog][QtGui][Text] Fixed a bug where a no-break space would
sometimes cause the first character of the containing line to not be
displayed.
Task-number: QTBUG-56714
Change-Id: Idd760a389052e6de70f6cc397122b217987fa5f2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Any other use than for enums should use std::is_[un]signed. Make this
explicit by renaming the type traits.
Change-Id: I494158563c95c710e710d0d337f4e547006df171
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since the macro is now just a wrapper for std::is_enum,
its use is also deprecated.
[ChangeLog][QtCore][Global] Q_IS_ENUM is deprecated.
Use std::is_enum<>::value instead.
Change-Id: I09b9f4559c02c81f338cace927873318f2acafde
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QLabel already does that for QPixmap, so just do the same for
QMovie's current pixmap.
Task-number: QTBUG-48157
Change-Id: I7b26460f778e56ff017a5efd433f8929f30e4b41
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Remove most type traits from qtypetraits.h, but keep the custom
implementation of is_signed/is_unsigned. This gets rid of
BSD-3 licensed code from Google in a public header (hugh!).
The custom implementations for is_signed/is_unsigned are kept
because the implementations in gcc's standard headers do not
work as we expect for enums - both is_signed and is_unsigned
always returns false there - see also
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59027
[ChangeLog][QtCore][General] Qt now relies on type traits from
the C++ standard library.
Change-Id: I3f2188b46949f04ca4482a6ac9afd3482103f0e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The existing cursor logic had a couple of issues:
- It made the faulty assumption that we could not use
the NSWindow invalidateCursorRectsForView API for
child NSViews.
- It used NSWindow invalidateCursorRectsForView and
NSView resetCursorRects. This API has been replaced
by the more general NSTrackingArea API.
- It did not implement falling back to the parent
window cursor if the current window has no cursor
set.
Document that QWindow cursors work the same way as
QWidget cursors in that a QWindow with no set cursor
will fall back to the parent window cursor.
Change the cocoa platform code to use NSTrackingArea
exclusively and implement NSView cursorUpdate which
sets the cursor. Handle immediate change on QWindow::
setCursor() manually.
Add QWindow::effectiveWindowCursor() and
applyEffectiveWindowCursor() which finds the correct
window cursor.
Add a manual test for the child window, child widget,
and QWidget::createWindowChild cases.
Task-number: QTBUG-33479
Task-number: QTBUG-52023
Change-Id: I0370e11bbadb2da95e8632e61be6228ec2cd5e9d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Adds a few missing parts of the conversion from QVariant to QJsonValue
after the introduction of the nullptr QVariant. The conversion the other
way is already implemented.
Change-Id: I8b25dec4b476c4761c5098a60944ff11c36f8bec
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
We were throwing away important information by claiming that all
fonts support all the standard sizes in QFontDatabase on Windows
This caused the font dialog to list unsupported sizes for bitmap
fonts, unlike the native font dialog.
We would also claim to support creating bitmap fonts at
unsupported sizes, which would lead to
1. QFontInfo(font).pointSize() would return the requested size,
not the actual rendered size.
2. Bitmap fonts created at 64 pixels and higher would be invisible.
On Mac, there are no system bitmap fonts, and the use is not very
common, but installing some bitmap fonts on the system, it does
seem to ignore the sizes supported in the font and just displays
the standard list instead, so we keep the current behavior there.
[ChangeLog][QtGui][Text] Fixed list of supported sizes for
bitmap fonts on Windows.
Task-number: QTBUG-56672
Change-Id: Idbec2db9eb3381ab5ddf6259bd2befcba9b93564
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
When no central widget has been set, calling takeCentralWidget should
just return a null pointer instead of crashing.
[ChangeLog][QtWidgets][QMainWindow] Fixed crash using takeCentralWidget when
the central widget was not set.
Task-number: QTBUG-56628
Change-Id: I240ccf4caa41d2716a78851571fbfbf444a4922e
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Apparently, the CI can run something over 1000x slower than on my
machine. We're getting over 100 ms delays in operations that shouldn't
have taken more than half a millisecond. The last report was of 136%
over budget, so I multiplied the resolution by 4.
Change-Id: I9093948278414644a416fffd1474406967b2a6ee
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
The file descriptor has been closed and this test is checking if we get
EBADF.
Change-Id: I33dc971f005a4848bb8ffffd1478eaffd99aa2e9
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Then we need to check if the current active (or focused)
window has any menubar associated. In case there isn't,
and the menubar has no window associated, then we should
update immediately.
The previous condition is still valid.
Change-Id: I4532ccc87354d91c76b53f5433dc3944b9e29584
Task-number: QTBUG-56275
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
This will be done by all POSIX APIs for strings coming in that way, but
because other code (like NSWhateverViews) will most likely return
decomposed form, we make sure that those are in composed form too.
Task-number: QTBUG-55896
Change-Id: I065e11cee6b59706d4346ed20d4b59b9b95163b8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
With the current API it is not possible to reset the
index into -1. We have setClean() method, but
we are lacking setDirty(). This is needed
in case when the document has changed outside
of the editor and nothing has changed
in the undo stack history. In this case we
don't know the state of the file modified
externally so we need to mark that editor's
contents is different from the file contents
and undoing or redoing commands can't bring
the editor to the clean state.
This may also be useful to call it when
we created a new document and haven't saved
it yet or when the document was restored
from backup file.
Task-number: QTCREATORBUG-17048
Change-Id: I64e2052b3559299e0b6939831557a07a59a851b6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This completely over-engineered piece of code has a hierarchy of
Operation subclasses encapsulating but three actual operations
on a QWizard.
Because these operations and their containers were all allocated
on the heap, but never deleted, asan went crazy and reported over
50 leaks (not the record so far, but a (distant) second).
Since these collections are passed through addColumn/QFETCH, too,
it's nearly impossible to track their lifetimes. So instead of
trying, delegate that to the runtime, ie. pack the Operation
objects into QSharedPointer and pass around those instead.
Change-Id: I8a0fe7a60cd30aed618667affaa030e80cf2b1ac
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
Store QGraphicsItems that are either not added to a scene or
removed from it again and that are also not children of other
items - iow: those that were leaked, even on successful runs
of the tests, in either a QScopedPointer, or, where that'd
cause too much churn due to adding of .data() calls, back the
pointer by a stack-allocated object.
This fixes the remaining leaks reported by GCC 6.2.1's ASan on
successful runs of tests/auto/widgets/graphicsview/qgraphicsitem.
Change-Id: I61c3a1cd39b9e96e83c5d7b8cf392e0b26ecbaf0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
The new takeRow() functions return a pair of pointers to
QLayoutItems and, as the name particle 'take' suggests,
releases ownership of these layout items. Which in turn
means that the caller of the function is supposed to deal
with them.
This was not done here.
To fix, write a RAII class that takes ownership of the
returned layout items, deleting them when it goes out of
scope or gets a new value assigned (only move special
member functions are implemented, making the class move
-only).
Deleting the QLayoutItems is not so easy, though:
QFormLayout has a special function for clearing the
QLayoutItems out, so it appears that just calling their
destructors is not going to fly (though I don't know off
the top of the head why that should be a problem).
Solve this, for now, by adding the layout items back into
a temporary QFormLayout for destruction.
Change-Id: If862989207b20f1e3f757c19ec9d498c4491184f
Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The usual:
- delete return values of QLayout::takeAt(), replaceWidget()
- delete styles
- delete top-level widgets
- delete actions
Either by naked delete, QScopedPointer or allocation on the
stack instead of the heap.
This fixes the remaining errors in GCC 6.1 Linux ASan runs of
tests/auto/widgets/kernel.
Change-Id: I8cc217be114b2e0edf34ad8d60dbf722f900bb7f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
HTTP/2 allows a server to pre-emptively send (or "push") responses (along
with corresponding "promised" requests) to a client in association with a
previous client-initiated request. This can be useful when the server
knows the client will need to have those responses available in order
to fully process the response to the original request.
Server push is semantically equivalent to a server responding to a request;
however, in this case, that request is also sent by the server, as a
PUSH_PROMISE frame.
The PUSH_PROMISE frame includes a header block that contains a complete set
of request header fields that the server attributes to the request.
After sending the PUSH_PROMISE frame, the server can begin delivering the
pushed response as a response on a server-initiated stream that uses the
promised stream identifier.
This patch:
- fixes the HPACK decompression of PUSH_PROMISE frames;
- allows a user to enable PUSH_PROMISE;
- processes and caches pushed data for promised streams;
- updates auto-test - emulates a simple PUSH_PROMISE
scenario.
Change-Id: Ic4850863a5e3895320baac3871a723fc091b4aca
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Saving strings with embedded zero-bytes (\0) as CFStrings would
sometimes fail, and only write the part of the string leading
up to the first zero-byte, instead of all the way to the final
zero-terminator. This bug was revealed by the code-path that
falls back to storing e.g. QTime as strings, via the helper
method QSettingsPrivate::variantToString().
We now use the same approach as on platforms such as Windows
and WinRT, where the string produced by variantToString() is
checked for null-bytes, and if so, stored using a binary
representation instead of as a string. For our case that
means we fall back to CFData when detecting the null-byte.
To separate strings from regular byte arrays, new logic has
been added to variantToString() that wraps the null-byte
strings in @String(). That way we can implement a fast-path
when converting back from CFData, that doesn't go via the
slow and lossy conversion via UTF8, and the resulting QVariant
will be of type QVariant::ByteArray. The reason for using
UTF-8 as the binary representation of the string is that
in the case of storing a QByteArray("@foo") we need to
still be able to convert it back to the same byte array,
which doesn't work if the on-disk format is UTF-16.
Task-number: QTBUG-56124
Change-Id: Iab2f71cf96cf3225de48dc5e71870d74b6dde1e8
Cherry-picked: 764f5bf48c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
All strings coming out of POSIX API calls are converted to composed form
by QFile::decodeName. Do the same for realpath(3) output. This is
especially important for HFS+, which will store file names in decomposed
form, and APIs will therefore return strings in decomposed form.
Task-number: QTBUG-55896
Change-Id: I5e51f4e5712ff26bf9644cbcf9a9603995748892
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
There are more than 1000 new entries since the table has been
generated the last time. The autotest needs to be tweaked
because the rules for the .mz domains have changed; use the
.ck domain instead.
Change-Id: Ife692afd46ac41a66604e966e5e8cb57c7aa649c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The Qt::ISODate format strips milliseconds, so a new format is introduced
that keeps the milliseconds. A new format was chosen over fixing the
existing format due to the behavioral change of suddenly having ms
as part of Qt::ISODate.
Change-Id: If8b852daed068cce8eee9b61a7cd4576bc763443
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
With the client message _NET_ACTIVE_WINDOW, not all window managers
will pass focus from a child window to its root window, Detect this
child-to-root case, and use xcb_set_input_focus() instead.
Task-number: QTBUG-39362
Change-Id: Ib32193018e3b725b323f87d7306c9ae9493d78a7
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
By templating on the <chrono> types and unconditionally using
duration_cast to coerce the duration into a milliseconds, we
violate a principal design rule of <chrono>, namely that non-
narrowing conversions are implicit, but narrowing conversions
need duration_cast. By accepting any duration, we allow non-
sensical code such as
QTimer::singleShot(10us, ...)
to compile, which is misleading, since it's actually a zero-
timeout timer.
Overloading a non-template with a template also has adverse
effects: it breaks qOverload().
Fix by replacing the function templates with functions that
just take std::chrono::milliseconds. This way, benign code
such as
QTimer::singleShot(10s, ...)
QTimer::singleShot(10min, ...)
QTimer::singleShot(1h, ...)
work as expected, but attempts to use sub-millisecond
resolution fails to compile / needs an explicit user-
provided duration_cast.
To allow future extension to more precise timers, forcibly
inline the functions, so they don't partake in the ABI of the
class and we can later support sub-millisecond resolution by
simply taking micro- or nano- instead of milliseconds.
Change-Id: I12c9a98bdabefcd8ec18a9eb09f87ad908d889de
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Saving strings with embedded zero-bytes (\0) as CFStrings would
sometimes fail, and only write the part of the string leading
up to the first zero-byte, instead of all the way to the final
zero-terminator. This bug was revealed by the code-path that
falls back to storing e.g. QTime as strings, via the helper
method QSettingsPrivate::variantToString().
We now use the same approach as on platforms such as Windows
and WinRT, where the string produced by variantToString() is
checked for null-bytes, and if so, stored using a binary
representation instead of as a string. For our case that
means we fall back to CFData when detecting the null-byte.
To separate strings from regular byte arrays, new logic has
been added to variantToString() that wraps the null-byte
strings in @String(). That way we can implement a fast-path
when converting back from CFData, that doesn't go via the
slow and lossy conversion via UTF8, and the resulting QVariant
will be of type QVariant::ByteArray. The reason for using
UTF-8 as the binary representation of the string is that
in the case of storing a QByteArray("@foo") we need to
still be able to convert it back to the same byte array,
which doesn't work if the on-disk format is UTF-16.
Task-number: QTBUG-56124
Change-Id: Iab2f71cf96cf3225de48dc5e71870d74b6dde1e8
Cherry-picked: 764f5bf48c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
There's a conflict between QGtk3Menu and QDbusPlatformMenuBar. The
problem is that on Unity the type of the platform menu instance must
be different depending on whether the menu is in the global menubar or
a standalone context menu.
Since QMenu creates a platform menu instance at construction time, it
does not yet know whether it will be added into a menubar. QMenuBar
checks that the QMenu already has a platform menu instance, and passes
it to the platform menubar. As a result, a QGtk3Menu instance is passed
to QDbusPlatformMenuBar.
Currently, a standalone QMenu does not use the native platform menu
instance. Only menus that are added to a QMenuBar do. Therefore we
don't need to create the platform instance when QMenu is constructed,
but only after it is added to QMenuBar. The platform menu instance
creation is implemented in QMenuBarPrivate::getPlatformMenu(), and
QMenu::setPlatformMenu() calls syncPlatformMenu() to take care of
syncing the QMenu properties and actions to the new platform menu
instance.
The macOS-specific methods QMenu::toNSMenu() and QMenu::setAsDockMenu()
rely on the platform menu instance, and must therefore create it on
demand.
This is a hot fix for the release blocker, not a long term solution.
In the future, if standalone QMenus are made to use native platform
menu instances, the instance must be created lazily when the menu is
about to be made visible.
Task-number: QTBUG-56526
Change-Id: I044933cabb1639406fe47908dfc4b1903af214d1
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Fixes the test for width of condensed fonts so it doesn't depend
on the presence of the Liberation font on the system, and adds
another test that condensed sub-families can be matched
consistently. The latter will however not work on Windows until
QTBUG-53458 is solved.
Task-number: QTBUG-51335.
Change-Id: Id6d046274fa21b2dce0ad6b32dce7f1c8a92a4f4
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
lumping together all kinds of unrelated stuff has caused problems with
spurious dependencies from the beginning. as the modularization infra is
now in a state which supports many small private libraries just fine,
take advantage of it.
Change-Id: Ic40f47ce76a308bbfd32deae281f6f064fe1ef4c
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Commit c5db8fc74 changed all instances of Q_WS_FOO to have the prefix
Q_DEAD_CODE_FROM_QT4 instead, to make it clearer when reading the code
that the code in question was a left-over from Qt4, when we used
Q_WS_ defines instead of Q_OS_ defines.
This worked well for cases of #ifdef Q_DEAD_CODE_FROM_QT4, but less so
for cases of #ifndef Q_DEAD_CODE_FROM_QT4, where the code was actually
unconditionally included.
To make this even clearer, the defines have been replaced by checks for
1 or 0, with a comment describing how the code used to look in Qt4. The
use of constants in the check also makes it easier for editors to parse
the condition and show visually that the code is defined out.
Change-Id: I152070d87334df7259b417cd5e17d7b7950379b7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Previously when a new QOpenGLFramebufferObject was bound, the
QOpenGLContextPrivate::qgl_current_fbo member was also updated to point
to this new object.
But if a user called QOpenGLFramebufferObject::bindDefault(),
qgl_current_fbo was not unset, meaning that if the FBO object would be
deleted at some point, qgl_current_fbo would be a dangling pointer.
This patch makes sure to clear the value of qgl_current_fbo when
bindDefault() is called. It is cleared, and not set to point to another
object because the default platform OpenGL FBO is not backed by a
QOpenGLFramebufferObject.
Task-number: QTBUG-56296
Change-Id: I68b53d8b446660accdf5841df3d168ee2f133a90
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Also bump minimum required Qt version for Android: Ministro updates.
Conflicts:
src/android/java/src/org/qtproject/qt5/android/bindings/QtActivityLoader.java
src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java
src/plugins/platforms/android/androidjnimain.cpp
Change-Id: I966f249bebf92da37bfdeb995ad21b027eb03301
Clip the transformed and rounded sourceClip to the source rectangle,
so we don't try to rotate pixels outside the source.
Task-number: QTBUG-56252
Change-Id: Ib9cb80f9856724118867aea37ead0b02a6c71495
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
It is already blacklisted for 10.8 and 10.9, and is now failing on 10.11
blocking integration.
Change-Id: I71b8119ab32ec64096bfc53d5e521714ad4ae11b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Found by UBSan:
tst_qwidget.cpp:10207:29: runtime error: member access within address 0x6060000e8880 which does not point to an object of type 'EnterTestModalDialog'
0x6060000e8880: note: object is of type 'QWidget'
eb 00 80 45 10 4b 32 ab 11 2b 00 00 80 df 08 00 60 61 00 00 c0 4c 32 ab 11 2b 00 00 00 00 be be
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QWidget'
#0 0x6ca13f in EnterTestMainDialog::eventFilter(QObject*, QEvent*) tst_qwidget.cpp:10207
#1 0x2b11b8bc90c3 in QCoreApplicationPrivate::sendThroughApplicationEventFilters(QObject*, QEvent*) qcoreapplication.cpp:1081
#2 0x2b11a3c49b4a in QApplicationPrivate::notify_helper(QObject*, QEvent*) qapplication.cpp:3716
#3 0x2b11a3c8ec72 in QApplication::notify(QObject*, QEvent*) qapplication.cpp:3704
#4 0x2b11b8bccd0f in QCoreApplication::notifyInternal2(QObject*, QEvent*) qcoreapplication.cpp:988
#5 0x2b11aea5c34d in QCoreApplication::sendEvent(QObject*, QEvent*) qcoreapplication.h:231
#6 0x2b11aea5c34d in QGuiApplicationPrivate::_q_updateFocusObject(QObject*) qguiapplication.cpp:3690
#7 0x2b11aea61360 in QGuiApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) .moc/moc_qguiapplication.cpp:177
#8 0x2b11b8d1dc86 in QMetaObject::activate(QObject*, int, int, void**) qobject.cpp:3787
#9 0x2b11aea784a3 in QWindow::focusObjectChanged(QObject*) .moc/moc_qwindow.cpp:760
#10 0x2b11a3fb24f2 in QWidget::clearFocus() qwidget.cpp:6705
#11 0x2b11a3fc87b1 in QWidget::~QWidget() qwidget.cpp:1608
#12 0x2b11a526688c in QDialog::~QDialog() qdialog.cpp:352
#13 0x6c43e2 in EnterTestModalDialog::~EnterTestModalDialog() tst_qwidget.cpp:10160
#14 0x6c43e2 in EnterTestModalDialog::~EnterTestModalDialog() tst_qwidget.cpp:10160
#15 0x492be3 in EnterTestMainDialog::buttonPressed() tst_qwidget.cpp:10188
#16 0x492be3 in EnterTestMainDialog::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) .moc/tst_qwidget.moc:2056
#17 0x2b11b8d1dc86 in QMetaObject::activate(QObject*, int, int, void**) qobject.cpp:3787
#18 0x2b11a45cb833 in QAbstractButton::clicked(bool) .moc/moc_qabstractbutton.cpp:307
#19 0x2b11a45cd54b in QAbstractButtonPrivate::emitClicked() qabstractbutton.cpp:411
#20 0x2b11a45df73a in QAbstractButtonPrivate::click() qabstractbutton.cpp:404
[...]
#41 0x6bb2cf in tst_QWidget::taskQTBUG_27643_enterEvents() tst_qwidget.cpp:10249
[...]
Fix by checking the event type first, and accessing
modal->button only if it's QEvent::Enter.
Change-Id: I2c7df3a1f43ecbfe14741b5861729078a91a32d6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
The vast majority is due to leaking styles in a data-driven
test with almost 100 rows (scrollBarRanges()).
Fix by creating the style into a QScopedPointer.
The remaining ~500 leaks were due to leaked QGraphicsScenes.
They had no parent, and QGraphicsView::addScene() does not
adopt them.
Fix those by passing the resp. view as their (QObject) parent.
Change-Id: I4316798019114ea3d7504d72cd83d534a21149c0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Adds missing image-formats so it doesn't segfault.
Also changes the exclusion of rare formats to lists of included ones
Change-Id: I1d00562cf8e96baa03121a0b996764224911e06a
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
The QXmlInputSource objects were allocated on the heap,
but never deleted.
Fix by allocating them on the stack instead.
Change-Id: Ifd8bd41d778c0634b7a426bbd22a367dfce511c9
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
The previous sync() of the specific scope and domain may have failed due
to not having the necessary permissions, but the saved value may still be
cached, so we need to check both.
This was observed on macOS Sierra, where a failed sync() will result in
marking the CFPrefsPlistSource as read-only, eg:
2016-10-04 13:14:11.713271 tst_qsettings[88537:767733] [User Defaults] attempt to set
<private> for key in <private> in read-only (due to a previous failed write) preferences
domain CFPrefsPlistSource<0x6180000e1780> (Domain: org.software.KillerAPP,
User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null))
Change-Id: I8976c1c4acfe2cb0d5510298d5c585faca9607f6
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
WinRT is not the only sandboxed platform. Since it doesn't hurt to keep
the test data in a well known location, we enable the code for all
platforms. We also make sure to mkpath the location, since writableLocation
doesn't guarantee that the location exists.
Change-Id: Ie8d90c5fbdf3b7fbf85ba6be25372b0ef7c4da55
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Before commit f1e9076809, mousePressEvent
called the virtual method setSelection(const QRect&, SelectionFlags)
with the 1x1 rectangle which contains only the clicked QPoint, unless
the SelectionFlag "Current" was set because Shift was pressed during
the mouse press.
Since that commit, the behavior has been changed such that the
rectangle is the one that is spanned by the center of the clicked item
and the clicked pixel. In theory, the result should be the same (i.e.,
only the clicked item should be selected), but
* the code path in QListView::setSelection for 1x1 QRects is more
efficient, and
* using a larger QRect can cause problems with custom views, see the
comments in QTBUG-18009
This commit ensures that the 1x1 QRect is used again, unless the
SelectionFlag "Current" is used.
Change-Id: I70dd70c083c20a3af6cd6095aa89a489756b505f
Task-number: QTBUG-18009
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
... and avoid detach()ing potentially large data for just
preserving the QPlatformPixmap::pixelType().
A QBitmap differs from a QPixmap (its base class, urgh)
by always having a data != nullptr and a Bitmap pixel
type, yet load() was unconditionally setting 'data' to
nullptr on failure, turning a QBitmap into a non-QBitmap.
Fix by move-assigning a null QBitmap instead of resetting
'data'.
Add some tests.
Change-Id: Ida58b3b24d96472a5f9d0f18f81cc763edcf3c16
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
By using _MIN for signed values, and _MAX for unsigned values, we may
detect conversion issues when serializing QVariants using QSettings.
Change-Id: I3ce58ba4b93f791f75c7ae44d1fd5030f07b2f25
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This leaves a clearer separation between the foreign-window and non-foreign
window use-cases, where a single QCococaWindow can only be in one mode,
which is determined in the constructor and doesn't change after that.
There are no source or binary compatibility guarantees for the QPA classes,
meaning the helper function in QPlatformNativeInterface can be removed.
Change-Id: I3232aedca1d98c49a8f54e16750832187f9dc69a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
The fix is trivial, but the patch adds a new QSettings tests that iterates most
of the QMetaTypes and verifies that storing and retrieving them again gives the
same value. This is a more complete test than the testVariantTypes tests, which
is limited to a subset of the QVariant types. The new tests borrows logic from
the QMetaType test machinery.
QSettings has been Q_ENUM'ified in the process, for improved debug output.
Note that on backends such as the INI backend, the metatype of the QVariant read
from the settings will be a string, so it won't match the input QVariant type,
but the result of converting that to the original value type should still work.
Task-number: QTBUG-56124
Change-Id: Ib03a26abf77c9fb449b94160d28bc4baeb095f25
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
The slot is invoked from QObject::destroyed(), which is emitted
from ~QObject. By that time the object is no longer a QShortcut,
so the static_cast it invalid.
Found by UBSan:
tst_qshortcut.cpp:1210:53: runtime error: downcast of address 0x6020000289d0 which does not point to an object of type 'QShortcut'
0x6020000289d0: note: object is of type 'QObject'
10 00 80 17 c0 ce 63 df 93 2b 00 00 b0 02 00 00 d0 60 00 00 02 00 00 00 ff ff ff 04 04 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QObject'
#0 0x42b3bb in tst_QShortcut::shortcutDestroyed(QObject*) tst_qshortcut.cpp:1210
#1 0x446cc9 in tst_QShortcut::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) .moc/tst_qshortcut.moc:186
#2 0x2b93dba52c86 in QMetaObject::activate(QObject*, int, int, void**) qobject.cpp:3787
#3 0x2b93dba55400 in QObject::destroyed(QObject*) .moc/moc_qobject.cpp:213
#4 0x2b93dba8d80d in QObject::~QObject() qobject.cpp:967
#5 0x2b93c6b6e032 in QShortcut::~QShortcut() qshortcut.cpp:476
#6 0x2b93c6b6e370 in QShortcut::~QShortcut() qshortcut.cpp:481
#7 0x42a5de in void qDeleteAll<QList<QShortcut*>::const_iterator>(QList<QShortcut*>::const_iterator, QList<QShortcut*>::const_iterator) qalgorithms.h:317
#8 0x42a5de in void qDeleteAll<QList<QShortcut*> >(QList<QShortcut*> const&) qalgorithms.h:325
#9 0x42a5de in tst_QShortcut::clearAllShortcuts() tst_qshortcut.cpp:1136
Fix by replacing QVector::replaceAll() with the erase-remove idiom,
which does not require the cast, because it can perform mixed-type
lookups.
Change-Id: I4251c1895fa4398023f489dbfd7108d90c1a6c94
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
To keep the change minimal, keep 'sw' as a pointer variable,
but back it by a stack-allocated QStackedWidget instead of a
heap-allocated one that's never deleted.
Change-Id: I9e2a8c07979b861eb7e7040c144d8e75c90d0bc9
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Saving strings with embedded zero-bytes (\0) as CFStrings would
sometimes fail, and only write the part of the string leading
up to the first zero-byte, instead of all the way to the final
zero-terminator. This bug was revealed by the code-path that
falls back to storing e.g. QTime as strings, via the helper
method QSettingsPrivate::variantToString().
We now use the same approach as on platforms such as Windows
and WinRT, where the string produced by variantToString() is
checked for null-bytes, and if so, stored using a binary
representation instead of as a string. For our case that
means we fall back to CFData when detecting the null-byte.
To separate strings from regular byte arrays, new logic has
been added to variantToString() that wraps the null-byte
strings in @String(). That way we can implement a fast-path
when converting back from CFData, that doesn't go via the
slow and lossy conversion via UTF8, and the resulting QVariant
will be of type QVariant::ByteArray. The reason for using
UTF-8 as the binary representation of the string is that
in the case of storing a QByteArray("@foo") we need to
still be able to convert it back to the same byte array,
which doesn't work if the on-disk format is UTF-16.
Task-number: QTBUG-56124
Change-Id: Iab2f71cf96cf3225de48dc5e71870d74b6dde1e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A fair amount of tests are skipped if we can't write to the system scope,
eg on iOS. Without this detection they will fail.
Change-Id: I8257f1f24e69dae88925c20d2bff851e81701405
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
it does not appear that the tests actually use these flags in any way;
they don't include any (actual) d-bus headers and have no ifdefs.
and the qdbus module already pulls in the flags via QMAKE_USE (in the
case where they are defined at all, i.e., dbus-linked).
Change-Id: Ie6bc6da7d1dd96da7b73f2d0fe45576936715874
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The layout isn't actually created until endLayout() or setLineWidth() is
called. So in the case where this was not done, the height of the line
would be 0, thus multiple lines would be placed on top of each other, at
y == 0.
[ChangeLog][QtGui][Text] Fixed QStaticText when manually breaking lines
and no text width was set.
Task-number: QTBUG-56346
Change-Id: I7f6ed6260545882f05fe39b21134315eca7401b9
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
this actually fixes the build when ssl is not enabled, as the openssl
features are in the not included network-private module.
Change-Id: Ibafae9867af493da184a45cf3981628d475d37a6
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
It fails on iOS as well, and likely also tvOS and watchOS.
Change-Id: Idfce98a5aeccb5680f6b4c6e66b526dd7922156d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Turn the list of newRow() calls into a for loop over a constexpr
data structure.
Fixes the GCC note:
tst_qgraphicsview_2.cpp:47:13: note: variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without
and speeds up compilation of the file from 13s to 2.5s on my
machine.
Task-number: QTBUG-38890
Change-Id: I4f0b3565c7df64b286d1d32eb3f3d6bf4df92609
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Added the binary compatibility test data files for Qt 5.7 for QtBase
Change-Id: I5b19571f5e266c52622027d820062afa5fd4fbf3
Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
CFAbsoluteTime is measured in seconds, represented by a double,
so when converting milliseconds to CFAbsoluteTime we may get a
slight error due to missing precision in double to represent
the milliseconds exactly. By rounding to the closest millisecond
when converting back, we avoid truncating and being one ms off.
Change-Id: If1e99f97b000fb8cb893ddfc5d7ba81096c0ea88
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
In tst_QCompleter, two completers were leaked because they
had no parent and setCompleter() calls don't reparent.
Fixed by giving them parents.
In tst_QUndo*, fix lots of leaked QActions by storing them
in a QScopedPointer. There were some half-hearted attempts
to clean them up with manual deletes, but I ported these to
scoped pointers, too, to make the code more robust in the
face of failures.
This fixes the remaining errors in GCC 6.1 Linux ASan runs of
tests/auto/widgets/util.
Change-Id: Icc5248cc9cf4514540915924df1c4d9e09c071fa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The generated data files for the binary compatibility test
updated for QtBase.
Change-Id: Idae703c83f55ff17cada4419db742ea12b22bf86
Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
The usual:
- delete styles
Either by using QScopedPointer.
This fixes the remaining errors in GCC 6.1 Linux ASan runs of
tests/auto/widgets/styles.
Change-Id: Ifba59085c057d474bf964cbb93010c408d773a61
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
GCC warned:
tst_qabstractslider.cpp:858:89: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
Qt::Orientation orientation = *reinterpret_cast<Qt::Orientation*>(&sliderOrientation);
^
tst_qabstractslider.cpp:867:72: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
orientation = *reinterpret_cast<Qt::Orientation*>(&wheelOrientation);
^
The solution, of course, would be to use a static_cast here, but
why go via int in the first place? Qt::Orientation can perfectly
well be used in QFETCH, as proven by tst_qmainwindow, among other
things.
Change-Id: I97916a50405e16d114837bc52580ce6666d74b17
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Restore Qt::AA_DontUseNativeDialogs that is disabled in the beginning
of the test function.
Change-Id: I4ff8eab4ecc458c478337824e66b5a59fbdd7c65
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
... and move toString() implementations there which were repeated in
network tests, or #ifdef'ed in qtest.h.
Since the functions moved from network tests are now in a public header,
had to massage them a bit to pass headersclean:
- replace Q_FOREACH with C++11 range-for
- avoid implicit conversion from QByteArray -> const char* (done by
re-using toString(QByteArray) instead of calling strdup() manually)
Also made the functions overloads instead of specializations. This
allows to pass the enum by value instead of by const-&.
Like the existing QHostAddress, the newly-added toString() overloads are
marked as \internal. We can decide later whether to turn them into
public API.
Change-Id: I8c23db7a0a6575273567017d42d7b2a957acece8
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
After e109b8a0f3, it is possible
that the cache will be flushed as a result of inserting a new
font rather than just when the timer event triggers. When doing
superscript and subscript text layouts, we would first get
a regular font engine, then a scaled one, and then reference
the regular font engine *after* getting the scaled one. If the
regular font engine was deleted as a result of inserting the scaled
one, we would get a dangling pointer and crash.
The situation was improved by 49926bb9ef.
You would now to switch between 256 different fonts in the layout
in order to trigger it. The test in the commit will trigger the
crash even with this change.
[ChangeLog][Qt Gui][Text] Fixed a crash that could happen if you
were doing many different text layouts with different fonts
and superscript or subscript alignment.
Task-number: QTBUG-53911
Change-Id: Ia33108252e030eff25924ef1b7c10b9d59b5bc8c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Nested namespaces are quite common, therefore moc should support them.
Task-number: QTBUG-55415
Change-Id: I756cab36d498eb4342b402d255836d5d30f07b30
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
We need to delete the style returned from QStyleFactory::create()
ourselves, so put them into a QScopedPointer.
The alternative would have been to create this once, as a member
of tst_QWidget, but this is the minimal approach that ensures
behavior just as the old code, but without the leak.
Change-Id: I527f1031c57be6f05942f4acc057e7dae1af2571
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Found by UBSan:
tst_qapplication.cpp:1754:48: runtime error: member access within address 0x7ffda11f2220 which does not point to an object of type 'SpontaneousEvent'
0x7ffda11f2220: note: object is of type 'QMouseEvent'
The code attempted to model the layout of a QEvent with another class
that allows public access to the memory location that (hopefully)
corresponds to QEvent::spont, gaining access by casting a QEvent
object to that specifically-crafted class.
Fix by the using the existing QSpontaneKeyEvent::setSpontaneous()
call, which, despite its name, works for all QEvent subclasses, and
which has already been fixed to not invoke UB (in bc087db).
Change-Id: I7db8b8a8a823f7d61ab17375142d19dc3874fea5
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Adds two formats that does not have optimized code-paths in qdrawhelper
to ensure the generic path has coverage.
This has already uncovered one bug fixed before this patch could go in.
Change-Id: I0e0a1a873555b27f6438f69a76982b8e06263dcf
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
QDateTimeEdit ignores the time-spec of its date-time value, using its
own time-spec instead; mostly, this works because it first conforms
the value to its own time-spec. However, during construction, before
doing this, it set up its display data, which could leave it with a
different time (rather than a different representation of the given
time) than it was asked to use.
Moved the updateTimeSpec() calls to immediately after setting value in
QDateTimeEditPrivate::init() to ensure correct handling. Added test.
Task-number: QTBUG-54781
Change-Id: I3b07c10997abb858fc0b40558bff96e3fdabbd83
Reviewed-by: Jesus Fernandez <jesus.fernandez@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
1. QSslSocketBackendPrivate::transmit was ignoring 'readBufferMaxSize';
as a result, we can have a user trying to set read buffer's size
to a small value (and more important - reading slowly in a small
chunks from this socket), but SSL itself socket reading 'too fast',
potentially growing its internal buffer to a huge size. This also
results in auto-tests failing - whenever we're trying to limit read
rate in some test.
2. Update qsslsocket auto-test.
Task-number: QTBUG-43388
Task-number: QTBUG-55170
Change-Id: Iedece26df0ac5b3b7cad62cc8c98aedc28e7ca5b
Reviewed-by: Richard J. Moore <rich@kde.org>
In setMinAndMaxSize(), QLayout::removeItem() doesn't actually delete
the removed item. We have to do that ourselves (RAII not necessary,
since the spacer is owned by the layout until we remove it).
In distributeMultiCell(), allocate the QStyle subclass on the stack so
the compiler cleans it up properly on all exit paths (was:
unconditional leak).
Change-Id: I24f8f11af2bfc5abf78f9aab0139dcfe0187402b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
In sizeConstraints(), QLayout::takeAt(), as the name suggests, doesn't
actually delete the item. We have to do that ourselves.
Likewise, in replaceWidget(), QLayout::replaceWidget() also doesn't
delete the affected item, but returns it. That's spectacularly bad API
design, but the leak is easy to fix: just delete the return value.
Change-Id: I8dcbc59898949eabce766cda2c0edae2e1f2799e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
The default should be false, meaning the application will prefer to
use a native menubar if the platform supports it. The application
author can set it to true if he wants to always use a Qt-rendered
menubar instead; or, he can call QMenuBar::setNativeMenuBar().
Qt and its plugins should not override the author's wishes.
Instead, if the platform plugin cannot create a native menubar
for whatever reason, createPlatformMenuBar() will return null,
and QMenuBar will fall back to using a Qt menubar instead.
The application can check the result via QMenuBar::isNativeMenuBar().
QMdiArea when maximized inside a QMainWindow with an empty title
does not replace the main window's title if we are using native menus.
This behavior turned out to be the same on Unity as it is on macOS,
so the autotest needed adjustment to expect that behavior whenever
the menubar is native, not only on certain platforms.
tst_QMenuBar::allowActiveAndDisabled() tests a standalone QMenuBar.
In f92f78094 it was disabled on macOS, but on Ubuntu it passes as
long as we force it to be a non-native menubar, so it should pass
that way on macOS too. Removed unused variable RESET to fix warning.
Task-number: QTBUG-54793
Change-Id: I716e40da709f96331cbbf25213bd7bc153e4dbe2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
A check "just in case" -- we don't want leaks nor crashes
due to double deletions, and so on.
Change-Id: I24f1a486f0d438595bbe352ab780b07c5d53acbd
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The test function tries to create a file inside the application bundle.
Change-Id: Ia429b42b102d5e98f20694058fa2633e3c7de30a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
There is no need to switch to the current directory, when there is no
process support. This also fixes running the test on sandboxed target
platforms.
Change-Id: I25fabb8b22d3510062a012884eb1eaab682901d3
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The inefficiency of QColor(const char*) came to light by
a recent refactoring which showed that the existing char*
overload of qt_get_hex_rgb() was never called.
So, provide a QLatin1String interface for named colors
that allows user code to reach that internal function
without converting to QString first.
Change-Id: I74df7b570ef28c00e35ca4adf46c4b7c7e9994b3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Found by UBSan:
tst_qgraphicsitem.cpp:5066:29: runtime error: downcast of address 0x2afcb006c7f0 which does not point to an object of type 'GeometryChanger'
0x2afcb006c7f0: note: object is of type 'QGraphicsRectItem'
00 00 00 00 d8 64 ca 98 fc 2a 00 00 40 a9 0b b0 fc 2a 00 00 75 65 29 00 00 00 00 00 35 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QGraphicsRectItem'
#0 0x4c5f1c in tst_QGraphicsItem::prepareGeometryChange() tst_qgraphicsitem.cpp:5066
Fix by actually instantiating a GeometryChanger, which incidentally is
the pattern used by paint() a few lines below, too.
While at it, allocate the item on the stack (as is done in paint())
and create a local QRectF variable to avoid repeating the same magic
numbers over and over again.
Change-Id: If5a3d56511000a17703d78d7dd1f0ea072b8bc11
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
5971b88e is not needed in new configure.
This merge also reverts "fix QMAKE_DEFAULT_*DIRS resolution with
apple SDK", 2c9d15d7, because it breaks iOS build with new
configure system.
Conflicts:
mkspecs/features/default_pre.prf
mkspecs/features/mac/toolchain.prf
mkspecs/features/toolchain.prf
src/dbus/qdbusconnection.cpp
src/plugins/sqldrivers/mysql/qsql_mysql.cpp
src/sql/drivers/mysql/qsql_mysql.cpp
src/widgets/widgets/qmenubar.cpp
src/widgets/widgets/qmenubar_p.h
tools/configure/configureapp.cpp
tools/configure/environment.cpp
tools/configure/environment.h
Change-Id: I995533dd334211ebd25912db05b639d6f908aaec
Allows us to detect cases where the requested vsync combination was
not possible to fulfill.
Change-Id: Ie8f3665129f7a1ab7fcefb94b2298d54520b753a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The FPS is now calculated and output on the command line in a single
place. The animated fps counter has been replaced with a vertical line
which should make it easier to observe tearing issues when vsync is
disabled.
Change-Id: Id356fc1958c048d85aba48edfed59124454038d4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The animated FPS counter should be enough to observe smooth animations,
so we use the color of the window to visualize frame latency.
Change-Id: I1171a1c4bdc261ca8655771290c6735357821781
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Costs only ~300B in text size in QtCore, which is roughly compensated by
savings in other QtBase libraries, even without specifically porting
users to QL1S.
Of course, the raison d'être for this overload is avoiding the expensive
QLatin1String -> QString conversion which, for small lists, can take up
to 50% of the total runtime (assuming memory allocations dominate over
scanning and copying the list).
[ChangeLog][QtCore][QStringList] Added join(QLatin1String) overload.
Change-Id: I91d7e1d4e2c76d6dc79f2b750cf8e256dd4e0ab6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Isolates the test from anything that might be going on on the globalInstance().
Enabled by the explicit thread-pool feature on QtConcurrent::run().
Add explicit timed wait (unit tests should contain as little indefinite waits
as possible).
Also avoids the use of QFutureSynchronizer, which makes my static QList
checker go nuts, with no way of fixing it until Qt 6.
Change-Id: I0829992642b2a49bb6a10ddd4b31eb3f88e3adeb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If the sloppy menu popups - send the leave event to the last active
menu (except Cocoa), because only currect active menu gets enter/leave
events (currently Cocoa is an exception).
Check that the menu really has a mouse before hiding the sloppy menu -
don't rely on enter events.
This patch removes some unnecessary synthetic mouse enter/leave events
from QMenu which causes event duplications with different mouse cursor
position.
Refactor sloppy menu timer handling - start or restart timers on mouse
move events. Enter/leave events are not reliable.
Fixes:
- better enter/leave events handling for native widget actions,
- reduce duplicated enter/leave events for menu actions,
- better handle torn off sloppy menus.
Partially reverts: 0ed68f3f58
Amends: 57ecd5aeeb
Task-number: QTBUG-53068
Change-Id: I7ad56ac1619db124915d373fab82d0512d44c90e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Found by UBSan:
qstring.h:1160:44: runtime error: null pointer passed as argument 1, which is declared to never be null
qstring.h:1160:44: runtime error: null pointer passed as argument 2, which is declared to never be null
Fix by avoiding the memcmp() calls if there's a chance that they
might be called with nullptr.
While at it, also implement !=, >, <=, >= in terms of ==, <,
and add a test, because this particular UB was not fingered by
any of the QtCore test cases, but by a Qt3D one.
Change-Id: I413792dcc8431ef14f0c79f26e89a3e9fab69465
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This one selftest is currently blocking OS X 10.11
from entering the CI. It can't be reproduced when
run manually.
Task-number: QTBUG-55155
Change-Id: I4553ef2d7813b29f5dc8577976c4482686346504
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
This has undesired effects when converting a QSqlRecord to JSON.
A char(0) e.g. has special semantics that are undesired when
reading a Tinyint column.
I don't think that returning bool for the special case of a
Tinyint(1) is required. This also did not happen before, and
is also not happening when not using a prepared statement.
Instead, a plain int/uint QVariant is returned.
This patch extends tst_QSqlQuery::integralTypesMysql to also
cover reading and writing booleans from/to a MySQL table column
of type Tinyint(1). Additionally, the reading is now also done
with a prepared statement and we also check the raw variant
value.
The broken behavior fixed by this patch was introduced by me in
commit 194403a348.
Change-Id: I028a3abd83fdd2b42d98d478950d205e5b6bbeb5
Task-number: QTBUG-53397
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Child widgets should get the show/hide event when the TLW changes its
state, because child widgets are also visible or invisible. This
restores the Qt4 behavior (fixes the Qt4->Qt5 regression).
Restoring/minimizing the TLW now sends the spontaneous show/hide event.
Show events are now handled also in the expose event handler in the
QWidgetWindow class, because the show event must occur before the
expose event to avoid possible flicker e.g. the OpenGL content. This
can happen e.g. on XCB platform. If the "WindowStateChange" event occur
before the expose event (e.g. Windows platform) then the code in expose
event handler will be ignored to prevent event duplications.
Added autotest.
Task-number: QTBUG-50589
Change-Id: Ie9a9329b1f29bff876de28d5948d0d5fb6bc1f05
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Source (.cpp and .h) files should not be executable.
Change-Id: I021d8733185d73d071fcaf3df7e529862a490b63
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Regression introduced in c32ef0a725
The expansion vector can be empty, in that case it is not allowed to
call constLast()
Task-number: QTBUG-55853
Change-Id: I47aa8eb7507ee91662215df42b4a66eebaa32bb5
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Instead of creating files relative to the application binary, use a
temporary directory. This also cleans up the test data after execution.
Change-Id: I5d680fd01c60b0d33df06f9cb9aaef7c86279710
Reviewed-by: Jesus Fernandez <jesus.fernandez@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
... to the new qmake based configuration system.
This removes the old qfeatures.txt (distributed over configure.json
files) and qfeatures.h (distributed over qconfig-<module>.h files).
qfeatures.prf is gone without replacement, as attempts to use it would
lead to followup errors anyway.
Change-Id: I1598de19db937082283a905b9592d3849d2199d0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Move the different parts of configure.json/.pri into the libraries where
they belong.
Gui is not yet fully modularized, and contains many things related to
the different QPA plugins.
Done-with: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Change-Id: I6659bb29354ed1f36b95b8c69e7fce58f642053f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Parsing the other files will (re)generate the same metaobject info in two places
Change-Id: I8984ed30751a7587de870f55dd427f067d1b2495
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>