Know when the mouse is hovering over SpinBox arrow buttons?
A spin box generally has an editable value and two buttons to step the value up and down. I would like to make a custom spin box that is aware of when the mouse clicks on the arrow buttons as opposed to in the text field. The ultimate goal is to have a spin box where you can click and drag on either arrow to advance the value up or down, depending on how far you move the mouse up/down from the point of the click.
I figured out a way to do this, but it feels fragile:
QAbstractSpinBox has an accessor to get the lineEdit control, so I just use the width of the line edit and presume that if I get a click whose x is larger than lineEdit().width(), it is over the arrows instead of over the line edit control. Not sure if I can rely on this in all styles, but for now it is at least working.
I think QStyle should be able to tell you the rect for the buttons, actually. You might be in trouble if RTL layouts in your current approach.