how to draw a custom slider which can be moved by mouse as the Qt intrinsic slider?
Unsolved
General and Desktop
-
Is it repeat of the question ?
As explained earlier, you need to draw things on your own using the paintEvent(..) & handle the mouse events appropriately. Please look at the topics how to write customWidgets.
-
You can do it in graphics view also. Again I'm repeating the following steps.
- Look at how custom widgets are created.
- re-impliment the paintEvent(...) function.
- Draw slider, handler, bar everything on your own.
- re-implement mousePress, mouseRelease events.
Look at the examples I have sent earlier. You are asking the code of the custom slider which you wanted. This will will be very difficult. Here people will help you with specific problem.
-
- Draw your slider handle in side the paintEvent(..) function.
- Handle mouse press, release and move function.
- Change the x, y position of your handle inside the mouse event handlers.
- Call paintEvent(...) again by calling update(..)
Look at the pathStroke example. It may help you.
-
Hi
Just as a note.
QtCreator comes with something like the gradient thing.
You could look around its code to see how its done.