Unsolved Gradient Picker, how?!
-
is there any tutorials on how to make a Gradient Picker GUI? where i can add / remove positions and edit each color in each position and save gradient palette and open / load gradient palette!
is there any tutorials at all? i've googled for 1 hour now but with no luck!
-
@Kris-Revi hi
I don't know any tutorial about that but here is an example that shows how to dynamically edit the gradient
https://stackoverflow.com/questions/36049068/how-to-dynamically-add-stops-in-a-gradient
You can then save/load the values to/from a text file[EDIT] i thought it's in QML
-
@LeLev hehe np!
Like this would be awsome! but google / github / stackoverflow = nothing in searching :/
-
@Kris-Revi
Is https://www.codeproject.com/Articles/5267129/Gradient-Color-Picker any good?Since it's in my favorite C#, it should be a doddle to convert to C++ :-) And hopefully to adapt to Qt. Worth a look at least for a schema of code already written?
-
@JonB im in no way an expert here and this is way out of my field! :/
-
@Kris-Revi
How do you mean? Translating C# into C++? Easy :) IMHO. I thought it looked like just what you wanted. Couldn't find anything else, desktop. -
You can create such Gradient picker easily with some subclassing and some color magic :)
If I were you, I would consider to build one myself, if you are planning to use it more than once -
@Pl45m4 it's easy to say that! but im a beginner at best :/ never touched QGradient / QPainter!
-
QGradient
has a very detailed documentation.Create a custom widget, play around with
QGradient
and add input widgets (some kind of sliders or whatsever you want to do) to set theQGradientStops
. -
Hi
Just as a note.
The example is kinda a picker
https://doc.qt.io/qt-5/qtwidgets-painting-gradients-example.htmlThere is also the build-in editor
but not sure in what files it lives or if it can be reused easily.