Bug in the Select Color dialogue

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Bug in the Select Color dialogue

Post by adrianinsaval »

mfro wrote: Mon Aug 08, 2022 5:44 pm If you want to blame FreeCAD, its fault is certainly the length of the translated strings that makes Qt's one apparent.
I'm not sure even that is under freecad control, I couldn't find that string in crwodin, I'm no expert on this stuff though
User avatar
mfro
Posts: 662
Joined: Sat Sep 23, 2017 8:15 am

Re: Bug in the Select Color dialogue

Post by mfro »

adrianinsaval wrote: Tue Aug 09, 2022 2:29 am I'm not sure even that is under freecad control, I couldn't find that string in crwodin, I'm no expert on this stuff though
Indeed. You are right. The translation comes with Qt (qtbase_{LANG}.qm).
Cheers,
Markus
User avatar
mfro
Posts: 662
Joined: Sat Sep 23, 2017 8:15 am

Re: Bug in the Select Color dialogue

Post by mfro »

https://bugreports.qt.io/browse/QTBUG-105476

Let's see if that leads to something.
Cheers,
Markus
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Bug in the Select Color dialogue

Post by wmayer »

There is still a certain possibility that there is an event filter in FreeCAD that eventually causes problems with the QColorDialog. But to be 100% sure that this is a Qt issue you can run the following snippet in a terminal window (it's important to not run it inside FreeCAD's Python console).

Start the Python interpreter in a terminal window and then enter:

Code: Select all

from PySide2 import QtWidgets

app = QtWidgets.QApplication()
cd = QtWidgets.QColorDialog()
cd.setOption(cd.DontUseNativeDialog)

bt = cd.findChildren(QtWidgets.QPushButton)
bt[0].setText("Set a fairly long button text to widen the panel")
bt[1].setText("Set a fairly long button text to widen the panel")

cd.show()
cd.exec()
Although it's a Qt issue we have the possibility to change the translation of the two strings. Therefore we need the file qtbase_de.ts from the Qt source code then modify the translations there and create the file qtbase_de.qm. This file then should be copied to the FreeCAD sources (it's under src/Gui/Language/).
Batucada
Posts: 213
Joined: Mon Jul 18, 2022 9:03 am

Re: Bug in the Select Color dialogue

Post by Batucada »

mfro wrote: Tue Aug 09, 2022 6:26 am https://bugreports.qt.io/browse/QTBUG-105476

Let's see if that leads to something.
As I have now learned in this thread, Qt is probably significantly involved in the GUI of FreeCAD. My earlier assumption of FreeCAD's involvement was wrong. What to do if there are more bugs in the Qt colour dialogue? At the moment I count about 5 bugs which, according to the knowledge gained now, are exclusively Qt's fault. What to do with these bugs?

BTW I still have some problems understanding the cross-platform world. A small example:

If a length is to be determined in Sketcher, this is done with the help of a dialogue whose design will be standardised for FreeCAD, but for Qt too? My FreeCAD runs on MacOS. What is going on inside FreeCAD then? A Qt lib that emulates something? Or what?

I have known the Mac GUI for 40 years now. The basic impetus came from Xerox PARC, who had created the first computer with a graphical user interface with the Alto. Apple changed and improved the GUI considerably compared to Xerox PARC and it has remained that way until today. What has Qt done better than Apple? That is not clear to me.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Bug in the Select Color dialogue

Post by adrianinsaval »

