Remove usages from autotests with the exception of
widgets/kernel, widgets/widgets and widgets/graphicsview.
Change-Id: I917b2857ed0cd07a6b3dbcd69244f558086c6586
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Also check the return value of
DefaultValueFactory<QMetaType::Void>::create(), the same way it's
done in testCreateHelper<QMetaType::Void>().
Change-Id: I3e6d7fca4ea74dbe65009f2eb2c64a1b3a370d68
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This is a simplified port of KDTools' KDAB_SET_OBJECT_NAME.
It simply assigns the variable name as the objectName of
a QObject, uic-style. It uses a small helper function so
that it works on references as well as pointer variables.
QLabel label;
QLabel *pLabel = new QLabel();
Q_SET_OBJECT_NAME(label);
Q_SET_OBJECT_NAME(pLabel);
Change-Id: I25fec0c90f33249a3ea5d2dd622ab708019fd101
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Using qRegisterMetaType<T>() has the advantage that multiple calls
during a program run are much more efficient, since an inlined
atomic is used to store the result. It also ensures that
Q_DECLARE_METATYPE(T) has been used, whereas qRegisterMetaType<T>("T")
will happily register anything.
Had to add Q_DECLARE_METATYPE to QFileInfo, for
QList<QPair<QString,QFileInfo>> of QFileSystemModel to work with
the partial specialisations of Q_DECLARE_METATYPE for QList, QPair.
In order to synchronize this change with other modules that did
their own Q_DECLARE_METATYPE(QFileInfo), a sync macro is defined
that can be tested in other modules, and will later be removed again.
Change-Id: I3004664e07e64cd885d5a03a57ff4e4379804aec
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
While the qWaitForWindowShown(QWidget *) is inherited
from Qt 4.8, the qWaitForWindowShown(QWindow *) was introduced
in Qt 5. As it is identical to qWaitForWindowExposed()
and removed already, it can be deprecated in Qt 5.
Remove its usages in qtbase.
Change-Id: I28788d120ad687a49f02b2b44de6b38a2832fe5c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
This makes development on the meta type system easier because only
QtCore must be re-built to run most of the tests. The existing
QGuiVariant test needs to be run before pushing anyway, but not
so frequently.
Change-Id: I1fa66edbd790c957e1a232226847dd550227a477
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
The type needs to be large enough that
QVariantIntegrator<T>::CanUseInternalSpace is true.
Change-Id: I311c44bedfebd946e41639975df206c27b6d55ca
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
For consistency with qMetaTypeId, and because we can.
Change-Id: I6882a16ef3c0d84539048c9f2c201c4a2b2ca7ad
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This patch implement the equivalent of
468626e99a90d6ac21cb311cde05c658ccb3b781 in qtdeclarative but for
QtWidgets.
If a widget doesn't accept a touch event, then QApplication gives it
another try by synthesizing a corresponding mouse event. This way
QtQuick and QtWidget behave in a similar way, removing the need for
platform backends to try to emulate a mouse event from a touch event
unconditionally.
Also add relevant unit tests and adjust old QApplication ones.
Change-Id: Iddbf6d756c4b52931a9d1c314b50d7a31dbcdee9
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
QModelIndex is a build-in type nowadays and doesn't
need to be registered anymore.
Also remove them from the tests.
Change-Id: I47029972651c045c880cee86fb292116a29493d5
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
The behavior of QTEST_MAIN depends on whether QT_GUI_LIB or QT_WIDGETS_LIB
is defined. It could create a QGuiApplication or QApplication which
could cause linking issues if the corresponding library is not linked to.
The failure cases are also tested.
Change-Id: I61ed0bc760564ef42ce1dbd86c83c06348c860ff
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
No need to pass the dispatcher. Get rid of Windows logic to maintain
a stack of dispatcher associated with flags.
Change-Id: Ic2daad4b6762a46fac3274937effc188af436c9a
Reviewed-by: David Faure <faure@kde.org>
This allows building the QVariant tests without the QtWidgets module.
Change-Id: I7cd7e78a60c7bc7614ec16df1abe1e93e45d4923
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
The previous API was hard to use (global function, no type safety,
manual chaining), and confusing (app vs dispatcher split only made
sense on Windows). Installing and removing out of order would have
the risk of setting back a dangling pointer (crash). Meanwhile QPA
added type safety, and this new API models the QObject::installEventFilter
API for ease of use. The virtual method is in a new interface,
QAbstractNativeEventFilter.
QPA was even calling the dispatcher event filter with QPA-private event
classes, which made no sense (refactoring leftover from when the code
was in the dispatcher). Now the QPA plugins trigger the qcoreapp event
filters with the actual native events directly.
Change-Id: Ie35e47c59c862383bcaf857b28d54f7c72547882
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
- Implement waitForWindowExposed() for toplevel windows.
- Implement waitForWindowShown(QWidget *) and mark as
deprecated in line with waitForWindowShown(QWindow*).
- Use in tests.
- Simplify tests (collapse waitForExposed, setActive
into setActiveWindow, waitForActive), remove most
hard-coded timeouts.
- Stabilize graphicsview tests by using waitForWindowActive.
Change-Id: Ic7c061e2745b36f71a715ee4e47c0346b11a91e8
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
When turning off fullscreen mode and restoring the widget's geometry
we must inform the QWindow about the geometry change synchronously.
Otherwise QWidget::geometry() will return the old value.
Using the same technique for the state transition to fullscreen mode
without sending a separate resize event.
Autotest: tst_QWidget::saveRestoreGeometry
Task-number: QTBUG-26421
Change-Id: I869e36cd302d9a94e398f48949ab3cb7ee9cdf51
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
QtWidgets and QtGui are currently compiled without exceptions,
which causes a crash with gcc 4.6.3.
Change-Id: I8f872f3bec6266444adf08d51a6678150c5fae8e
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
It should be possible to include both:
* <QtGui/private/qfoo.h>
* <private/qfoo.h>
Change-Id: I83ed5bba633b4a6b9bd38e315c987d78beecfb1b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
When mixing native and regular widgets in same QMdiArea, some
subwindows didn't properly get set native. This was because
when a native parentless widget was given a parent, it wouldn't
enforce native window on the new parent and its ancestors.
This happened because window flags were adjusted too late in
relation to createWinId() call in setParent_sys().
Fixed by moving the createWinId() call to its proper place.
Also removed some old Q_WS_* ifdeffing in QWidget::setParent() that
masked some native enforcement code.
Additionally removed few QEXPECT_FAILs from QWidget autotest now
that those cases work correctly.
Task-number: QTBUG-26424
Change-Id: Ib6f9d0531e5c7299e2c307734d49c81f1ffa9713
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
WinAPI GetTempPath() sometimes returns short names
for C:/Users/<user>/AppData/Local/Temp.
Change-Id: I33f991acc06e652ccd484d36a5a384eb776f8395
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
SQL Server 10 introduced stricter rules for TIMESTAMP validation,
making it necessary to specify the decimal digits.
Other databases might do the same as well, so this patch introduces
a check for the TIMESTAMP column size and adjusts the decimal digits
parameter as needed.
Task-number: QTBUG-2192
Change-Id: If6d798c6c928ebda75bc474e49a07fbbfbe5816c
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
A virtual method was reimplemented to return an always-empty string,
probably a leftover from a refactoring.
This fix showed that tst_qwidget_window was buggy: between Qt4 and Qt5,
a "Before" became "After", which made "Before" unused, and was masking
the fact that the app name was empty by default. In addition, the
earlier Qt5 change that made the app name default to argv[0] now requires
updating this test, now that it's actually working.
Change-Id: I5360026821a9b95bedd0ff09dba3d51a22e542b7
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@nokia.com>
This makes it possible to add API for setting the restore policy
per state, or even per property assignment (QTBUG-17861).
This change is fully source compatible with Qt4.
Change-Id: I53628546b070f6fc84891f86e7ad7bd8ef5ba285
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Back when QStateMachine was changed to inherit QState, this
constructor was conveniently left out because setting the state
machine (root state) to be a parallel state group didn't actually
work. But as of commit d281aa6936,
it does work, so add the missing constructor.
Task-number: QTBUG-15430
Change-Id: I68c599baa0ef1bfc869195140cf5daf645e75b8b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
under extremely rare circumstances this would have actually failed
Change-Id: I4132d0f82e9f924e92e9e96f6d34451c94a67201
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This is just for completeness of the understanding of the limitations
of private signals. There are no private signals in Qt which have
overloads.
Change-Id: Ic34c555aea360ee34beec796e597657888573da9
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
When the pushbutton is shown, it will generate both a ShowEvent and
a StateChange with active=1 (because it is a top level window).
This patch relaxes the reqirement in which order events are delivered.
Ideally the order should also relied on, but I'm not sure if that
is feasible due to differences among window managers across all
platforms.
This got provoked by codereview.qt-project.org/#change,26014
Change-Id: I96159fbb1b64f0ca8d13833d8a4c6799c655afc2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
Since Qt's connections are thread-safe, QStateMachine's plumbing
around them should be thread-safe too.
Change-Id: I8ae91c2edc2d32ca4ed4258b71e5da22de30ed91
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
By default, QStateMachine lazily registers signal transitions (i.e.,
connects to the signal) when the transition's source state is
entered. The connections are established in Qt::AutoConnection mode,
which means that if the sender object lives in a different thread,
the signal processing will be queued.
But if a sender object's signal is used in an out-going transition
of the target state of the queued transition, it's possible that a
second signal emission on the sender object's thread will be
"missed" by the state machine; before the machine gets around to
processing the first queued emission (and registering the
transitions of the new state), a sender object on the other thread
could have emitted a new signal.
The solution employed here is to eagerly register any signal
transition whose sender object is on a different thread; that is,
register it regardless of whether the transition's source state is
active.
Conversely, when a machine's transitions are unregistered (i.e.,
because the machine finished), signal transitions with sender
objects on other threads should be left as-is, in case the machine
will be run again.
This doesn't solve the case where the sender object is moved to a
different thread _after_ the transition has been initialized.
Theoretically, we could catch that by installing an event filter
on every sender object and handle the ThreadChange events, but
that would be very expensive, and likely useless in most cases.
So let's just say that that case isn't supported for now.
Task-number: QTBUG-19789
Change-Id: Ibc87bfbf2ed83217ac61ae9401fe4f179ef26c24
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Some of the transition constructors didn't call the maybeRegister()
function, causing the transitions to be ignored if they were created
when the state machine was running and the transition's source state
was active.
Added tests that cover all possible cases.
Change-Id: If1b593b127bd719e3be4e5a2e6949a780c4e97c3
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
The originalSignalIndex member was not set if the signature had to be
normalized. This caused the SignalEvent passed to onTransition() to
report a signal index of -1.
Improve the signal transition tests so they check both the event
passed to eventTest() and onTransition().
Change-Id: I5331fd1944d53310b6d11eb2fd8713b80faa53a1
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>