How should I create dock widgets for a MainWindow style application that can handle multiple documents via tabs?

For example, if this was an image editing program and I had a histogram in a dockwidget, how would I get the histogram to always display information associated with the currently selected tab?

Should I have the dock widget be a QStackWidget?
Should I have only a single widget that just updates itself with data from the currently selected widget?
Are there other strategies?

Thanks in advance,
~Eric