Commit Graph

121 Commits

Author SHA1 Message Date
Bradley T. Hughes
3f74aea9bb Fix tst_QSocketNotifier on Mac OS X
Socket notifier behavior is very OS-dependent. QtNetwork uses non-
immediately (it will return -1 w/ errno=EINPROGRESS). We have to wait
with select(2) to indicate that the connection is ready, then call
connect(2) again. When this happens, we need another call to select(2)
to get notification on the listening socket so that we can call
accept(2) to complete the connection.

The mixingWithTimers() failure happens due to the test expecting a
single processEvents() call to be able to completely connect a TCP
socket. But as described above, this may not happen. The test should
QTRY_COMPARE() to give the test a chance to let all this happen.

The posixSockets() test can fail due to the same connect() behavior. The
test already has a comment about the write notifier behavior being very
OS dependent. This caused the first enterLoop() to return too early,
before the read notifier fired (which is what the test is checking for,
that the read notifier fired). Move creation of the write notifier to
where we expect it to fire, just before writing to the posix socket.

In the same test, the read notifier inside QTcpSocket may not fire after
the write notifier on the posix socket. Use the waitForReadyRead()
function to give the socket a chance to read the data written to the
posix socket.

Change-Id: I541e6ee9a39a92ce3acf6b9ffee51079febe43e4
Reviewed-by: Jonas Gastal <jgastal@profusion.mobi>
Reviewed-by: Shane Kearns <ext-shane.2.kearns@nokia.com>
2012-02-13 22:16:17 +01:00
Bradley T. Hughes
8f8e3db6ae Test posted events in tst_QEventDispatcher with various flags
Add QEventLoop::ProcessEventsFlags test data for
tst_QEventDispatcher::sendPostedEvents() to test that posted events are
sent when waiting for events and when not waiting.

Change-Id: I99f9eb121d0b1ded725e19c5233922fc0a6b81e4
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
2012-02-10 15:22:11 +01:00
Bradley T. Hughes
358c14821b Run tst_QEventDispatcher with the GUI event dispatchers as well
Since some GUI event dispatchers are complete reimplementations and do
not build on the corelib ones, we want to run the same tests with the
other dispatcher.

Since this is a GUI test now, we need to make sure to drain system
events queued during application startup to make sure we can reliably
run the test functions.

Change-Id: I4905db70bc8f8584c4ef1f4d767824040281452c
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
2012-02-10 15:22:03 +01:00
Bradley T. Hughes
c50f026a22 Add tst_QEventDispatcher to tests/auto/corelib/kernel
This will test the event dispatcher in corelib for proper timer and
posted event handling. The test makes sure all of the necessary virtual
functions are implemented and working as expected.

This test doesn't test socket notifiers or Win32 event notifiers, as
these are already covered in existing tests.

Change-Id: I5540ffc4e6d7f97bcd6c3725d7e74c0ab9c97015
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
2012-02-10 15:21:55 +01:00
Olivier Goffart
482d96a0c5 Force -fPIE on ELF if Qt is built with reduced relocations
Put in qconfig.h whether qt is compiled with reduced relocations.

When using -Bsymbolic-functions (enabled by default on Qt)
but not -fPIE, the comparison of the function pointers fail
because the addresses are different in Qt, and in the executable.

Hence we now enable -fPIE by default on qmake, and force a compilation
error when it is not enabled and built with reduced relocations.

Done-with: Sune Vuorela <sune@vuorela.dk>
Change-Id: Ib3fdba06fab6e8a93b75b4c6cf16cc973ab335db
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-02-10 11:42:31 +01:00
Miikka Heikkinen
581f079b04 Make "nmake check" pass for corelib tests in Windows.
- Marked four tests insignificant due to failures, these need to be
  fixed later and then re-enabled:
  - tst_qfilesystemwatcher
  - tst_qsettings
  - tst_qlibrary
  - tst_qsharedpointer
- Skipped one invalid case (tst_QCoreApplication::argc())
- Ifdeffed around vsprintf issue in MSVC (tst_QByteArray::qvsnprintf())

