KDDockWidgets API Documentation 1.7
Loading...
Searching...
No Matches
MultiSplitterConfig.cpp
Go to the documentation of this file.
1/*
2 This file is part of KDDockWidgets.
3
4 SPDX-FileCopyrightText: 2020-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5 Author: SĂ©rgio Martins <sergio.martins@kdab.com>
6
7 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
8
9 Contact KDAB at <info@kdab.com> for commercial licensing options.
10*/
11
12#include "MultiSplitterConfig.h"
13#include "Widget.h"
14#include "Item_p.h"
15#include "Separator_p.h"
16
17#ifdef KDMULTISPLITTER_QTQUICK
18#include <QQmlEngine>
19#endif
20
21namespace Layouting {
22
23Config::Config()
24{
25 registerQmlTypes();
26}
27
28Separator *Config::createSeparator(Widget *parent) const
29{
30 if (m_separatorFactoryFunc)
31 return m_separatorFactoryFunc(parent);
32
33 return nullptr;
34}
35
36void Config::registerQmlTypes()
37{
38#ifdef KDMULTISPLITTER_QTQUICK
39 qmlRegisterUncreatableType<Item>("com.kdab.kddockwidgets.multisplitter", 1, 0,
40 "KDMultiSplitter", QStringLiteral("enum access"));
41#endif
42}
43
45{
46 static Config config;
47 return config;
48}
49
53
55{
56 // TODO: Make Item call Config::separatorThickness instead ?
57 return Item::separatorThickness;
58}
59
61{
62 if (value < 0 || value >= 100) {
63 qWarning() << Q_FUNC_INFO << "Invalid value" << value;
64 return;
65 }
66
67 Layouting::Item::separatorThickness = value;
68}
69
71{
72 if (m_separatorFactoryFunc && !func) {
73 qWarning() << Q_FUNC_INFO << "Refusing to store nullptr separator func";
74 return;
75 }
76
77 m_separatorFactoryFunc = func;
78}
79
81{
82 return m_separatorFactoryFunc;
83}
84
85Config::Flags Config::flags() const
86{
87 return m_flags;
88}
89
90void Config::setFlags(Flags flags)
91{
92 if (m_flags == flags)
93 return;
94
95 // validations here, if any
96
97 m_flags = flags;
98}
99
100}
An abstraction/wrapper around QWidget, QtQuickItem or anything else.
SeparatorFactoryFunc separatorFactoryFunc() const
Returns the function used to create separators, null by default.
Config::Flags flags() const
returns the flags;
int separatorThickness() const
Returns the thickness of the separator.
void setSeparatorThickness(int value)
setter for separatorThickness Note: Only use this function at startup before creating any Item
void setFlags(Flags)
sets the flags. Set only before creating any Item
static Config & self()
returns the singleton Config instance
void setSeparatorFactoryFunc(SeparatorFactoryFunc)
sets the function used internally to create the separators
~Config()
destructor, called at shutdown
Separator *(* SeparatorFactoryFunc)(Layouting::Widget *parent)

© 2019-2023 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDDockWidgets
Advanced Dock Widget Framework for Qt
https://www.kdab.com/development-resources/qt-tools/kddockwidgets/
Generated on Wed Nov 1 2023 00:02:31 for KDDockWidgets API Documentation by doxygen 1.9.8