Remove the inheritance hack used in
QDirIterator to gain access to QDir's
d-pointer by simply making QDirIterator
a friend of QDir.
This allows to turn QDir into a final class.
Change-Id: I97efef8714bb194d62b9fe5192ce240a90f2bf97
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QString and QVariant are about to be marked
Q_DECL_FINAL_CLASS, so change inheritance to
composition.
At least this was private inheritance...
Change-Id: I43caaa6c03041b8f0bd0f7987ddb4c6ff8309e50
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QSharedPointer isn't meant to be used as a
base class.
Instead of inheriting from it to add implicit
conversions to and from QNetworkReply*, make
QNetworkReplyPtr a typedef, overload two
oft-used functions to take a QNetworkReplyPtr
in addition to QNetworkReply*, and otherwise
make the conversions explicit.
Change-Id: I1eff1793a19f2d5bad1cce8de74c0786675a50f3
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
QMap used to use a skiplist in Qt 4.x, which has variable
sized nodes and we can thus not optimise using custom
allocators.
The rewrite now uses a red-black tree, and all allocations
and tree operations happen in the cpp file. This will allow
us to introduce custom allocation schemes in later versions
of Qt.
Added some more tests and a benchmark. Memory consumption
of the new QMap implementation is pretty much the same as before.
Performance of insertion and lookup has increased by 10-30%. iteration
is slower, but still extremely fast and should not matter compared
to the work usually done when iterating.
Change-Id: I8796c0e4b207d01111e2ead7ae55afb464dd88f5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Implement QPointer in terms of QPointerBase,
a non-template roughly the same as
QPointer<QObject>, to reduce the amount of
template code being generated.
Also mark QPointer as movable, fake an
isNull() for qdoc, and remove qpointer.h's
content from QT_NO_QOBJECT builds (some
indirect include hits the missing
QWeakPointer(QObject*) constructor when
bootstrapping; worked before b/c QPointer
is a template; QPointerBase isn't, though).
Change-Id: I657826601f570f954d80b84bb0334dd3a7452859
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: I7903d9664d52c6afeff800a95062c983a49703c6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Sean Harmer <sh@theharmers.co.uk>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
The const version should be enough.
Change-Id: Ia9cfa484f070e318c76f03df8d8220217a7100c2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
We are running out of type ids for built-in types, 255 is not enough.
QMetaType already contains about ~70 types, situation is maybe not
tragic now, but there is a great chance that we will want to add more
built-in types from different modules like jsondb or declarative. Then
it might be tight, because we are not allowed to reorganize type ids
(it would be a binary incompatible change).
This change was not possible up to now. Old moc generated code assumes
that type id can be safely stored in 8 bits.
This is source compatible change.
Change-Id: Iec600adf6b6196a9f3f06ca6d865911084390cc2
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Since change 2e4d8f67a8 the need for Map and Unmap events has
gone away, as now the Expose event is used to notify the application
about when it can start rendering.
The Map and Unmap events weren't really used except by QWidget to set
the WA_Mapped flag, which we now set based on the expose / unexpose.
Also guarantee that a Resize event is always sent before the first
Expose, by re-introducing an asynchronous expose event handler. Since
an expose is required before rendering to a QWindow, show a warning if
QOpenGLContext::swapBuffers() or QBackingStore::flush() if called on a
window that has not received its first expose.
Change-Id: Ia6b609aa275d5b463b5011a96f2fd9bbe52e9bc4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
As it is a static library, it is also necessary to link to
QtPrintSupport when using QtPlatformSupport.
Change-Id: Id7ed458e5a7a0f6199d76b12f979faabb51d0f87
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
For Qt5 we no longer want to support the older revisions due to the
dual codepaths that must be maintained, and because the format of the
meta-object data is quite different in revision 7.
The dual codepaths have been replaced by asserts that indicate the
revision in which the feature was introduced, and the older-revision
fallbacks have been removed.
It's not possible to build code generated by moc that has
revision <= 6 with Qt5 because the type of the
QMetaObject::stringdata member changed from const char * to const
QByteArrayData *. For the same reason it's not possible to build a
dynamic meta-object generator targeting revision <= 6 with Qt5.
Hence, too old meta-objects will be caught at compile time, and the
code will have to be ported to generate revision 7 (e.g., by running
Qt5's moc on the original class declaration).
Change-Id: I33f05878a2d3ee3de53fc7009f7a367f55c25e36
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
QMetaMethod::typeName() is documented to return an empty string if
the return type is void. But after the introduction of
QMetaType::UnknownType (where void was made a distinct type),
returning an empty string causes the idiom
QMetaType::type(method.typeName())
to break; the result will be QMetaType::UnknownType rather than
the expected QMetaType::Void for methods that return void.
New code should use the new function QMetaMethod::returnType()
instead, but it would be good if existing code still did the right
thing.
The consequence of returning "void" instead of an empty string is
that it breaks existing logic that uses the typeName() length to
determine whether a method returns void. But we judge this as the
lesser of the two evils; it's better to have a typeName() function
that is consistent and keeps the QMetaType::type(method.typeName())
idiom working, than to force the typeName() inconsistency for void
only to keep code that does "strlen(method.typeName()) == 0"
working.
The places in Qt that were relying on a zero-length typeName()
(testlib, dbus, declarative) have already been changed to use
returnType().
Also adapt QMetaObjectBuilder, which is internal API.
Change-Id: I70249174029811c5b5d2a08c24b6db33b3723d19
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Since the introduction of QMetaType::UnknownType, void is a proper
meta-type, and the normalized form of "void" should be "void", not
an empty string.
Add more tests to ensure that we do remove "void" in the one case
where it actually should be removed (e.g. "foo(void)").
Change-Id: I72dc2d24da67cf52da00c678f50213cff1b92e25
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Use QMetaMethod::name() instead of parsing the signature.
Use QMetaMethod::returnType() instead of checking the length of
typeName().
Use QMetaMethod::parameterCount() instead of checking the
size of parameterTypes().
Change-Id: I424370b19b5b150865377666dca0fba5f29ad30f
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
This actually involved tiding up QObject sources a little bit
to clearly separate QString / QRegExp overloads of findChildren.
The corresponding qFindChildren overload for MSVC 6 compatibiltiy
was *not* added.
Change-Id: I84826b3df9275a9bda03608a5b66756890eda6f8
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
QVariant handlers can not be unregistered. We are not able to guarantee
that such operation is safe and we do not want to.
Change-Id: Id9a12e6a8c750110e4a08eab1de3e07e5c408675
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This add a bool as return value on QCoreApplication::installTranslator
and QCoreApplication::removeTranslator. It returns true on success.
Before it was very clumsy to detected this. It was needed to react
on the signal and mark a success - just to provide an error message
on failure.
This is 99.99% source compatible - only if someone grabs a function
pointer to this - it will break the code - but it seems to be very
theoretic.
Change-Id: I947fcee1352f530e559bb177a90c10d84eed1aec
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This patch changes invalid QVariant qDebug stream value from
"QVariant(, QVariant::Invalid)" to "QVariant(Invalid)"
New tests were added.
Change-Id: Ia57d4fc2d775cc9fce28e03eba402c2173845b35
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Use QMetaMethod::name() instead of parsing the signature.
Use QMetaMethod::returnType() instead of resolving the type id
via the type name.
Change-Id: If5d0198c5f1329fd9d9340acd58bd4a36933d960
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Make QJsonValue, QJsonObject, QJsonArray and QJsonDocument
first-class meta-types.
This is an enabler for a lightweight integration with QML.
Change-Id: I4725efdd2746cf97fd26d3632a99e8eee849f834
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
The view will query the delegate for roles which are relevant to
the particular delegate. For unrelated roles, the delegate
will not have to repaint when the data changes.
Change-Id: If8f1ba4c2bce7dbcf70de344b984aea1deca0edd
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: David Faure <faure@kde.org>
The virtual method will be used to implement
the patch at http://codereview.qt-project.org/#change,11763
Change-Id: I6d6ffbb8aaaba73e5c769f3435cc60323c77b75a
Reviewed-by: Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
In Qt 5.1, http://codereview.qt-project.org/#change,19113 can be rebased
on top of this change in a compatible way.
Change-Id: If7ac0481a3b2a874528de4ef6ea7535501a4ac71
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Clear all the Q3* items away,
expect QStyle::SH_Q3ListViewExpand_SelectMouseType which is still used
by QTreeView. So simply removed Q3 from its name.
Change-Id: Ia79f0283137b6751ba68791ae55df1d8bd7ea74a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This will allow separation of API that should work with QString
results, and API that should work with QByteArray results.
Change-Id: I5be398188abd421bb5056cea2658ea85fc03aa4f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Remove some "safety" code, but essentially it was a dead code.
Change-Id: Ie19c29d4cce8b72be5dbaca53c03adc63e8c3dc5
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Without this, QMAKE_RPATHDIR is empty and qt_module.prf's logic to turn
on absolute_library_soname fails, causing some modules to build without
absolute paths (eg. qtjsbackend's QtV8 framework).
Change-Id: If03136ca60a5d8a96a589e2d1034e5884fd6a1ac
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
- Changed benchmarks to use TESTDATA and QFINDTESTDATA
- Fixed up targets all use tst_bench_ syntax
Change-Id: I5c2936702e248478f5df225ce38893158ee22d7f
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Also make the handling of events in the test pointer
based since mac-g++ doesn't seem to like const
references the way they were before.
Change-Id: I7fe39978d4729b8e586be30978b74aa51ca7cfe6
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
These were not covered at all by tst_qmetatype.
Change-Id: Ic957470ac78b2c15fe449efe17e1f178a41c3690
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
When cross-compiling, the qreal type can be different on the target
than on the host (e.g. double on host, and float on target). moc is
a host binary, so it shouldn't try to resolve the type id of qreal,
but instead always output "QMetaType::QReal" (which is just an alias
for QMetaType::Double or QMetaType::Float, depending on the target).
This was a regression introduced in commit
f95181c7bb (new meta-object format);
the special-casing for qreal should have been kept.
Moved the code that generates the type info into its own function so
the logic is shared by generateFunctions() and generateProperties().
Change-Id: I2b76cf063a08ba95a7e6033549452355f67283ac
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Makes no sense to disable iconv based on QPA. This change will
make iconv as the "system" codec i.e the codec used for 8-bit
locale dependent conversions.
Change-Id: I4469e9c226b2411ac1338f61dabb84ec9c2ec603
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Cocoa sends function keys (e.g. arrow keys, backspace, F1-F35, etc.) as
Unicode characters in the U+F700-U+F8FF range. Do not deliver text for
events that contain a single control character (to match Qt 4 behavior).
With this fix, keyboard navigation works again in Qt Creator when
running against Qt 5.
Change-Id: I5854bf713c2855dbc5ee491bace2f9dc1acd9426
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
KeyPress events could be shortcuts or deadkeys, but we don't know which
until we try. Shortcuts take precedence over deadkeys, so send them
through QWindowSystemInterface::tryHandleSynchronousShortcutEvent()
before passing it onto the input method.
Change-Id: I479a3a7ff1c35e7c5692e8a17fb2173576dd0a29
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@nokia.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
This involves invoking the Moc classes directly and using the data
structures it provides instead of invoking the moc exectutable and
parsing the generated code.
Change-Id: Ia5c654e8ef58d52d0d3376252c13e13885f80da3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is the pristine version from qttools at
a0e2b3e96be934438974b175d0e640ed30f4efcb.
Change-Id: I38eafde3f4b909bb63988f855672a908cae41d2c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is the pristine version from qttools at
a0e2b3e96be934438974b175d0e640ed30f4efcb.
Change-Id: I4dc7c7fd98637cecfc57a9be61063d351b660e72
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>