Commit Graph

809 Commits

Author SHA1 Message Date
Jian Liang
8fcab70408 Avoid crash due to accessing deleted QWidgetWindow object
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>
2013-12-24 02:56:41 +01:00
Marc Mutz
7fef5fe293 Stabilize tst_qabstractitemview
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>
2013-12-11 09:55:39 +01:00
Sérgio Martins
0c936ca83c Windows: Don't cover the taskbar when maximizing frameless windows
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>
2013-12-06 13:52:34 +01:00
Mitch Curtis
b9c8073230 QSpinBox: allow positive values to be entered with the '+' prefix.
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>
2013-12-05 23:57:53 +01:00
Frederik Gladhorn
733ace5a7a Merge remote-tracking branch 'origin/release' into stable
Conflicts:
	configure
	mkspecs/macx-ios-clang/features/default_post.prf
	tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp

Change-Id: Iaba97eed2272bccf54289640b8197d40e22f7bf5
2013-12-05 17:42:33 +01:00
Morten Johan Sørvig
1983bc9c37 Make layoutDirection pass with new expose behavior
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>
2013-12-04 14:48:12 +01:00
Marc Mutz
c70750f536 Stabilize tst_QGraphicsItem
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>
2013-12-03 11:42:13 +01:00
Friedemann Kleint
d1f9f2125e Stabilize tst_QColumnView::dynamicModelChanges().
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>
2013-12-03 11:40:57 +01:00
Andrew Knight
1c2be58fec Fix test compilation on WinRT
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>
2013-11-26 20:29:09 +01:00
Frederik Gladhorn
3061dc4abd Merge remote-tracking branch 'origin/release' into stable
Change-Id: I83ff8f4d7dffd7385013a1bd8a1732a89ee20d56
2013-11-26 10:51:34 +01:00
Frederik Gladhorn
225526410b Merge "Merge remote-tracking branch 'origin/release' into stable" into refs/staging/stable 2013-11-22 16:47:35 +01:00
Friedemann Kleint
219455951b Center/position windows in tst_qmenu.
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>
2013-11-21 21:06:53 +01:00
Tor Arne Vestbø
773610cc45 Revert "Ensure Qt::WA_Mapped is set in case of obscured native windows."
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>
2013-11-21 16:28:36 +01:00
Shawn Rutledge
b4bb709733 Remove QMacStyle titlebar height + 4 adjustment and consequences
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>
2013-11-21 11:22:38 +01:00
Marc Mutz
885bd1d0e5 tst_QFileSystemModel: don't expect ~/Documents to exist
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>
2013-11-21 07:45:38 +01:00
Friedemann Kleint
054dfae39d Stabilize tst_QGraphicsWidget::updateFocusChainWhenChildDie().
Position windows, use QTRY_VERIFY.

Change-Id: I185bcd91bcdffbc0460a4d24f685d3dde84338a7
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
2013-11-20 18:19:01 +01:00
Friedemann Kleint
0787550f63 Stabilize tst_QGraphicsView::hoverLeave().
Position windows, use QTRY_VERIFY.

Change-Id: I0fab91c65b30e7028343c7e9b19a1b232fe72ebf
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
2013-11-20 18:18:55 +01:00
Friedemann Kleint
097be87a64 Stabilize tst_QGraphicsScene::isActive().
Position windows, use QTRY_VERIFY.

Change-Id: I84349dd696a633840973e9db0c538830aaa96948
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
2013-11-20 18:18:48 +01:00
Frederik Gladhorn
ff4ad44b69 Merge remote-tracking branch 'origin/release' into stable
Conflicts:
	configure

