Make view columns user selectable
ClosedPublic

Authored by wojnilowicz on Jul 27 2017, 6:46 PM.

Details

Summary

Purpose of this patch is to speed up set up of accounts model. It involves deduplication of data loaded into model, configuring columns to be displayed and deferring load of data.
Changes:

  1. Context menu per view for selecting columns to be displayed. Views can have different columns set. If column isn't displayed in any view, then it is released from AccountsModel thus freeing resources.
  2. During KMM start only Account column is loaded. The rest is loaded on demand.
  3. Signals for views using KMyMoneyAccountTreeView are connected in ctors of those views, so no need for proxy signals.
  4. KAccountsView is loaded on demand just like other views.
  5. Signals blocked in AccountsModel::load to not emit lots of dataChanged signals.
  6. AccountsModel::loadPreferredAccount for copying preferred account and not recalculating it from the beginning.
  7. QStandardItemModel::setChild instead of QStandardItemModel::setData(index, value) to lessen overhead.
  8. AccountsModel::setAccountData takes minimal arguments needed for correctness.
  9. AccountsModel::setAccountData can update data selectively thus shortening time to update.
  10. AccountsModel::Columns::*DisplayRole are useless (There is already Qt::DisplayRole), so they were removed significantly.
  11. AccountsModel::Columns::Account used instead of 0 for correctness.
  12. KMyMoneyView::slotNetBalProChanged deduplicates common code from views using KMyMoneyAccountTreeView

Diff Detail

Repository
R261 KMyMoney
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
wojnilowicz created this revision.Jul 27 2017, 6:46 PM

Fulfills wish 315747.

tbaumgart requested changes to this revision.Jul 28 2017, 7:19 AM
tbaumgart added a subscriber: tbaumgart.
tbaumgart added inline comments.
kmymoney/views/newspliteditor.cpp
203

Can't we simply add a new addAccountGroups(QContainer<MyMoneyAccount::_accountType) member to the model? That would simplify the many identical constructs of that loop even more.

kmymoney/widgets/kmymoneyaccountcombo.cpp
240

Account column must always be column zero as only column 0 can carry the hierarchy.

kmymoney/widgets/kmymoneyaccounttreeview.cpp
175

Brace should be on separate line here

This revision now requires changes to proceed.Jul 28 2017, 7:19 AM
wojnilowicz marked 3 inline comments as done.Jul 28 2017, 5:43 PM
wojnilowicz added inline comments.
kmymoney/views/newspliteditor.cpp
203

Good idea.

kmymoney/widgets/kmymoneyaccountcombo.cpp
240

That's understood. I think it's important to use AccountsModel::Account instead of 0 as it gives meaning and to forewarn developers that AccountsModel::Account shouldn't be anything else than 0.

wojnilowicz edited edge metadata.
wojnilowicz marked 2 inline comments as done.

Fixes after review + some glitches fixed.

wojnilowicz updated this revision to Diff 17505.Aug 1 2017, 4:47 PM

More work on institutions view which led to fix for bug 346009

tbaumgart accepted this revision as: tbaumgart.Aug 2 2017, 7:23 AM

Looks good to me. Please fix the commented stuff and give it a go.

kmymoney/models/accountsmodel.cpp
332

This case label can be removed, since CreditCard is part of the group Liability

631

The indentation seems to be off here for some reason. Do you use TABs instead of spaces?

wojnilowicz marked 2 inline comments as done.Aug 2 2017, 3:54 PM
wojnilowicz added inline comments.
kmymoney/models/accountsmodel.cpp
631

I use automatic indentation. It's not me.

This revision was automatically updated to reflect the committed changes.
wojnilowicz marked an inline comment as done.