Add a basic MDI layout
Not fully functional yet, and no API for end user yet.
This commit is contained in:
@@ -38,6 +38,8 @@ set(DOCKSLIBS_SRCS
|
||||
LayoutSaver_p.h
|
||||
private/LayoutWidget.cpp
|
||||
private/LayoutWidget_p.h
|
||||
private/MDILayoutWidget.cpp
|
||||
private/MDILayoutWidget_p.h
|
||||
private/MultiSplitter.cpp
|
||||
private/MultiSplitter_p.h
|
||||
private/Position.cpp
|
||||
@@ -79,6 +81,8 @@ set(DOCKSLIBS_SRCS
|
||||
|
||||
private/multisplitter/Item.cpp
|
||||
private/multisplitter/Item_p.h
|
||||
private/multisplitter/ItemFreeContainer.cpp
|
||||
private/multisplitter/ItemFreeContainer_p.h
|
||||
private/multisplitter/Logging.cpp
|
||||
private/multisplitter/Logging_p.h
|
||||
private/multisplitter/MultiSplitterConfig.cpp
|
||||
|
||||
26
src/private/MDILayoutWidget.cpp
Normal file
26
src/private/MDILayoutWidget.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
*/
|
||||
|
||||
#include "ItemFreeContainer_p.h"
|
||||
#include "MDILayoutWidget_p.h"
|
||||
|
||||
using namespace KDDockWidgets;
|
||||
|
||||
MDILayoutWidget::MDILayoutWidget(QWidgetOrQuick *parent)
|
||||
: LayoutWidget(parent)
|
||||
, m_rootItem(new Layouting::ItemFreeContainer(this))
|
||||
{
|
||||
setRootItem(m_rootItem);
|
||||
}
|
||||
|
||||
MDILayoutWidget::~MDILayoutWidget()
|
||||
{
|
||||
}
|
||||
44
src/private/MDILayoutWidget_p.h
Normal file
44
src/private/MDILayoutWidget_p.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef KDDOCKWIDGETS_MDI_LAYOUT_WIDGET_P_H
|
||||
#define KDDOCKWIDGETS_MDI_LAYOUT_WIDGET_P_H
|
||||
|
||||
#include "LayoutWidget_p.h"
|
||||
#include "kddockwidgets/KDDockWidgets.h"
|
||||
#include "kddockwidgets/docks_export.h"
|
||||
|
||||
namespace Layouting {
|
||||
class ItemFreeContainer;
|
||||
}
|
||||
|
||||
namespace KDDockWidgets {
|
||||
|
||||
/**
|
||||
* @brief The MDILayoutWidget class implements a layout suitable for MDI style docking.
|
||||
* Where dock widgets are free to be positioned in arbitrary positions, not restricted by layouting.
|
||||
*/
|
||||
class DOCKS_EXPORT MDILayoutWidget : public LayoutWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MDILayoutWidget(QWidgetOrQuick *parent = nullptr);
|
||||
~MDILayoutWidget() override;
|
||||
|
||||
private:
|
||||
Layouting::ItemFreeContainer *const m_rootItem;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
58
src/private/multisplitter/ItemFreeContainer.cpp
Normal file
58
src/private/multisplitter/ItemFreeContainer.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company
|
||||
<info@kdab.com> Author: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
*/
|
||||
|
||||
#include "ItemFreeContainer_p.h"
|
||||
|
||||
using namespace Layouting;
|
||||
|
||||
ItemFreeContainer::ItemFreeContainer(Widget *hostWidget, ItemContainer *parent)
|
||||
: ItemContainer(hostWidget, parent)
|
||||
{
|
||||
}
|
||||
|
||||
ItemFreeContainer::ItemFreeContainer(Widget *hostWidget)
|
||||
: ItemContainer(hostWidget)
|
||||
{
|
||||
}
|
||||
|
||||
ItemFreeContainer::~ItemFreeContainer()
|
||||
{
|
||||
}
|
||||
|
||||
void ItemFreeContainer::clear()
|
||||
{
|
||||
qWarning() << Q_FUNC_INFO << "Implement me";
|
||||
}
|
||||
|
||||
void ItemFreeContainer::removeItem(Item *, bool hardRemove)
|
||||
{
|
||||
Q_UNUSED(hardRemove);
|
||||
qWarning() << Q_FUNC_INFO << "Implement me";
|
||||
}
|
||||
|
||||
void ItemFreeContainer::restore(Item *child)
|
||||
{
|
||||
Q_UNUSED(child);
|
||||
qWarning() << Q_FUNC_INFO << "Implement me";
|
||||
}
|
||||
|
||||
void ItemFreeContainer::onChildMinSizeChanged(Item *child)
|
||||
{
|
||||
Q_UNUSED(child);
|
||||
qWarning() << Q_FUNC_INFO << "Implement me";
|
||||
}
|
||||
|
||||
void ItemFreeContainer::onChildVisibleChanged(Item *child, bool visible)
|
||||
{
|
||||
Q_UNUSED(child);
|
||||
Q_UNUSED(visible);
|
||||
qWarning() << Q_FUNC_INFO << "Implement me";
|
||||
}
|
||||
44
src/private/multisplitter/ItemFreeContainer_p.h
Normal file
44
src/private/multisplitter/ItemFreeContainer_p.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "kddockwidgets/docks_export.h"
|
||||
#include "kddockwidgets/KDDockWidgets.h"
|
||||
#include "Item_p.h"
|
||||
|
||||
namespace Layouting {
|
||||
|
||||
|
||||
///@brief An Item container that supports its child widgets to occupy arbitrary positions
|
||||
///
|
||||
/// This is unlike ItemBoxContainer, which is used for the default/traditional vertical/horizontal
|
||||
/// layouting with nesting.
|
||||
///
|
||||
/// This free layout can be used to implement MDI style windows
|
||||
class DOCKS_EXPORT_FOR_UNIT_TESTS ItemFreeContainer : public ItemContainer
|
||||
{
|
||||
public:
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ItemFreeContainer(Widget *hostWidget, ItemContainer *parent);
|
||||
explicit ItemFreeContainer(Widget *hostWidget);
|
||||
~ItemFreeContainer();
|
||||
|
||||
void clear() override;
|
||||
void removeItem(Item *, bool hardRemove = true) override;
|
||||
void restore(Item *child) override;
|
||||
void onChildMinSizeChanged(Item *child) override;
|
||||
void onChildVisibleChanged(Item *child, bool visible) override;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user