A graphical gauge for qt/c++ applications
This gauge doesn't use any static picture or wallpaper, rather it is rendered at C++ Runtime by 'drawing'. This allows for dynamic changes to the instrument's attributes.
Extensibile widget can be adapted for use as Compass , Altimeter , etc...
- First use header and source file in your project
- Instantiate QcGaugeWidget object (this will run necessary initialization)
- Set key attributes for your application
- Add widget to layout (unless widget is already present in UI form)
- See example below:
#include "qcgaugewidget.h" QcGaugeWidget * mSpeedGauge;
mSpeedGauge = new QcGaugeWidget(); // Instantiate and call constructor mSpeedGauge->setColour(Qt::cyan); // Set accent colours mSpeedGauge->titleLabel->setText("km/h"); // Title or Units mSpeedGauge->needle->setValueRange(0,80); // Displayable range of values ui->verticalLayout->addWidget(mSpeedGauge); // Add widget to layout
Results in:
Can also be adapted for other uses:
This is building on other's work to make the widget more accessible and extensible.
See parent project: https://github.com/Berrima/Qt-custom-gauge-widget