Commit Graph

5556 Commits

Author SHA1 Message Date
Kent Hansen
22d621dd99 QMetaMethod::typeName() should return "void" if the return type is void
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>
2012-03-21 18:55:51 +01:00
Kent Hansen
b8d71ed60b Fix QMetaObject::normalizedType() for "void" argument
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>
2012-03-21 18:55:27 +01:00
Kent Hansen
e2502e1a06 Use the new QMetaMethod API in testlib
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>
2012-03-21 13:38:03 +01:00
Debao Zhang
d4258bc238 QLatin1String: Suppress MSVC warnning.
Change-Id: I61ab71549799a5af8cce85e334245642a266c3c8
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-03-21 11:52:34 +01:00
Giuseppe D'Angelo
cb32450c47 QRegularExpression: add QObject::findChildren overload
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>
2012-03-21 11:43:38 +01:00
Giuseppe D'Angelo
8659495202 QRegularExpression: support for QStringList overloads
Change-Id: Ia9017348742e41187684185d04b56d27edd383b5
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-21 11:43:30 +01:00
Jason McDonald
054b69c963 testlib: Remove obsolete internal compare_helper overload.
Change-Id: Ic98faf360a713ac698f9bf1ff8aaad5a4c5c176b
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-21 11:43:23 +01:00
Jędrzej Nowacki
bfd2b30faf Crash fix in ~QVariant
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>
2012-03-21 11:43:14 +01:00
Thorbjørn Lund Martsum
a4a61bb3ef QCoreApplication - add return type bool on install/remove translator
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>
2012-03-21 11:02:46 +01:00
Jędrzej Nowacki
37b0a8e7e6 Fix qDebug stream for an invalid QVariant.
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>
2012-03-21 06:55:33 +01:00
João Abecasis
c236842241 Use clang's builtin is_enum, if available
Change-Id: Ie0c32b8fd6d3bb02cf6c6b626bb31d57cdcdf497
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Glenn Watson <glenn.watson@nokia.com>
2012-03-21 01:18:22 +01:00
Kent Hansen
3e1e0b41a8 Use the new QMetaMethod API in QtDBus
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>
2012-03-20 22:23:13 +01:00
Kent Hansen
83e055424a Add QtJson types to meta-type system
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>
2012-03-20 22:22:41 +01:00
Stephen Kelly
8727db0dad Fix cross-compilation of qdbus bootstrapped tools.
Change-Id: Ib40fc1c1743ff23a259cabbf26d91956398c3239
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2012-03-20 22:20:25 +01:00
Stephen Kelly
fbdf76771c Reserve a virtual method for use with a feature in Qt 5.1.
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>
2012-03-20 22:20:13 +01:00
Stephen Kelly
8687cf1f99 Forward declare QMetaObject as a struct.
Fixes compiler warnings with clang and others.

Change-Id: I726d4c10644287bb642c8b5dd28172afe8c4d1ea
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-20 19:20:02 +01:00
Stephen Kelly
0042b5f0f2 Reserve the virtual viewportSizeHint method in QAbstractScrollArea.
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>
2012-03-20 19:09:27 +01:00
Stephen Kelly
afa50b1478 Add API and reserve space for storing the QMetaObject with the QMetaType.
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>
2012-03-20 16:03:57 +01:00
Stephen Kelly
105a7fccc4 Generate a forwarding header for QStringBuilder.
This should fix the declarative build.

Change-Id: I32dd5b7783995759f27d016c801ae6dfb3d44733
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-03-20 11:43:52 +01:00
Debao Zhang
e7adaed529 QtWidgets: Cleanup Q3* items
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>
2012-03-20 08:53:39 +01:00
Stephen Kelly
84ef7704a8 Add a base class with specialization to QStringBuilder.
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>
2012-03-19 15:53:23 +01:00
Stephen Kelly
3ca168d6fe Fix up the QEventLoopLocker documentation.
Change-Id: If5bf8c2703f094023a614b3efcbd8489560694d9
Reviewed-by: Richard J. Moore <rich@kde.org>
2012-03-19 14:04:24 +01:00
Jędrzej Nowacki
39e0063193 Remove a dead code from QVariant.
Remove some "safety" code, but essentially it was a dead code.

