[Kmymoney-devel] Trying to understand the code in GroupMarker::paintRegisterCell()

Cristian Oneț onet.cristian at gmail.com
Fri Nov 25 07:49:27 UTC 2011


2011/11/25 Marko Käning <mk-lists at email.de>:
> Hi Alvaro,
>
> always great to hear from you! :-)
>
>> that's because it's KXConfig stuff.
>
>> The code is autogenerated from the kmymoney settings file.
> I see.
>
>> What do you want to do with it?
> As my feature request https://bugs.kde.org/show_bug.cgi?id=287494 describes, I would like to have the group marker for "Online Statement Balance: %.2f" change its background and font color depending on whether the online balance is equal to the local one or not. I.e. I'd rather be alerted by a red group marker if there is a difference in both balances.
>
> The motivation behind it is that I had a every now and then a difference in the two balances which stayed unnoticed for quite a few weeks, simply because the numbers were different only in one digit, usually stg like 50 EUR or so. This can happen if there are older transactions which get delivered by the bank with too big a lag, so that KMyMoney doesn't import it anymore by default. Sometimes I myself messed up without noticing it as well.
>
> To find the cause of such balance differences can sometimes be quite a PITA, I tell you! :-(
>
> Therefore an early alerting of the user by KMyMoney itself would be a nice feature for me. :-)
>
> After posting my feature request I thought I dig a little into the code and perhaps figure out how to implement this myself. It took me a while to figure out which methods were responsible for those group markers, but I was still in good spirits… Now that I see you writing about generated code I see my hopes waning, though, because I am afraid I won't be able to get anything done without more substantial knowledge of QT, KDE and the like.

You should not give up that easily. Your feature request seems
alright, after all the application should provide the user with all
information which he needs. You can find the auto generated code in
the build directory if you need to take a look at it.

> Anyway, still, one can always learn and skimming through KMM's code is always an interesting endeavor, so, if you're willing to share a little knowledge about how one could achieve this, I'd be very grateful, Alvaro. :-)
>

To implement this you don't really need to know about KConfig unless
you want to make the "balance mismatch" color user configurable.

bool bBalanceDoesNotMatch = condition // only for the online statement
balance group marker

option.palette.setColor(QPalette::Base, bBalanceDoesNotMatch ?
KMyMoneyGlobalSettings::listErronousTransactionColor() :
KMyMoneyGlobalSettings::groupMarkerColor());


Regards,
Cristian

> Thanks for your response.
> Greets,
> Marko
> _______________________________________________
> KMyMoney-devel mailing list
> KMyMoney-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kmymoney-devel
>


More information about the KMyMoney-devel mailing list