There are a number of approaches that may work.
You might first consider trying to compose a solution with a normal QPushButton
with a QVBoxLayout
on it. You could add three QLabels
; one for the title text, one for the caption text and one for the image. Some CSS could probably be used to render the background image of the button for up and down and more CSS to style the text in the two labels and position the image on the third but you would then find that the labels don't shift down when the button is clicked.
I think the best solution involves direct painting. You could do this by sub classing a QWidget
and overriding the paintEvent()
. Render everything for the up state and shift everything over and down a bit for the down state.
You could achieve this without sub classing by rendering the up and down states to a QImage
and styling a QPushbutton with them using CSS.
There are a number of combinations of these approaches too.