Task-number: QTBUG-24157
Task-number: QTBUG-24146
Task-number: QTBUG-24128
Change-Id: I4db957a65fbf0093f5ae3dc1a04d792492818104
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
2012-02-09 12:52:28 +01:00
Rohan McGovern
adfca27ac0 Fixed tst_qobject::property for clang
The test was failing at:

  QCOMPARE(property.userType(), qMetaTypeId<CustomType*>());

The CustomType* metatype was not registered before this part of the
test.

qMetaTypeId<T> will register the metatype for T before returning it if
it is not yet registered, while QMetaProperty::userType() returns 0 if
the metatype is not yet registered.  However, the order of evaluation of
these two expressions in the above statement is technically undefined.

Apparently, gcc evaluates the arguments in order from right to left,
allowing the test to pass, while clang evaluates the arguments in order
from left to right, causing the test to fail.

Change-Id: I5059556e860cec29b57c31e4e26f46cf9e6055da
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-02-09 10:45:38 +01:00
João Abecasis
0c97840708 Introduce Q_DECLARE_OPAQUE_POINTER
To hide the IsPointerToTypeDerivedFromQObject monstruosity :-)

Documentation for Q_DECLARE_METATYPE and qRegisterMetaType was updated
to mention requirements on registered types and how they can be
circumvented for pointer types with the new macro.

Change-Id: If83b037a8e2f28761eb903525e87008107298801
Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-02-09 00:32:41 +01:00
Stephen Kelly
ae85d7c965 Treat pointers to QObject derived types in QVariant specially.
It is possible to do this for example:

QVariant v = QVariant::fromValue<MyCustomQObject*>();
QObject *object = v.value<QObject*>();

This means that if a QVariant contains a pointer to a QObject
derived type, third parties can extract a QObject* and use its
properties without knowing the concrete type.

This is a source compatible change.

Change-Id: Iee9a9437e99cc2f40d1a4bfea47275482ef7161f
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-02-08 14:43:18 +01:00
Andrew den Exter
979cb5a09e Initialize dynamic meta object extradata.
QMetaObject::invokeMethod attempts to deference the extradata for
meta objects versions 6 and greater which is causing a crash in some
of the qtquick1 tests.

Change-Id: If5b2ca83b15de2cd558976c6b681dd5457c404d1
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2012-02-08 09:53:23 +01:00
João Abecasis
5a92dd6124 Detect incompatibilities in repeated type registration
QMetaType used to register a typeName and factory functions for
creation/destruction of objects. While it would be possible for a single
type name to be registered matching different actual types and memory
layouts, there was little that could be done about it.

Now that QMetaType is tracking type information with a direct impact on
data layout and ABI (size and type flags) it is important that we check
and detect binary incompatibilities as early as possible.

[Such incompatibilities could arise from type name re-use (technically,
ODR violations) or, more commonly, as version mismatch between different
shared libraries or plugins.]

Only type size and flags are checked as function pointers to inline and
template or otherwise non-exported functions could trivially differ
across translation units and shared libraries.

When registering typedef types, a check is made to ensure the same name
doesn't get registered as different types.

Change-Id: I8211c3de75d4854ce8fafdb620d3a931c206e0c3
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2012-02-07 09:47:51 +01:00
Jędrzej Nowacki
b8cf1d6bdc Remove QMetaType::unregisterType().
The function hasn't been working properly. It was not well tested, for
example it is undefined how QVariant should behave if it contains an
instance of an unregistered type.

Concept of unregistering types was inspired by plug-in system, but in
most supported platforms we do not unload plug-ins.

Idea of type unregistering may block optimizations in meta object
system, because it would be not possible to cache a type id.
QMetaType::type() could return different ids for the same name.

Currently QMetaType::unregisterType() is not used in Qt.

Change-Id: I878b6e8d91de99f9bcefeab73af2e2ba0bd0cba0
Reviewed-by: Prasanth Ullattil <prasanth.ullattil@nokia.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2012-02-07 08:53:18 +01:00
Jędrzej Nowacki
56265031b7 Align QVariant::UserType and QMetaType::User
There is no point in keeping separate values which should mean the
same.

