PDA

View Full Version : QColorDialog, Custom Color, Stored where and how to delete?



HappyCoder
17th November 2015, 14:46
Hello,
i'm using the QColorDialog. For testing purpose i drag&drop a color
into the custom colors. Even if i close my app, after restart the custom
color remains.

1) Where does Qt store the custom colors?
2) How to delete a custom color from QColorDialog? (pressing "Delete" doesn't work)

Thx
HappyCoder

d_stranz
17th November 2015, 15:54
By default, Qt uses the operating system's native color dialog. Any custom colors are stored by the OS wherever it stores them and are shared by all color dialogs.

You probably have two choices to work around this:

1 - Set the DontUseNativeDialog option to use Qt's internal color dialog
2 - Use a loop over QColorDialog::customCount() and QColorDialog::setCustomColor() to set them all to white before calling exec().