Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QColorDialog window blank on Linux
Have the similar problem to the linked one. Running Qt 5.9.0 on Ubuntu 16.04 (64 bit).
Trick with QColorDialog::Don'tUseNativeDialog works for me as well but unfortunately I had to patch some third party code which I would prefer to leave as is.
Any ideas why ?
You should try with 5.9.1 to see if it's still misbehaving otherwise please post a sample code that reproduces the error you get.
I will try once back from holidays as currently I do not have access to reliable Wifi.
However, for the error part. I dont see any. I simply see no content in the color dialog, like it was never painted.
enmaniac last edited by enmaniac
Sorry for coming late.
I have checked against Qt 5.9.1 and I could observe the same problem.
The code used which leads to wrong result is like this (this is from QtPropertyBrowser):
bool ok = false; ... QRgb newRgba = QColorDialog::getRgba(oldRgba, &ok, this);
The code which works as expected:
... QColor newColor = QColorDialog::getColor(m_color, this, QString(), QColorDialog::DontUseNativeDialog);
EDIT: hmmm...it seems that the problem occurs only for this particular case when called from QtPropertyBrowser...I'll try to investigate it further
So I have built Qt 5.9.1 from sources on my Ubuntu box to be able to debug Qt code. It seems the dialog is presented correctly when using my developers Qt :/
However, the dialog shown is exactly the same as one with stock Qt and QColorDialog::DontUseNativeDialog option enabled.
I wonder if it can have something to do with configuration of my Qt source build.
Do you have the same behaviour with your distribution provided Qt ?
Just as a note,
QRgb newRgba = QColorDialog::getRgba(oldRgba, &ok, this);
works as expected on Mint 18 64bit xfce , Qt5.9 downloaded.
Ok I have found the cause of the problem. It seems that in this particular case, problem with rendering on QColorDialog was caused by my QOpenGLWidget based object where in its paintGL method I was calling update(). This somehow messed up the composition of QColorDialog which popped up on top of QOpenGLWidget.
I am not sure why the rendering problem does not occur when QColorDialog::DontUseNativeDialog is used though. Since depending on the flag presence, 2 completely different QColorDialogs can popup, I can only assume that one of them is somehow influenced by composition with OpenGL-enabled widget.
Thanks for the feedback !
One is the native dialog of the system and the other one is Qt's own implementation of the dialog.
enmaniac last edited by enmaniac
Indeed, it looks like that form the flag name. Apparently, in this case, native dialog has some 'feature' causing composition to fail. At least we know it now, though I suppose this is very OS based or even window manager based.
For future reference, I am using Unity.
Thanks again for all your time!
ChortleMortal last edited by
I am experiencing this problem on 5.11.2 running Linux Mint. So it is still there.
Using the following formulation:
First problem: the dialog initializes with color black, not the given color. When pressing OK, the slot is triggered
but the color is always color white, whatever is selected in the dialg. So essentially it does not work at all.
using the formulation
QColor newColor = QColorDialog::getColor(m_color, this, QString(), QColorDialog::DontUseNativeDialog);
does work as was mentioned before