Otherwise we can fail to stretch the last section when adding new
sections.
Task-number: QTBUG-52446
Change-Id: I7eb5267ac500bf4246e57c3e3a43268bb65ef1f7
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
As reported by UBSan:
tst_qtreeview.cpp:2187:36: runtime error: downcast of address 0x7ffc15749f20 which does not point to an object of type 'PublicView'
0x7ffc15749f20: note: object is of type 'QTreeView'
Fix by making the test a friend of QTreeView (and, for
Clang, of QAbstractItemView) instead.
Change-Id: I5b748696ab441a91058f4d45a18bd5ed75a6e560
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
As reported by UBSan:
tst_qabstractitemview.cpp:336:23: runtime error: member call on address 0x7ffe6fe96e10 which does not point to an object of type 'TestView'
0x7ffe6fe96e10: note: object is of type 'QListView'
tst_qabstractitemview.cpp:337:5: runtime error: member call on address 0x7ffe6fe96e10 which does not point to an object of type 'TestView'
0x7ffe6fe96e10: note: object is of type 'QListView'
tst_qabstractitemview.cpp:338:23: runtime error: member call on address 0x7ffe6fe96e10 which does not point to an object of type 'TestView'
0x7ffe6fe96e10: note: object is of type 'QListView'
[etc ...]
Fix by making the test a friend of QAbstractItemView instead.
Change-Id: I1a08977042296eb34e9dbdb5c0595662dbd2e5ef
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
As reported by UBSan:
tst_qtreeview.cpp:663:5: runtime error: load of value 4294967295, which is not a valid value for type 'DragDropMode'
Instead of abusing -1 to indicate to not set the dragDropMode,
use a separate boolean field in tha data.
Change-Id: I13e7539c858f3b2462d57d660062ef3cb7aec61b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Extract the common part from QItemDelegate and QStyledItemDelegate
which uses QLocale to convert a value for Qt::DisplayRole to a string.
Use this code to get the text for tooltips and "What's this?".
[ChangeLog][QtWidgets][QAbstractItemDelegate] Show localized detailed
tooltips and "What's this?" texts.
Task-number: QTBUG-16469
Change-Id: I8618763d45b8cfddafc2f263d658ba256be60a15
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
The test was half-ported from Qt 4 and #ifdefed out depending
on WINVER. When it became active, it failed since it queries the window
handle too early in the process.
Move the code sending the message into showEvent() to ensure a window
handle exists and parent the listview properly to prevent a leaking
toplevel.
Change-Id: I74aa9ddfd0e88dd31e9258400fc3e473b6e0d92e
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
The old code sometimes made incorrect selections when rows or columns were
hidden or moved. It used logical top left and bottom right indexes to create a
selection rectangle. However on moved or hidden cells a wrong rectangle was
made. This fix calculates a simple rectangle without hidden cells and makes use
of the row/column select functionality provided by the selection model, to make
the right selection.
[ChangeLog][QtWidgets][QTableView] Fixed a selection bug when rows or columns were hidden (QTBUG-50171)
Task-number: QTBUG-50171
Change-Id: Id186012af26da7b2051ff5eb1c13e6b7494cca77
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
The old code incorrectly calculated visual region for a selection (specified by
QItemSelection object) in case of reordered / swapped rows or columns. It used
the leftmost and rightmost (upmost and downmost for vertical mode) logical
indexes directly. However some middle logical index (in case of reorder) may be
the leftmost or rightmost visual index. In such cases the repainting didn't
work properly. This fix first checks whether reordering / swapping is in use.
If it isn't (ie visual=logical) we use code similar to the old code. Otherwise
the new code scans all selected logical indexes, translates them into visual
ones and gets the correct leftmost and rightmost indexes.
[ChangeLog][QtWidgets][QHeaderView] Fixed a repainting issue when items had been reordered.
Task-number: QTBUG-50171
Change-Id: If6afabebf445cf32a8e0afe262b6ee149e7c4b2b
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Cleaning out the workarounds for the discontinued "Embedded Android"
platform of Boot2Qt.
Change-Id: I0ff9d770e82a43457fb7e5da0428f4597ead4038
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
The most visible problem is that changing selection model didn't update()
the view, resulting in the old selection/current item still being drawn.
In general trigger the handlers for when the selection/current item
changes.
Change-Id: Ib3b2ad70412e6a21a182d4c173e617710bcc630d
Task-number: QTBUG-50535
Reviewed-by: Stephen Kelly <ske@ableton.com>
QListWidget uses a set of slots for its selection model that are
connected only at creation time. This patch adds the missing
connections cleanup and setup when a user changes the selection
model.
Task-number: QTBUG-50891
Change-Id: I942bae6c471ea1ae22637d09b96d6fbd422f653f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The test was made insignificant for Windows in change
f3939d943e. As the failure is not
reproduceable locally, re-enable it. Also split apart the test.
Task-number: QTBUG-51149
Change-Id: I6a06bdf2369bc3bdbc73dfe4fa416e9d644f8b01
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
This also reverts commit 018e670a26.
The change was introduced in 5.6. After the refactoring, 14960f52,
in 5.7 branch and a merge, it is not needed any more.
Conflicts:
.qmake.conf
src/corelib/io/qstandardpaths_mac.mm
src/corelib/tools/qsharedpointer_impl.h
tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
Change-Id: If4fdff0ebf2b9b5df9f9db93ea0022d5ee3da2a4
On OS X, the default scrolling mode of item views should be
per pixel instead of per item. We enforce this through a new
style hint. On all other platforms, the behavior remains the
same.
It's still possible to override the style hint by using the
regular scroll mode setters. Any subsequent style change will
result in a no-op once the setters have been called and until
the properties are reset.
Some auto-tests had to be update to to take the new behavior
into account.
[ChangeLog][QtWidgets][Styles] Added SH_ItemView_ScrollMode
style hint.
[ChangeLog][QtWidgets][Item Views] Item views scroll per pixel
on OS X now.
[ChangeLog][QtWidgets][Item Views] QAbstractItemView::verticalScrollMode
and QAbstractItemView::horizontalScrollMode are now resettable.
Change-Id: I3f923275c99aa4389323b52fc1c5455fe71f8d73
Task-number: QTBUG-50102
Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com>
From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some
exceptions, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/
Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one
(in those files which will be under GPL 3 with exceptions)
Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
In setStretchLastSection we restore a default section size
if we no longer use stretch. That size was however not
sufficient - we should restore the actual size.
Furthermore we should also always stretch the last section
(last visible index) - and not leave a section with a
huge size and stretch another.
This patch refactors stretch handling and keeps track
of the last section and its size in eg. moveSection,
swapSection, hideSection, showSection etc.
There is an auto test showing and guarding its behavior.
[ChangeLog][QtWidgets][QHeaderView] Fixed some issues
(e.g QTBUG-39010) with restoring of section size after
a section is no longer the last visible section
(in stretchLastSection mode).
Task-number: QTBUG-39010
Change-Id: Id47075b5a9dfeb250027374ecbd10eb8babbf9ef
Reviewed-by: David Faure <david.faure@kdab.com>
Move some code (like registrations of meta types) from init() to
initTestCase() in the process.
Change-Id: I57db5156647cfadab554fbed853b2e68b2815f3b
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
The documentation says that we scroll one pixel, but changing the
behavior in 934f062203 to do that
was not well received.
People were relying on the undocumented behavior - and the new behavior
was considered to be a regression. (Nobody called setSingleStep since
Qt in many cases provide a reasonable singleStep - which implied that their
programs scrolled with 1 pixel which was quite slow). Furthermore getting
the old behavior (auto set of single step) was nearly impossible.
However the revert (done in 0e69230d02)
gets us back to QScrollbar::setSingleStep not working in pixel scroll mode
(even without it being documented - but we should also have a working API
rather than documenting that it is not working)
The previous approach was directly prevented Qt from changing
single step (on e.g resize) at all. This patch only prevents Qt from
changing when a user explicitly has called the function
QScrollBar::setSingleStep (in pixel scroll mode).
That is we expect that calls to setSingleStep means that the user actually
wants to set the singleStep and doesn't want Qt to control that value.
Furthermore it is possible to switch back to the automatically adjusted
singlestep with QScrollBar::setSingleStep(-1).
[ChangeLog][QtWidgets][QAbstractItemView] QTBUG-7232 - In ItemViews
when scrollMode is set to scrollPerPixel, it is now possible to
change the single step. Qt will automatically adjust the single step
until setSingleStep is called. When setSingleStep is called it will
however respect the set and stop doing automatic changes of the value.
Calling setSingleStep(-1) will switch mode back to automatic adjust.
Task-number: QTBUG-7232
Change-Id: Ibfe0caa9751d3bcc11bfc6e0654a3d1ac35ac8ae
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
In a QPair, the member names {first, second} have no semantic
value. A simple struct, while not as featureful as QPair, can
be given meaningful member names, {rect, index}, in this case.
Change-Id: If1e289ecee82a1cb020ac3a854efd2ec1096493b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
The platform is no longer supported or actively maintained, and is
in the way for improvements to the Unix event dispatcher and QProcess
implementations.
Change-Id: I3935488ca12e2139ea5f46068d7665a453e20526
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This may result in incrementing an invalid iterator after the
iterator's container has changed. Also, for this to happen,
the view needs to have an active editor.
The reentrant call happens as follows in QTreeView, after the
model adds new rows to the view:
QTreeView::rowsInserted()
QAbstractItemView::rowsInserted()
QAbstractItemView::updateEditorGeometries()
QTreeView::visualRect()
QAbstractItemViewPrivate::executePostedLayout()
QTreeView::doItemsLayout()
QAbstractItemView::doItemsLayout()
QTreeView::updateGeometries()
QAbstractItemView::updateGeometries()
QAbstractItemView::updateEditorGeometries()
Other concrete item view classes may be prone to the same issue.
The fix consists in relayouting the items if needed, which should
trigger calling updateEditorGeometries() again. This doesn't
invalidate previous optimizations regarding item relayouting since
we only force relayouting when it'll be done by visualRect().
Change-Id: Id31507fdc8d9a84d50265298191d690d1a06792b
Task-number: QTBUG-48968
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Use QByteArray/QString addition instead in loops and for
test row names.
Change-Id: Ia067cd966bf13506e6ca19925eae3158da027b83
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
The delegate may be null in QHeaderView.
Task-number: QTBUG-48543
Change-Id: I4d3ba104b0b57431e8765271dc2dc880be096672
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Use character literals where applicable.
Change-Id: I1a026c320079ee5ca6f70be835d5a541deee2dd1
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Calculation was working as long as one didn't use per pixel scrolling.
Task-number: QTBUG-48579
Change-Id: Ie02e28b008c5c81ed45d7dd17fed96148c23b598
Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: David Faure <david.faure@kdab.com>
OldPersistentIndexes store selected items during sort operation. They
were wrongly taken from static list of indexes. This change takes them
from parent (QTableWidget) who maintains the list of selected segments.
Task-number: QTBUG-48408
Change-Id: Ie1bc4071a275dd76d113d883ab30ccd4cb1fa625
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Use case insensitive comparison and static invocation
of QGuiApplication::platformName().
Change-Id: I8c197c7b4f0669f71c019fbcee09a0f03dfab399
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
The test is moved from tst_qtreeview to tst_qtreewidget as it tests
qtreewidget class.
C++ usage is fixed, there was an illegal C cast that was causing crashes
Change-Id: I80e90a9b531e87f9b133186b6f48be42f54901b5
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
The keyword no longer has a meaning for the new CI.
Change-Id: Ibcea4c7a82fb7f982cf4569fdff19f82066543d1
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
- Replace Q[TRY]_VERIFY(pointer == 0) by Q[TRY]_VERIFY(!pointer).
- Replace Q[TRY]_VERIFY(smartPointer == 0) by
Q[TRY]_VERIFY(smartPointer.isNull()).
- Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b) and
add casts where necessary. The values will then be logged
should a test fail.
Change-Id: Ie29640451dddeb58342038a8cd5fac152cce39e5
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
The test showed failures on OS X:
FAIL! : tst_QListView::batchedMode() Compared values are not the same
Actual (ba.size()): 2
Expected (3) : 3
Loc: [tst_qlistview.cpp(848)]
Use QTRY_COMPARE() to count the number of visible indexes with
a helper function instead of using hard-coded timeouts. Item 3
appears with a little delay on OS X.
Change-Id: I2fb2ff5ebdf9dbe85bdc79401375ad6f47b7b12b
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>