QVariant::UserType was used also to construct a valid, null QVariant,
containing an instance of unknown custom type. The concept was strange
and useless as there was no operation that could be done on such
QVariant. Therefore it was dropped.

Please note that the patch slightly changes behavior of different
functions accepting a type id as parameter. Before QVariant::UserType
was an invalid type from QMetaType perspective (id 127 was not assigned
to any built-in type), but QMetaType::User points to the first registered
custom type.

Change-Id: I5c7d541a9affdcdacf53a4eda2272bdafaa87b71
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Andrew Stanley-Jones <andrew.stanley-jones@nokia.com>
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
2012-02-07 08:52:32 +01:00
Kent Hansen
b184dd0a01 Bring qmetaobjectbuilder in sync with moc
qmetaobjectbuilder should generate meta-objects of the same version
as moc; in the future, when the moc version is bumped, QMOB has to
be adapted at the same time.

QMOB was generating version 4 meta-objects. This patch makes it
generate version 6 (the current version). This also fixes a bug with
using qt_static_metacall with QMOB (setStaticMetacallFunction()); it
was already using the version 6 qt_static_metacall signature, which
isn't compatible with version 4.

Also add tests that ensure that the QMOB-generated meta-object works
with real objects; in particular we want to test the codepaths in Qt
that check for version >= 4.

Change-Id: I64a151ea5c947a6f8b7a00e85a39866446c735e9
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-02-03 15:09:03 +01:00
Stephen Kelly
a512e210ac Add the event loop quitlock feature to QtCore.
A feature of a ref-counted quit (managed by a quit-lock class)
is added to both QEventLoop and QCoreApplication.

This allows, for example, an event loop to quit() when there is
no more work for it to do.

quitOnLastWindowClosed is implemented in terms of the refcount in
QCoreApplication so that jobs can be completed before the
application quits.

Change-Id: I14c8f4e7ee12bbf81a6e5849290d4c8ff37fa110
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-01-31 23:22:15 +01:00
João Abecasis
2bf186a2e5 Allow function types to be registered without workarounds
Commit 4b8ceb41ae added the requirement
that pointed-to types need to be registered when registering pointer
types. Unfortunately, the implementation also affects function pointer
types.

This change whitelists 0, 1, 2 and 3 argument functions as not deriving
from QObject, forgoing the need to workaround details of the type
registration implementation when registering those function pointer
types.

Change-Id: I4d855e9d70a8179a6e31b84623ad5bf063e0d6d8
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-01-31 16:17:55 +01:00
Lars Knoll
3855233dab Remove many deprecated methods
Remove methods that have been marked as deprecated
before Qt 4.6. Keep others, but inline them
where possible and mark them as QT_DEPRECATED_SINCE(5, 0).

Change-Id: If881821ae095f054b31cc13464f19e2007c20ed7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-01-31 16:17:55 +01:00
Kent Hansen
283140742a Remove type id/name conversion for QVariant::UserType
QVariant::UserType does not correspond to an actual type named
"UserType". This logic didn't make sense.

Change-Id: I369911e514f7902fc863cb05174011d6fc15c447
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Jonas Gastal <jgastal@profusion.mobi>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-01-30 16:40:19 +01:00
Jason McDonald
5635823e17 Remove "All rights reserved" line from license headers.
As in the past, to avoid rewriting various autotests that contain
line-number information, an extra blank line has been inserted at the
end of the license text to ensure that this commit does not change the
total number of lines in the license header.

Change-Id: I311e001373776812699d6efc045b5f742890c689
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-30 03:54:59 +01:00
Jędrzej Nowacki
d874c059d3 Introduce QTypeInfo::sizeOf.
In QMetaType "void" is a regular type, lack of c++ sizeof operator
force us to write a template specialization for the type.

Change-Id: I9a56e135223b416b8031836d29ef33ef3fb750e4
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-01-29 15:21:16 +01:00
Kent Hansen
36c057787f Get rid of checks for Qt3 types
These types don't exist anymore, so it's pointless to check for them.

Also remove the dead types from uic's type-to-header map.

