From 13c57d0f68cffb139311e8e22a074099eb28a88f Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Tue, 28 Feb 2012 22:42:02 +0100 Subject: QSqlTableModel::isDirty(): new overloaded method Checks if model has any changes to submit. Includes new test covering isDirty(index) as well the new overloaded function. Task-number: QTBUG-3108 Change-Id: I0ccbda45d5d9f06434cf1e1c037a9efb76d0cc37 Reviewed-by: Honglei Zhang --- dist/changes-5.0.0 | 3 +++ 1 file changed, 3 insertions(+) (limited to 'dist') diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0 index ba1adde6c0..80ea702b76 100644 --- a/dist/changes-5.0.0 +++ b/dist/changes-5.0.0 @@ -420,6 +420,9 @@ done after committing. This includes deleted rows which remain in the model as blank rows until the application calls select(). Instead, selectRow() is called to refresh only the affected row. +* QSqlTableModel::isDirty(): New overloaded method to check whether model +has any changes to submit. QTBUG-3108 + **************************************************************************** * Database Drivers * **************************************************************************** -- cgit v1.2.3 From b64426248d2212eb59535b2ca383d30fdb5e1c7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Sat, 3 Mar 2012 06:05:54 +0100 Subject: QHeaderView - renaming functions in Qt5 This patch renames the functions in Qt5 according to the notes. It also renames resizeMode to be consistent. The old functions are both marked with both QT_DEPRECATED and '### Qt 6 - remove' All usage of the function within the qtbase are also changed to use the new functions. Change-Id: I9e05fa41d232e9ca43b945fcc949987017f3aedd Reviewed-by: Stephen Kelly --- dist/changes-5.0.0 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'dist') diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0 index 80ea702b76..3bc23c810a 100644 --- a/dist/changes-5.0.0 +++ b/dist/changes-5.0.0 @@ -352,6 +352,22 @@ QtWidgets the proper Qt API: due to the version bump, QStyle will try to use the additional QStyleOption members, which are left default-initialized. +* QHeaderView - The following functions have been obsoleted. + + * void setMovable(bool movable) - use void setSectionsMovable(bool movable) instead. + + * bool isMovable() const - use bool sectionsMovable() const instead. + + * void setClickable(bool clickable) - use void setSectionsClickable(bool clickable) instead. + + * bool isClickable() const - use bool sectionsClickable() instead. + + * void setResizeMode(int logicalindex, ResizeMode mode) - + use setSectionResizeMode(logicalindex, mode) instead. + + * ResizeMode resizeMode(int logicalindex) const - + use sectionResizeMode(int logicalindex) instead. + QtNetwork --------- * QHostAddress::isLoopback() API added. Returns true if the address is -- cgit v1.2.3 From f6ca63f896b5f9a330ff497aebff6943653dc35d Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Tue, 28 Feb 2012 23:41:31 +0100 Subject: QSqlTableModel::setData()/setRecord(): fix incorrect row For OnFieldChange and OnRowChange, before submitting new changes, setData() and setRecord() attempt to submit pending changes and revert them upon failure. However, they fail to consider that reverting pending insertions removes rows from the model. As a result, the new change can be applied to a row higher than intended. One possible solution would be to adjust the targetted index for the removed rows, so that the intended row is affected by the new change. But this still causes the strange editing experience as rows jump up just as they are being edited. It does not seem right in the first place for the model to initiate reverting changes. It should be up to the application to decide what to do when data cannot be committed. In particular, setData() and setRecord() should not have the side effect of reverting already pending changes. The chosen solution is simply to refuse new changes that don't make sense for the edit strategy. For OnFieldChange, flag() will indicate read-only when editing is blocked by a pending change. Since setData() and setRecord() submit data immediately for OnFieldChange, it no longer makes sense to resubmit changes automatically before a new change. For OnRowChange, setData() keeps the behavior of automatically submitting a pending row before starting on a new row. This is historical behavior and is probably motivated by the fact that QTableView does not automatically call submit() when editing leaves a row. The obvious shortcoming of this is that the last row to be edited will not be submitted automatically. It also prevents us from flagging rows other than the pending row as read-only. For OnRowChange, setRecord(), being row-oriented by nature, should submit the change immediately rather than waiting for the next call to setRecord(). This makes setRecord() consistent with insertRecord(). Change-Id: Icb4019d8b7c53a7ee48f8121a7a525e8bc35d523 Reviewed-by: Honglei Zhang --- dist/changes-5.0.0 | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'dist') diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0 index 3bc23c810a..c85749f2eb 100644 --- a/dist/changes-5.0.0 +++ b/dist/changes-5.0.0 @@ -420,6 +420,7 @@ ignore the rest of the range. map were simply ignored. -For OnManualSubmit, insertRecord() no longer leaves behind an empty row if setRecord() fails. + -setRecord() now automatically submits for OnRowChange. * QSqlQueryModel::indexInQuery() is now virtual. See QSqlTableModel::indexInQuery() as example of how to implement in a @@ -439,6 +440,12 @@ selectRow() is called to refresh only the affected row. * QSqlTableModel::isDirty(): New overloaded method to check whether model has any changes to submit. QTBUG-3108 +* QSqlTableModel::setData() and setRecord() no longer revert pending changes +that fail upon resubmitting for edit strategies OnFieldChange and OnRowChange. +Instead, pending (failed) changes cause new changes inappropriate to the +edit strategy to be refused. The application should resolve or revert pending +changes. + **************************************************************************** * Database Drivers * **************************************************************************** -- cgit v1.2.3 From 3d7cec6577fa32fb6036b346db57c53e38ea2ffd Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Wed, 29 Feb 2012 01:51:23 +0100 Subject: QSqlTableModel: disallow insert if changes are pending For OnFieldChange and OnRowChange, inserting rows should not be allowed if there are pending changes in cache. Change-Id: Ia794332959a35a1de87e798ba1a74ace3dfae68f Reviewed-by: Honglei Zhang --- dist/changes-5.0.0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dist') diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0 index c85749f2eb..e10f0df195 100644 --- a/dist/changes-5.0.0 +++ b/dist/changes-5.0.0 @@ -444,7 +444,7 @@ has any changes to submit. QTBUG-3108 that fail upon resubmitting for edit strategies OnFieldChange and OnRowChange. Instead, pending (failed) changes cause new changes inappropriate to the edit strategy to be refused. The application should resolve or revert pending -changes. +changes. insertRows() and insertRecord() also respect the edit strategy. **************************************************************************** * Database Drivers * -- cgit v1.2.3 From 108748404beb607538ea965a21fa932d275eecdd Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Tue, 13 Mar 2012 01:28:35 +0100 Subject: QSqlTableModel::setData(): no longer autosubmit for OnRowChange The model can never do a good job of knowing when user moves to a new row in the view. Faking it by detecting when another row is changed was not a good solution because it cannot detect when the last edited row is left. Either the view should automatically submit when the user leaves a row or the application should provide a way to submit. This change made it possible to reuse the logic of flags() in setData(). Change-Id: I2550e5b113bceba1a852fc21203babeca07c5748 Reviewed-by: Honglei Zhang --- dist/changes-5.0.0 | 2 ++ 1 file changed, 2 insertions(+) (limited to 'dist') diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0 index e10f0df195..ebe8ad5331 100644 --- a/dist/changes-5.0.0 +++ b/dist/changes-5.0.0 @@ -446,6 +446,8 @@ Instead, pending (failed) changes cause new changes inappropriate to the edit strategy to be refused. The application should resolve or revert pending changes. insertRows() and insertRecord() also respect the edit strategy. +* QSqlTableModel::setData() and setRecord() in OnRowChange no longer have the +side effect of submitting the cached row when invoked on a different row. **************************************************************************** * Database Drivers * **************************************************************************** -- cgit v1.2.3 From 26450fe6a6340b09b1e3fa49c35028aa15ef223f Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Thu, 15 Mar 2012 11:23:27 +0100 Subject: QSqlTableModel::removeRows() enforce edit strategy For OnFieldChange and OnRowChange, we don't want more than one row in the cache with uncommitted changes. This could happen if deletion in the database fails while other changes are pending. Chosen solution is to return false if other rows have pending changes. Also, we only allow 1 row removed at a time. Updated test, changes and documentation. Change-Id: I68baf6d221789b4754e891535070011c759a2155 Reviewed-by: Honglei Zhang --- dist/changes-5.0.0 | 3 +++ 1 file changed, 3 insertions(+) (limited to 'dist') diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0 index ebe8ad5331..03dc414e7f 100644 --- a/dist/changes-5.0.0 +++ b/dist/changes-5.0.0 @@ -413,6 +413,9 @@ model methods setData() or setRecord(). before doing anything. Previously, it would remove what it could and ignore the rest of the range. +* removeRows(), for OnFieldChange and OnRowChange, allows only 1 row to be +removed and only if there are no other changed rows. + * setRecord() and insertRecord() -Only use fields where generated flag is set to true. This is is consistent with the meaning of the flag. -- cgit v1.2.3