Skip to content

Commit eb9b439

Browse files
Added support for setting config parameters to CDockManager
1 parent a13ed7e commit eb9b439

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

src/DockManager.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#include <QApplication>
4949
#include <QWindow>
5050
#include <QWindowStateChangeEvent>
51+
#include <QVector>
5152

5253
#include "FloatingDockContainer.h"
5354
#include "DockOverlay.h"
@@ -94,6 +95,7 @@ enum eStateFileVersion
9495

9596
static CDockManager::ConfigFlags StaticConfigFlags = CDockManager::DefaultNonOpaqueConfig;
9697
static CDockManager::AutoHideFlags StaticAutoHideConfigFlags; // auto hide feature is disabled by default
98+
static QVector<QVariant> StaticConfigParams(CDockManager::ConfigParamCount);
9799

98100
static QString FloatingContainersTitle;
99101

@@ -1475,6 +1477,20 @@ CDockWidget::DockWidgetFeatures CDockManager::globallyLockedDockWidgetFeatures()
14751477
}
14761478

14771479

1480+
//===========================================================================
1481+
void CDockManager::setConfigParam(CDockManager::eConfigParam Param, QVariant Value)
1482+
{
1483+
StaticConfigParams[Param] = Value;
1484+
}
1485+
1486+
1487+
//===========================================================================
1488+
QVariant CDockManager::configParam(eConfigParam Param, QVariant Default)
1489+
{
1490+
return StaticConfigParams[Param].isValid() ? StaticConfigParams[Param] : Default;
1491+
}
1492+
1493+
14781494
} // namespace ads
14791495

14801496
//---------------------------------------------------------------------------

src/DockManager.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,15 @@ public Q_SLOTS:
263263
};
264264
Q_DECLARE_FLAGS(AutoHideFlags, eAutoHideFlag)
265265

266+
/**
267+
* Global configuration parameters that you can set via setConfigParam()
268+
*/
269+
enum eConfigParam
270+
{
271+
AutoHideOpenOnDragHoverDelay_ms, ///< Delay in ms before the dock opens on drag hover if AutoHideOpenOnDragHover flag is set
272+
ConfigParamCount // just a delimiter to count number of config params
273+
};
274+
266275

267276
/**
268277
* Default Constructor.
@@ -324,6 +333,17 @@ public Q_SLOTS:
324333
*/
325334
static bool testAutoHideConfigFlag(eAutoHideFlag Flag);
326335

336+
/**
337+
* Sets the value for the given config parameter
338+
*/
339+
static void setConfigParam(eConfigParam Param, QVariant Value);
340+
341+
/**
342+
* Returns the value for the given config parameter or the default value
343+
* if the parameter is not set.
344+
*/
345+
static QVariant configParam(eConfigParam Param, QVariant Default);
346+
327347
/**
328348
* Returns the global icon provider.
329349
* The icon provider enables the use of custom icons in case using

0 commit comments

Comments
 (0)