The quick table view enhanced with row and column reordering feature
(as part of patch 332385ffbf51a9abb03b3abdde1db2a62b6fe25a). This
patch updates the manual test of table view to accommodate row and
column reordering change.
Task-number: QTBUG-100440
Change-Id: I06e19b0a2b39434245133e148534eb3079e1e77f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
If you make a selection with SelectionRectangle and then resize a
row, the selection handles will not move to the resized position.
Likewise, if you do a selection, but then clear the selection
by interacting with the ItemSelectionModel directly, the
selection handles will not be updated to reflect the changes.
To fix this bug, this patch will add a callback from TableView to
SelectionRectangle that can be used to notify when changes are
done outside of SelectionRectangle. This especially allows us to:
- Remove the selection handles if the active selection is cleared
or changed programatically (or anyway not by SelectionRectangle).
- Keep the selection handles, and update their position, when rows
or columns are merely resized.
This change also allows us to clean up qquickselectionrectangle.cpp
a bit, and remove e.g a now superfluous tap handler listener.
Task-number: QTBUG-121143
Pick-to: 6.7 6.6 6.5
Change-Id: Id170520d49bc92c0bb9d16deaba741cab6f5c553
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
According to QUIP-18 [1], all test files should be
LicenseRef-Qt-Commercial OR GPL-3.0-only
[1]: https://contribute.qt-project.org/quips/18
Pick-to: 6.7
Task-number: QTBUG-121787
Change-Id: I26d72e8de04d4c7c57b3b7838af5d033265de5ba
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The size policy of item updated as part of task QTBUG-117597. This
patch update existing examples and manual tests that depends on quick
layout to embrace size policy change.
Task-number: QTBUG-117597
Pick-to: 6.7
Change-Id: I68469a3bba3c4d3e5ed4b6eae0fd765b5206efc0
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
This patch will implement support for setting a
selectionMode. This API mirrors the selectionMode
API in QTableView.
Currently only SingleSelection, ContiguousSelection
and ExtendedSelection are implemented. The last mode,
MultiSelection, is postponed for now since its unclear
which use-case it supports, and also seems to overlap
too much with ExtendedSelection (if holding down Control
modifier). NoSelection is already supported by setting
selectionBehavior to TableView.SelectionDisabled.
[ChangeLog][Quick][TableView] You can now set a selectionMode
in TableView, to control if the user should be allowed to
select single or multiple cells.
Fixes: QTBUG-112836
Fixes: QTBUG-112835
Change-Id: I0f96d9fb68882aededc42d653c861cfd22e3d03a
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
After TableView got support for resizable rows and columns, a
side effect is that any overlay, like the selection handles, will
need to be repositioned when rows and columns are resized.
Currenly the selection handles will instead stay put at the
initial location.
This patch will make sure that SelectionRectangle listens to
the layoutChanged() signal from TableView, and reposition the
handles.
Because the current selection rectangle implementation in
TableView didn't take row and column resizing into account
either, the logic that calculates the rectangle is also
changed. Rather than storing the selection rectangle after
each mouse drag, we now calculate the exact (and updated)
rectangle when queried instead.
Fixes: QTBUG-109448
Pick-to: 6.5
Change-Id: I80171f992bea1035c1410ede384a2d847ee3aa46
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
The first version parented the edit delegate to the content
item of QQuickTableView. This approach, however, turned out
make it really difficult to implement an edit delegate that
relied on the geometry of items inside the tableview delegate.
E.g for a TreeViewDelegate, we would like to show an editable
TextField on top of the label while editing. But only on top
of the label, not the whole delegate (including
e.g the expanded/collapsed indicator). Moreover, we don't want
to hide the whole delegate while editing, only the label that
is underneatch (a possible semi-transparent) edit delegate.
For this to be possible, we therefore need to parent the edit
delegate to the TableView delegate instead, so that the edit
delegate can e.g more easily query the geometry of the items
inside the delegate (like the label) to position its own items
(like a TextField).
Since we also want the developer to then have more control
over which items get hidden, we offer a property:
"required property bool editing" to the tableview delegate.
This can be used to e.g hide items inside the delegate while its
being edited (or to implement other kinds of transitions).
This new solution should also be easier to work with, and
understand, for application developers, since the parent-child
structure now mirrors the location where the edit delegate is
written in QML.
Change-Id: Ieeae28c8297f8bb1fb2d90d152fd575b4f41f36f
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
This patch will implement support for editing cells
in TableView. It enables you to attach an edit delegate
to the tableview delegate, using the attached property
TableView.editDelegate.
The application can initiate editing by calling TableView.edit()
(and TableView.closeEditor()) explicitly, or implicitly by using
edit triggers. The EditTriggers enum in TableView mirrors the
EditTriggers in QTableView (Widgets).
[ChangeLog][Quick][TableView] Added support for editing cells
Fixes: QTBUG-108838
Change-Id: I25df93a7eeabf9d8a4c4c6248e020d8eba6d5bd7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This patch will add support to TableView for resizing rows and
columns by dragging between the cells.
To achieve this, a custom pointer handler (QQuickTableViewResizeHandler)
is implemented. This handler can detect if the pointer is hovering
between the cells, and if the user starts a drag. This information is
used to call out to the new setColumnWidth()/setRowHeight() API for
adjusting the row and column sizes while the user is dragging.
The pointer handler is careful to make sure that you can only start to
resize by dragging _between_ the cells. If the drag starts elsewhere, the
solution will fall back to normal contentItem dragging/flicking instead.
Resizing is off by default. The user can enable it by setting the
resizableRows/resizableColumns properties. In addition, an API that
lets you query the state of the resizing has been added.
[ChangeLog][Quick][TableView] Added resizableColumns and
resizableRows properties to enable resizing by dragging between cells.
Change-Id: I05d4170f30b8c6461a5877c2b831a1ab044d2b5b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.
Existing copyright statements remain intact
Task-number: QTBUG-88621
Change-Id: I72c89a98c42bbc9234d8495e9e503bec81d11037
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.
Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The source model in the selection model will always need to be
the same as the source model in TableView. So TableView
might as well forward its own model to the selection model, so
that the user don't need to worry about setting the model
explicitly. The same is also done in QTableView.
Still, it's always possible to force (perhaps by accident?) the
two models to be different. To avoid confusion, we choose to
print a warning if that happens.
Change-Id: I9fec1d3de4cfe83cf28950ebdedd38a010df16a3
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This avoids the need to run qt-cmake-standalone-test and then import
the test, as described in QTCREATORBUG-25389.
Task-number: QTBUG-93020
Pick-to: 6.2
Change-Id: I7e0685aff91e82fc834b91b08878d48ba21fba9b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Tweak the abstracttablemodel manual test so that can
select table cells. And enhance the look and feel in
the same go.
Pick-to: 6.2
Change-Id: Ia1f2544fde26d24e7761f2eb0c96e1194e6a644f
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Remove all qmake project files, except for examples which are used to
test that qmake continues to work.
Change-Id: Ic4abb72dc2dcd75df7a797c56056b6b3c5fe62ac
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Modify special case locations to use the new API as well.
Task-number: QTBUG-86815
Change-Id: I3b964e3baf0cc7040830156dac30358ea1152801
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
An old, unused, model was just lying around in the code. And the
buttons in the test was modifying it. But after introducing the
syncView concept in 5.14, all the TableViews in the test got their own
separate model. So fix up the test to work as it should with the new setup.
Change-Id: Ic3e6e3013186ef1c2998566b84b3b94e809296e8
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
All tests compile and run on a developer build.
These tests are failing:
tst_qqmlsqldatabase Fails due to missing sql driver
tst_qqmlsqldatabase Fails in wip/qt6
tst_ququicklayouts Fails in wip/qt6
tst_flickableinterop Fails in wip/qt6
tst_qquickpinchandler Fails in wip/qt6
tst_qquickflickable Fails in wip/qt6
tst_qquickgridview Fails in wip/qt6
tst_qquickimage Fails due to missing jpeg plugin
tst_qquicklistview Fails in wip/qt6
tst_qquicktext Fails in wip/qt6
tst_qquickcanvasitem Fails in wip/qt6
tst_scenegraph Fails due to missing jpeg plugin
tst_TestFiltering Fails in wip/qt6
Change-Id: I4b9d69c118e23c095cb72ad5a67653fc30943bb1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Add some more TableViews and buttons that can
be used to test the new syncView functionality.
Change-Id: I0ad649598ef2ff08487c9a0b450861c27535c62c
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Add buttons for adding and removing rows and columns
Change-Id: I8d391db4f61ff4ec4273adc7134bd30ffc73fa3c
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
TableView is now ready for Qt-5.12. The only thing missing
is documentation, which is currently being written, and on the
way. So remove the temporary labs plugin that used to register
TableView, and register it together with the other QtQuick items.
Change-Id: I7f360eac3934d228904a4133363e336afe0c451a
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Improve the test so that you can click on
the cells to change their color.
Change-Id: Ia74620894f2885242f587c4c863bcf3544b13488
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
As discussed during API review, remove cacheBuffer from the public API.
The cache buffer was a feature inherited from ListView to avoid loading
a lot of items (and affect performance) when the user started to flick.
But now that TableView has support for reusing items, the point of the
cache buffer is more or less gone. At least we choose to remove it from
the public API until we have better understanding if this is really needed.
Note that the cacheBuffer still plays a small role internally, so we
don't remove it from the implementation. We want to preload an extra row
and column for reuse at start-up, since you often cannot reuse the first
row and column during the first flick (they will still be visible
on the screen).
Change-Id: Ie62835a04ac29a84c9a76151b73fe2f75d9ae844
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
The attached properties TableView.cellWidth/Height were added
for corner cases where you couldn't set/override implicit size
for a delegate item. But now that we have added rowHeightProvider
and columnWidthProvider (and we know that we're going to offer a
broader API to set row/column size from a HeaderView), you have
a way out for those cases as well. So lets remove the attached
properties until we know for sure if they will be needed.
Change-Id: I7d20fb02c36aebd3f24964630ccb68d4c813e93e
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
TableView.row and TableView.column is no different from the row
and column properties that are injected into the context from the
model classes. So just remove them to not bloat the API.
This attached properties where added at an early stage where we
thought that it should be possible to set a different row and
column count on the view than compared to the model (to e.g to
"fake" a table layout when just assigning an integer as a model).
Also, we consider supporting right-to-left etc, where we might
end up with cells that have a different row/column in the view
compared to where the cell is in the model. If we decide to
do this later (not for the first release), we can consider
adding the attached properties back again at that point.
Change-Id: I588a45913b968db789978339bc9a63cd2ccfad49
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This is logically more correct since TableView will override
width / height anyway to make the delegates fit into the table if
they are not as wide/tall as the widest column/row.
And it gets even more problematic when we recycle delegates, since
in that case we need to keep the original width binding of the
delegate to calulate the size of new columns. And this all
fits better by using attached properties instead.
Change-Id: Ia5f2acd2bfc45f3fb160c3782191ad8da9f780e6
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
This patch will add three new manual tests for testing
TableView. The first uses a standard ListModel; the second
uses a custom QAbstractTableModel. The third is a port
of the storageview example in widgets.
Change-Id: Ic8ac1aaf9951d0e2982f512b570caa059a212a17
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>