Introduce DockWidgetBase::LayoutSaverOptions enum

The first enumerator is "Skip", meaning the dock widget won't
be affected by save/restore. It won't disappear while restoring,
and won't be shown if already hidden. (only applies to floating widgets)
This commit is contained in:
Sergio Martins
2021-01-11 22:42:23 +00:00
parent 7698584ee0
commit e0e6f55868
13 changed files with 167 additions and 47 deletions

View File

@@ -76,9 +76,17 @@ public:
Option_None = 0, ///< No option, the default
Option_NotClosable = 1, ///< The DockWidget can't be closed on the [x], only programatically
Option_NotDockable = 2 ///< The DockWidget can't be docked, it's always floating
};
Q_DECLARE_FLAGS(Options, Option)
/// @brief Options which will affect LayoutSaver save/restore
enum class LayoutSaverOption {
None = 0, ///< Just use the defaults
Skip = 1, ///< The dock widget won't participate in save/restore. Currently only available for floating windows.
};
Q_DECLARE_FLAGS(LayoutSaverOptions, LayoutSaverOption)
enum class IconPlace {
TitleBar = 1,
TabBar = 2,
@@ -91,12 +99,15 @@ public:
/**
* @brief constructs a new DockWidget
* @param uniqueName the name of the dockwidget, should be unique. Use title for user visible text.
* @param options optional options controlling behaviour
* @param options options controlling certain behaviours
* @param layoutSaverOptions options to control save/restore
*
* There's no parent argument. The DockWidget is either parented to FloatingWindow or MainWindow
* when visible, or stays without a parent when hidden.
*/
explicit DockWidgetBase(const QString &uniqueName, Options options = DockWidgetBase::Options());
explicit DockWidgetBase(const QString &uniqueName,
Options options = DockWidgetBase::Options(),
LayoutSaverOptions layoutSaverOptions = LayoutSaverOptions());
///@brief destructor
~DockWidgetBase() override;
@@ -198,6 +209,10 @@ public:
*/
Options options() const;
/// @brief returns the per-dockwidget options which will affect LayoutSaver
/// These are the options which were passed to the constructor
KDDockWidgets::DockWidgetBase::LayoutSaverOptions layoutSaverOptions() const;
/**
* @brief Setter for the options.
* Only Option_NotClosable is allowed to change after construction. For the other options use