KDDockWidgets API Documentation  1.5
DropAreaWithCentralFrame.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KDDockWidgets.
3 
4  SPDX-FileCopyrightText: 2019-2022 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"
14 #include "FrameworkWidgetFactory.h"
15 
16 using namespace KDDockWidgets;
17 
18 DropAreaWithCentralFrame::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 
26 DropAreaWithCentralFrame::~DropAreaWithCentralFrame()
27 {
28 }
29 
30 Frame *DropAreaWithCentralFrame::createCentralFrame(MainWindowOptions options)
31 {
32  Frame *frame = nullptr;
33  if (options & MainWindowOption_HasCentralFrame) {
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 }
QWidget
KDDockWidgets::Location_OnTop
@ Location_OnTop
Left docking location
Definition: KDDockWidgets.h:48
KDDockWidgets::MainWindowOption_HasCentralWidget
@ MainWindowOption_HasCentralWidget
The layout will be MDI. DockWidgets can have arbitrary positions, not restricted by any layout
Definition: KDDockWidgets.h:59
KDDockWidgets::FrameOption_AlwaysShowsTabs
@ FrameOption_AlwaysShowsTabs
Definition: KDDockWidgets.h:261
KDDockWidgets::FrameOption_NonDockable
@ FrameOption_NonDockable
Definition: KDDockWidgets.h:264
Config.h
Application-wide config to tune certain behaviours of the framework.
KDDockWidgets
Definition: Config.cpp:36
KDDockWidgets::FrameOption_IsCentralFrame
@ FrameOption_IsCentralFrame
Definition: KDDockWidgets.h:262
FrameworkWidgetFactory.h
A factory class for allowing the user to customize some internal widgets.
KDDockWidgets::MainWindowOption_HasCentralFrame
@ MainWindowOption_HasCentralFrame
No option set
Definition: KDDockWidgets.h:57

© 2019-2022 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 Mon Mar 7 2022 02:01:20 for KDDockWidgets API Documentation by doxygen 1.8.20