Lazarus

Programming => Widgetset => QT => Topic started by: guest58172 on October 25, 2018, 03:59:46 am

Title: [Solved] Qt5 widgetset - Strange look
Post by: guest58172 on October 25, 2018, 03:59:46 am
I just tried to compile something using the Qt5 widgetset under Linux (and a KDE DE). Is it supposed to be finished ? i've noticed that some components look strangely small and that the texts are strangely aligned (especially in TTreeView), see attachements.

side note:
Also i noticed that linking fails with the so names as found in the packages (libQt5Pas.so.1) until renamed without the ".1"
Title: Re: Qt5 widgetset - Strange look
Post by: mig-31 on October 25, 2018, 09:56:27 am
A think it' s ok.

If you want , I upload image how Qt5 looks on Mageia6 KDE5.
Title: Re: Qt5 widgetset - Strange look
Post by: guest58172 on October 25, 2018, 10:27:49 am
You think it's okay ? It rather looks like i would have to do many widgetset specific tweaks if i want to release for qt5 by default, which then would cancel the beauty of lazarus LCL concept. Remember "program once, compile everywhere". Differences here are not subtle, they are gross and make my eyes bleeding.
Title: Re: Qt5 widgetset - Strange look
Post by: zeljko on October 25, 2018, 11:09:25 am
Do projects (gtk2 and qt5) use same font ? It looks pretty strange for Qt5, I cannot reproduce or see such problems here.
When you want to build apps against qt5 you must install libqt5pas-devel package , so in that case you don't need to create symbolic links manually.
Title: Re: Qt5 widgetset - Strange look
Post by: guest58172 on October 25, 2018, 11:24:16 am
Yes of course, it's the same project, same code, same LFMs. I just change the macro for the LCL in the project settings before taking the screenshots i attached in the first post.

(About Qt5Pas, i didn't find the devel version. Maybe you should provide them as optional download on SF.)
Title: Re: Qt5 widgetset - Strange look
Post by: zeljko on October 25, 2018, 06:03:34 pm
Yes of course, it's the same project, same code, same LFMs. I just change the macro for the LCL in the project settings before taking the screenshots i attached in the first post.

Please open an issue about it and attach example project which reproduces your bug. Also, what linux distro is that ?

(About Qt5Pas, i didn't find the devel version. Maybe you should provide them as optional download on SF.)

In that case you must manually create symlinks.
Title: Re: Qt5 widgetset - Strange look
Post by: Thaddy on October 25, 2018, 06:12:02 pm
In that case you must manually create symlinks.
Indeed, but:
I understand this is a cross-compile issue? symlinks won't help in that case and can even screw up your current OS!!!! unless, indeed, manually created. X.so.X is versioning. and X.so is either the current lib or a symlink to the current one.
With cross compiling, avoid hardcoding the extra extension for your shared library in...and probably rename it, provided your cross-compile libraries are completely separated from the OS you are actually using. This is a quite common mistake. For programmers in any language, not just Pascal.
Title: Re: Qt5 widgetset - Strange look
Post by: Martin_fr on October 25, 2018, 07:23:56 pm
Well there are a few difference.

1) Most noteable: different fonts.
I don't know if that is correct. Unless you specified a font by name, QT and gtk may or may not have different default fonts? (probably some config for each of them on your system)

2) the "filter" text is not grayed.
I don't know if qt supports this, but if qt can do it, it seems like a bug.

3) The columns of the grid.
Under gtk the columns are extended to fill 100% of the space.
Under QT, they only take as much space as each of them really needs (IIRC that is the same under Windows).
I am not sure if GTK can be made to behave like the others (or what carbon/cocoa do).

4) the indent of text in the treeview
No idea why qt does that. Assuming none of the text label has leading spaces.
Title: Re: Qt5 widgetset - Strange look
Post by: Zoran on October 25, 2018, 09:22:24 pm
I just tried to compile something using the Qt5 widgetset under Linux (and a KDE DE). Is it supposed to be finished ?

Could you also try with Qt4, on the same system, and attach the screenshot, just to see if these problems show there too. This will probably be helpful for locating bugs.
Title: Re: Qt5 widgetset - Strange look
Post by: guest58172 on October 26, 2018, 07:58:31 am
I'm on Fedora F28 using the KDE desktop so i'd be surprised if any Qt5 stuff would miss.
I use Lazarus 2.0-RC1

The Qt4 version looks perfect. Note that the difference of size with the filter is not related it was a something caused by the alignment in toolbars not done anymore.
Title: Re: Qt5 widgetset - Strange look
Post by: mse on October 26, 2018, 08:25:27 am
Also i noticed that linking fails with the so names as found in the packages (libQt5Pas.so.1) until renamed without the ".1"
Another victim of
https://bugs.freepascal.org/view.php?id=32367
It is unbelievable how much effort is necessary until the FPC team moves a little bit. IIRC the problem has been discussed the first time more than 10 years ago.


Title: Re: Qt5 widgetset - Strange look
Post by: guest58172 on October 26, 2018, 09:31:10 am
The size issue was caused by the KDE theme "Fusion". Using "Brise" the listview look better. There's still the padded text issue in the treeview.
Title: Re: Qt5 widgetset - Strange look
Post by: guest58172 on October 26, 2018, 11:27:22 am
Look here : https://github.com/graemeg/lazarus/blob/fe215cf5cba4195586fc830e804e1127cfab8e98/lcl/include/treeview.inc#L5243

If i change to this

Code: Pascal  [Select][+][-]
  1.  DrawText(Canvas.Handle, PChar(AText), -1, NodeRect, DT_LEFT or DT_VCENTER or DT_SINGLELINE or DT_NOPREFIX);

Then the offset disappears. It seems that a combination of long text + stuff hosted in anchor docking form + qt4 gives a bigger draw rectangle. Since text is centered there's this padding. Other widget sets gives a correct draw rectangle so even if centered, the text appears like if left aligned. This is an hypothesis but it explains the problem perfectly.
Title: Re: Qt5 widgetset - Strange look
Post by: guest58172 on October 26, 2018, 11:30:41 am
DT_CENTER is a bug anyway, will submit patch
Title: Re: Qt5 widgetset - Strange look
Post by: guest58172 on October 26, 2018, 11:41:57 am
https://bugs.freepascal.org/view.php?id=34461
Title: Re: [Solved] Qt5 widgetset - Strange look
Post by: zeljko on October 26, 2018, 01:32:45 pm
Thanks for the patch, but since it's LCL patch all widgetsets must be tested against such change. Really don't know why DT_CENTER is there by default and why other widgetsets draws correct text in this case (gtk2, win32)
TinyPortal © 2005-2018