In touch event terminology the global position is the screenPos,
scenePos is the windowPos.
Fixes a tst_qdeclarativepincharea test failure in qtquick1.
Change-Id: Ie98fe12be8cbedc9b019913b066e7c4bce75278d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Make sure the test subdirectories are actually visible
in the file model before the tests start.
Change-Id: If640456bba4362b19d7ad9d9184736c2eb8d3bde
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This avoids test instabilities and prevents test directories
from being cluttered with temporary files. Change tests
accordingly. Remove unused createLink() method.
Change-Id: I843c28ab81c8a476c71c5211a7479b22d3d9fc93
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
This allows to check whether QMetaTypeId2::MetaType exists, and can help
turn run-time into compile-time expressions, even without constexpr support,
or in situations where constexpr can't be used (because you can't overload
on it). This was designed for the QMetaType::registerConversion feature,
but it's much more widely applicable.
Change-Id: Iafa04add04bcb531b3f7fe3e751c7e91ee6a3bc0
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
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>
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 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>
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>
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>
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>
Deprecate qWaitForWindowShown for Qt 6 as it is just a wrapper.
Change-Id: I0f8195679679120bd402e273fed4d331dc926708
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Change-Id: I19d3b2e9a5180b13deb828b55195404ef20be295
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This is a bigger test after this change:
c3e1abad4e
Beside the test of behavior it has the class
FastEditItemView which could be useful in the future.
QTestEventLoop::instance().enterLoop(1) does not perform well.
(IE it makes CI slower). My class could be used to extensions.
(or maybe even to remove a few of these calls)
Change-Id: I4f1460873cd07ddc482d5cfe462b59c47ebb189f
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
removed printsupport tests for wince as there
is no print support on wince and removed the special
handling for wince from 4.8 on some tests as the dependent
modules are not part of qt base anymore
Change-Id: I4ffb22da11f98beee1013f775cb5ce4b936d3211
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
To let this test pass, a bunch of test cases had to be disabled.
Task-number: QTBUG-25300
Change-Id: I26bc08f366c43fb2bf3ba42a5fcbeb3888ed02c0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This test is nice to have regardless though the main reason for it
is a refactor of hiddenSections in QHeaderView.
Change-Id: Id41a1d5edda2ef75bf432a78cdb3e952303eae92
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
In 96f1fe8855 we agreed that sections
with negative sizes did not make sense. Of the same reason default
section sizes and minimum section sizes should be not negative.
Change-Id: I6a770e7f510d8e2bb90bfd8f38b4fa0566fc137b
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
QTBUG-8911 has been fixed some time ago.
Change-Id: I19dae0571b1829f6b3b797f7e0ec5c24a4241db8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Make test projects declare TEST_HELPER_INSTALLS rather than calling a
function exported by testcase.prf. load(testcase) may be unsafe, as
testcase.prf should be processed after default_post.prf.
Fixes silent disabling of various autotests.
Change-Id: I56b35ffd653a637ad5ab18d64dd1a1edadfac59f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Kurt Korbatits <kurt.korbatits@nokia.com>
Prevent a crash by giving the widget some time to show up.
Task-number: QTBUG-22326
Change-Id: Idaa23b21121e7c4f7098e8d51efd313bcc467e9a
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Implement QPlatformSystemTrayIcon providing QPA-plugin-support for
system tray icons. Make QSystemTrayIcon use this as new backend.
Ported over qsystemtrayicon_mac.mm to qcocoasystemtrayicon.mm to provide
Cocoa support for the new interface. It had to be changed to match the
interface, especially for icon and menu handling.
This interface is made to not use QStyle or QMenu which are related
classes of QSystemTrayIcon. It's therefore not introducing QtWidget
dependency into the platform plugin.
Task-number: QTBUG-20978
Change-Id: I0d0a73835698b3b4f97219d4f5bbcfa2af57dbe2
Reviewed-by: Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Removed old defunct platform specific code from
QWidget::isActiveWindow() and added call to
QPlatformWindow::isActive() instead. This is done because
the embedded native windows inside QAxWidgets can have
focus but are not part of the parent application's Qt
window hierarchy, so native methods are required to determine
if they are part of the active window or not.
QWidgetPrivate::setFocus_sys() was implemented to activate
the window of the focused widget if the focus was elsewhere.
This is required because embedded native windows can steal the
focus from the main application window.
Focus event handling in Windows platform adaptation plugin was
fixed to correctly identify the active window in cases where
the are embedded native widgets that can have focus.
Also fixed three test cases that were affected by these changes.
Task-number: QTBUG-25852
Task-number: QTBUG-23699
Change-Id: I817e0ce4317e88955bb49b034eacd630a876ccf0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
The part of tst_qwidget::reparent() that "makes sense only on Windows"
is antiquated at least since the introduction of alien widgets.
It basically tests if QWidget::winId() returns a valid window handle
(has been replaced with winHandleOf here in the meantime).
This is always successful, because winId() creates a valid window handle.
Change-Id: I52c370e26fd9b34861bd4d52c12dded243382d43
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
We cannot use QWidget::grab for widgets that have WA_PaintOnScreen set.
QScreen::grabWindow copies the real screen contents for us.
Change-Id: If1f6233ec48bcb2b941ea683c56ce71a39642e67
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This will allow conversion between pointers to compatible QObject
derived types.
Change-Id: I19e08934571fb3f1b91e594892214041fe5f6a11
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
The dependencies on QFont, QBrush, QIcon are all in QtGui, so there's
little sense to still have these classes in QtWidgets.
This also copies and pastes a version of QWidgetItemData as
QStandardItemData inside qstandarditemmodel_p.h.
Change-Id: Ibafc5a30748e7ce0b54753309ae6dc4a797fc20e
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
QCalendarWidget currently uses Qt::Sunday as the default first day
of the week. It has been suggested that a better user experience
would see the calendar's locale be used instead.
Task-number: QTBUG-19811
Change-Id: I4441bf9ffd52213ef622a4a7f498530b7cc9e110
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
The test looks vulnerable to misbehaviour if the working directory
contains unexpected files and folders. As it's already skipped on
Mac, skip on linux as well to unblock the CI.
Change-Id: Id2e48ea455eb77e36c4f9d899885e101f674c0a3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Defined missing SPI_GETPLATFORMTYPE macro as it was done in for example
in qwidget and qaccesiblity test cases.
Change-Id: I33a1e0119848911fbc4830299fcc1854f5259e86
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
The pointer grabbing leads to fake Enter events being sent to the
Qt::Popup window, preventing it from closing since QWidget::underMouse()
returns true. We should only send Enter events if the mouse is actually
inside the widget.
Change-Id: I4ba3fb08943580f93ad4337ff0227becd647767e
Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>