[kmymoney] [Bug 471208] New: In payee view, the default category displays with AccountNameRole instead of AccountFullNameRole

Cory F Cohen bugzilla_noreply at kde.org
Sun Jun 18 23:56:19 BST 2023


https://bugs.kde.org/show_bug.cgi?id=471208

            Bug ID: 471208
           Summary: In payee view, the default category displays with
                    AccountNameRole instead of AccountFullNameRole
    Classification: Applications
           Product: kmymoney
           Version: git (master)
          Platform: Compiled Sources
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: kmymoney-devel at kde.org
          Reporter: cfcohen77 at gmail.com
  Target Milestone: ---

In the payee view, the default category displays with AccountNameRole instead
of AccountFullNameRole.   It should display the full "hierarchical" name
because, without additional context, it can be difficult to tell which category
is actually selected.

I'm opening a ticket for this issue because I choose poorly and this problem
exceeded my ability to produce a clean fix to the problem. :-( I expected that
I was hunting for a place where I would set something like
"ui->comboDefaultCategory->displayFullName = true" and instead ended up over
AccountDelegate changing how accounts are painted inside a ComboBox TreeView.
:-| I'm happy to submit a merge request and work to finish fixing the problem
if someone can tell me what to do, or for someone else to just correct this bug
and I'll see what I can learn from the correct patch.

My solution involved: 1. In models/accountsproxymodel.h, return
AccountFullNameRole for Qt::EditRole AND Qt:DisplayRole.  This causes the full
name to display in the default category widget.  2. In
views/accountdelegate.cpp, test if the parent is a ComboBox (instead of a view)
and set opt.txt to the AccountNameRole (this causes the short name to display
in the TreeView).  3. In views/kpayeesview_p.h call setItemDelegate() on
ui->comboDefaultCategory to an instance of AccountDelegate.

This solution works in the payee view, but it also changes how the
KMyMoneyAccountCombo renders in the transaction editor and split editor. 
Specifically, it results in full names being shown inside the tree view.  I
also tried marking the payee default category widget editable, which displayed
the full name correctly, but that added a "split" widget to the default
category control which was inappropriate in this context.  There appears to be
logic for doing something similar in KMyMoneyAccountComboSplitHelper, but it
also does much more.

In summary, I don't see how the problem can be easily fixed in the payee view
without affecting the editing views, and the similarity of the issues raises
concerns (at least to me) about whether a shared mechanism should be used in
both places. My intuition is that the SplitHelper could probably use my fix by
setting an AccountDelegate plus a few other changes and that this approach
would make it easier to create category selection widgets that display a full
name in the future.  But that's a bigger change than I had intended and would
welcome some feedback.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the KMyMoney-devel mailing list