Recent

Author Topic: [Solved] Qt5 widgetset - Strange look  (Read 4142 times)

Basile-B

  • Sr. Member
  • ****
  • Posts: 457
[Solved] Qt5 widgetset - Strange look
« 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"
« Last Edit: October 26, 2018, 11:42:14 am by BBasile »

mig-31

  • Sr. Member
  • ****
  • Posts: 261
Re: Qt5 widgetset - Strange look
« Reply #1 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.
Lazarus 2.0.2 - CentOS 7.x, Mageia 7.1

Basile-B

  • Sr. Member
  • ****
  • Posts: 457
Re: Qt5 widgetset - Strange look
« Reply #2 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.

zeljko

  • Hero Member
  • *****
  • Posts: 1090
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Qt5 widgetset - Strange look
« Reply #3 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.

Basile-B

  • Sr. Member
  • ****
  • Posts: 457
Re: Qt5 widgetset - Strange look
« Reply #4 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.)

zeljko

  • Hero Member
  • *****
  • Posts: 1090
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Qt5 widgetset - Strange look
« Reply #5 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.

Thaddy

  • Hero Member
  • *****
  • Posts: 9303
Re: Qt5 widgetset - Strange look
« Reply #6 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.
« Last Edit: October 25, 2018, 06:18:21 pm by Thaddy »
also related to equus asinus.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5800
    • wiki
Re: Qt5 widgetset - Strange look
« Reply #7 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.
« Last Edit: October 25, 2018, 07:26:41 pm by Martin_fr »

Zoran

  • Hero Member
  • *****
  • Posts: 1469
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Qt5 widgetset - Strange look
« Reply #8 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.

Basile-B

  • Sr. Member
  • ****
  • Posts: 457
Re: Qt5 widgetset - Strange look
« Reply #9 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.
« Last Edit: October 26, 2018, 08:17:14 am by BBasile »

mse

  • Sr. Member
  • ****
  • Posts: 286
Re: Qt5 widgetset - Strange look
« Reply #10 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.



Basile-B

  • Sr. Member
  • ****
  • Posts: 457
Re: Qt5 widgetset - Strange look
« Reply #11 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.

Basile-B

  • Sr. Member
  • ****
  • Posts: 457
Re: Qt5 widgetset - Strange look
« Reply #12 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.

Basile-B

  • Sr. Member
  • ****
  • Posts: 457
Re: Qt5 widgetset - Strange look
« Reply #13 on: October 26, 2018, 11:30:41 am »
DT_CENTER is a bug anyway, will submit patch

Basile-B

  • Sr. Member
  • ****
  • Posts: 457
Re: Qt5 widgetset - Strange look
« Reply #14 on: October 26, 2018, 11:41:57 am »