Rename MDILayoutWidget class to MDILayout
Since it's a controller, we strip the suffix
This commit is contained in:
@@ -118,7 +118,7 @@ public:
|
||||
|
||||
/// @brief Called internally by the framework to create a DropArea
|
||||
virtual View *createDropArea(Controllers::DropArea *, View *parent) const = 0;
|
||||
virtual View *createMDILayout(MDILayoutWidget *, View *parent) const = 0;
|
||||
virtual View *createMDILayout(MDILayout *, View *parent) const = 0;
|
||||
|
||||
///@brief Called internally by the framework to create a RubberBand to show as drop zone
|
||||
/// Returns a rubber band
|
||||
|
||||
@@ -26,7 +26,7 @@ MainWindowMDI::~MainWindowMDI()
|
||||
|
||||
void MainWindowMDI::addDockWidget(DockWidget *dockWidget, QPoint localPos, InitialOption addingOption)
|
||||
{
|
||||
auto layout = static_cast<MDILayoutWidget *>(mainWindow()->layoutWidget());
|
||||
auto layout = static_cast<MDILayout *>(mainWindow()->layoutWidget());
|
||||
layout->addDockWidget(dockWidget, localPos, addingOption);
|
||||
}
|
||||
|
||||
|
||||
@@ -256,10 +256,10 @@ Controllers::DropArea *View::asDropAreaController() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MDILayoutWidget *View::asMDILayoutController() const
|
||||
MDILayout *View::asMDILayoutController() const
|
||||
{
|
||||
if (!m_inDtor && m_controller && m_controller->is(Type::MDILayout))
|
||||
return qobject_cast<MDILayoutWidget *>(m_controller);
|
||||
return qobject_cast<MDILayout *>(m_controller);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -268,7 +268,7 @@ LayoutWidget *View::asLayout() const
|
||||
{
|
||||
if (Controllers::DropArea *da = asDropAreaController()) {
|
||||
return da;
|
||||
} else if (MDILayoutWidget *mdi = asMDILayoutController()) {
|
||||
} else if (MDILayout *mdi = asMDILayoutController()) {
|
||||
return mdi;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace KDDockWidgets {
|
||||
class ViewWrapper;
|
||||
class Controller;
|
||||
class Window;
|
||||
class MDILayoutWidget;
|
||||
class MDILayout;
|
||||
class LayoutWidget;
|
||||
|
||||
namespace Controllers {
|
||||
@@ -246,7 +246,7 @@ public:
|
||||
Controllers::DockWidget *asDockWidgetController() const;
|
||||
Controllers::MainWindow *asMainWindowController() const;
|
||||
Controllers::DropArea *asDropAreaController() const;
|
||||
MDILayoutWidget *asMDILayoutController() const;
|
||||
MDILayout *asMDILayoutController() const;
|
||||
LayoutWidget *asLayout() const;
|
||||
|
||||
/// @brief returns whether this view is inside the specified window
|
||||
|
||||
@@ -555,7 +555,7 @@ void DockWidget::Private::maybeMorphIntoFloatingWindow()
|
||||
morphIntoFloatingWindow();
|
||||
}
|
||||
|
||||
MDILayoutWidget *DockWidget::Private::mdiLayout() const
|
||||
MDILayout *DockWidget::Private::mdiLayout() const
|
||||
{
|
||||
auto p = q->view()->parentView();
|
||||
while (p) {
|
||||
@@ -907,7 +907,7 @@ int DockWidget::userType() const
|
||||
|
||||
void DockWidget::setMDIPosition(QPoint pos)
|
||||
{
|
||||
if (MDILayoutWidget *layout = d->mdiLayout()) {
|
||||
if (MDILayout *layout = d->mdiLayout()) {
|
||||
if (auto wrapperDW = d->mdiDockWidgetWrapper()) {
|
||||
// Case of using Option_MDINestable. We need to layout the actual top level DW
|
||||
layout->moveDockWidget(wrapperDW, pos);
|
||||
@@ -919,7 +919,7 @@ void DockWidget::setMDIPosition(QPoint pos)
|
||||
|
||||
void DockWidget::setMDISize(QSize size)
|
||||
{
|
||||
if (MDILayoutWidget *layout = d->mdiLayout()) {
|
||||
if (MDILayout *layout = d->mdiLayout()) {
|
||||
if (auto wrapperDW = d->mdiDockWidgetWrapper()) {
|
||||
// Case of using Option_MDINestable. We need to layout the actual top level DW
|
||||
layout->resizeDockWidget(wrapperDW, size);
|
||||
|
||||
@@ -140,7 +140,7 @@ public:
|
||||
void maybeMorphIntoFloatingWindow();
|
||||
|
||||
/// @brief Returns the mdi layout this dock widget is in, if any.
|
||||
MDILayoutWidget *mdiLayout() const;
|
||||
MDILayout *mdiLayout() const;
|
||||
|
||||
/// @brief Returns if this is an helper DockWidget created automatically to host a drop area inside MDI
|
||||
/// This is only used by the DockWidget::Option_MDINestable feature
|
||||
|
||||
@@ -935,7 +935,7 @@ DropArea *Frame::mdiDropAreaWrapper() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MDILayoutWidget *Frame::mdiLayoutWidget() const
|
||||
MDILayout *Frame::mdiLayoutWidget() const
|
||||
{
|
||||
return m_layoutWidget ? m_layoutWidget->asMDILayout() : nullptr;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
class TestDocks;
|
||||
|
||||
namespace KDDockWidgets {
|
||||
class MDILayoutWidget;
|
||||
class MDILayout;
|
||||
class WidgetResizeHandler;
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ public:
|
||||
Frame *mdiFrame() const;
|
||||
|
||||
/// @brief Returns the MDI layout. Or nullptr if this frame isn't in a MDI layout
|
||||
MDILayoutWidget *mdiLayoutWidget() const;
|
||||
MDILayout *mdiLayoutWidget() const;
|
||||
|
||||
/// @brief If this frame is a MDI frame (isMDI() == true), returns whether it contains nested dock widgets (DockWidget::Option_MDINestable)
|
||||
/// @sa isMDI()
|
||||
|
||||
@@ -19,18 +19,18 @@
|
||||
using namespace KDDockWidgets;
|
||||
using namespace KDDockWidgets::Controllers;
|
||||
|
||||
MDILayoutWidget::MDILayoutWidget(View *parent)
|
||||
MDILayout::MDILayout(View *parent)
|
||||
: LayoutWidget(Type::MDILayout, Config::self().frameworkWidgetFactory()->createMDILayout(this, parent))
|
||||
, m_rootItem(new Layouting::ItemFreeContainer(view()))
|
||||
{
|
||||
setRootItem(m_rootItem);
|
||||
}
|
||||
|
||||
MDILayoutWidget::~MDILayoutWidget()
|
||||
MDILayout::~MDILayout()
|
||||
{
|
||||
}
|
||||
|
||||
void MDILayoutWidget::addDockWidget(Controllers::DockWidget *dw, QPoint localPt, InitialOption addingOption)
|
||||
void MDILayout::addDockWidget(Controllers::DockWidget *dw, QPoint localPt, InitialOption addingOption)
|
||||
{
|
||||
if (!dw) {
|
||||
qWarning() << Q_FUNC_INFO << "Refusing to add null dock widget";
|
||||
@@ -62,7 +62,7 @@ void MDILayoutWidget::addDockWidget(Controllers::DockWidget *dw, QPoint localPt,
|
||||
}
|
||||
}
|
||||
|
||||
void MDILayoutWidget::setDockWidgetGeometry(Controllers::Frame *frame, QRect geometry)
|
||||
void MDILayout::setDockWidgetGeometry(Controllers::Frame *frame, QRect geometry)
|
||||
{
|
||||
if (!frame)
|
||||
return;
|
||||
@@ -76,12 +76,12 @@ void MDILayoutWidget::setDockWidgetGeometry(Controllers::Frame *frame, QRect geo
|
||||
item->setGeometry(geometry);
|
||||
}
|
||||
|
||||
void MDILayoutWidget::moveDockWidget(Controllers::DockWidget *dw, QPoint pos)
|
||||
void MDILayout::moveDockWidget(Controllers::DockWidget *dw, QPoint pos)
|
||||
{
|
||||
moveDockWidget(dw->d->frame(), pos);
|
||||
}
|
||||
|
||||
void MDILayoutWidget::moveDockWidget(Controllers::Frame *frame, QPoint pos)
|
||||
void MDILayout::moveDockWidget(Controllers::Frame *frame, QPoint pos)
|
||||
{
|
||||
if (!frame)
|
||||
return;
|
||||
@@ -97,12 +97,12 @@ void MDILayoutWidget::moveDockWidget(Controllers::Frame *frame, QPoint pos)
|
||||
item->setGeometry(geo);
|
||||
}
|
||||
|
||||
void MDILayoutWidget::resizeDockWidget(Controllers::DockWidget *dw, QSize size)
|
||||
void MDILayout::resizeDockWidget(Controllers::DockWidget *dw, QSize size)
|
||||
{
|
||||
resizeDockWidget(dw->d->frame(), size);
|
||||
}
|
||||
|
||||
void MDILayoutWidget::resizeDockWidget(Controllers::Frame *frame, QSize size)
|
||||
void MDILayout::resizeDockWidget(Controllers::Frame *frame, QSize size)
|
||||
{
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
@@ -32,12 +32,12 @@ 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
|
||||
class DOCKS_EXPORT MDILayout : public LayoutWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MDILayoutWidget(View *parent = nullptr);
|
||||
~MDILayoutWidget() override;
|
||||
explicit MDILayout(View *parent = nullptr);
|
||||
~MDILayout() override;
|
||||
|
||||
/// @brief docks the dock widgets into this MDI area, at the specified position
|
||||
void addDockWidget(Controllers::DockWidget *dw, QPoint localPt, InitialOption addingOption = {});
|
||||
|
||||
@@ -41,7 +41,7 @@ using namespace KDDockWidgets::Controllers;
|
||||
static LayoutWidget *createLayoutWidget(MainWindow *mainWindow, MainWindowOptions options)
|
||||
{
|
||||
if (options & MainWindowOption_MDI)
|
||||
return new MDILayoutWidget(mainWindow->view());
|
||||
return new MDILayout(mainWindow->view());
|
||||
|
||||
return new DropArea(mainWindow->view(), options);
|
||||
}
|
||||
@@ -217,7 +217,7 @@ LayoutWidget *MainWindow::layoutWidget() const
|
||||
return d->m_layoutWidget;
|
||||
}
|
||||
|
||||
MDILayoutWidget *MainWindow::mdiLayoutWidget() const
|
||||
MDILayout *MainWindow::mdiLayoutWidget() const
|
||||
{
|
||||
return d->m_layoutWidget->asMDILayout();
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class TestDocks;
|
||||
|
||||
namespace KDDockWidgets {
|
||||
|
||||
class MDILayoutWidget;
|
||||
class MDILayout;
|
||||
class LayoutWidget;
|
||||
|
||||
namespace Controllers {
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
|
||||
///@internal
|
||||
///@brief Returns the MDI layout. Or nullptr if this isn't a MDI main window
|
||||
MDILayoutWidget *mdiLayoutWidget() const;
|
||||
MDILayout *mdiLayoutWidget() const;
|
||||
|
||||
/**
|
||||
* @brief Sets the affinities names. Dock widgets can only dock into main windows of the same affinity.
|
||||
|
||||
@@ -325,7 +325,7 @@ Controllers::DropArea *LayoutWidget::asDropArea() const
|
||||
return view()->asDropAreaController();
|
||||
}
|
||||
|
||||
MDILayoutWidget *LayoutWidget::asMDILayout() const
|
||||
MDILayout *LayoutWidget::asMDILayout() const
|
||||
{
|
||||
return view()->asMDILayoutController();
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
LayoutSaver::MultiSplitter serialize() const;
|
||||
|
||||
Controllers::DropArea *asDropArea() const;
|
||||
MDILayoutWidget *asMDILayout() const;
|
||||
MDILayout *asMDILayout() const;
|
||||
|
||||
/// @brief Emitted when the count of visible widgets changes
|
||||
KDBindings::Signal<int> visibleWidgetCountChanged;
|
||||
|
||||
68
src/private/MDILayoutWidget_p.h
Normal file
68
src/private/MDILayoutWidget_p.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020-2022 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"
|
||||
|
||||
#include "qtwidgets/views/View_qtwidgets.h"
|
||||
|
||||
namespace Layouting {
|
||||
class ItemFreeContainer;
|
||||
}
|
||||
|
||||
// TODOv2: Move to controllers/
|
||||
|
||||
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 MDILayout : public LayoutWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MDILayout(View *parent = nullptr);
|
||||
~MDILayout() override;
|
||||
|
||||
/// @brief docks the dock widgets into this MDI area, at the specified position
|
||||
void addDockWidget(Controllers::DockWidget *dw, QPoint localPt, InitialOption addingOption = {});
|
||||
|
||||
/// @brief Moves a dock widget @p dw to point @p pos
|
||||
void moveDockWidget(Controllers::DockWidget *dw, QPoint pos);
|
||||
|
||||
/// @brief Moves a dock widget @p f to point @p pos
|
||||
/// Convenience overload.
|
||||
void moveDockWidget(Controllers::Frame *f, QPoint pos);
|
||||
|
||||
/// @brief Sets the size of dock widget @p dw to @p size
|
||||
void resizeDockWidget(Controllers::DockWidget *dw, QSize size);
|
||||
|
||||
/// @brief Sets the size of dock widget @p f to @p size
|
||||
/// Convenience overload.
|
||||
void resizeDockWidget(Controllers::Frame *f, QSize size);
|
||||
|
||||
/// @brief sets the size and position of the dock widget @p f
|
||||
void setDockWidgetGeometry(Controllers::Frame *f, QRect);
|
||||
|
||||
private:
|
||||
Layouting::ItemFreeContainer *const m_rootItem;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -187,7 +187,7 @@ View *DefaultWidgetFactory_qtquick::createDropArea(Controllers::DropArea *contro
|
||||
return new Views::DropArea_qtquick(controller, parent);
|
||||
}
|
||||
|
||||
View *DefaultWidgetFactory_qtquick::createMDILayout(MDILayoutWidget *controller, View *parent) const
|
||||
View *DefaultWidgetFactory_qtquick::createMDILayout(MDILayout *controller, View *parent) const
|
||||
{
|
||||
return new Views::MDILayout_qtquick(controller, parent);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
View *createRubberBand(View *parent) const override;
|
||||
View *createSideBar(Controllers::SideBar *, Controllers::MainWindow *parent) const override;
|
||||
View *createDropArea(Controllers::DropArea *, View *parent) const override;
|
||||
View *createMDILayout(MDILayoutWidget *, View *parent) const override;
|
||||
View *createMDILayout(MDILayout *, View *parent) const override;
|
||||
|
||||
Q_INVOKABLE QUrl titleBarFilename() const;
|
||||
QUrl dockwidgetFilename() const;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
using namespace KDDockWidgets;
|
||||
using namespace KDDockWidgets::Views;
|
||||
|
||||
MDILayout_qtquick::MDILayout_qtquick(MDILayoutWidget *controller, View *parent)
|
||||
MDILayout_qtquick::MDILayout_qtquick(MDILayout *controller, View *parent)
|
||||
: Views::View_qtquick(controller, Type::MDILayout, asQQuickItem(parent))
|
||||
, m_controller(controller)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "View_qtquick.h"
|
||||
|
||||
namespace KDDockWidgets {
|
||||
class MDILayoutWidget;
|
||||
class MDILayout;
|
||||
|
||||
namespace Views {
|
||||
|
||||
@@ -23,7 +23,7 @@ class DOCKS_EXPORT MDILayout_qtquick : public Views::View_qtquick
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MDILayout_qtquick(MDILayoutWidget *controller, View *parent);
|
||||
explicit MDILayout_qtquick(MDILayout *controller, View *parent);
|
||||
~MDILayout_qtquick();
|
||||
|
||||
/// TODOv2
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
bool onResize(QSize newSize) override;
|
||||
|
||||
private:
|
||||
MDILayoutWidget *const m_controller;
|
||||
MDILayout *const m_controller;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ View *DefaultWidgetFactory_qtwidgets::createDropArea(Controllers::DropArea *cont
|
||||
return new Views::DropArea_qtwidgets(controller, parent);
|
||||
}
|
||||
|
||||
View *DefaultWidgetFactory_qtwidgets::createMDILayout(MDILayoutWidget *controller, View *parent) const
|
||||
View *DefaultWidgetFactory_qtwidgets::createMDILayout(MDILayout *controller, View *parent) const
|
||||
{
|
||||
return new Views::MDILayout_qtwidgets(controller, parent);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
View *createRubberBand(View *parent) const override;
|
||||
View *createSideBar(Controllers::SideBar *, Controllers::MainWindow *parent) const override;
|
||||
View *createDropArea(Controllers::DropArea *, View *parent) const override;
|
||||
View *createMDILayout(MDILayoutWidget *, View *parent) const override;
|
||||
View *createMDILayout(MDILayout *, View *parent) const override;
|
||||
QIcon iconForButtonType(TitleBarButtonType type, qreal dpr) const override;
|
||||
QAbstractButton *createTitleBarButton(QWidget *parent, TitleBarButtonType) const;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class MDIArea::Private
|
||||
{
|
||||
public:
|
||||
Private(View *parent)
|
||||
: layoutWidget(new MDILayoutWidget(parent))
|
||||
: layoutWidget(new MDILayout(parent))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
delete layoutWidget;
|
||||
}
|
||||
|
||||
MDILayoutWidget *const layoutWidget;
|
||||
MDILayout *const layoutWidget;
|
||||
};
|
||||
|
||||
MDIArea::MDIArea(QWidget *parent)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
namespace KDDockWidgets {
|
||||
|
||||
class MDILayoutWidget;
|
||||
class MDILayout;
|
||||
|
||||
namespace Controllers {
|
||||
class Frame;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
using namespace KDDockWidgets;
|
||||
using namespace KDDockWidgets::Views;
|
||||
|
||||
MDILayout_qtwidgets::MDILayout_qtwidgets(MDILayoutWidget *controller, View *parent)
|
||||
MDILayout_qtwidgets::MDILayout_qtwidgets(MDILayout *controller, View *parent)
|
||||
: Views::View_qtwidgets<QWidget>(controller, Type::MDILayout, parent ? qobject_cast<QWidget *>(parent->asQObject()) : nullptr)
|
||||
, m_controller(controller)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "qtwidgets/views/View_qtwidgets.h"
|
||||
|
||||
namespace KDDockWidgets {
|
||||
class MDILayoutWidget;
|
||||
class MDILayout;
|
||||
|
||||
namespace Views {
|
||||
|
||||
@@ -23,7 +23,7 @@ class DOCKS_EXPORT MDILayout_qtwidgets : public Views::View_qtwidgets<QWidget>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MDILayout_qtwidgets(MDILayoutWidget *controller, View *parent);
|
||||
explicit MDILayout_qtwidgets(MDILayout *controller, View *parent);
|
||||
~MDILayout_qtwidgets();
|
||||
|
||||
/// TODOv2
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
bool onResize(QSize newSize) override;
|
||||
|
||||
private:
|
||||
MDILayoutWidget *const m_controller;
|
||||
MDILayout *const m_controller;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user