Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Get the advanced color picker only, from QColorDialog
-
Is it possible to load advanced picker from QColorDialog into a widget? By advanced picker I mean like the one in the picture.
I made a color picker with colors of my choice but still want to let the user define their own colors and add it to a custom colors list. I could write something like the one in the picture myself but was thinking if it possible to just get the thing from QColorDialog and add it into a layout/widget.
-
Hi
Well the
class QColorPicker : public QFrame
{is only defined in .cpp it seems its not possible to reuse.
But we can steal one from a QColroDialog and insert into a layout
But im not use if we can connect to it and use it really.
btw i steal it like this
QColorDialog d; d.dumpObjectTree(); // to see the class names inside.. auto list = d.findChildren<QWidget *>(); for (QWidget *w : list) { if (strcmp( w->metaObject()->className(), "QColorPicker") == 0) ui->test->addWidget(w); // test is a layout }
-
@mrjj I tried implementing this in PySide2. This method was just not going well with my full code for some reason. Ended up writing a whole new class and made my own advanced color picker (not complete) it gives me more control too. But this is a nice method and can actually be used in certain cases. Thank you for your effort.
-
@tIk90wT
Hi
Well since we can't use the type QColorPicker, it was not really possible to connect to its signals
so it was not very useful anyway.
So a custom color picker sounds much better.
If it turns out good, maybe share it with the world ?
-
@mrjj Yes I will. It's part of a bigger project, which includes the color picker, event calender etc. I will be sharing it with a GPL licence.