Unsolved Making custom button widget
-
Hi All,
I need a custom button widget as shown below:
I need to make this as reusable throughout my project. Is there any documentation detailing procedure to make custom button widgets?
Thank you
-
Hi
But is that not more like a QSlider ?
And not a button?In any case, you would inherit from the base class you want and override virtual function or add new functions to make it do what you want. Sample is not related to slider/button. just example.
#include <qwidget.h> class Vcr : public QWidget { Q_OBJECT public: Vcr( QWidget *parent = 0, const char *name = 0 ); ~Vcr() {} signals: void rewind(); void play(); void next(); void stop(); };
However, for such slider thingy , would it not be easier to simply make a composite widget.
One that is made of several widgets ?
and then use stylesheet and images to make it look like the image.However, if u really want the value to show on the Sliders handle, then you have to subclass
QSlider and its paintEvent, to draw the the value on top. its not possible via stylesheets. -
Hi,
Isn't that basically the same question as this thread ?
-
I'm sorry for posting it again. The idea is the same but I'm looking for a more general procedure to make a custom widget.
I followed @mrjj comments created a button as shown below:
This widget contains four push buttons (for fine increment/decrement and double increment/decrement) and a label to show the current value. It is a standard form class. I need to make it as a standard widget.
I'm still in question how to reuse it on my other forms?
-
Basically there are two ways:
In both cases you can use your widget in different projects (if you promote it, you have to include the source code / your widgets class)