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>
As the d-pointer, QBrush uses a QScopedPointer with a
custom deleter that checks for QBrushData::style and
casts the QBrushData pointer down to corresponding
subclasses before calling delete on them.
In QBrush::detach(), however, any of the three brush
data classes were held in a QScopedPointer _without_
the custom deleter, invoking UB when that scoped
pointer would ever get to be the one that deleted
the payload instead of handing it over to the objects
d-pointer.
Found by making dtors protected following a Coverity
report wrongly marked as 'dismissed' (these static
checks are not included in this patch, since they
are binary-incompatible), to find out where Coverity
could possibly see a problem.
Also replace the d.reset(x.take()) that allowed this
mismatch to compile with d.swap(x), which nicely
ensures that x and d are of the same type.
Coverity-Id: 11772
Change-Id: I85e2c205df9291bd7508b6c90f7b03fbe8c3bcd2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Coverity somewhat rightfully complained that the FD may be leaked in
certain cases, e.g. when the new-expression throws. Yes, the plugin
is compiled with exceptions disabled, but the code is still a bug
waiting to happen, because it's too easy to just add an early return
to the function and leak the FD that way.
Fix by writing a small RAII class for FDs (can't use QSharedPointer,
since it's not a pointer we're dealing with). It's quite generically
named, in anticipation that it might come in handy elsewhere, too.
Coverity-Id: 89046
Change-Id: I83d1ed3f11219065d2248c129ed191a651f617c7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of the global state
Task-number: QTBUG-48795
Change-Id: Ic2c545718adb68df41730e5a3bf25adb374ffce3
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
The names of some screen properties have changed in 7.0.
For 6.6, map the 7.0 names to 6.6 names.
Change-Id: Iaf9d297fdd6a0329a84150f2b9a27665d89cc1ec
Reviewed-by: Dan Cape <dcape@qnx.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
It was backwards so the screen context was being flushed on every screen
interaction when the parameter was _not_ specified. During mouse/touch
movement, the number of flushes can be so great that it negatively
impacts performance.
Change-Id: I4dfe9c33c8ce31237db1d78db1cb8e04c00c4dd3
Reviewed-by: Dan Cape <dcape@qnx.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
The const QString &format variants of these methods lack adequate
control over the locale used; the Qt::DateFormat variants give only
limited control over the format string. So reference the QLocale
methods that provide the general case, in the docs of each. Also made
the \sa cross-referencing among these methods a little more coherent.
Task-number: QTBUG-55632
Change-Id: Icd0c8548045e74879e941ba089c3bdea78f14e34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Fix inspired by Qt 4 sources. When we get drop events that are not
coming from the same application, it's unlikely that the keyboard
modifiers are in a sensible state (the usual XCB events are not sent
during drag and drop), so set the keyboard modifier state explicitly.
Task-number: QTBUG-49645
Change-Id: I9360f2b7ffeaa5243a4dfe7ccf96df134c5d2156
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Yes, yes, this is just a configure test, but why do something stupid
in the code and then have to shut up Coverity manually?
Fix by making it a global, which means it will be zero-initialized
(I didn't want to do the obvious = 0, as that could protentially
create a "0 used as nullptr" warning at some point in the future.
Coverity-Id: 59485
Change-Id: I49ecd28be983a0e42b420d20da0db34a872c6f44
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's probably benign, but it causes Corverity to complain,
so always init all fields of QComposeCacheFileHeader.
Format the code so it can easily be ported to uniform init
later on.
Coverity-Id: 93043
Change-Id: Ifa1ccc3fa58dc813306917f216772fd24d4930c9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Q_CC_GNU is (__GNUC__ * 100 + __GNUC_MINOR__), so 510 is 5.10 not
5.1.0. The first GCC 5 release has support for -Wsuggest-override, so
it should really be 501.
Change-Id: I7b264af087cd4562ce8720c99b70116d7654ea5f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This function sends D-Bus messages directly (in huntAndEmit), so it
should only be called from the QDBusConnectionManager thread. Somehow, I
missed this in the Qt 5.6 refactoring of QtDBus.
Being called in the wrong thread means that there's a visible behavior
change compared to Qt 5.5: if the user code sent a method call or method
return/error and then emitted a signal, we'd have two threads racing to
send the D-Bus messages. This was observed in Telepathy-Qt code: certain
signals arrived before a method return, even though they were clearly
emitted by a queued QMetaObject::invokeMethod.
In addition to that, we have has an internal problem (though not
observed): the libdbus-1 timer and socket callbacks would be called in
the wrong thread and we no longer have protection against that.
Unit testing not possible since this is a race condition.
Change-Id: I9e96ecd4f6aa4ff0ae08fffd1471d002142613d6
Reviewed-by: Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
The ASAN talk at QtCon was pointing out a out of
bound read in a vector.
Let's try to do something about it.
If the lazy initialization of compose table fails,
the first character handling still tries to actually
access it. Later characters are properly handled
in the caller.
Reported-by: Hanno Böck
Change-Id: Ieac3e95361abd0fcd06c555bcd00ca1c4d8f1931
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Delete references from menu to its containing item, and vice versa.
Fixes https://launchpad.net/bugs/1620937
Task-number: QTBUG-55966
Change-Id: I58f0f0a90184bee4b0466c28d91c670a34fa65a5
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This fixes a bug where notificationClosed() and actionInvoked() slots
were called more than once, from previous alive notifier instances.
Change-Id: I4cb4dfc27ee129bc5282fbd8e0961959d0765112
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Instead of trying to keep that variable in sync with platformMenuBar
state, just check whether platformMenuBar exists instead.
Now QMenuBar::isNativeMenuBar() is more reliable, and will not return
true if the QPA plugin provides no platform menu bar.
Also, remove useless restrictions for code using isNativeMenuBar().
That method is available on all platforms for a long time, not only on
macOS or WinCE.
This makes sure local menus do not appear if global menus are available,
and setVisible(true) is called.
Change-Id: I7a5944c64376b4714a38ad981089df8a151c3403
Task-number: QTBUG-54793
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
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>
This prevents getting "QWidget::showEvent()" when hiding minimized
widget on some WMs like Marco or Xfwm4.
If QWindow is minimized and it gets the new "XCB_WM_STATE_WITHDRAWN"
event from XCB, then don't change the QWindow state.
Task-number: QTBUG-55942
Change-Id: I90cfc2bf55e507864ad8f26c8f569ea562c27314
Reviewed-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The move constructor as well as member-swap were dealing with the
'unused' field as if it would be usable. But as the comment in the
default ctor suggests, the field can never be used in Qt 5, due to
the inline dtor.
So, don't bother with the field. Doing so only triggers checkers
such as Coverity.
Also mark the field for removal in Qt 6.
Coverity-Id: 154503
Coverity-Id: 154510
Change-Id: If42c5ed66d1133e651de7477f3313b3989b64bc9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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>
I actually doubt it's Linux-specific (more like all Unix), but the
changes are in files called "linuxaccessibility".
Change-Id: I9093948278414644a416fffd14744ae826b83303
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Change-Id: Ie1d6d7f3adf61b482b8e797849dbb2b3053fe720
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
qstyleoption_cast should use Q_NULLPTR to represent a null pointer.
Task-number: QTBUG-45291
Change-Id: I85078ceb435b310daf63db2ed771be2f36cf3e4f
Reviewed-by: Marc Mutz <marc.mutz@kdab.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>
When you would start to drag a tab, and then drag it in the other
direction along the point where you started the drag, the tab would fail
to follow the mouse for a distance twice the "startDragDistance", before
jumping to the mouse again.
Fixed this by only taking into account the "startDragDistance" when
checking whether a drag is started, and to rely on the "dragInProgress"
variable otherwise.
Change-Id: I5dd4ebd8340fef7e870f087be68c5097b49728cb
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
We must ensure that QDBusServer's newConnection() signal has been
processed by the application, before starting processing messages on it.
Task-number: QTBUG-55087
Change-Id: I595329b2f98788dbf9f40558b8c230c0c0817ef8
Reviewed-by: Timo Jyrinki <timo.jyrinki@iki.fi>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Calling style() can trigger a call into user code which can read
the tool button's members before they are initialized
==3566== Conditional jump or move depends on uninitialised value(s)
==3566== at 0x421C39: MyProxyStyle::pixelMetric(QStyle::PixelMetric, QStyleOption const*, QWidget const*) const (MyProxyStyle.cpp:635)
==3566== by 0x504B8B1: QRenderRule::QRenderRule(QVector<QCss::Declaration> const&, QObject const*) (qstylesheetstyle.cpp:1004)
==3566== by 0x504D084: QStyleSheetStyle::renderRule(QObject const*, int, unsigned long long) const (qstylesheetstyle.cpp:1747)
==3566== by 0x504D4A5: QStyleSheetStyle::renderRule(QObject const*, QStyleOption const*, int) const (qstylesheetstyle.cpp:2023)
==3566== by 0x504FF02: QStyleSheetStyle::styleHint(QStyle::StyleHint, QStyleOption const*, QWidget const*, QStyleHintReturn*) const (qstylesheetstyle.cpp:5146)
==3566== by 0x517B2D0: QToolButtonPrivate::init() (qtoolbutton.cpp:193)
Change-Id: I56bca15d3ec7cd7b255a83dca786532a2f9b9b48
Reviewed-by: David Faure <david.faure@kdab.com>
The calculated end position of script lines, consisting of nothing but
trailing spaces, is lower than the start position. This results in not
shaping those script lines.
Task-number: QTBUG-55255
Change-Id: Ib70c1a800d2f70b7f61e3d05c10618e275f45f12
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Handling user events while creating a window can cause problems and
crashes as the event tries to access non initialized parts of the window
itself being created. Hence exclude user input events at that time and
have them handled when the event loop checks for them regularly.
Change-Id: I2a78efd619250be8f6f2e737ed78e39481a4cf76
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Detect and apply style sheets font set when calculating
QHeaderView section content size and drawing it.
Change-Id: I542cd0d31bbe62f127c509f297eef0a576fec054
Task-number: QTBUG-55597
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Backport a feature of the new configure system setting the
variables QT_CL_MAJOR_VERSION, QT_CL_MINOR_VERSION,
QT_CL_PATCH_VERSION similarly to the existing variables for gcc.
This allows for disabling optimizations depending on the compiler
version.
Task-number: QTBUG-55238
Change-Id: If2349b008c1049e2ab98a5c1160b244a6e8937a8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
An entry was missing in one of the tables. This patch adds it back in
and adds the enum comments used to keep track of whether they all are
there and correctly set.
Change-Id: Ic6a55a8f81f9c42a3174a2a75c80c3a354f173b7
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Otherwise we will return an empty list of fallbacks if no QFontDatabase
has been created yet.
Task-number: QTBUG-55222
Change-Id: I50508162fad3206e0acf3cc6eb39aefac5c3e197
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Earlier versions of the compiler cannot default
move special member functions, even though we
also define Q_COMPILER_RVALUE_REFS for them.
Fix by retracting the less-often-used of the
two compiler feature defines.
Q_COMPILER_DEFAULT_MEMBERS is not used outside
QtBase in neither 5.6 nor 5.7 (5.8 is not
released at this time, so wasn't considered).
The same is true of the dependent macros
Q_COMPILER_DEFAULT_DELETE_MEMBERS and
Q_DECL_EQ_DEFAULT.
In QtBase, the three uses are:
1. in QAtomic*, where the user also requires
Q_COMPILER_CONSTEXPR, which is not defined
for any MSVC at this time,
2. for QEnableSharedFromThis, which is a class
template with an alternative {} implementa-
tion of the default constructor, and uncon-
ditional user-defined copy special member
functions.
3. The test of the corresponding functionality
in tst_compiler, which this commit amends.
That means that neither of these two only uses
of the macro in Qt libraries are affected by
the change.
The reason we do this change, then, is that in
the future, we want to be able to more easily
restore move special member functions for
classes for which they are suppressed due to
user-defined dtors or copy special member
functions.
Change-Id: I6f88cad66d6b87a758231f16355c3bddae697b86
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
According to https://msdn.microsoft.com/en-us/library/5dae5d43.aspx,
strncpy_s' second argument must not be 0:
> If strDest or strSource is NULL, *or numberOfElements is 0*, the
> invalid parameter handler is invoked.
Move the existing check for len > 0 up to protect the strncpy_s
call, too.
Change-Id: I70d339ea60d4b76f3038b2e4e4756f6590a9bd31
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
uic should use Q_NULLPTR instead of 0 as the default disambiguation
context.
Task-number: QTBUG-45291
Change-Id: I889182c7fe1c4be3336f3cd645aa60838863c633
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
iOS was excluded in 09aeda21b9, probably
unnecessarily. The build has been found to be warning-free.
Change-Id: I81de2fff40938b6ab9f7a6a5b9f08f8a8baadb16
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Release the IShellItem instances according to the
documentation of IFile[Open]Dialog.
Task-number: QTBUG-55509
Task-number: QTBUG-55459
Change-Id: Ib79622cde21982b1bda0be7d0483c6e652a1d5fe
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>