Change-Id: Ie19c29d4cce8b72be5dbaca53c03adc63e8c3dc5
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-03-19 12:17:33 +01:00
Kent Hansen
95d6f8a4cf Merge master into api_changes
Conflicts:
	src/corelib/tools/qvector.h
	tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp

Change-Id: I877256e95f3788e617437f4e9661a88047f38cd6
2012-03-19 10:03:48 +01:00
Lincoln Ramsay
25e004bfe4 Set RPATH_FLAGS on Mac too
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>
2012-03-19 04:46:15 +01:00
Kurt Korbatits
0f929bfa9a Fixed benchmarks to work from install directory
- 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>
2012-03-19 01:18:20 +01:00
Frederik Gladhorn
36513264da Make copy and assign private for QAccessibleEvent.
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>
2012-03-18 21:42:38 +01:00
Kent Hansen
3f64a7b67b Add autotests for QMetaType::load() and save()
These were not covered at all by tst_qmetatype.

Change-Id: Ic957470ac78b2c15fe449efe17e1f178a41c3690
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-03-18 21:06:57 +01:00
Kent Hansen
66ec281ba2 Ensure that moc doesn't resolve the qreal meta-type id
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>
2012-03-18 21:05:59 +01:00
Girish Ramakrishnan
73b42378e7 configure: Fix iconv detection
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>
2012-03-18 19:26:33 +01:00
Bradley T. Hughes
4dbce2a469 Cocoa: Fix function key handling
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>
2012-03-18 16:09:31 +01:00
Bradley T. Hughes
60c59b5cf5 Fix shortcut handling in the Cocoa plugin
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>
2012-03-18 16:09:23 +01:00
Stephen Kelly
b20cbf7102 Move CMake macros and tests for dbus tools from qttools.
Change-Id: I9d589a2d33eb8fcac63443565bb3e2319be3e04f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-18 14:14:57 +01:00
Stephen Kelly
72367b1679 Bootstrap qdbuscpp2xml.
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>
2012-03-18 14:14:42 +01:00
Stephen Kelly
0054505510 Add qdbuscpp2xml.
This is the pristine version from qttools at
a0e2b3e96be934438974b175d0e640ed30f4efcb.

Change-Id: I38eafde3f4b909bb63988f855672a908cae41d2c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-18 14:14:30 +01:00
Stephen Kelly
2f534e4423 Bootstrap qdbusxml2cpp
Change-Id: I06856b169d5ee4f99fcf9c87ce88cb5ac34568e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-18 14:14:19 +01:00
Stephen Kelly
2031c822f5 Add qdbusxml2cpp.
This is the pristine version from qttools at
a0e2b3e96be934438974b175d0e640ed30f4efcb.

Change-Id: I4dc7c7fd98637cecfc57a9be61063d351b660e72
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-18 14:14:04 +01:00
Marius Storm-Olsen
fbc251b364 Win32: Compile qmake when shadow-building
Change-Id: I803c733f744372701c51e4d629ff797c6648f833
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-03-18 12:36:48 +01:00
Jędrzej Nowacki
5e497111db Add new test cases to tst_QMetaType.
Change-Id: I405ab5df9d9de3a0a0a71276b172a27ee01392e3
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-03-18 12:35:09 +01:00
Debao Zhang
78e0ab3342 QPointer: update its document and changes-5.0.0
QPointer has been un-deprecated and one behavior which slightly different
from Qt4 has been fixed.
see SHA: b8773165d7
and SHA: 497622cafe

Change-Id: I4bae2cce3ebfebd8f59b18b5a6a7a7226b8353b9
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
2012-03-18 03:55:07 +01:00
Bradley T. Hughes
7b26a2cf2e Add QWindowSystemInterface::tryHandleSynchronousShortcutEvent()
This function sends a shortcut override through the shortcut system and
returns the result of the event. This will be used in platform plugins
(such as the Cocoa plugin) to make sure that shortcuts work when the
user presses a dead-key combination that normally would go through an
input method to produce text.

