An Animated Circular Gauge for QGraphicsView Framework

This article describes a simple animated round gauge I created for the Qt Graphics View Framework.  Despite the emphasis on QML nowadays, “old” Qt is still of value.  Lots of people use QGraphicsView still, so I thought this could be useful to people. Find the source at

The image below shows a static view of the CircularGaugeGraphicsObject. The outer white ring is the outline of the gauge, the red curved “bar” is a graphical representation of the value displayed by the gauge, and the red ring is the “glow ring”.  The glow ring pulses; its color can be altered to pulse different colors within different value ranges.

Here is a video of the gauge in action. A change in the displayed value results in an animation sequence that changes the bar gradually.  An animation sequence also causes the glow ring to pulse.  Both effects are obtained via the the Qt Animation Framework. 

The gauge is built up from layers.  The first layer is the empty “channel”, while the next layer adds the value bar.  Both layers are drawn by QPainter::drawPie.

The next layer is the pulse ring, which is an ellipse drawn by QPainter::drawEllipse.

The next to last layer is a black ellipse, within which the value of the gauge is displayed.

QVariantAnimation is used animate both the value bar and the pulse ring.

I hope you find this useful.  Constructive feedback and questions are always welcome.


Introduction to Hierarchical Data Format (HDF)

Hierarchical Data Format (HDF) is a non-proprietary format designed to handle large sets of complex, multidimensional, heterogeneous data.  It is supported by the HDF Group, a non-profit organization dedicated to long-term development and maintenance of HDF. There are two versions of the format, HDF4 and HDF5.  HDF5 is a simplification of HDF4, with a better defined data model and a much simpler API. I have worked with both formats, and HDF5 is IMO the better choice, unless you have legacy files and code in HDF4.

HDF5 has a very liberal licensing policy; you may distribute it in binary or source form, as long as you acknowledge the HDF Group appropriately (licensing info).  This includes commercial uses.

HDF5 is supported by Matlab, Mathematica, and other commercial and non-commercial products.  It is a C library with bindings for C++, Fortran,  Java, Python, Julia, .Net, R, and others.  This makes it a good format for cross-platform/cross-language exchange/transmission of data. The distribution includes the library, an Java-based HDF viewer, command-line utilities, and source for a test suite.

Internally, HDF5 is very much like a file system structure, with group objects that can hold other groups or data sets.  You can refer to groups using file system like paths: /path/to/stuff.  It’s basically a Big Data/No SQL format.  Data is self-describing, so any application that wants to read an HDF5 file knows exactly what is in each data set.  It has a very flexible metadata/attribute system.  You can easily describe and read/write any data type that meets specific data needs in your environment, and allow anyone to understand that data type later. An HDF5 file is internally indexed by a BSP tree, so you can randomly access groups and data sets without having to read in the entire file first. HDF5 data sets can be laid out in contiguous or “chunked” form.  Chunking is necessary for compression and for creating data sets with extendible dimensions. In other words, you can continue to grow the dimensions of a data set within the file.

This was just a short introduction, but I hope you can see that HDF is a powerful way to store and exchange data, and check it out to see if it can help you with your data storage needs and issues.


New article on libclang

I have just added a new article about using libclang to discover information about C++ classes, in particular QObject classes. The article describes the approach I took to find special Qt keywords, such as signals and slots.  Look under Articles->Clang.


This blog is about software.  In it, I intend to explore and experiment with a number of software concepts that interest me, among them:

Most posts will take the form of tutorials with code, showing what I’ve personally learned about a subject.  There is nothing like picking up a library or a tool, doing a project with it, and writing about it to really help one fully internalize what it is all about.  Much of what I know about any particular subject, libclang for instance, comes from tutorials I Googled; my posts may or may not give you much more than those other sources.  My point here is to learn, write, and share whatever I can that may be useful to myself and my readers. And, of course, I hope to receive constructive criticism, advice, and ideas from those who choose to visit here….