| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The current logic was based on the idea that if both rowHeight-, and
columnWidthProveders were set, we didn't have to relayout the items
at the end of a rebuild. Because in that case, the row and column sizes
would already be correct after the initial load.
This assumption turns out to be false, because the providers are
allowed to return -1 to signal that the size of a row or column should
use default values (meaning, calculated by TableView). And for those
cases, we need to do a relayout at the end of a rebuild.
Fixes: QTBUG-77074
Change-Id: I0e0f2fdca1cfa9e98f2a0a2b227c3715c16a70f9
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| | |
Change-Id: Ib8417729d439cf0c638dae7a43025aa315406793
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/qml/jsruntime/qv4value_p.h
src/qml/qml/qqmlmetatype.cpp
src/qml/qml/qqmltypewrapper.cpp
src/quick/items/qquicktableview.cpp
Change-Id: I684f8e01a711580512848bf1253f39b39fcbf4c7
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
forceLayout is user invokable. If it's called before columns are loaded
our call to firstColumn call QMap::firstKey will assert/crash.
Insertion of columns later will trigger a layout.
Change-Id: Id102e3ab4756ddd3f433037783dc70e1b29101c8
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
There are now three mechanisms in TableView that works together to
ensure that the table ends up edge-to-edge with the content view. They
are applied in the following order:
1. Adjust the content size, based on the predicted size of the table.
2. Adjust the origin and endExtend on the fly, if the content size is wrong.
3. Move the table directly to where it should be, in case we don't have
time to wait for the origin to change.
We could have, strictly speaking, setteled with just one of them, but choose
to use them all at the same time for best flicking experience. Still, 1. and
2. sometimes step on each others feet when they both detect that something is
a bit off, and adjust.
So rather than adjusting the size of the content view every time we load a
new row or column, we just keep the first prediction. And then we leave all
later ajustments to 2. and 3. This turns out to be a more stable, and will
avoid some glitches that occur when flicking using a scrollbar, if several
mechanisms kick in at the same time.
Change-Id: Ib551a0bf8f6ee59ac9b3556b9462c91adb9cc80b
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We set the size of the content view to be the size of the complete
table. The problem is that the exact size will always be just
a prediction, since we would otherwise need to iterate over all rows
and column up front, to be able calculate the exact size.
This is not acceptable when using non-trival table models.
A side effect of this, is that is will be possible to flick the
viewport further out than the actual end of the table, if the
content view turns out to be larger than the table itself. From
before we used to just move the whole table back into the viewport
when that happened, which could be seen as a sudden jump of the
table to a new position.
This change will improve this logic so that we can avoid most
visual jumps. Instead of moving the table around, QQuickFlickable
supports moving the origin instead. So when we see that the
table is not in sync with the content view, we simple move the
origin to the edge of the table. The effect is that any flicking
or ongoing momentum animation in QQuickFlickable will continue as
if nothing happened. This is also the same logic used by QQuickListView.
Change-Id: I6060b7e84b9489c8fa569e6ff41b958e3871f8e7
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When moving contentX/Y, we also need to ensure that the viewport rect
reflects the change. Otherwise we'll end up loading rows and columns
somewhere else then under the viewport.
Change-Id: Ifbd3d66b9b3a822414aefde9b5bd088274dfa2ad
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When we know the exact size of the content view, we can take advantage
of this to calculate the exact average cell size. This in turn will
improve the positioning of rows and columns whenever we need to
rebuild, since we have a better idea where they should end up in
the content view.
Change-Id: I46c3e87eb38ab032df7c28b6144d1b2de1b9d4ef
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
It was only called from one place. And we can optimize
it a bit by moving the contents to the caller. Besides, stray
relayouts without rebuilding (RebuildOption::LayoutOnly)
is no longer allowed.
Change-Id: Id63bd2d71969b81ea999caa9d4d331abf8999704
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Since different tables can have different sized
models, it can also happen, as the views are being flicked
around, that some views temporarily end up with no
visible rows and columns in the viewport. When that
happens, we continually check if the columns should
become visible again, and if so, schedule a rebuild.
Change-Id: Ic84e47fd5d7968c1f1408eb122e38fa841e7aec7
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
content view
Calling the base class implementation of fixup might move the content
view and start animations etc, which will cause glitches. So ensure
we don't do this when we adjust the content size internally.
Change-Id: I214a6ae2da0c21fd733ea884bccb5e77fc554615
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| | |
Change-Id: Ib2f195780415836ebb03c151a6586fd7b0fb77b8
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The model types are not part of the core QML runtime and should only be
loaded if you explicitly import them. We cannot enforce that in Qt5 as
some of them are available from the QtQml import, but we can change it
in Qt6.
Change-Id: I1e49e84d748e352537ec2d4af901c034c91d038f
Reviewed-by: Erik Verbruggen <erik.verbruggen@me.com>
|
| |
| |
| |
| |
| |
| |
| | |
Used to store columnWidths and rowHeights.
Change-Id: Id66fba9de05afa2c4df15761fb004b4f046fe103
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If you put two tables inside an async loader, with one being
the syncView for the other, the syncView child will start
loading items async simultaneously with the syncView.
This is unnecessary, and steals loading resources, since
the child will have to rebuild anyway once the syncView has
completed loading. So return early from the recursiveUpdateTable
call before handling the children if we detect that the parent
is not done.
Change-Id: I8c0badaf3cfa3a353a650e5f38f381bf9a7b98f9
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
calculateTopLeft() takes care of finding which cell should be
the 'corner stone' that needs to be loaded first when doing
a rebuild. When we have a syncView, the top left cell should
match the top left cell of the syncView, so the logic needs
to change quite a bit to take this into account.
Change-Id: Ia0b621a3155bbd113fa37c2ed585f16627d46443
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Now that several table views can stay in sync through the
syncView parent-child chain, we also need to ensure that the
position of the content views stays in sync. This patch will
recursively go through all connected views when one of the
views are moved and set the same position on them all according
to the syncDirection flag.
Change-Id: I5a5b8e795426484eeab3771f6c8d4c9b7da046eb
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Now that a TableView can be inside a syncView hierarchy, we
cannot update a table in isolation, but need to coordinate
this with the other views. It's especially important that
we update a parent syncView before a child syncView, to
ensure that the parent has calculated all the necessary
columns width and row heights. For that reason, we always
update the table views starting from the top.
Change-Id: Iba8ae7d28fa0bb2fbbad9f8fc7aa198e15b91872
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Ensure that properties that has to do with the layout
stays in sync with the syncView. This is currently
rowSpacing, columnSpacing, rowHeight, columnWidth,
contentWidth and contentHeight.
Change-Id: I5af29d7be6c30cefbfa7d2353f53359907c9405b
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Make two sub-sections: C++ and QML
- Add a TableModel example to the QML section
Change-Id: Ib391b4c0a78e11f5130944b6ac99e20a5982a453
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This property can be set to point to another TableView.
If set, this TableView will be synchronized to the
other table with respect to flicking, column width, row
heights, spacing, etc. This logic is needed as a foundation
for the upcoming HeaderView.
Upcoming patches will implement this logic (together with
autotests) gradually.
Change-Id: Ic7dea8e1d1aa46bbb3ea6e795953a65c96c25cc6
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| | |
Change-Id: I5e7b5b261d3ba28fbbf345f2fc3f086d87112a2d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Rather than handle relayouts differenty than rebuilds, we
can make it a part of the rebuild structure instead, since
they overlap a lot. That way we can collect everything
that needs to be updated into a single variable (rebuildOptions).
This will simplify the upcoming work for synchronizing tableviews.
Change-Id: I8bb2638612c86194a854e6fefc998eae22357a7a
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We already have the variable 'scheduledRebuildOptions'. When this
is set to something else than RebuildOption::None, it means
that a rebuild is scheduled.
Change-Id: I85cde5c45eba15023cd389ebb0ba86f9d58835ae
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Clarified that contentHeight and contentWidth define the size
of the table but not the view's. The view's width and height defines
the size of the viewport, while the contentWidth and contentHeight
defines the size of the table based on the size of the data model.
Change-Id: I17aa84d7e7efcb9369f96ff3b1206e9965015c8f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
|
|/
|
|
|
|
|
|
|
| |
- Promoted TableModel as another alternative
- Added \readonly commands
- Minor edits
Change-Id: Iaa1a320daa8b9afb17ace4273fdc33ca35b9c59c
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|\
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/qml/compiler/qv4codegen.cpp
src/qml/animations/qsequentialanimationgroupjob.cpp
Change-Id: I8b76e509fd7c8599d4cef25181d790ee28edab54
|
| |
| |
| |
| |
| | |
Change-Id: I0e08820a6d25996fe27118f05214ff63d695d24e
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
|
|\|
| |
| |
| |
| |
| |
| | |
Conflicts:
tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
Change-Id: If3bf1abc23a59c458be0bb862d92f2edcb16b79f
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Tag the new 'row' and 'column' properties with revision 12.
This will make sure that they cannot be accessed by the delegate
unless the QQmlAdaptorModel has the correct minorVersion set.
Fixes: QTBUG-70031
Change-Id: I49e67c37ab5b7925c7bca313bbb99f04d1387cc4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
After the call to the application, we check the return value
and adjust it if it's e.g NaN. And we need to cache the
adjusted value, not the raw return value, otherwise the
getColumnWidth()/getRowHeight() functions might return different
values on subsequent calls.
Change-Id: I7f3134f599b9863641132811ab7d5883cc02857b
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Otherwise, if we're unlucky, it's the stored column in the cache that
changes visibility. And unless we clear the cache, we'll not detect it.
Change-Id: I0933a7d6cd3056d7d3883bd032ea5f8fa048402e
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This patch will add support for hiding rows and columns to TableView.
You can now hide a column by returning 0 width for it from the
columnWidthProvider. The same can be done to hide a row (by using the
rowHeightProvider). If you return NaN or negative number, TableView
will fall back to calculate the size of the column/row by looking at
the delegate items, like before. This to make it possible to hide
some rows/columns, without having to calculate and return the heights
and widths of the other rows and columns.
[ChangeLog][QtQuick][TableView] Added support for hiding rows and columns
by setting their size to 0 from the columnsWidthProvider/rowHeightProvider.
Change-Id: If9e1a8db91e257d36cb2787bab4856e6201456ac
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
TableView keeps track of which rows and columns that are loaded
at any point by using a QRect called "loadedTable". loadedTable
basically describes the top-left and bottom-right corner of the
table that has been loaded (which also is what ends up visible
on screen).
But now that we prepare for making it possible to hide rows
and columns, using just a QRect becomes to simple. A rectangle will
only tell what the edges of the table are, but not if any of the
rows and columns in-between are hidden and therefore not loaded.
So a QRect(0, 0, 10, 10) will give us the impression that we have
10 visible columns on screen, but in reality, we might have a
lot less.
This patch will change this to instead use two QMaps to record
loaded rows and columns. This will make it much more easy
to deal with hidden rows and columns in upcoming patches. We
use a QMap instead of a QHash/QSet to keep the list of columns and
rows sorted, since we frequently still need to know the edges of
the table, like before.
Change-Id: I45736485c67042403b095e73b5f2effa411281d0
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|\|
| |
| |
| | |
Change-Id: Ie977b1998eba8c9aa8582a96132bf1aa0ec55ca4
|
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes building with gcc 4.8.4
Change-Id: I61810102bba20c21321112c63e7197bbe05ec27d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Michael Brasser <michael.brasser@live.com>
|
|\|
| |
| |
| | |
Change-Id: I85be5e6ef173fa733d7febd3209164bb31762e0d
|
| |
| |
| |
| |
| | |
Change-Id: Iebd325afcfc0e892f970d450b59e0249d1fcb83f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Make destructors explicitly override and virtual.
Make QQuickTableView's setModel/model virtual, so that can be
overridden for derived classes.
Change-Id: Ieabc9add74a4725653a84b39f7e4c00c18a89f1d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
|
|\|
| |
| |
| | |
Change-Id: I939b8ddc8b24e9c9853a72eb22da317023c7a2c4
|
| |
| |
| |
| |
| |
| |
| |
| | |
Ensure we rebuild the table when the model emits 'layoutChanged'.
Fixes: QTBUG-71140
Change-Id: I70dac897830bf5a12ae6987920e388743fd358a1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
|
|/
|
|
|
|
|
| |
add constructor QQuickTableView::QQuickTableView(QQuickTableViewPrivate &dd, QQuickItem *parent)
Change-Id: I60de6d907d3c28d5857e81c0f362a093e683046c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
VisualDataModel, VisualDataGroup, and VisualItemModel
are replaced with DelegateModel, DelegateModelGroup, and ObjectModel
respectively (since 7cad0e52c5a020bd29635e9912fd8946a6b48124), so
shouldn't be mentioned anymore, in preparation for removal.
Task-number: QTBUG-37725
Change-Id: I9a01ec8db748f817efca638383b7a278c7b562cd
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When flicking, the current implementation would load and unload
edges around the table until the new viewport was covered. The downside
of that strategy is that you if you move the viewport a long
distance in one go, you will need to load and unload edges hidden
outside the viewport until it catches up with the new viewport. It gets
even worse if you flick with a scrollbar, since then you can end up
flicking thousands of rows in one go. And this will keep tableview
busy loading and unloading edges for a "long" time.
This patch will fix this issue by checking how much the viewport
changes during a flick, and select a strategy based on that. So if the
viewport moves more than a page (which is the size of the viewport), it
will schedule a rebuild of the table from the viewports new location,
rather than trying to load and unload edges until it catches up.
Fixes: QTBUG-70704
Change-Id: I88909e118ec0759a7b7a305c19ccc6670af6263b
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
We preload delegate items when the table is built from scratch to ensure
that we have enough items in circulation before the user starts to flick.
But when we only rebuild a section of the table after e.g adding or removing
rows, we already have enough items in circulation. So only preload when
building for RebuildOption::All.
Change-Id: I96aa9518e8032ecaba25f92fe6a0fbf17ea34c7d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|
|
|
|
|
|
|
|
| |
The latest version of QtCreator is detecting issues in the code
that the compiler doesn't warn about. This patch will fix those
issues.
Change-Id: Iab6a75196161ab253f0590929d3722bec5ea4b31
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
componentComplete() is called on us after all static values
have been assigned, but before bindings to any ancestors
have been evaluated. Especially this means that if our size
is bound to the parents size, it will not be ready at that point.
Since we cannot build the table without knowing our own size, we
waited for the updatePolish() call before we started to build
the table.
The problem with that strategy, is that any asynchronous loaders that
TableView might be inside would already be finished by the time
we received the updatePolish() call. The result would be that we
ended up loading all the delegate items synchronously instead of
asynchronously. (As soon as a loader has finished loading the initial
item, async loading will no longer be used).
This patch will therefore add a componentFinalized function that gets
called after all bindings have been evaluated, but before the loader
has finished. When receiving this call, we load the delegate items (and
build the table).
A nice side effect is that the table will also be ready
by the time Component.onCompeted is emitted to the QML
app. This means that e.g contentWidth/Height has valid values.
Change-Id: Ief92d2fecfaea54f6191da116ed4ba79cc673b01
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Doing (silly) things in the delegate, like:
Component.onCompleted: TableView.view.delegate = null
will lead to a crash. The same if you change the model.
The reason is that you end up changing the model
while e.g a row is half-way loaded. Information needed for
building the row, like model size, will then be invalid.
To protect against this, we insert a "sync" phase to the
code that takes any such changes into effect at a time
when we know it's safe to do so.
Change-Id: I85a992dfc0e04ec6635b10c9768a8ddc140e09da
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Flickable::fixup() will be called from Flickable::componentComplete().
fixup() is a virtual function that subclasses can override to e.g
ensure that cells snap to grid etc (which is not yet supported by
TableView). The default implementation will check if the assigned
contentX/Y is within the current content item size, and adjust it
back to 0,0 if not. The problem is that during componentComplete(), the
table has not yet been built. And we don't want Flickable to reset
any assignments to contentX/Y until that has happened. So override the
function and block it from doing any adjustments before the table has
been built.
Change-Id: Id6c5a3b5f053f71bf1854573cd5b9dc3ecc9f246
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a rebuild is scheduled, calling updatePolish() directly (which
is just an optimization) will rebuild the table there and then. But
we don't want this to happen upon a callback from viewportMoved(),
since rebuilding the table will usually also change the geometry of
the viewport/contentItem, which can easily trigger binding loops
back to the place that made the viewport move in the first place.
At the same time, we don't want to impose the same limitation when
calling updatePolish() from forceLayout(), since that function is
always called explicit from the application. And any binding loops
caused by it can as such be avoided by the developer.
This patch will therefore remove the common updatePolishIfPossible()
function, and move the logic for when to call updatePolish back
to the calling locations.
Change-Id: I845b9469c61735d27fc28ebe9f7b254d5a9b2efd
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|