Bug 294093 - The header state of some account trees in the application is not correctly restored on Windows
Summary: The header state of some account trees in the application is not correctly re...
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: git (master)
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-14 18:54 UTC by Cristian Oneț
Modified: 2012-02-14 19:02 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cristian Oneț 2012-02-14 18:54:00 UTC
Version:           git master (using KDE 4.8.0) 
OS:                MS Windows

The header state of the account trees in the 'Accounts' and the 'Budgets' view are not restored correctly. 'Categories' and 'Institutions' work fine.

Reproducible: Always

Steps to Reproduce:
See details.

Actual Results:  
See details.

Expected Results:  
See details.
Comment 1 Cristian Oneț 2012-02-14 19:01:31 UTC
Git commit be9d99d447013d27b20f4c0a5c34b7d158deed33 by Cristian Oneț.
Committed on 14/02/2012 at 19:50.
Pushed by conet into branch 'master'.

Explanation (I figured this out by debugging Qt code):
Do this by setting the model of the view *before* the header state is being restored.
This is necessary because in some cases a layout of the items is triggered which causes
the header to ask for the column count from the model which is 0 if the model is not set
and this causes the restored section sizes to be lost after the model is finally set.

M  +1    -1    kmymoney/views/kaccountsview.cpp
M  +2    -1    kmymoney/views/kbudgetview.cpp
M  +1    -1    kmymoney/views/kcategoriesview.cpp
M  +1    -1    kmymoney/views/kinstitutionsview.cpp

http://commits.kde.org/kmymoney/be9d99d447013d27b20f4c0a5c34b7d158deed33
Comment 2 Cristian Oneț 2012-02-14 19:02:39 UTC
Git commit e4e945022196df6e6b51e3f864b939323efba13f by Cristian Oneț.
Committed on 14/02/2012 at 19:50.
Pushed by conet into branch '4.6'.

Explanation (I figured this out by debugging Qt code):
Do this by setting the model of the view *before* the header state is being restored.
This is necessary because in some cases a layout of the items is triggered which causes
the header to ask for the column count from the model which is 0 if the model is not set
and this causes the restored section sizes to be lost after the model is finally set.
(cherry picked from commit be9d99d447013d27b20f4c0a5c34b7d158deed33)

M  +1    -1    kmymoney/views/kaccountsview.cpp
M  +2    -1    kmymoney/views/kbudgetview.cpp
M  +1    -1    kmymoney/views/kcategoriesview.cpp
M  +1    -1    kmymoney/views/kinstitutionsview.cpp

http://commits.kde.org/kmymoney/e4e945022196df6e6b51e3f864b939323efba13f