aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quickcontrols/spreadsheets/Spreadsheets
Commit message (Collapse)AuthorAgeFilesLines
* Examples: Stop using version numbers with QML modulesSze Howe Koh2025-10-281-1/+0
| | | | | | | | | | | | | | | | | | | | | Continues 2d44365f69b9bc946d085c6b149e2ac319700265 and b7f448f8647a9a118cee2d79d446194b20d4b335 * Qt 6.0 enabled and encouraged users to import QML modules without specifying a version number * Qt 6.5 enabled and encouraged users to create QML modules without specifying a version number With this approach, there is little benefit in specifying QT_QML_SOURCE_VERSIONS, especially in an example module that is not consumed by external software. It does not need to worry about compatibility/versioning. Task-number: QTBUG-89033 Task-number: QTBUG-140406 Change-Id: I7f83dc7430180b79b70c75e7ce7b3aef46a028ae Pick-to: 6.10 6.8 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Move SPDX header comment back to the top of the fileFabian Kosmale2025-07-211-1/+1
| | | | | | | | | Amends 728028280a6ed10191a14918b3b87acf8e2bd4d5 Pick-to: 6.10 Change-Id: Id65cca4a2189e798ae99c6997bdcbb0a6df2f786 Reviewed-by: MohammadHossein Qanbari <mohammad.qanbari@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* spreadsheets example: Configure qmllintFabian Kosmale2025-07-181-0/+2
| | | | | | | | | | | | The example is now warning free, so we can configure qmllint to fail if there is any additional warning. This is unfortunately not enforced in CI yet, as the all_qmllint target is (intentionally) not part of the all target; so we don't run qmllint in CI so far. Pick-to: 6.10 Change-Id: Ib179364ac5bda033ad6a2c3d87bc3738a98d1489 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
* spreadsheets example: Fix warnings (and code)Fabian Kosmale2025-07-186-35/+38
| | | | | | | | | | | | | | - Use qualified lookups - Set the ComponentBehavior pragma where needed - There's no implicitRowWidth, use implicitRowHeight - Query styleHints from Application, where it has the correct type, instead of from the global Qt object, where it's only known as QObject (as it needs to provide something even when QtQuick is not available) - Remove unused import Pick-to: 6.10 Change-Id: Ia4ff94aa8f66754d0a374ade7ff6c8cad4329530 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
* spreadsheets: Make HeaderToolBar a regular ToolBarTor Arne Vestbø2025-05-311-54/+47
| | | | | | | | | Which gives us safe area padding automatically. Change-Id: Id8c68f857813740d1b22a19cfe4d1a86520310aa Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* QuickControls: Add vertical and horizontal header view delegatesMohammadHossein Qanbari2025-03-062-62/+49
| | | | | | | | | | | | | | | | | | | | | | Implement QQuickHeaderViewDelegate as the base class for header view delegates, introducing 'headerView' and 'orientation' properties. Separate previous delegate settings into HorizontalHeaderViewDelegate and VerticalHeaderViewDelegate components for Basic, Fusion, and Imagine styles. This change improves the modularity and reusability of header view delegates across different styles. It also allows for more consistent behavior and easier customization of header views. A test suite has been added to verify default property settings and ensure the new components work without warnings. [ChangeLog][QtQuickControls][HeaderView] Add dedicated delegate components for vertical and horizontal header views. Task-number: QTBUG-70326 Change-Id: I8831e77f6909bdae13c3a7262145ab156f63a59a Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Spreadsheets: Fix drag and drop issue after scrolling in table viewMohammadHossein Qanbari2025-01-281-94/+102
| | | | | | | | | | | | | | | | | | This patch fixes an issue with drag and drop functionality in the example, particularly after long scrolling. The problem stemmed from two main factors: - The table view was stealing DropArea events when interactive. - The drop area was positioned behind the table view's contentItem, preventing it from receiving the events. The drop area is now positioned above the table view, ensuring it can receive events during dragging operations. The table view's interactive mode is temporarily disabled when dragging begins and restored to its previous state when dragging ends. Task-number: QTBUG-125767 Change-Id: I8920284f4652464bccd92109a2a9685228e11783 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Spreadsheets: Prevent data loss when dropping cells in invalid locationsMohammadHossein Qanbari2025-01-241-0/+23
| | | | | | | | | | | | | | | | | Before this patch, dropping selected cells into an invalid place in the TableView could result in partial data loss. This occurred because some of the selected data couldn't be set to the new cells, and the data was copied at the start of the drag operation. This patch improves the drag-and-drop functionality by: - Checking the possibility of copying selected data to target cells before the drop occurs (and during dragging). - Avoiding highlighting of invalid target cells during the drag operation. Task-number: QTBUG-125767 Change-Id: Iff1058c2239f4bad3430f4f01ccea619f1ac8773 Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Spreadsheets Example: Use TableViewDelegateMohammadHossein Qanbari2024-11-303-55/+15
| | | | | | | | | This update removes the custom table cell and uses the TableViewDelegate type as the main TableView's delegate. Task-number: QTBUG-114636 Change-Id: Icc2fd121d66f2bd1a6102e8575b75abd46940b96 Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* SpreadSheet: Use SpreadModel to invoke the required mapping functionsSanthosh Kumar2024-11-112-2/+2
| | | | | | | | | | | | The 'model' used when invoking mapColumn/mapRow during section reordering seems incorrect as the model here has been referred to as QHeaderProxyModel and not the SpreadModel. Updated the corresponding qml to refer to the correct model. Pick-to: 6.8 Change-Id: Ia8fe900eb0574319fd4c967b6f85cf8dd11bddd8 Reviewed-by: MohammadHossein Qanbari <mohammad.qanbari@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Spreadsheets Example: Fix hang on dragging header through selected cellsMohammadHossein Qanbari2024-11-071-0/+1
| | | | | | | | | | | | | | | The bug occurred when dragging a column over a selected column cells. The DropArea in TableView attempted to process inconsistent drag data for all the selected cells (up to 1000), causing the application to hang. Fix: Enable DropArea only for dragging TableView cells; disable for other cases. Fixes: QTBUG-130928 Pick-to: 6.8 Change-Id: I162a57638d89b97f3f1ef553850e3be3be389f1d Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Spreadsheets Example: Remove circular dependencyMohammadHossein Qanbari2024-09-103-1/+3
| | | | | | | | | | | | The example fails to compile on some platforms due to an existing circular dependency. To fix this issue, the inclusion of `spreadformula.h` has been moved to the related .cpp files, and a forward declaration is used in the `spreadmodel.h` file instead. Fixes: QTBUG-128272 Pick-to: 6.8 Change-Id: Ic2c589f9126e0ba0eed6ffe5150bacd4afa6d239 Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Spreadsheets Example: Fix Installation and DeploymentMohammadHossein Qanbari2024-08-221-2/+2
| | | | | | | | | | | | | | | After installing the example outside the build directory using `cmake --install --prefix`, the installed application could not run because the Spreadsheet subproject library was not found at runtime. To fix this issue, the Spreadsheets subproject has been added as a static library to the project. Now, it can be found in the installed directory. Fixes: QTBUG-127846 Pick-to: 6.8 Change-Id: I30968afa958ec6bda6017969de157e27550a7616 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Spreadsheets Example: Some improvementsMohammadHossein Qanbari2024-08-175-341/+314
| | | | | | | | | | | | The following changes are applied: - Using ScrollView - Cut action removes the data from the model - Selection handle: smaller size, lighter color and border is used Pick-to: 6.8 Change-Id: Id09c12db5f5c38c2254e1bf81970616e7e84f38d Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Spreadsheets Example: Check if clipboard is supportedMohammadHossein Qanbari2024-07-231-0/+12
| | | | | | | | | | | | | The Spreadsheets example does not build on QNX as it uses the clipboard, which is not supported on QNX. To fix this issue, it checks `QT_NO_CLIPBOARD` macro around the clipboard usage and prints a warning if it is not supported. Fixes: QTBUG-127273 Pick-to: 6.8 Change-Id: Ib677ecd79c216f4e7dde20d82875ee3f492a21ea Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Spreadsheets Example: Fix bug in inserting a new rowMohammadHossein Qanbari2024-07-121-0/+1
| | | | | | | | | | | | | | | | When inserting a new row (above or below an existing row), it was causing a crash. There was a forgotten call of the previous() method on the iterator that was supposed to iterate backward. It has been fixed by adding this function call inside the loop. Task-number: QTBUG-125767 Pick-to: 6.8 Change-Id: I6a4436bacb0348c1b6bccd929f715e36d0279754 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Spreadsheets Example: Separate HeaderViews and TapHandlers as typesMohammadHossein Qanbari2024-07-105-428/+474
| | | | | | | | | | | | | | | | | | The Main.qml file was growing larger due to modifications in header views. To prevent this, the header views have been separated into ColumnHeaderView and RowHeaderView QML module types. Similar to the header views, the tap handlers have been separated into a QML module type to maintain consistent behavior for header views. Additionally, the mouse tap handlers have been merged into a single tap handler to manage mouse events with different combinations of buttons and modifiers. Task-number: QTBUG-125767 Pick-to: 6.8 Change-Id: Ib465b8b631cb8fe2aeeaaea229e2c4985619d2e9 Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Spreadsheets Example: Use TapHandler instead of MouseAreaMohammadHossein Qanbari2024-07-091-42/+80
| | | | | | | | | | | | | | When MouseArea is used for the header views, it blocks events for the column/row reordering event handler. To fix this issue, TapHandler is used instead of MouseArea. With proper configuration of TapHandler properties, the column/row reordering event handler can access events when they're not accepted by TapHandler. Task-number: QTBUG-125767 Pick-to: 6.8 Change-Id: Ie59dfc681bb3d853e0a73a05d46bdcd2607091b0 Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Correct license for example filesLucie Gérard2024-06-271-1/+1
| | | | | | | | | | | | | | According to QUIP-18 [1], all example files should be LicenseRef-Qt-Commercial OR BSD-3-Clause Example takes precedence over build system [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.8 Task-number: QTBUG-121787 Change-Id: Ia60be3cc375a3a16af7e6ea7755a61cfe6e1573b Reviewed-by: MohammadHossein Qanbari <mohammad.qanbari@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Spreadsheet Example: Fix bug in update and minor improvementMohammadHossein Qanbari2024-06-116-15/+51
| | | | | | | | | | | | | | | | | | | | | | | | | If the user drags a column from outside the visible area and drops it into the visible area when the column contains a formula that depends on a visible cell, updating that cell will not update the cell containing the formula. The reason is that the update method in the SpreadModel updates the wrong rows and columns. The visible rows and columns need to be mapped to the model's rows and columns. The improvement is that the update uses a mutex instead of enabling or disabling the connection in the view. However, the blockConnection() function has been kept because some actions need to update a large amount of data in the model, and then the view can be updated without any extra view updates. The pan and reset_reordering icons are updated. The new icons have been designed by the designers. Task-number: QTBUG-125767 Pick-to: 6.8 Change-Id: I20ea1ef0bb777b5b0b04e7ae74df172ffc5b5ed8 Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Spreadsheets Example: some fixes and improvementsMohammadHossein Qanbari2024-06-112-102/+97
| | | | | | | | | | | | | | | | | The HelpDialog is improved by defining an inline component inside it. The column selection issue is fixed by removing the unnecessary margins and rows as well. When the user tries to cut cell data and paste it onto an area including the cell itself, that cell would be deleted because it was a cut action. However, this is not correct because the value of that cell is replaced with the data from the clipboard (mime data) already. To fix this bug, before deleting the data of the cutting cell, that cell should be checked to ensure it is not part of the target cells. Task-number: QTBUG-125767 Pick-to: 6.8 Change-Id: I1adab2c17dab1cf07245bfaed03193904d7d7a2e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Add the Spreadsheet exampleMohammadHossein Qanbari2024-06-0331-0/+2763
The example demonstrates a Spreadsheet that provides adding, editing, and deleting data, and also the ability to write formulas for numeric data. Also, it's possible to select cells, rows, and columns for deleting them or their data, copying or cutting the data, and dragging them to other places. The user can hide columns or rows, and also show them again. Thanks to the reordering API, columns and rows can be reordered and also can be reset to the default order. There is a SpreadModel class which handles the entered data. It only stores the data of the cells that is provided by the user. It means that it does not create any empty data structure for empty cells, in order to reduce memory usage. Task-number: QTBUG-125767 Pick-to: 6.8 Change-Id: I1d9cc5b4b8d902257e9ed508d4a712b0574490f3 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>