Unsolved QT equivalent of CGradient and CGradientCtrl
-
I've got an application I'm converting to Qt. It uses the above Windows custom controls. Effectively they give you UI control of QLinearGradient like gradients.
The application in question is using it as a Gamma slider.
I suspect that a Qt expert (which I most definitely am not) could probably create something like it in a "jiffy".
Has anyone "been there, done that, bought the T-Shirt"?
Thanks
David -
Hi
Im not sure what a CGradientCtrl does ? ( what it allows the user to do )You can style any with a gradient.
even has an editor.
But not sure what a "Gamma slider." is.
My brain says like a QSlider with gradient on. but just guessing :)
-
So sorry I forgot to post the URL, so of course you won't know what it does:
https://www.codeproject.com/articles/2196/cgradient-and-cgradientctrl
D.
-
@Perdrix
So its a control that allows the user to kinda edit the gradient, moving the PEGS around ?
Like the build-in editor ?It seems to use palettes, is that important to you ?
-
Well not much like that editor, but sort of in concept at least. But it does more than that - when the use moves the pegs the application can be told that changes have been made. So if I wish to move the "grey" point in a gamma slider for the default position of sqrt(0.5) , I can do so and the application get to know the new position etc.. Or I can change the "black point" and be told that has changed as well.
Palettes, yes but that's a Windows CPalette which isn't very much like a QPalette ...
-
@Perdrix
Hi
Hmm I have not seen such Widget im afraid. ( also did a google search but its all types of other sliders)So it must allow color change and have movable PEGS that send a signal when moved.
Can user also add/remove pegs ?You could reuse the editor for the PEGS part
https://code.woboq.org/qt5/qttools/src/shared/qtgradienteditor/
or try to port that class CGradientCtrl to Qt. I could not watch the code so not sure how much
it would take. You can reuse its structures but anything mouse related and colors would have to be changed. -
Yes, User can add pegs as needed by double click - it's a pretty clever control. I looked at the Gradient control editor and it's not IMHO in the same league. You might be able to convert the MFC code to Qt, not sure I could!
-
Hi
Update.
I found this
https://github.com/ctin/MultiSlider
That can have multiple handles. (as many as you like) Maybe this can be tweaked to do what you want ?
-
Hi,
Do you mean something like shown in this cgradient demo project ?
-
@SGaist
Yep, exactly that one. He links to it higher up. -
@mrjj said in QT equivalent of CGradient and CGradientCtrl:
@SGaist
Yep, exactly that one. He links to it higher up.Sorry, I missed the link.
The multi slider you found looks like a good start.
-
@SGaist
At least he would get the "PEGS" adding and movement for free.
So yeah, it could be, i hope.