There's no value in the ctor and it might be inhibiting some
C++98 POD-only compiler optimizations.
Change-Id: I6887afcd2af9805251eac2d8dfe4ced5b54bff85
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
QGraphicsItemAnimationPrivate::Pair, being a (qreal,qreal) is
larger than a void*, so holding them in a QList is needlessly
inefficient. Worse, the code could come to depend on the fragile
property of (inefficient) QLists that references to elements
therein never are invalidated.
Fix by marking Pair as primitive and holding it in QVector
instead.
Change-Id: I190721f4b0cdeab2efab2d51536f64572cd663df
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Adding constexpr there is allowed, because QWeakPointer is a class template.
But in 100% of cases, it will be dropped, because the destructor is not
trivial. So, don't mislead users and devs to think that any or even all
QWeakPointers could ever be constexpr.
Change-Id: Ia50aad4d6c4fb724254308150124c666e82ef817
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
In IsInvalidName::operator(), marked as _NOTHROW, we're calling qWarning(),
which, of course, _can_ throw. We don't care in that case, but then we
musn't use _NOTHROW, which causes UB on MSVC, but _NOEXCEPT, which causes
std::terminate to be called.
Change-Id: I18f74546ea3b388495fdb173d3abd9a162fb78a9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QList<bool> uses from 400% (32-bit platforms) to 800% (64-bit)
more per-element memory than QVector<bool>.
This change is binary compatible, since QList and QVector have
the same size, and the QList field was not referenced from
inline functions. This includes all relevant special member
functions, since they are all out-of-line (and move assignment
and move constructor are disabled by used-defined copy
assignment and copy constructors, resp.). The header is unchanged
from Qt 5.0, so there were also no past inline users of the
member.
Change-Id: I3a94ddc73a4f388031dfd4fce3fedccc507a39c7
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
So far, this was only supported for dlopen mode. This adds symmetric
defines for the linking case.
Change-Id: I9cbfa18e04d041dde0cbd833929782cada9eb812
Reviewed-by: Richard J. Moore <rich@kde.org>
We should accept JPEGs with broken EXIF headers since the header is
optional and can be ignored if broken.
Task-number: QTBUG-46870
Change-Id: I494e5497b8449ce6494285d4d77caadbbb0ccaf8
Reviewed-by: aavit <eirik.aavitsland@theqtcompany.com>
That's the version Apple ships with Xcode 6.3.2. We set the
threshold to Xcode 7, whose clang version supports the "missing
override" warning.
Change-Id: Ibcab8a45306120bdcd02ca5b0bb0d1c638cea177
Task-number: QTBUG-46833
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Instantiate widgets on stack and add cleanup function for the check.
Change all functions instantiating a QFormLayout without widget on
the stack to use a toplevel widget and pointer variables since
otherwise, the labels automatically created by a call like
QFormLayout::addRow("bla", widget) leak.
Change-Id: I72a7a9c3175b5793a9450c6fcb970012ccd2274b
Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
Instantiate widgets on stack and add cleanup function for the check.
Change-Id: Ia527c228f9173d1b5aeba94ba4e14e1beba60731
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
Gather member variables testWidget, testLayout, w1..w3 and sp
used in getItemPosition() and itemAtPosition() in Helper
class ItemTestWidget.
Remove member variables m_grid, m_toplevel and instantiate the
top level widget on the stack in minMaxSize().
Remove empty slots and functions.
Add a cleanup() test checking that no visible top levels
are leaked with explanatory comment about data driven tests.
Change-Id: Ia30120d78144dab3b7c73864c6fbcef606cb19d3
Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
Howard Hinnant is right: just swapping may keep a resource alive too long.
The problem with replacing swap(other) was that the naïve approach:
clear(); swap(other);
is not safe for self-assignment. Taking a cue from the default std::swap()
implementation, and the copy-swap idiom, a self-assignment-safe version is
QSharedPointer moved(std::move(other)); swap(moved);
which is to what I changed the implementation now.
Change-Id: I589fdae50ae22b95350db8250b02d983dc8487a6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Conflicts:
src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
Manually fixed src/testlib/qtestcase.cpp to return the right type.
Change-Id: Id1634dbe3d73fefe9431b9f5378846cb187624e4
f9408317e7 was unfortunately
approved though it had an annoying bug. The patch had
an assign of a visual index into a logical index.
This patch fixes that issue.
Change-Id: I9cc75e4e9701858c92e2c3e5817415041b42f8e8
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Guarantee the values are exactly the same on all platforms
and avoid the macro redefinition(s) on a newer MinGW.
This also fixes a typo in #define S_IFLNK 020000 (<-- must be 0120000).
Change-Id: I4993d2a9bdb4b0871af110b89c137ce0ac0e953a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
os.version is the kernel version which is just not very useful or easy to
use for us. Instead, introduce a string that allows easy differentiation
between Windows 7 and 8.
From the adapter identifier the driver description is often helpful too,
especially in virtual machines.
These allow writing rules like:
{ "description": "Use WARP in some Win 8 and 8.1 VMs",
"os": { "type": "win", "release": [ "8", "8.1" ] },
"driver_description": "VMware SVGA 3D",
"features": [ "disable_desktopgl", "disable_d3d9", "disable_d3d11" ]
}
Change-Id: I196f6b44d7bb9e42ef47f61f4c28d8aa79afb7c4
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
This is used by the scene graph to automatically switch over from distance
field text to native text rendering for the given glyph node, which allows
mixing regular text with Emoji in e.g. a Text item without having to set
renderType to Text.NativeRendering.
Change-Id: I5d96d1dab329a975e3442284bf4c5a82174177c9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Merely filling with Qt::transparent is not enough, as the default blend
mode of QPainter is QPainter::CompositionMode_SourceOver, where the alpha
of the source is used to blend the pixel on top of the destination. The
destination in the case of an FBO may contain garbage, and we end up with
the same garbage as the alpha is 0.
This was evident when running the ellipses and porter_duff/porter_duff2
tests on OS X. These tests can now be un-blacklisted.
Change-Id: I315fa764fa29fb3a06e38945a738a6feadf4502d
Reviewed-by: aavit <eirik.aavitsland@theqtcompany.com>
Overload QPlatformWindow::format() to return the desired format
defined in the QWindow. This is required for windows that define
specific surface formats (such as those used in Qt3d which require
a depth buffer).
This is similar to what is done in the OS X Cocoa QPA plugin.
Change-Id: I7661a2a9c4e13603d03d3a5be10d000f73c712e6
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
warning C4100: 'name' : unreferenced formal parameter
This is despite the new Q_ASSERT "using" its expression even in release
mode.
Change-Id: Ieebfc4ab72a6493eaa68ffff13ead0574dd78627
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Instantiate QLibrary once and use member functions instead of using
the static functions which instantiate QLibrary in each call.
Strip suffix from file name.
Task-number: QTBUG-46710
Change-Id: Ia6ec5542e1104ea9024961dda202e6f22bcf5b69
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
The test tried to position the mouse cursor over item #0 . This
sometimes results in the cursor being outside the window when
the window manager adds the window decoration on X11.
Move the cursor to the center of the window instead.
Add cleanup slot checking top level leaks, remove empty
functions.
Change-Id: I908240e1cc3fdbe370b43eae0015272ca342a312
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
If we have a filter applied that removes all entries, the source
model is sorted, and then we remove the filter, QSortFilterProxyModel
never emits rowsInserted. This is because it doesn't have the correct
source mapping and doesn't update when the filter is removed.
Change-Id: I447b2d150e509b128d27f4dabc4e081ca4ef037f
Task-number: QTBUG-46282
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
It was obsoleted for quite a while already and we forgot to get rid
of it the last time.
Change-Id: Ib15e71829e80648aa667a6b0af31698460b99cc1
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
The rationale being that the empty string is not a valid path component.
[ChangeLog][QtCore][QDir] QDir::relativeFilePath() now returns "."
instead of an empty string if the given path is the same as the
directory.
Change-Id: Ibcf31904b2ae5edf5639d4c2e5ba234365d347fd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Instead of creating a QList with the keys with one of two statically
known sizes, stream the contents itself. Apart from QDataStream,
this no longer allocates any memory.
Change-Id: I5ed814b186dcaf8cc7dedcc520928aefab01f009
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QPointer is larger than a void*, so holding them in a QList is needlessly
inefficient. Worse, the code could come to depend on the fragile property
of (inefficient) QLists that references to elements therein never are
invalidated.
Change-Id: I3cdd4914658b6fe025ad379007502b4223e126cd
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
QImage is larger than a void*, so holding them in a QList is needlessly
inefficient. Worse, the code could come to depend on the fragile property
of (inefficient) QLists that references to elements therein never are
invalidated.
Change-Id: I153995d691692f7317cab31b95a00d679f31c0af
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
QPixmap is larger than a void*, so holding them in a QList is needlessly
inefficient. Worse, the code could come to depend on the fragile property
of (inefficient) QLists that references to elements therein never are
invalidated.
Change-Id: I82bb9a88e7030e566f39421cd78babcf01bce285
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
... even if they are not (currently) held in Qt containers
(though FileInfo is).
Change-Id: Id14d4af89fed8bcefdbb9b28d11c1c43fccf7190
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
QPainterPath isn't marked movable , so holding them in a QList is needlessly
inefficient. Worse, the code could come to depend on the fragile property
of (inefficient) QLists that references to elements therein never are
invalidated.
Change-Id: Id4dae8037401c52fd57a2274e45399a9b70beb69
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
QPointer is larger than a void*, so holding them in a QList is needlessly
inefficient. Worse, the code could come to depend on the fragile property
of (inefficient) QLists that references to elements therein never are
invalidated.
Change-Id: I52e83a26eda06fb9826e9c4773a7a0b84b0f59c7
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Holding a mutable item in a QSet violates QSet invariants, namely that in
bucket N, all items have hash % size == N. If a value gets reset to
nullptr by external means, that invariant no longer holds. The code works
by pure luck.
Replace the set with a vector, which doesn't care whether elements change
under the hood, and will also outperform the typical QSet use due to
better locality of reference.
Change-Id: Ied7940e82525fd0da9f74dfb0bc36a320b45d172
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Use translator::load(QLocale(), ...) which loads the a translation mapping
the users preferred languages, instead of just hardcoding one. This is
arguably the more common (and interesting) case.
Also, QPushButton::tr() does place the string in the "QPushButton"
namespace, which is just wrong (TM).
Change-Id: Id22851556b3f876da3b756b452811e07fc7b173e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
The documentation (correctly) states that the first item in the list
is the most preferred one. Anyhow, then it doesn't make much sense to
list "en_US" after "en".
Change-Id: Ib88e5c97d4329b444d1cb49eeb49eaed2ddedad3
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>