By ensuring that the current index follows the focus of an index widget,
we can ensure that moving the cursor will happen in the way that is
expected from the focused widget.
Task-number: QTBUG-27793
Change-Id: Ia36891a94ce41c7d12fba678de23a6f3b69374ae
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
The action which added by QMenuBar::addAction(const QString &text) already
connected relevant signals and slots implicitly, however, while
QMenuBarPrivate::updateGeometry -ing, it reconnects them
if there's a extension button associated with a hidden popup menu.
In that case the QMenuBar::triggered would be fired twice.
Since the QAction's ownership may be changed or added dynamically,
there are still very rare cases like several widgets share the same
QAction object to result in this problem.
[ChangeLog][QtWidgets][QMenu] Fixed a bug in QMenu that caused QMenuBar::triggered
to be fired multiple times.
Task-number: QTBUG-25669
Change-Id: I4d52e82a2136a992e0b37118e41237d96a2c5d22
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
QItemDelegate::doLayout added a margin after the checkbox which is not
done within QCommonStylePrivate::viewItemLayout. This created a small
but visual difference between using QItemDelegate or QStyledItemDelegate.
The additional margin was removed from viewItemLayout somehwere between
4.4 and 4.5 so it was intentional.
Change-Id: I2fc3f287fe8b181355edeebec9626c49d85fe74d
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Introduce a special hash modeled on the one used for QFileSystemWatcher
on Windows.
Task-number: QTBUG-31103
Task-number: QTBUG-64147
Change-Id: I69ebabe841716e4957ae3fb04fa5c43d233a3552
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
[ChangeLog][QtWidgets][QMenuBar] Add overloads of addAction() using Qt 5 signals and slots
Change-Id: Ief21974213b80111f0ca87df490eb72dd6b9c9b9
Reviewed-by: Martin Smith <martin.smith@qt.io>
QHeaderView::resizeSection() did not check if the given section size is
inside the min/max property bounds.
Also on calling setMin/MaximumSectionSize() the current section sizes
were not checked if they are inside the new given bounds.
This is a small behavior change when a user is setting the section size
via resizeSection() without respecting the min/maxSectionSizes.
Task-number: QTBUG-64173
Change-Id: Ia9c9eebf058d60c776ab5f8f8336642013ec553f
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Since there may be some applications that want to make their comboboxes
scrollable or not with the mouse wheel then a style hint is added to
make this toggable. It defaults to true for all platforms except macOS
to keep it in line with existing behavior.
[ChangeLog][QtWidgets][QStyle] Added SH_ComboBox_AllowWheelScrolling as
a style hint to enable/disable the use of the mouse wheel in a QComboBox.
This defaults to true in all styles except the macOS one so there is no
change in existing behavior.
Task-number: QTBUG-53094
Change-Id: I6eb61e1990bfc79e3b3ea82d7b91ee39096fa077
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
QTreeWidget::visualItemRect() returned an invalid QRect when a column
was moved and then hidden (or the other way round). The reason was that
the logical index returned by QHeaderView::logicalIndexAt() was again
passed to QHeaderView::logicalIndex() to create the QModelIndexes needed
for QTreeView::visualRect()
Task-number: QTBUG-28733
Change-Id: I8676f21bcab8c05c2260b85d483902f18cbf3e24
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
QTreeView makes columns movable except for the first one
(since Qt 5.0, see commit e0fc088c0c). This is indeed best
for actual trees, but not when using QTreeView as a flat
multi-column list (with no "root decoration"). Then it should
be possible to move the first column.
[ChangeLog][QtWidgets][QHeaderView] Flat treeviews can now allow
the user to move the first column (like in Qt 4.x) using the new
method QHeaderView::setFirstSectionMovable().
Change-Id: I6b5025e40850bf5c4c373124ee81f657f3f09d29
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
QHeaderViewPrivate reimplemented _q_layoutChanged() to handle changes
of rows/columns via layoutChanged/layoutAboutToBeChanged. This worked
fine for Qt4 but since Qt5 only the special signals rowsAboutToBeMoved/
rowsMoved are used for this (8021e2d5e7).
With this change, QAbstractItemViewPrivate::_q_rows/columnsMoved() is
calling the virtual function _q_layoutChanged(). This resulted in a
wrong call of QHP::_q_layoutChanged() for a horizontal header when
a row changed and for a vertical header during a column change. In the
end this can lead to an unhide of hidden sections.
Task-number: QTBUG-54610
Change-Id: Ide4bfc5b24a97746fd1e5af82d3ba08257149157
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
QHeaderViewPrivate::_q_layoutChanged() was not called when used in a
QTreeView because it was explicitly disconnected in setModel().
The disconnect was added sometime prio to Qt 4.3, but there the signal
was connected to the doItemsLayout() slot. This was correct since
QTreeView::doItemsLayout() is calling header->doItemsLayout().
In Qt 4.3.0 _q_layoutChanged() was introduced and the disconnect was
adjusted. But since _q_layoutChanged() is doing much more than
doItemsLayout() (e.g. restoring hidden sections), functionality was
lost. The problem was already observed for Qt 4.6 (QTBUG-18196) but
only partially fixed.
Task-number: QTBUG-41124
Task-number: QTBUG-54610
Change-Id: Id13a9930d0163812e12a0287016bab9c3aa02068
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Autotest is taken from the previously reverted
8b1377fde1.
Task-number: QTBUG-60231
Change-Id: I44dd79cba22b6baefdd6d95c176790bef0b7eafe
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
QFontMetrics(F)::width() has been deprecated and is replaced by
horizontalAdvance(). This updates all usage of it in tests and
documentation.
It is worth noting that many or most of the usages of
QFontMetrics::width() probably intended to use boundingRect().width(),
but since it currently works, I have not looked into that, just
replaced the function name mechanically.
Change-Id: Iec382e5bad0b50f37a6cfff841bfb46ed4d4555f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Use being()/end() instead.
These were the last remaining uses of QRegion::rects() within qtbase.
Change-Id: I264beb6f660968f40eecbbee2260341fca94ddb5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Drop the useless copy 'r' of 'region', reuse 'r' for the rects in 'region',
to clean up the region handling in verifyColor().
Change-Id: I8e159976b4b0152823be864488d2ef25d7cb0078
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The test is flaky on Linux.
Task-number: QTBUG-64639
Change-Id: Iec56ebce4f656f52187b34c8f655b137e41c3d17
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
QAbstractItemDelegatePrivate::textForRole() was formatting date and
time separately, then gluing the parts back together with space.
QLocale can do that just fine itself (it has a toString() overload
that handles a QDateTime) and might even (some day) do it better. To
my mild surprise, this proved sufficient to fix a problem with
date-time display in tool-tips, when the date-time includes a zone.
Extracted the date-time part of an existing selftest into a test of
its own and extended it to test times of each spec-type; verified that
the non-local spec cases of this all failed before this fix.
Task-number: QTBUG-61069
Change-Id: I6d6be0c27be9a557d8afc3ced200a10b2aaff816
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Test-case taken from bug-report; fits in as an easy row in an existing
data-driven test. Add similar tests for date-time and time; and an
isValid test on the end of year 9999. The date-time parser was using
the end of year 7999 as maximum value for dates and date-times; extend
this to year 9999, as I can see no reason not to.
[ChangeLog][QtCore][QDateTime] Years up to 9999 can now be parsed
without error (previously 8000 and beyond were treated as invalid) in
all formats (not only in ISO format). Widgets handling dates now
support dates to 9999, likewise.
Task-number: QTBUG-64401
Change-Id: I518cfa6c2cb4ecc5a85b896dc9e56b4fdd8a8bb1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QTreeWidgetItem::insertChildren should behave like a more-optimized
QTreeWidgetItem::insertChild. Unlike the latter, the former lacks
out-of-bounds checks, resulting in successful insertions even
when using an invalid index (say, bigger than the row/column count).
Reintroduce some sanity checks instead. This allows to fix a "fixme"
left in the autotest.
[ChangeLog][QtWidgets][QTreeWidgetItem] QTreeWidgetItem::insertChildren
now ignores insertions happening at invalid indices, for
consistency with QTreeWidgetItem::insertChild.
Change-Id: I1532597768cc6aff96a6e8f356bc6075b582801d
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
The tests start to show flakyness on Linux in 5.10 (rowCount() check
failing). This seems to point to a race condition between the files
showing up and the file system watchers of QFileSystemModel starting.
To fix this, close the file and wait until it shows up in the directory
before pointing the QFileSystemModel to it. The tests then no longer
rely on the file system watchers.
Change-Id: I39cffb4cacf6843e8e4180efb405345307c78dd8
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
A layoutChange indicates that anything can have moved to anywhere else,
including as a result purely of new items being added. It can also
indicate that items are removed.
The old code here incorrectly assumed that the section count remained
constant over this operation by setting the size of the oldSectionHidden
QBitArray - whose size is the size before the layoutChange operation -
and then calling setBit with model rows numbered after the layoutChange
operation. As the two are not necessarily the same dimensions, this can
result in asserts from the setBit call.
Simplify the handling of layoutChanged entirely by clearing section
information, and using the QPersistentIndexes which indicate hidden
state to restore that state after re-population.
Task-number: QTBUG-53221
Change-Id: I3cda13e86b51b3029b37b647a48748fb604db252
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Since the first item in a treeview might be hidden, start from the
first visible item in the view when starting or wrapping round
during a keyboard search.
Task-number: QTBUG-63869
Change-Id: I202bea567c6d4484c3ffaf8a5f9af8ea2e13708d
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
When calling QTreeView::hideColumn() the row heights are not
recalculated. This can lead to rows which are unnecessarily high due to
hidden columns may contain large (e.g. multiline) content. The same
applies to showColumn() - there the row might be to small.
Hiding columns directly via QTreeView::header()->hideSection() is not
covered by this patch since QHeaderView has no way to inform about
newly shown/hidden sections.
Task-number: QTBUG-8376
Change-Id: I20b1198e56e403ab8cf649af76e5e2280821dd68
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Also blacklist tst_QNetworkReply::ioHttpRedirectErrors(too-many-redirects)
on RHEL 6.6 in CI.
Conflicts:
tests/auto/network/access/qnetworkreply/BLACKLIST
tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
Task-number: QTBUG-64569
Change-Id: I7514fc0660c18fd3a3e1d0d0af3f15d879e3c6f4
As it stood, we would set 'pressed' to false regardless of which button that
was released. This would end up wrong if pressing the left button, and
at the same time, did a click with the right button. This would clear the
flag prematurely, and cause a release signal not to be emitted when later
releasing the left button.
tst_QAbstractButton: adding autotest
Adding tests to simulate the bug report's cases:
1) left press button
2) click right/middle key
3) move mouse out of button's boundary
4) test if the released() signal triggered properly
Taks-number: QTBUG-53244
Change-Id: Ifc0d5f52a917ac9cd2df5e86c0475abcda47e425
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
on Ubuntu_16_04 and openSUSE_42_3.
Task-number: QTBUG-64446
Change-Id: If8fff2823f041428852822470a2f00157795558b
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
The vast majority is actually switched to QRandomGenerator::bounded(),
which gives a mostly uniform distribution over the [0, bound)
range. There are very few floating point cases left, as many of those
that did use floating point did not need to, after all. (I did leave
some that were too ugly for me to understand)
This commit also found a couple of calls to rand() instead of qrand().
This commit does not include changes to SSL code that continues to use
qrand() (job for someone else):
src/network/ssl/qsslkey_qt.cpp
src/network/ssl/qsslsocket_mac.cpp
tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Resizing a QTreeeView section with double click or
resizeColumnToContents() does not respect the maximumSectionSize when
the resize mode is Interactive or Fixed. Since the documentation of
maximumSectionSize states that it should honor this property for those
cases either the documentation or implementation is incorrect.
This patch fixes the latter.
Task-number: QTBUG-64036
Change-Id: Ic14c8e444d50b9c50a117efed19d0bca7ec1cf82
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The test showed flakyness on Linux. It has been observed that its
windows overlap. Position the windows beside each other.
Change-Id: I4ff1b9cafaf753a6844b3dfabb576a07f74b396a
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
ultrix and reliant have not seen a release since 1995. dgux not since
2001. bsdi not since 2003. irix not since 2006. osf not since 2010.
dynix... unclear, but no later than 2002. symbian needs no mention.
All considered obsolete, all gone.
sco and unixware are effectively obsolete. Remove them until someone
expresses a real need.
Change-Id: Ia3d9d370016adce9213ae5ad0ef965ef8de2a3ff
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... by moving them in QTestPrivate namespace (qtesthelpers_p.h). This
header file is a convenient staging area for helper APIs, eventually
some could be moved to public QTest API.
This header file utilizes the same pattern as other qtestlib header
files - wrapping functions with QT_${LIBNAME}_LIB to automatically
enable certain APIs based on what is in the projects dependencies,
e.g. QT += widgets.
Change-Id: Ic0266429939c1f3788912ad8b84fc6e0d5edd68b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This test is flaky on Unity due to regression introduced by QTBUG-39362.
Skip the test functions until QTBUG-39362 is resolved.
These test functions do not fail on Gnome and KDE, so the functionality
tested by check_cursorKeys* will be covered by other linux distributions
in CI.
Change-Id: Ifd1a7779a9728142424f4956dd6466c822ccde91
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
If a window is blocked by a WindowModal dialog, it should not be
possible to trigger window shortcuts on that window if it receives
a WindowActivate event.
This currently happens if the blocked window gets clicked, because the
window becomes the active_window and then QApplication sends it a
WindowActivate event (this doesn't happen with application modal dialogs).
The correctWidgetContext() function calls QApplicationPrivate::tryModalHelper()
only if the shortcut context is ApplicationShortcut. This patch makes it
call even if the shortcut context is WindowShortcut.
Change-Id: Iff87d85bcae603a6a24128e0cedfa9d33b6485fd
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>