Bug 295883 - Layout in ledger view much too wide
Summary: Layout in ledger view much too wide
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 4.6.2
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-12 23:42 UTC by Frank Steinmetzger
Modified: 2012-07-29 04:43 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screenshot of ledger (actually a combination of two separate shots). The window cannot be resized to anything thinner. (29.03 KB, image/png)
2012-03-12 23:42 UTC, Frank Steinmetzger
Details
Account selector which seems to cause the width problem. (17.27 KB, image/png)
2012-03-13 14:24 UTC, Frank Steinmetzger
Details
Same problem in Krusader (12.89 KB, image/png)
2012-03-24 14:22 UTC, Frank Steinmetzger
Details
Screenshot of ledger view at minimum possible size with Sans Serif font (24.23 KB, image/png)
2012-05-12 14:09 UTC, Frank Steinmetzger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Steinmetzger 2012-03-12 23:42:18 UTC
Created attachment 69560 [details]
Screenshot of ledger (actually a combination of two separate shots). The window cannot be resized to anything thinner.

Something is making the ledger view ultra-wide. When I first start KMyMoney, I can reduce the window's width to 255 pixel. But as soon as I switched to ledger view, the window expands to 1817 pixels and can't be made any slimmer. This makes entering new transactions very impractical for me (I have a 1400x1050 screen, so I have to move the window around to reach the various input controls) that I haven't used the program regularly for almost a year now, always hoping that something this obvious would be fixed soon. With the recent release of 4.6.2 and the fact that it didn't fix this finally convinced me to file a bug for it.

