Discussion:
[Lazarus] Scaling of menuitem icons
Juha Manninen via Lazarus
2018-10-13 20:08:59 UTC
Permalink
Hi

When higher DPI setting is used on Windows, Lazarus IDE appears to obey nicely.
All icons are also scaled, together with texts.

On my Linux + KDE system however icons of the IDE's main menuitems do not scale.
In KDE settings panel -> Fonts I set the "Force font's DPI" value to
144 which is about 150%.
Then I start lazarus and everything is scaled including menu texts but
not the icons beside them. Icons everywhere else like in the IDE
Coolbar and component palette are scaled. Editor toolbar also has
scaled icons and the exact same icons show smaller in the main menu.
This happens with both GTK2 and QT bindings.
Could somebody please test with other desktop / window manager systems.
Who knows the High DPI code well enough to fix the issue?

I wanted to take a screenshot but the IDE's menus always close when
Spectacle (screeshot app) takes it. This is another bug somewhere.
Menus of well behaving KDE apps, for example Kate's, do not close.

Juha
--
Vojtěch Čihák via Lazarus
2018-10-13 20:52:49 UTC
Permalink
It seems the same here (KDE and Lazarus Qt4). I was able to take screenshot with Spectacle (rectangular area).
 
V.
______________________________________________________________
> Od: "Juha Manninen via Lazarus" <***@lists.lazarus-ide.org>
> Komu: "Lazarus mailing list" <***@lists.lazarus-ide.org>
> Datum: 13.10.2018 22:09
> Předmět: [Lazarus] Scaling of menuitem icons
>
Hi

When higher DPI setting is used on Windows, Lazarus IDE appears to obey nicely.
All icons are also scaled, together with texts.

On my Linux + KDE system however icons of the IDE's main menuitems do not scale.
In KDE settings panel -> Fonts I set the "Force font's DPI" value to
144 which is about 150%.
Then I start lazarus and everything is scaled including menu texts but
not the icons beside them. Icons everywhere else like in the IDE
Coolbar and component palette are scaled. Editor toolbar also has
scaled icons and the exact same icons show smaller in the main menu.
This happens with both GTK2 and QT bindings.
Could somebody please test with other desktop / window manager systems.
Who knows the High DPI code well enough to fix the issue?

I wanted to take a screenshot but the IDE's menus always close when
Spectacle (screeshot app) takes it. This is another bug somewhere.
Menus of well behaving KDE apps, for example Kate's, do not close.

Juha
--
_______________________________________________
Lazarus mailing list
***@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus <https://lists.lazarus-ide.org/listinfo/lazarus>
Martin Schreiber via Lazarus
2018-10-14 07:09:54 UTC
Permalink
On Saturday 13 October 2018 22:08:59 Juha Manninen via Lazarus wrote:
>
> I wanted to take a screenshot but the IDE's menus always close when
> Spectacle (screeshot app) takes it.

Do you use a delay?
https://userbase.kde.org/Spectacle#Screenshot_delay

Martin
--
Juha Manninen via Lazarus
2018-10-14 16:37:10 UTC
Permalink
On Sun, Oct 14, 2018 at 10:10 AM Martin Schreiber via Lazarus
<***@lists.lazarus-ide.org> wrote:
> Do you use a delay?
> https://userbase.kde.org/Spectacle#Screenshot_delay

Yes I did. I tried all variations including the rectangular area that
Vojtěch Čihák used.
Strangely enough, I remember I could include menus in a screenshot
earlier. Something has changed maybe in the libs provided by Manjaro.
Who knows...
I will test again some time later.

Juha
--
Ondrej Pokorny via Lazarus
2018-10-19 08:15:53 UTC
Permalink
>  On my Linux + KDE system however icons of the IDE's main menuitems
do not scale.
> In KDE settings panel -> Fonts I set the "Force font's DPI" value to
144 which is about 150%.

I remember I worked on it:

1.) Gtk2: I added support for Gtk2. See screenshot. It works well for me
if I use "xrandr --dpi 144x144" as it is suggested in
http://wiki.lazarus.freepascal.org/High_DPI

Your settings revealed a bug in Gtk2 bindings. Patch is attached.

2.) Qt: I wasn't able to add support of high-resolution icons in menus
under Qt. My conclusion was that either Qt itself or LCL-Qt bindings do
not support big icons in menus. When I used the correct size icon in the
menu it was always (badly) downscaled to 16x16 pixels.


Greetings
Ondrej
zeljko via Lazarus
2018-10-19 09:43:32 UTC
Permalink
On 10/19/2018 10:15 AM, Ondrej Pokorny via Lazarus wrote:
> >  On my Linux + KDE system however icons of the IDE's main menuitems
> do not scale.
> > In KDE settings panel -> Fonts I set the "Force font's DPI" value to
> 144 which is about 150%.
>
> I remember I worked on it:
>
> 1.) Gtk2: I added support for Gtk2. See screenshot. It works well for me
> if I use "xrandr --dpi 144x144" as it is suggested in
> http://wiki.lazarus.freepascal.org/High_DPI
>
> Your settings revealed a bug in Gtk2 bindings. Patch is attached.
>
> 2.) Qt: I wasn't able to add support of high-resolution icons in menus
> under Qt. My conclusion was that either Qt itself or LCL-Qt bindings do
> not support big icons in menus. When I used the correct size icon in the
> menu it was always (badly) downscaled to 16x16 pixels.

Probably the only solution is to use QProxyStyle class.
There's no QProxyStyle class in Qt4/Qt5 C bindings and to fix this
problem it should be implemented with it's overrides.
QProxyStyle can return any size for PM_SmallIconSize, but in that case
we should know what's the current size of "normal" icons in LCL.

zeljko
--
Ondrej Pokorny via Lazarus
2018-10-19 09:46:55 UTC
Permalink
On 19.10.2018 11:43, zeljko wrote:
> QProxyStyle can return any size for PM_SmallIconSize, but in that case
> we should know what's the current size of "normal" icons in LCL.

The current size of "normal" icons in LCL is perfectly known, as well as
the size of any menu icon in LCL. Call the TMenuItem.GetIconSize
function to get it.

Ondrej
--
zeljko via Lazarus
2018-10-19 09:50:45 UTC
Permalink
On 10/19/2018 11:46 AM, Ondrej Pokorny wrote:
> On 19.10.2018 11:43, zeljko wrote:
>> QProxyStyle can return any size for PM_SmallIconSize, but in that case
>> we should know what's the current size of "normal" icons in LCL.
>
> The current size of "normal" icons in LCL is perfectly known, as well as
> the size of any menu icon in LCL. Call the TMenuItem.GetIconSize
> function to get it.

Tnx

zeljko
--
Juha Manninen via Lazarus
2018-10-19 16:11:13 UTC
Permalink
On Fri, Oct 19, 2018 at 11:16 AM Ondrej Pokorny via Lazarus
<***@lists.lazarus-ide.org> wrote:
> Your settings revealed a bug in Gtk2 bindings. Patch is attached.

Applied in r59325. It works now with GTK2. Very nice, thanks!

Juha
--
Loading...