Added support for setting config parameters to CDockManager

This commit is contained in:
Uwe Kindler 2024-10-28 15:30:29 +01:00
parent a13ed7e4d6
commit eb9b439d11
2 changed files with 36 additions and 0 deletions

View File

@ -48,6 +48,7 @@
#include <QApplication>
#include <QWindow>
#include <QWindowStateChangeEvent>
#include <QVector>
#include "FloatingDockContainer.h"
#include "DockOverlay.h"
@ -94,6 +95,7 @@ enum eStateFileVersion
static CDockManager::ConfigFlags StaticConfigFlags = CDockManager::DefaultNonOpaqueConfig;
static CDockManager::AutoHideFlags StaticAutoHideConfigFlags; // auto hide feature is disabled by default
static QVector<QVariant> StaticConfigParams(CDockManager::ConfigParamCount);
static QString FloatingContainersTitle;
@ -1475,6 +1477,20 @@ CDockWidget::DockWidgetFeatures CDockManager::globallyLockedDockWidgetFeatures()
}
//===========================================================================
void CDockManager::setConfigParam(CDockManager::eConfigParam Param, QVariant Value)
{
StaticConfigParams[Param] = Value;
}
//===========================================================================
QVariant CDockManager::configParam(eConfigParam Param, QVariant Default)
{
return StaticConfigParams[Param].isValid() ? StaticConfigParams[Param] : Default;
}
} // namespace ads
//---------------------------------------------------------------------------

View File

@ -263,6 +263,15 @@ public:
};
Q_DECLARE_FLAGS(AutoHideFlags, eAutoHideFlag)
/**
* Global configuration parameters that you can set via setConfigParam()
*/
enum eConfigParam
{
AutoHideOpenOnDragHoverDelay_ms, ///< Delay in ms before the dock opens on drag hover if AutoHideOpenOnDragHover flag is set
ConfigParamCount // just a delimiter to count number of config params
};
/**
* Default Constructor.
@ -324,6 +333,17 @@ public:
*/
static bool testAutoHideConfigFlag(eAutoHideFlag Flag);
/**
* Sets the value for the given config parameter
*/
static void setConfigParam(eConfigParam Param, QVariant Value);
/**
* Returns the value for the given config parameter or the default value
* if the parameter is not set.
*/
static QVariant configParam(eConfigParam Param, QVariant Default);
/**
* Returns the global icon provider.
* The icon provider enables the use of custom icons in case using