Thanks for your time.
Comment 1 Cristian Oneț 2012-03-13 08:18:11 UTC
(In reply to comment #0)
> Something is making the ledger view ultra-wide. When I first start KMyMoney,
> I can reduce the window's width to 255 pixel. But as soon as I switched to
> ledger view, the window expands to 1817 pixels and can't be made any
> slimmer. 

This is really strange. Could you provide more information about your setup: system, kmymoney version and it's source (package or compiled from sources)?

> This makes entering new transactions very impractical for me (I
> have a 1400x1050 screen, so I have to move the window around to reach the
> various input controls) that I haven't used the program regularly for almost
> a year now, always hoping that something this obvious would be fixed soon.

Believe me, if this problem would be so obvious it would have been fixed by now. I never seen it happen.

> With the recent release of 4.6.2 and the fact that it didn't fix this
> finally convinced me to file a bug for it.

That was the right choice.

> Thanks for your time.

Now to get more information about what is causing this bug. Looking at the screenshot I suspect that the unusually large width is caused by the account selector combo. Do you, by any chance, use a very deep account hierarchy? Or do you have very long account names? 

Can you reproduce this behavior with a new kmymoney file? You can try this sample test file http://kmymoney2.sourceforge.net/SampleKMyMoneyDataFile.kmy

If you save the file as anonymous is this still happening?
Comment 2 Frank Steinmetzger 2012-03-13 14:24:50 UTC
Created attachment 69575 [details]
Account selector which seems to cause the width problem.

Thanks for the quick response, I'm willing to give you any info you need in order to fix it.
Yes, it is also happening with the sample file provided. It *must* be the account selector, for I also encounter the thing on the Investments and on the Recipients page. Both of which contain one. Also, if you look at the attached screenshot, you see why. I moved the window half way out of the screen to the right and then opened the selector. The drop down appears much more to the left than where the widget starts. For some reason it wants this much space.

I'm running 4.6.2 on KDE 4.8, compiled from source through the Gentoo package manager, source file md5 is 5659706cbe85416cbabfa000a29b19b5. I also tried the Oxygen style, because I'm using QtCurve as my default style, and it shows the same behavior.
Comment 3 Cristian Oneț 2012-03-13 14:58:52 UTC
(In reply to comment #2)
> Created attachment 69575 [details]
> Account selector which seems to cause the width problem.
> 
> Thanks for the quick response, I'm willing to give you any info you need in
> order to fix it.
> Yes, it is also happening with the sample file provided. It *must* be the
> account selector, for I also encounter the thing on the Investments and on
> the Recipients page. Both of which contain one. Also, if you look at the
> attached screenshot, you see why. I moved the window half way out of the
> screen to the right and then opened the selector. The drop down appears much
> more to the left than where the widget starts. For some reason it wants this
> much space.

From this I conclude that you don't have an unusually deep account hierarchy or account names.

> 
> I'm running 4.6.2 on KDE 4.8, compiled from source through the Gentoo
> package manager, source file md5 is 5659706cbe85416cbabfa000a29b19b5. I also
> tried the Oxygen style, because I'm using QtCurve as my default style, and
> it shows the same behavior.

I'm running the same setup and I don't see this behavior so there must be something else causing this. You could try the following:
1. Run KMyMoney as another user which has the default UI settings so we can tel that this is somehow style/user interface related.
2. Since I'm lucky that your a Gentoo user I can ask you to try some patches that could change the behavior that you are observing for this:
Comment 4 Cristian Oneț 2012-03-13 15:03:19 UTC
(In reply to comment #2)
> Created attachment 69575 [details]
> Account selector which seems to cause the width problem.
> 
> Thanks for the quick response, I'm willing to give you any info you need in
> order to fix it.
> Yes, it is also happening with the sample file provided. It *must* be the
> account selector, for I also encounter the thing on the Investments and on
> the Recipients page. Both of which contain one. Also, if you look at the
> attached screenshot, you see why. I moved the window half way out of the
> screen to the right and then opened the selector. The drop down appears much
> more to the left than where the widget starts. For some reason it wants this
> much space.

From this I conclude that you don't have an unusually deep account hierarchy or account names.

> 
> I'm running 4.6.2 on KDE 4.8, compiled from source through the Gentoo
> package manager, source file md5 is 5659706cbe85416cbabfa000a29b19b5. I also
> tried the Oxygen style, because I'm using QtCurve as my default style, and
> it shows the same behavior.

I'm running the same setup and I don't see this behavior so there must be something else causing this. You could try the following:
1. Run KMyMoney as another user which has the default UI settings so we can tell if this is somehow style/user interface related.
2. Since I'm lucky that you are a Gentoo user I can ask you to try some patches that could change the behavior that you are observing:
  a. try removing https://projects.kde.org/projects/extragear/office/kmymoney/repository/revisions/master/entry/kmymoney/widgets/kmymoneyaccountcombo.cpp#L89 lines 89-90
  b. try removing line 194 https://projects.kde.org/projects/extragear/office/kmymoney/repository/revisions/master/entry/kmymoney/views/kgloballedgerview.cpp#L194

Fell free to try only one of the above suggestions. Sorry that we have to do it this way but since you are the lucky one experiencing this issue I hope to get your feedback.
Comment 5 Cristian Oneț 2012-03-13 15:04:37 UTC
I've had some problems submitting the comments so please ignore comment 3.
Comment 6 Frank Steinmetzger 2012-03-14 01:54:43 UTC
I tried both deletions in every combination -- no effect. *But* when I tried it with the guest user I have set up on my system, the problem does not occur, so it seems to be something in my setup. :-/
Comment 7 Cristian Oneț 2012-03-14 05:42:26 UTC
(In reply to comment #6)
> I tried both deletions in every combination -- no effect. *But* when I tried
> it with the guest user I have set up on my system, the problem does not
> occur, so it seems to be something in my setup. :-/

I guess then that this is caused by a style or UI setting. Could you try to change the style/windows decorations and see which exactly is causing the problem. I know youve tried oxygen but there must be something that's causing this problem and if I could reproduce it I could fix it.
Comment 8 Frank Steinmetzger 2012-03-14 22:15:58 UTC
I tried almost all styles -- CDE, GTK-Style, Plastik, they all showed the same result. When run as the guest user, either from a guest login or via kdesu, the issue doesn't occur. But it does when started as my own user either from my own session or via kdesu from a guest session. I don't really know what to look for now.

The only thing that comes to mind right now is to do a newton approach and find out which KDE config file is responsible, which is a lengthy process. -- set up config files, login, start and close KMyMoney, log out, rinse and repeat.
Comment 9 Jack 2012-03-14 22:34:13 UTC
I'd start with kmymoneyrc before digging into general KDE config stuff.  In my case (also Gentoo) it's in .kde4/share/config/kmymoneyrc.  Rename it to something else and retry KMM (no need to log in/out)

You can also then compare the KDE config files between your own user and your new guest user - that might narrow  down the search at least somewhat.
Comment 10 Frank Steinmetzger 2012-03-15 02:57:02 UTC
I already tried a run with a blank kmymoneyrc and the sample file provided earlier. The KDE settings between my account and the (practically unused) guest account are very extensive, I guess I'll be quicker if I just start with an empty kde config dir and always add half of the remaining files back with each iteration. That *could* lead me to the culprit, as long as it is the sole cause, and doesn't act in combination with other files.
Comment 11 Frank Steinmetzger 2012-03-24 14:22:11 UTC
Created attachment 69853 [details]
Same problem in Krusader

I haven't gotten around to doing anything about this since my last post, but yesterday I discovered the very same issue in one of Krusader's dialogues (which can be reached in Krusader’s settings, “Archives” page, “Automatic detection” button). So it’s not KMyMoneys fault alone. :-)
Comment 12 Frank Steinmetzger 2012-05-12 02:41:49 UTC
You will not believe what I just found out... I finally took the time to bisect my .kde/share/config dir (took me several hours altogether). In the end it turned out that setting the “General” KDE font to Linux Libertine/Linux Biolinum was the cause for this problem. I set it back to Sans Serif and now the Ledger stays at its size. The same goes for the mentioned Krusader window.

So.... should this be re-assigned to something within KDE? Or is it maybe even a Qt bug?
Comment 13 Cristian Oneț 2012-05-12 12:53:37 UTC
Git commit b7993aeaf9184345310527ae8e5acd3237dfe3e7 by Cristian Oneț.
Committed on 12/05/2012 at 14:42.
Pushed by conet into branch 'master'.

Use a safer way to set the minimum width of the account combo.

Using QFontMetrics::maxWidth() was a bad idea because some fonts could
contain really wide characters (with a very low probability of appearing
in the account names) - see the bug that is fixed.

Instead of the width of the widest character in the font use the width of
the 'W' character which will produce a much more predictable result.

Even the Qt implementation uses the width of a know character ('x') to
compute a kind of minimum size.

M  +2    -6    kmymoney/widgets/kmymoneyaccountcombo.cpp
M  +2    -3    kmymoney/widgets/kmymoneycompletion.cpp

http://commits.kde.org/kmymoney/b7993aeaf9184345310527ae8e5acd3237dfe3e7
Comment 14 Cristian Oneț 2012-05-12 12:54:28 UTC
Git commit c93bfa3c47d1db4c43ba3da33d693e81613295fd by Cristian Oneț.
Committed on 12/05/2012 at 14:42.
Pushed by conet into branch '4.6'.

Use a safer way to set the minimum width of the account combo.

Using QFontMetrics::maxWidth() was a bad idea because some fonts could
contain really wide characters (with a very low probability of appearing
in the account names) - see the bug that is fixed.

Instead of the width of the widest character in the font use the width of
the 'W' character which will produce a much more predictable result.

Even the Qt implementation uses the width of a know character ('x') to
compute a kind of minimum size.
(cherry picked from commit b7993aeaf9184345310527ae8e5acd3237dfe3e7)

M  +2    -6    kmymoney/widgets/kmymoneyaccountcombo.cpp
M  +2    -3    kmymoney/widgets/kmymoneycompletion.cpp

http://commits.kde.org/kmymoney/c93bfa3c47d1db4c43ba3da33d693e81613295fd
Comment 15 Cristian Oneț 2012-05-12 12:57:25 UTC
Thanks for your perseverance to track  down the source of this problem. It really was a problem in KMyMoney (you can tell what was the problem by looking at the patch).

So you can go back to using your favorite font if you apply this patch (which should not be that hard if you are a Gentoo user).

Thanks again for your contribution :)
Comment 16 Frank Steinmetzger 2012-05-12 14:09:18 UTC
Created attachment 71042 [details]
Screenshot of ledger view at minimum possible size with Sans Serif font

Thanks back for your quick response. I applied the patch to 4.6.2, it did do something, but unfortunately not enough. :-/
In my original post, the window was expanded to 1817 pixels, now it is at 1695.

How can it be *that* much more in width? It may seem a stupid question, but what does width(QLatin1Char('W')) actually return? Not only for the Linux* fonts, but also for the default Sans Serif. I mention the latter, too, because this new screenie shows the Ledger view at its minimum size using Sans serif. Clearly, the selector still uses too much space. I superimposed 15 W characters of both Sans serif and Linux Biolinum (which is a screenshot from KWrite, to rule out Gimp's own font rendering). Linux Biolinum's W is actually a bit thinner than Sans Serif (which is one reason why I chose this font in the first place -- it fits more on the same screen area).
Comment 17 Cristian Oneț 2012-05-13 07:42:56 UTC
(In reply to comment #16)
> Created attachment 71042 [details]
> Screenshot of ledger view at minimum possible size with Sans Serif font
> 
> Thanks back for your quick response. I applied the patch to 4.6.2, it did do
> something, but unfortunately not enough. :-/
> In my original post, the window was expanded to 1817 pixels, now it is at
> 1695.

Could you check what happens if you remove the setMinimumSize  statement? My experience with the font used by you was that without the patch the application was very wide (around 1400px) but with the patch the minimum width was reduced to around 800px.

> How can it be *that* much more in width? It may seem a stupid question, but
> what does width(QLatin1Char('W')) actually return? Not only for the Linux*
> fonts, but also for the default Sans Serif. I mention the latter, too,
> because this new screenie shows the Ledger view at its minimum size using
> Sans serif. Clearly, the selector still uses too much space. I superimposed
> 15 W characters of both Sans serif and Linux Biolinum (which is a screenshot
> from KWrite, to rule out Gimp's own font rendering). Linux Biolinum's W is
> actually a bit thinner than Sans Serif (which is one reason why I chose this
> font in the first place -- it fits more on the same screen area).

I wouldn't be sure that the minimum size of the ledger in the screen shot is given by the account selector. Maybe it's given by some other widget and since the account selector has a larger stretch factor it's larger then it's minimum size.
Comment 18 allan 2012-05-13 23:12:28 UTC
It's many years since I looked in a font file, but I seem to remember that that it contains many parameters other than character width: inter-character spacing and kerning spring to mind.
Comment 19 allan 2012-05-27 09:56:36 UTC
This may be something you are already aware of, but I've only just found out, and I don't know if it may help, but you might try it if you haven't already.

Drag the KMM window more than halfway off screen to the side.  This automatically resizes to half width and half height.
Comment 20 Yuri Chornoivan 2012-07-29 04:43:35 UTC
*** Bug 304215 has been marked as a duplicate of this bug. ***