Batucada wrote: Tue Aug 09, 2022 6:52 pm What to do with these bugs?
Ideally they should be reported to Qt as mfro has done, but they will likely ask for a minimum example code to reproduce the issue, which might not be easy to do for you, for now you can post here and maybe someone can guide you through reporting it to Qt or will report it themselves
If a length is to be determined in Sketcher, this is done with the help of a dialogue whose design will be standardised for FreeCAD, but for Qt too? My FreeCAD runs on MacOS. What is going on inside FreeCAD then? A Qt lib that emulates something? Or what?
What do you mean for Qt too? The color dialog is a special case where Qt provides a full dialog due to this being something very commonly used, this is not the case for the sketcher constraint dialog, this is defined in FreeCAD using a combination of Qt widgets (checkboxes, buttons, lineEdit, etc), for the theming of these widgets Qt provides some themes that are similar to the "native" look for the platform and this is used by default on FreeCAD, then FreeCAD itself provides a few stylesheets of it's own that can be enabled in preferences. I don't know exactly what you mean with emulation here but there is no actual emulation going on (unless you are running on arm processor), qt (and FreeCAD) can be compiled for macOS.
Batucada wrote: Tue Aug 09, 2022 6:52 pm What has Qt done better than Apple? That is not clear to me.
Well for starters it's open source and multi platform ;) can't say much else since I don't use mac so I wouldn't know if they did anything else better.
Batucada
Posts: 213
Joined: Mon Jul 18, 2022 9:03 am

Re: Bug in the Select Color dialogue

Post by Batucada »

adrianinsaval wrote: Tue Aug 09, 2022 7:56 pm Ideally they should be reported to Qt as mfro has done, but ...
We will see later. I don't want to extend this thread with other topics.
...The color dialog is a special case where Qt provides a full dialog due to this being something very commonly used, this is not the case for the sketcher constraint dialog, this is defined in FreeCAD using a combination of Qt widgets (checkboxes, buttons, lineEdit, etc), for...
I didn't really expect this explanation, but it adds to my insight into the cross-platform basis.

Nevertheless, I still have a question. How does one specify in the build how a Mac executable is subsequently created using Qt libs? Are specific parts linked to it so that native Mac code can be generated? After all, in such a programme, the specific system calls of the Mac must be present, for example, to appear in a dialogue a button with the corresponding function at the intended location. If my assumptions are correct, then such a Qt-lib can only take into account the lowest common denominator, which must be present on all intended operating systems. System-specific features that are not present on other systems are then left out.

I do not expect a comprehensive answer, a global short answer would be sufficient.
[/quote]
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Bug in the Select Color dialogue

Post by adrianinsaval »

Batucada wrote: Tue Aug 09, 2022 9:17 pm After all, in such a programme, the specific system calls of the Mac must be present, for example, to appear in a dialogue a button with the corresponding function at the intended location. If my assumptions are correct, then such a Qt-lib can only take into account the lowest common denominator, which must be present on all intended operating systems. System-specific features that are not present on other systems are then left out.
A GUI dialog it's pretty high level programming stuff so I don't expect there to be any mac specific code needed here or in most of the GUI, deeper down the chain FreeCAD has a few if blocks where needed that have different implementations depending on the system for stuff like file saving for example, qt and other libraries also have system dependent implementations where needed and then the C++ compiler itself deals with the lower level stuff.
Batucada
Posts: 213
Joined: Mon Jul 18, 2022 9:03 am

Re: Bug in the Select Color dialogue

Post by Batucada »

adrianinsaval wrote: Tue Aug 09, 2022 9:42 pm ... and then the C++ compiler itself deals with the lower level stuff.
Yes, cross-compiling is an exciting matter. What I now got to read externally about Clang, for example, was very enlightening. And no, you don't have to fiddle around with low-level system calls to get to the goal. But it remains a full-time job to realise a project of this size. But it's not for people like me who have other goals in life. That should be it from me.
User avatar
mfro
Posts: 662
Joined: Sat Sep 23, 2017 8:15 am

Re: Bug in the Select Color dialogue

Post by mfro »

Batucada wrote: Wed Aug 10, 2022 8:36 am Yes, cross-compiling is an exciting matter.
That's true, but cross-compiling is something entirely different (compile code for platform X with a compiler hosted on platform y, e.g. generate a Windows executable with a Linux-hosted compiler).

Qt is a multi-platform GUI toolkit that provides one single, uniform programming interface to different native GUI programming interfaces of different platforms. That has nothing to do with cross-compiling.
Without Qt, we most likely wouldn't have FreeCAD on Mac (and probably not even on Linux). I think with that in mind, we can certainly live with that (very few, mostly harmless) Qt bugs we're facing.
Cheers,
Markus
Post Reply