Change-Id: I7f0af5c337859f3da1c103157a802bbe5372df9f
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Jonas Gastal <jgastal@profusion.mobi>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-01-29 14:34:12 +01:00
Olivier Goffart
889092504e Call connectNotify when connecting with function pointer
Some objects expect connectNotify to be called in order the signal to be
emitted.

Change-Id: Id0460d9c2aef8f9c3618a2b62b2119a790e06f30
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-01-29 12:40:51 +01:00
Stephen Kelly
61e8487e8e Mark the single argument containers as movable.
Change-Id: I1557b9f3c2d3ad805e1ab7bf4d49973f08664a79
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-01-26 13:15:47 +01:00
Stephen Kelly
6b4f8a68c8 Automated metatype definition for template types.
If T is defined as a metatype, then QList<T> is too automatically.

So for example, no need to use

  Q_DECLARE_METATYPE(QList<int>)

anymore.

This is a source compatible change.

Change-Id: I2ee8a7b9e28fe6d4775f6a05cce39aca8563e0c5
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-01-26 13:15:38 +01:00
Jędrzej Nowacki
aee1f6cc41 Cleanup mess in public type ids.
There is no reason to keep two separated core types sets. It
couldn't be fixed before Qt5 because of binary compatibility promise.

This patch merges QMetaType core types with ext core types.

This "simple" operation consists of:
- QDataStream version was incremented, because type ids are
saved in QVariant's data stream.
- QMetaType LastExtCoreType and FirstExtCoreType were replaced by
LastCoreType, FirstCoreType and new QMetaType::HighestInternalId.
- New tests checking QVariant data stream for Qt4 and for Qt5 versions
were added.

Change-Id: I02dd74d29317365c297a789a4eb7c9c5edc3b231
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-01-25 21:08:08 +01:00
Kent Hansen
00c8984b4e moc: Use QMetaType::QVariant as the type for QVariant
QMetaType::QVariant has existed as a proper type for almost two
years, but the qvariant_nameToType function was written in 2006.

Using QMetaType::QVariant means QVariant can be treated just like
any other type. We can get rid of those hacky checks for LastType,
and the remaining checks become more readable.

The fact that QMetaProperty::{type,userType}() returned LastType
(0xffffffff) for QVariants was never documented (LastType itself is
internal). But there are other Qt modules that assume so. I'll fix
the ones I know about (qtdeclarative, qtscript, activeqt).

Change-Id: I799b9079bb8bbb1fe76c132525440b30415cbac5
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-01-25 08:46:40 +01:00
Friedemann Kleint
4fa2d51cf1 tst_qobject: Run as console application.
Change-Id: If3049249cf8ceeb0985d158209e217455bfc3c47
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-01-25 02:24:29 +01:00
Friedemann Kleint
992e50e421 Add autotest for failing signal connection.
Change-Id: Iaae93253fa6d1ca0798d05d69a7ab6d6ff8b60bc
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-01-24 19:12:23 +01:00
Stephen Kelly
4b8ceb41ae Store the is-a QObject fact with the metatype declaration.
This is a source incompatible change for Q_DECLARE_METATYPE(T*),
which now requires T to be fully defined.

The consequences of this are:
 * Forward declared types can no longer be declared as a metatype.
     (though this is a very uncommon thing to do).

There is a trivial workaround where necessary.

Change-Id: Id74c40088b8c0b466fcd7c55abd616f69acc82c8
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-01-24 15:27:25 +01:00
Olivier Goffart
c0323cfbaf Test connecting to virtual function pointer
The C++ standard says that the comparison between pointer to virtual
function is unspecified (C++11 $5.10.2)
But we still may rely on it for the Qt::UniqueConnection and the
disconnection

So test if it works while using the same function.
Using function from different classes works for me, but we should
probably not assume it works. I left it commented in the test for
reference.

Change-Id: I1d9b91d4cc1a424d4f43ef2ee4981b8573f1e86f
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-01-24 01:13:01 +01:00
Jason McDonald
629d6eda5c Update contact information in license headers.
Replace Nokia contact email address with Qt Project website.

Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-23 04:04:33 +01:00
Stephen Kelly
0fd8816340 Add QModelIndex as a built-in metatype.
Change-Id: Ib87cfff8b4baee78189f3df5e20d2e1a00d690e1
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-01-11 19:32:34 +01:00
Jędrzej Nowacki
f85b9f8242 Reimplement QVariant to QDebug streaming.
New implementation fixes some commented code marked as FIXME.

