[Kmymoney-devel] String pixel widths differ

Allan agander93 at gmail.com
Mon Sep 22 17:08:27 UTC 2014


Replying to Cristian and Jack (saving paper)

>>> On 2014.09.22 06:13, Allan wrote:
>>>> When testing the CSV plugin on Linux Mint and Ubuntu, I'm having
>>>> difficulty because the string pixel widths differ, I assume because
>>>> the fonts differ.
>>>>
>>>> I'm trying now to access KMyMoneyGlobalSettings::listCellFont(), but
>>>> I'm getting undefined reference when linking, and I haven't found the
>>>> correct way to adjust CMakeLists.txt.
>>>>
>>>> How do I do this please?  Thanks
>>>>
>>>> Allan
>>>
>>> Is it possible you are ending up with some conflict, in that some sizes
>>> are being calculated based on the font you request and others are being
>>> calculated on the font the system is actually using?   Do things seem to
>>> be better or worse if you don't specify any font details at all?
>>>
>>> Jack
>>
>> I'm calculating the width of a string and then applying that as a
>> column width, rather than relying on resizeColumntoContents(), as that
>> works on the full complement of rows, whereas I need just the
>> displayed rows.
>>
>> Now that I specify the same font for the calculation and for the UI,
>> then I think I'm pretty well there now.
>
> But if the system does not use the font you specify for the UI, will the
> system font or your font be used for the calculation?
> _______________________________________________

to Jack
I don't think it really matters what font the system is using, as long 
as that font is available.  I'm using DejaVu Sans at the moment, but I 
understand that if that is not available, the system will substitute a 
similar one.
_________________________________________________

To Cristian
>> The font that the UI uses can be easily obtained using the
>> QWidget::font() method [1].

>> Regards,
>> Cristian

>> [1] http://qt-project.org/doc/qt-4.8/qwidget.html#font-prop

I think I already know that, as on my Ubuntu, QtDesigner shows a Ubuntu 
font, whereas on Mint it shows DejaVu.

But, I'll have a look at that anyway.  It certainly now looks that both 
are using the one I coded in.  The measurements from the calculations 
are identical, although there is a very slight, barely noticeable 
difference in the QTableWidget->columnWidth() version.  I'll try to find 
why, I hope.  Different QT versions?

Allan





More information about the KMyMoney-devel mailing list