Change-Id: I0d31f23483ea67c4cac5af16014366e1ba5ac093
2013-11-20 17:16:59 +01:00
Gunnar Sletta
54b8c27e03 Fix crash when windowcontainer is used in a dockwidget
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>
2013-11-20 14:10:37 +01:00
Frederik Gladhorn
c83c08d84f Merge "Merge remote-tracking branch 'origin/release' into stable" into refs/staging/stable 2013-11-20 12:18:23 +01:00
Friedemann Kleint
829b1d13b2 Ensure Qt::WA_Mapped is set in case of obscured native windows.
Task-number: QTBUG-33520
Change-Id: I51f9b4634be29fd32f4ad9cc8b5d3e10b19ea2f5
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
2013-11-20 09:39:56 +01:00
David Faure
e1c0a1b56c QProgressDialog: add unittest for the auto-show feature
Change-Id: I244d0b740467a09e8833f4debb95b19e45df371f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2013-11-20 09:03:09 +01:00
Christoph Schleifenbaum
7e768dde39 Widgets: Never revoke focus by click on focused widget.
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>
2013-11-18 20:38:41 +01:00
Frederik Gladhorn
72ea790085 Merge remote-tracking branch 'origin/release' into stable
Change-Id: Ie6d44caf1d630cb029178a1af40c637f24a25ee7
2013-11-18 12:27:04 +01:00
Thorbjørn Martsum
aafbd7392e QHeaderView - do not ignore -1 as minimum section size
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>
2013-11-17 20:49:00 +01:00
Martin Pley
6c04c21c10 Crash fix in QTreeView::sizeHintForColumn().
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>
2013-11-16 16:40:46 +01:00
Friedemann Kleint
afe8e36872 Stabilize tst_qabstractitemview.
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>
2013-11-16 14:57:10 +01:00
Friedemann Kleint
e2557933cb Remove QTRY_ macro from tst_qabstractitemview.
Change-Id: Ic8b8e5c242b640581aa735a3716666d4e7ff44eb
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
2013-11-15 12:42:36 +01:00
Jan Arve Saether
de5b3780cf QFormLayout: Avoid assertion with negative spacings.
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>
2013-11-15 09:15:13 +01:00
Marc Mutz
4d1ece8b44 QKeySequenceEdit: simplify clear()
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>
2013-11-14 18:59:54 +01:00
Gunnar Sletta
105da329a3 Skip tst_QGraphicsItem::ensureUpdateOnTextItem() on OSX 10.7
Change-Id: Iedb8ed3ac797d11c47f08b92507401e2e1e96c14
Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
2013-11-14 15:24:47 +01:00
Friedemann Kleint
dd262dc7f5 Revert "Fix setVisible() of QWidget has no effect in QTreeWidgetItem"
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>
2013-11-08 16:45:26 +01:00
Friedemann Kleint
161e8653c3 Disable clear button in read-only QLineEdit.
Task-number: QTBUG-34315
Change-Id: I6c318879aee907c080e871a541da4ba5eadd71ed
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2013-11-05 09:16:47 +01:00
Jan Arve Saether
7b33bd4110 Fix stability issues in tst_qwidget with VERIFY_COLOR
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>
2013-11-01 14:52:47 +01:00
Chengyong Xie
04de24c644 Fix setVisible() of QWidget has no effect in QTreeWidgetItem
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>
2013-10-31 19:41:49 +01:00
Friedemann Kleint
33a88d6cd7 Stabilize moveChild/showAndMoveChild-tests.
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>
2013-10-31 14:22:25 +01:00
Marc Mutz
1ea191276e QWizard: give all buttons an objectName
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>
2013-10-28 12:05:22 +01:00
Shawn Rutledge
7e30d3afd3 QFileDialog can delete files too, not just directories
After Ic12de12ec51c20de52d040514e90be5e783add43 this functionality
was broken.  Added an autotest.

Task-number: QTBUG-34159
Change-Id: I8f41b7073dc57fea855ab87796f09e8a91520d13
Reviewed-by: David Faure <david.faure@kdab.com>
2013-10-23 19:09:54 +02:00
Gunnar Sletta
72a7882cec Better QWindowContainer by not relying on native widgets.
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>
2013-10-22 10:46:21 +02:00
Sergio Ahumada
bdc558019a tests: Replace Q_OS_MACX -> Q_OS_OSX
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>
2013-10-21 10:37:56 +02:00
Andy Shaw
89c01c3242 Only emit messageChanged() if the message has actually changed
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>
2013-10-15 13:01:59 +02:00
Shawn Rutledge
37ca2224ec QFileDialog: don't create widgets if the platform dialog will be used
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>
2013-10-15 08:14:48 +02:00
Simo Fält
cd13fe44cd Skip tst_QGraphicsItem::paint() on Mac OS X 10.7
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>
2013-10-15 06:20:01 +02:00
Friedemann Kleint
12b68ed072 Stabilize tst_qmenu on Mac.
Position cursor outside and move once more.

Task-number: QTBUG-33972

Change-Id: If060f1359361981cf1243d8d2a4ebef181689d74
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
2013-10-14 17:29:37 +02:00
Friedemann Kleint
2b8e571f84 Stabilize tst_QComboBox::keyBoardNavigationWithMouse.
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>
2013-10-11 18:47:27 +02:00
Friedemann Kleint
cdf0c5905b Fix temporary file leak in tst_qfiledialog2.
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>
2013-10-03 21:43:56 +02:00
Liang Qi
5b70efb125 Mac: QWizard default background pixmap works again
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>
2013-09-26 20:42:33 +02:00
Ivan Komissarov
f3a723f2ec Add QKeySequenceEdit
Change-Id: I497309d3e6cbf38b298afb5ff3cb1ed6a0e82000
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2013-09-24 10:55:17 +02:00
Thorbjørn Lund Martsum
42d681f9cf Add widget replace function to QLayout
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>
2013-09-21 23:17:55 +02:00