Qt5 custom widget - Curved slider

796 views Asked by At

I'm starting my next electronics project which is to create my own version of Google's Nest Thermostat. I like the whole circular dial for temperature selection and I've been having a think about how to create this myself. GUI programming is not my area of expertise (CLI all the way!).

So far I'm think along one of two lines, both involving custom widgets:

  1. Create a widget that inherits from the pushbutton class. This subclass will contain lots of buttons, one for each step in the temperature scale, arranged in a 3/4 circle.
  2. Create a widget that inherits from the slider class, defining an object that is curved around 3/4 of a circle. Each step is a temperature.

Now... I have no idea if these are practical solutions to this problem or if there is a much easier way of doing this. I've had a look at the style sheets and I don't THINK that is going to do it. I've had a root around Google for anything similar and not found anything yet; that said, AnalogWidgets from 3electrons at least creates dials, but these are for output rather than input.

1

There are 1 answers

2
AudioBubble On

I tried this out yesterday and it works rather nicely if you want to simulate the nest thermostat in an app this includes the js and SVG image: https://www.svidget.io/examples/nestthermostat

HTML snippet:

<object id="nestThermostatWidget" role="svidget" data="nestThermostatWidget.svg" type="image/svg+xml" width="400" height="400">
<param name="targetTemp" value="77" />
<param name="ambientTemp" value="80" />
<param name="unit" value="F" />
<param name="state" value="cooling" />
<param name="showLeaf" value="1" />
<param name="awayMode" value="0" /> 
</object>