KDDockWidgets API Documentation 1.7
Loading...
Searching...
No Matches
DropAreaWithCentralFrame.cpp
Go to the documentation of this file.
1/*
2 This file is part of KDDockWidgets.
3
4 SPDX-FileCopyrightText: 2019-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 "DropAreaWithCentralFrame_p.h"
13#include "Config.h"
15
16using namespace KDDockWidgets;
17
18DropAreaWithCentralFrame::DropAreaWithCentralFrame(QWidgetOrQuick *parent, MainWindowOptions options)
19 : DropArea(parent)
20 , m_centralFrame(createCentralFrame(options))
21{
22 if (m_centralFrame)
23 addWidget(m_centralFrame, KDDockWidgets::Location_OnTop, {});
24}
25
26DropAreaWithCentralFrame::~DropAreaWithCentralFrame()
27{
28}
29
30Frame *DropAreaWithCentralFrame::createCentralFrame(MainWindowOptions options)
31{
32 Frame *frame = nullptr;
34 FrameOptions frameOptions = FrameOption_IsCentralFrame;
35 const bool hasPersistentCentralWidget = (options & MainWindowOption_HasCentralWidget) == MainWindowOption_HasCentralWidget;
36 if (hasPersistentCentralWidget) {
37 frameOptions |= FrameOption_NonDockable;
38 } else {
39 // With a persistent central widget we don't allow detaching it
40 frameOptions |= FrameOption_AlwaysShowsTabs;
41 }
42
43 frame = Config::self().frameworkWidgetFactory()->createFrame(nullptr, frameOptions);
44 frame->setObjectName(QStringLiteral("central frame"));
45 }
46
47 return frame;
48}
Application-wide config to tune certain behaviours of the framework.
A factory class for allowing the user to customize some internal widgets.
FrameworkWidgetFactory * frameworkWidgetFactory() const
getter for the framework widget factory
Definition Config.cpp:145
static Config & self()
returns the singleton Config instance
Definition Config.cpp:84
virtual Frame * createFrame(QWidgetOrQuick *parent=nullptr, FrameOptions options=FrameOption_None) const =0
Called internally by the framework to create a Frame class Override to provide your own Frame sub-cla...
@ MainWindowOption_HasCentralWidget
‍The layout will be MDI. DockWidgets can have arbitrary positions, not restricted by any layout
@ MainWindowOption_HasCentralFrame
‍No option set
@ Location_OnTop
‍Left docking location

© 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