Introduce main window affinity

By default a dock widget can dock into any main window.
With affinities, we can now have a dock widget "belong" to a main window
and only be able to dock into it (or into other floating dock widgets
with the same affinity).

See DockWidgetBase::setAffinity() and MainWindowBase::setAffinity().
This commit is contained in:
Sergio Martins
2020-02-09 21:02:21 +00:00
parent 59bb0d8e71
commit d6997eaf7f
13 changed files with 234 additions and 10 deletions

View File

@@ -100,6 +100,29 @@ public:
///@brief returns the MultiSplitterLayout.
MultiSplitterLayout* multiSplitterLayout() const;
/**
* @brief Sets the affinity name. Dock widgets can only dock into main windows of the same affinity.
*
* By default the affinity is empty and a dock widget can dock into any main window. Usually you
* won't ever need to call this function, unless you have requirements where certain dock widgets
* can only dock into certain main windows. @sa DockWidgetBase::setAffinityName().
*
* Note: Call this function right after creating your main window, before docking any dock widgets
* into a main window and before restoring any layout.
*
* Note: Currently you can only call this function once, to keep the code simple and avoid
* edge cases. This will only be changed if a good use case comes up that requires changing
* affinities multiple times.
*
* @p name The affinity name.
*/
void setAffinityName(const QString &name);
/**
* @brief Returns the affinity name. Empty by default.
*/
QString affinityName() const;
protected:
void setUniqueName(const QString &uniqueName);