Change childWidget->windowHandle() to childWidget->internalWinId() in
q_createNativeChildrenAndSetParent() to determine whether should we call
childWidget->winId().
This is because in some circumstances Qt will crash due to accessing
deleted QWidgetWindow object if we use windowHandle(). Think about the
following scenario:
1) create a widget A without parent and add two child widgets B and C to A
2) create a native widget D as the child of B, note that when we set
Qt::WA_NativeWindow attribute to it, its QWidgetWindow will be created
which means its windowHandle() is not null.
3) create a top level widget E as the child of C and show it. This will
make Qt call createWinId() to A and then
q_createNativeChildrenAndSetParent() will be called to create A's native
children recursively and finally make D's QWidgetWindow object become a
child of A's QWidgetWindow object. Please note here that B will not become
a native widget just because at that moment windowHandle() of D is not
null and Qt will not call winId() to its parent B
4) Set A's parent to another widget which has been shown, setParent_sys()
will be called to A and then Qt will call destroy() to A. in destroy() Qt
will try to call destroy() to its children recursively with a condition that
the child has Qt::WA_NativeWindow been set. But D's parent B is not a native
widget right now so B and D is not destroyed. Qt will then deleted the
QWidgetWindow object of A, since E's QWidgetWindow object is a child of
A's QWidgetWindow object, it will also be deleted. Now E hold a deleted
pointer of QWidgetWindow object. This is the source of crash later.
Task-number: QTBUG-35600
Change-Id: I97a20a68e626ee62b15bb4eae580e26f8948923b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Attempt to fix
FAIL! : tst_QAbstractItemView::task200665_itemEntered() Compared values are not the same
Actual (spy.count()): 0
Expected (1) : 1
Loc: [tst_qabstractitemview.cpp(1292)]
which might have been introduced by removing the absolute qWait(200) in favor
of qWaitForWindowExposed() in afe8e368, so trying to compensate with a
QTRY_COMPARE.
Change-Id: Id437acd810b54e005daaf66ffffd4dd586075ab6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Brings Windows QPA on par with other platforms.
[ChangeLog][Windows] Don't cover the taskbar when maximizing
frameless windows.
Task-number: QTBUG-8361
Change-Id: Iba35132f697cb7379650a4c883b616c5c2023d4c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
The code was there to do it, but it was using minimumValue instead of
maximumValue to test if the '+' should be allowed.
Task-number: QTBUG-20691
[ChangeLog][QtWidgets][QSpinBox] Entering positive values with the '+'
prefix is now allowed.
Change-Id: Iff62d073e350dc9a33b7e06e4b492048c74437c4
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
A QMenu with no actions gets a size of (0, 0) on OS X.
With the new stricter expose event behavior this
is considered invalid geometry and the platform plugin
won't send an expose event, causing the qWaitForWindowExposed
test to fail.
Add a menu entry since the layoutDirection test is
not really interested in testing the special case of
empty menus.
Change-Id: I5221dc3f0472ac13edf821df08bacc3a4eb5cd9d
Reviewed-by: Simo Fält <simo.falt@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
The cursor() test was missing a QTest::moveMouse() before sending of the
mouse event (as all the following subtests do). When run on a desktop with
the panel on the left side of the screen, the mouse pointer would land over
the left item instead of in between them, as assumed by the subtest, and
the following QCOMPARE failed.
Change-Id: Ib74fdf0cfbfbc8ecb79a906610a2da5cb50c89d0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Use QTest::qWaitForWindowExposed() and QTRY_COMPARE() instead of
hardcoded timeout.
Task-number: QTBUG-35308
Change-Id: I27eee9932dd3b6087db4ad13b1a4fb184a487f57
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Tweak a handful of tests which didn't compile on this platform.
Change-Id: I208d9eb289dfb226746c6d0163c3ea752485033b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Avoid menus showing up at 0,0 which is a taskbar area when running
Unity.
Task-number: QTBUG-33972
Change-Id: I156eec78248cec1708adf6bcf2e9ddcc98b7d8c4
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Qt::WA_Mapped maps (sic) to windowHandle()->isExposed(), and we set/update
it in QWidgetWindow::handleExposeEvent(). Setting it directly in show_sys
shortcuts QPA and assumes showing a window is synchronous on all platforms,
resulting in trying to flush the widget backingstore when the window was
not exposed yet (due to discardSyncRequest starting to return false).
This reverts commit 829b1d13b2.
Change-Id: I0bd700d4939bc69ba184d8586435b68ec3dd72fb
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
This was a tweak to fix a bug in 2005 which has probably outlived its
usefulness, plus an accumulation of workarounds on top. (started as
48b5266e8ff9b472a16290dd923fe24dd0b6989b in the historical repo)
Task-number: QTBUG-34760
Change-Id: I2c01269e43636385ee5c89305c6b90f4a7f2c537
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
For me, this test failed because I don't have a Documents folder in my
home directory, even though that's what's returned from QStandardPaths
as the first DocumentsLocation.
Fix by falling back on the home directory if documentPaths.front()
does not exist.
Change-Id: I483f62f3b4b43d055c74774a7058a4aa420849b1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
The dockwidget's toplevel window would be a parent of the container's
window when floating. When plugged back into the mainwindow the
dockwidget's window is destroyed and the container's window along
with it. Added a function toplevelAboutToBeDestroyed to unparent
the containers window before this happens so parentWasChanged will
work correctly.
Change-Id: I06679cfb3a8fa3834c0db0be5973c012b8277275
Reviewed-by: Ulf Hermann <ulf.hermann@digia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
When clicking on a widget currently focused, w/o having Qt::ClickFocus
set as focus policy, the focus should stay on the widget and not get
propagated to the widget's parent.
Task-number: QTBUG-34042
Change-Id: I53f1153829cc7228de02a90e38125b5cf4ee5008
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
We claim that -1 is a special automatic value, but calling
setMinimumSectionSize with -1 is unfortunately ignored due a
regression in 524c3e05e8
Change-Id: I7d7e5dbbf78e561849d2f2352c9edb2df36aa181
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Vertical scrollbar may get out of sync. When this happens, the calculation of
firstVisibleItem will retrun "-1". This must be handled in ::sizeHintForColumn().
Added an auto-test for the crashes.
Task-number: QTBUG-34717
Change-Id: I867fd144ef3ce45e382337c5eafe345f573cd944
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Center windows on screen to avoid conflicts with Unity taskbars,
observe minimum geometry for Windows, move cursor out of the
way for Mac. Introduce QScopedPointer to ensure cleanup in
case of failures.
Change-Id: Ic169e015e795597457b8e85a28ff7fcb7b9b9430
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
It's not really clear if styles *must* return a non-negative value for
QStyle::pixelMetric(PM_Layout{Vertical,Horizontal}Spacing), but both
QBoxLayout and QGridLayout seems to be robust enough to handle this.
They will simply make sure that the spacing is never negative.
We therefore make QFormLayout equally robust.
Task-number: QTBUG-34731
Change-Id: I62235bfcd8adf7757cf15bc9927b29650ae6459d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
As the test case shows, clear() is semantically equivalent to
setKeySequence(QKeySequence()), so implement it that way.
Change-Id: Id68edbbf85aac3bcff82c81310c38274ed8e6708
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
It introduces QTBUG-34653 (Qt Designer widget box no longer
repainted after collapsing items or using the filter).
This reverts commit 04de24c644.
Task-number: QTBUG-13522
Task-number: QTBUG-34653
Change-Id: Ieb9766e7f15acea901fce4ad7142aa72557b9957
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
The grabbing always grabbed the desktop. This caused it to also grab
tooltips, siderbars etc that could overlap the window which again
caused the pixmap comparison to obviously fail.
This will currently only fix it on windows. If needed, it should also
be fixed for other platforms.
Task-number: QTBUG-30566
Change-Id: I5cee8651e1d94dedded0acae8b19f351acd976c4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Check if the item is hidden before show the item(QWidget)
Task-number: QTBUG-13522
Change-Id: I1c605d5cb8a80f340e9b7601612d3760f51cb4a7
Reviewed-by: Liang Qi <liang.qi@digia.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Pass window flags on to ColorWidget constructor and use a window
frame + stay on top-hint for the moveChild/showAndMoveChild tests
to make the screen grabbing more reliable.
Disable animations on Windows since they seem to affect screen
grabbing as well (fading in of windows).
Task-number: QTBUG-30566
Change-Id: I8eacfc203d26674dc1b283d6643f3d434f218f26
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Only Commit, Finish and Cancel didn't have an object name, yet.
Also Extract Method on the switch statement, add a test, and
use QStringBuilder.
Task-number: QTBUG-29924
Reported-by: Leo Arias
Change-Id: I8c29606bc53e9d4caab631da2089e971a9da2d75
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
After Ic12de12ec51c20de52d040514e90be5e783add43 this functionality
was broken. Added an autotest.
Task-number: QTBUG-34159
Change-Id: I8f41b7073dc57fea855ab87796f09e8a91520d13
Reviewed-by: David Faure <david.faure@kdab.com>
We change the behavior slightly from the initial implementation in
5.1. Forcing the use of native child widgets is causing massive
performance issues so instead, we attach the embedded QWindow directly
to the root window. The only exception is QScrollArea and QMdiArea
which still enforces native windows for the entire parent chain
to make clipping and stacking work.
Task-number: QTBUG-34138
Change-Id: If713637bd4dce630552ace2f8ad6b2e86c063721
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Use the correct identifier for the OS X operating system.
Change-Id: I7158a6b77e5e7418bc6b0a565f003500820a346d
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This fixes QStatusBar so it is back to the original behavior of only
emitting the signal when the message has changed. The intention of the
code that caused this to break in the first place is kept intact.
Change-Id: I2f57c2abec01246ed924626ad954ac9ff9889855
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This is a performance and memory optimization which also fixes bugs
that are related to creating widgets, file system models etc.
despite using platform native dialogs. Similar to
785bc64f8e for QColorDialog.
Task-number: QTBUG-33039
Change-Id: Ia1aa7ec1f43b47006b9ebd377aed15c958538a17
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
The test is randomly failing on CI when ran on 10.7.
Task-number: QTBUG-31454
Change-Id: I79fce9a37616c6abaee960e338f8eea8fe6f31cf
Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Position cursor outside and move once more.
Task-number: QTBUG-33972
Change-Id: If060f1359361981cf1243d8d2a4ebef181689d74
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
The cursor needs to be within the view from start on Mac.
Task-number: QTBUG-33973
Change-Id: I313c9fd1c3a917e135a92497f1818d1b0d8b7698
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Change-Id: I5a1e601e3aa6e84300efa09bfbd9232fecab903e
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@digia.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Task-number: QTBUG-26722
Change-Id: I579111b5d34f8e3cdc6bb016d9c0e42ec3ffb8c9
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Reviewed-by: Stephen Chu <stephen@ju-ju.com>
Sometimes it is nice to be able to replace a widget in a layout.
Change-Id: I23a6a65e417e94d53bc48639503db1a142bc3f10
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>