An extended overload taking native scan code, virtual key, and modifiers
has also been added.

Change-Id: Ia3836229ab0c66d2fb6f310e72b6f4d6dfa9ead9
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
2012-03-17 20:33:34 +01:00
Stephen Kelly
bcf842e04c Include geometric variants when bootstrapping.
They are needed by the qdbus tools.

Change-Id: Ia1994f6a9bfa2ce1d526fd3e49370fd188ce5972
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-17 18:21:00 +01:00
Marius Storm-Olsen
1711bab719 Add support for ICU on Windows
Needed by QtWebKit now.

Change-Id: I177d8dcf6063a14501f7ba3081b43a29a48661c7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-17 17:54:59 +01:00
Lincoln Ramsay
7f67d0810e Don't reject plugins that have empty meta-data
Having an empty Json object ({}) should be valid meta-data but this
check means that there needs to be at least one key-value pair or
the plugin will be rejected.

Change-Id: I578ccc35016af16fd30b3807e796fa63c0282f30
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-17 17:53:00 +01:00
Olivier Goffart
09348c3efb Compile QLatin1String with C++11
qstring.h: In constructor ‘QLatin1String::QLatin1String(const QByteArray&)’:
qstring.h:667:129: error: ‘const char* QByteArray::constData() const’ is not ‘constexpr’

QByteArray has a destructor and therefore cannot be used in constexpr,
so do not mark it as constexpr

Change-Id: I037e9ae73a244660923eac791cc3e0082d1d7a63
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-17 11:17:58 +01:00
Marc Mutz
d823646db3 containers: add C++11-style c{begin,end}() as alias for const{Begin,End}()
C++11 adds cbegin()/cend() functions for the same reason Qt has
constBegin()/constEnd(). This patch adds these functions to the
Qt containers with the same implementation as constBegin()/constEnd().

It also fixes the return types in the documentation of existing
constFind() functions (documentation only).

C++11 only adds cbegin()/cend() (and crbegin()/crend(), which Qt doesn't have).
In particular, it doesn't add cfind(), so I didn't supply these, even though
Qt comes with constFind().

This is a forward-port of https://qt.gitorious.org/qt/qt/merge_requests/1365.

Change-Id: Ida086b64246b24e25254eafbcb06c8e33388502b
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-03-17 09:10:57 +01:00
Bradley T. Hughes
7c7e47493e Replace Q_WS_MAC with Q_OS_MAC in qshortcut.cpp
This re-enables shortcut context matching for menubar actions.

Change-Id: I0d9f2b3d4316a4611afe96eb1a2cf29cb9e91851
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
2012-03-17 07:06:44 +01:00
Morten Johan Sorvig
b6bce2dd75 QCocoaClipboard: Make QClipboard::clear() clear.
Change-Id: Ifb235d015f7831b335a9c3db92515a8d1cd49311
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-03-17 07:06:42 +01:00
Arnt Witteveen
437da962c2 Fix bug showing folder icons for files
Fix an issue where the cache was updated with the folder icon,
even though this is never used from the cache. This caused
files to sometimes be shown with a folder icon: If a folder
has an extension (e.g. a folder named 'folder.ext'), this
means the folder icon will be written to the cache for the
'ext' extension, and from that point on all .ext files will
be shown with the folder icon.

The fix is to not save an icon in the cache for those cases
where it will not be used from the cache anyway, by using the
same condition for updating the cache as for reading it (which
is in line 8 of the same function).

Change-Id: I9ce8fca0718b2b62b9390fa64989acd54952a88e
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-03-17 01:52:17 +01:00
Martin Smith
c227546d2e qdoc: Structure the DITA map with a root node.
Use the title from the index.html page for the
navtitle, if there is a title on the index.html
page. Otherwise use the project as the navtitle.

Task-number:  Mzilla bug - 7229
Change-Id: I25fc1f09b0bdff58c6340cec7d9d8a43d95845a2
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
2012-03-17 01:52:12 +01:00