Change-Id: If8f5bebedd65bcf8f839d804c2022ca79ef82ddf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-01-10 09:13:11 +01:00
Jędrzej Nowacki
3d7ce0e96a Add missing subdirectory to kernel.pro file.
QMetaPropery test was not build by CI.

Change-Id: I27407e8df674414c2d74f3aa1e4cbb809969c040
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-01-10 01:25:45 +01:00
Stephen Kelly
9eacf32de9 Move the qitemmodel test to the itemmodels directory.
Change-Id: I67e1008bea0d94ffbc52aad453a29645261e109e
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-01-06 17:21:25 +01:00
Robin Burchell
b08daaedd4 Remove all non-inline of qMalloc/qFree/qRealloc.
We're trying to deprecate these, so don't use them anymore.

The inline uses of these have been left intact, for the moment. Inline code will
need to create their own non-inline allocation methods (for future-proofing to
allow alterations in how e.g. individual containers allocate)

Change-Id: I1071a487c25e95b7bb81a3327b20c5481fb5ed22
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-01-06 14:11:14 +01:00
Jason McDonald
1fdfc2abfe Update copyright year in license headers.
Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-05 06:36:56 +01:00
Denis Dzyubenko
92f9678055 Registered QUuid in the metatype system as a builtin type.
Change-Id: I6be6129d9f6bf468ba8a5805cfa0f6f79199afb3
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Prasanth Ullattil <prasanth.ullattil@nokia.com>
2012-01-05 02:17:04 +01:00
Jędrzej Nowacki
08863b6fda Refactor QVariant handlers.
QVariant implementation is based on delegation to a handler. The handler
has rather simple construction, it is a set of function that implements
a switch statement over known types and redirects calls to a right
method of an encapsulated types instance. Unfortunately after qt
modularization project, it is not easy to use types directly from
different modules, as they can be undefined or completely unaccessible.
Which means that each module has to implement own handler to cooperate
correctly with QVariant. We can suspect that list of modules known to
QVariant will grow and it is not limited to GUI, Widgets and Core,
therefore it would be nice to have an unified, from performance and
source code point of view, way of working with handlers.

This patch is an attempt to cleanup handlers. Keynotes:
- Each handler is working only on types defined in the same module
- Core handler implements handling of primitive types too
- Custom types have an own handler
- Each handler is independent which means that dispatch between handlers
  is done on QVariant level
- Handlers might be registered / unregistered using same interface

Change-Id: Ib096df65e2c4ce464bc7a684aade5af7d1264c24
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-01-04 14:25:25 +01:00
Jason McDonald
fda36df6ba Use true and false in preference to TRUE and FALSE in tests.
Use the C++ boolean constants true and false instead of the C macros
TRUE and FALSE (which are actually integers), and use QVERIFY instead of
QCOMPARE for verifying simple boolean expressions.

Change-Id: Ie76dfcab6722df6b93b3fa62b0f3437901482932
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-03 02:57:12 +01:00
Stephen Kelly
f29e55448b Change the default value of QSortFilterProxyModel::dynamicSortFilter
The value is changed to true. It is a common bug that developers expect
this proxy model to reflect the source model when the source changes.
That requires setDynamicSortFilter(true), so we change the default to
optimize for the common case.

Change-Id: I9bf7efdbda10309fa77aed9391c33054aaae4a29
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-01-02 16:43:02 +01:00
Bradley T. Hughes
2bbf9befd8 Add Qt::TimerType argument to QAbstractEventDispatcher::registerTimer()
... and deprecate the old registerTimer() functions. The new pure-
virtual registerTimer() breaks source-compatibility. Subclasses cannot
be instantiated anymore, since the pure virtual function signature has
changed.

