12 #include "MDILayoutWidget_p.h"
13 #include "multisplitter/ItemFreeContainer_p.h"
14 #include "DockWidgetBase_p.h"
21 : LayoutWidget(parent)
22 , m_rootItem(new
Layouting::ItemFreeContainer(this))
24 setRootItem(m_rootItem);
27 MDILayoutWidget::~MDILayoutWidget()
34 qWarning() << Q_FUNC_INFO <<
"Refusing to add null dock widget";
38 auto frame = qobject_cast<Frame *>(dw->d->frame());
39 if (itemForFrame(frame) !=
nullptr) {
41 frame->QWidgetAdapter::setParent(
nullptr);
42 frame->setLayoutItem(
nullptr);
45 Layouting::Item *newItem =
new Layouting::Item(
this);
47 newItem->setGuestWidget(frame);
50 frame->addWidget(dw, addingOption);
52 newItem->setGuestWidget(frame);
55 Q_ASSERT(!newItem->geometry().isEmpty());
56 m_rootItem->addDockWidget(newItem, localPt);
63 void MDILayoutWidget::setDockWidgetGeometry(Frame *frame,
QRect geometry)
68 Layouting::Item *item = itemForFrame(frame);
70 qWarning() << Q_FUNC_INFO <<
"Frame not found in the layout" << frame;
74 item->setGeometry(geometry);
79 moveDockWidget(dw->d->frame(), pos);
82 void MDILayoutWidget::moveDockWidget(Frame *frame,
QPoint pos)
87 Layouting::Item *item = itemForFrame(frame);
89 qWarning() << Q_FUNC_INFO <<
"Frame not found in the layout" << frame;
93 QRect geo = item->geometry();
95 item->setGeometry(geo);
100 resizeDockWidget(dw->d->frame(), size);
103 void MDILayoutWidget::resizeDockWidget(Frame *frame,
QSize size)
108 Layouting::Item *item = itemForFrame(frame);
110 qWarning() << Q_FUNC_INFO <<
"Frame not found in the layout" << frame;
114 item->setSize(size.
expandedTo(frame->minimumSize()));