Ok, hopefully this will be my last Qwt question for a little bit!

I'm still working on having a single QwtScaleWidget that isn't associated with a specific plot and use it to display the x-axis information for a group of vertically aligned plots in that are in a scroll area. The only issue I have remaining is figuring out how to properly align the standalone QwtScaleWidget with the plots.

Here's an image of where I'm at currently:
plotRaw.jpg
Note how the scale widget up in the top white area isn't aligned with the plots/scale widgets in the grey area.

And here's where I want to get to (photoshopped image!)
plotDesired.jpg
Scale widget in white area is lined up with plots. The per plot bottom scale widgets are disabled.

And here's a breakdown of all the widgets in play
plotBreakdown.jpg

So the specific issues I'm having:
  1. Calculating the correct width of the standalone QwtScaleWidget. I'm assuming maybe if I dig down into QwtPlot's code (maybe inside resizeEvent()?) I can copy how Uwe calculates the correct size for the scale widgets that are internal to the QwtPlot class? Right now, I'm emitting a signal in my myPlot's resizeEvent() (after calling QwtPlot::resizeEvent()) that emits the width of the bottom scale widget. This works when the bottom scale widget is enabled, but obviously doesn't work once I disable the bottom scale widget, so my current method clearly isn't going to work.
  2. Calculating the correct x coordinate (in plotContainer coordinates) for where the standalone QwtScaleWidget needs to be placed to be aligned with the plots. This seems to have something to do with the string length of the leftmost tick label.
  3. Locking the x position of the standalone QwtScaleWidget to the position calculated in the previous step. Right now, the QSpacerItem that is between the "Add Plot.." QPushButton and the QwtScaleWidget seems to just be doing whatever it wants, so the scale widget doesn't line up where I need it to. Maybe once I've calculated the correct x-axis coordinate in step 3 (in plotContainer coordinates), I need to subtract off the QPushButton width, plus the various internal margins/spacings, and then set that QSpacertItem to have a fixed width?
  4. When is the correct time to set the width and position? Right now, the plots are in layouts that allow the plots to take up as much space as they can whenever the main window resizes. I want to keep that functionality intact, but I noticed that as I explicitly resize the standalone scale widget, which I'm triggering off from the plot(s) resizeEvent(), it sometimes causes a ripple effect where the plotContainer widget tries to grow wider, which then causes another plot resize, which can get me in an infinite loop