QAbstractEventDispatcher::TimerInfo is no longer a QPair. It is now a
struct with timerId, interval, and timerType members. This is a source
incompatibility that should only affect subclasses of
QAbstractEventDispatcher, which will need to pass 3 arguments to the
TimerInfo constructor instead of 2. If the subclass used QPair<int,int>
instead of the TimerInfo typedef, the QPair<int,int> declarations will
need to be replaced with TimerInfo.

Call the new registerTimer() function with the type from
QObject::startTimer(). Change all subclasses of QAbstractEventDispatcher
to reimplement the new virtual function. The type argument is unused at
the momemnt, except to ensure that registeredTimers() returns the type
each timer was registered with. Implementations for the various
dispatchers will be done in separate commits.

Author: Thiago Macieira <thiago.macieira@nokia.com>
Change-Id: Ia22697e0ab0847810c5d162ef473e0e5a17a904b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-01-02 10:44:00 +01:00
Jason McDonald
ea415e2060 Cleanup corelib autotests.
When using QSignalSpy, always verify that the signal spy is valid.  This
will cause the test to give a meaningful failure when spying on a
non-existant signal.  Without this change, tests that spy on a signal to
ensure that it is not emitted (i.e. by comparing the spy count to zero)
could pass erroneously if something went wrong when creating the signal
spy, as an invalid QSignalSpy will always return a count of zero.

Change-Id: I41f4a63d9f0de9190a86de237662dc96be802446
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-12-28 04:48:11 +01:00
Bradley T. Hughes
ae8c61db21 Finish removing Qt3 support
Remove the (-no)-qt3support options from configure, and remove the last
remaining references to Qt3Support, QT3_SUPPORT, and
QEvent::ChildInserted.

The compatibilityChildInsertEvents() tests in tst_QObject and
tst_QWidget have been renamed to childEvents(), which is a more
appropriate name.

Change-Id: Id0b45e9b177efcc8dceee8c9ed8afafedeeace2f
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2011-12-23 11:59:11 +01:00
Jędrzej Nowacki
ee0a997bcd Fix movablity of QVariant.
After 8fd64d22ac (Make usage of internal
QVariant space.) change QVariant started to "inherit" movablity from
interned type.

This change fix it by interning only movable type in QVariant and by
using external allocation for not movable ones.

Obviously, this change has negative impact on QVariant it self, but
after it, QVariant will behave a lot nicer with our containers.

Change-Id: Ibffc95833918f65be737f52d694ee81a2036c412
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-12-22 16:09:34 +01:00
Jędrzej Nowacki
56f154c747 Allow QMetaType to register information about movability
We need that information to perform some optimizations in QVariant.

Change-Id: Id9a1716e49e4cedd17cd09a32fea4ff003ef61f2
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2011-12-22 13:20:40 +01:00
Shane Kearns
d62228a77e Fix compile error when configured with -no-exceptions
The test was skipped, but still tried to compile code that uses
exceptions. The throwing class it uses was conditionally compiled
out earlier in the file, causing an error for undefined class.

Task-number: QTBUG-23028
Change-Id: Ia2e05a8a0abbf0e913f6c41e85bfee8b85cbc8a5
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2011-12-22 02:28:09 +01:00
Alan Alpert
cb9b7ceffb Revert "Revert "Add QObject::objectNameChanged(con... signal""
This reverts commit 9b17557f3b.

Justification: Temporary commit, see JIRA task.
Task-number: QTBUG-22985
Change-Id: I3df9eb5fdbdc133349dca5e192dcfcc9e758626c
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2011-12-20 11:15:21 +01:00
Olivier Goffart
87679491cb Do not call QueuedConnection slot on partialy destroyed object
This is a regression introduced in Qt 4.8
When QApplication::processEvents is called from a destructor, it is
possible that pending events would still be called on the already
destroyed subclass.
Prevent that by using the same pattern as in QMetaObject::activate

Change-Id: Ida50db07ae089264402dafcde7a41a066479d08b
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2011-12-19 14:06:12 +01:00
Giuseppe D'Angelo
be6b29f001 Fix typos in QObject::(dis)connect warnings
For some strange reason "Object::method ..." was printed, without
the leading Q.

Change-Id: I10b99e8aa8730e4020d15b3e04a01004bade76c3
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2011-12-15 05:48:27 +01:00