wayland: Add needed API to WindowBeingDragged
So it can act as a substitute for FloatingWindow, which we don't always have during a drag
This commit is contained in:
@@ -441,14 +441,12 @@ QRect MultiSplitter::rectForDrop(const WindowBeingDragged *wbd, Location locatio
|
||||
const Layouting::Item *relativeTo) const
|
||||
{
|
||||
Layouting::Item item(nullptr);
|
||||
FloatingWindow *fw = wbd ? wbd->floatingWindow() : nullptr;
|
||||
if (!fw)
|
||||
if (!wbd)
|
||||
return {};
|
||||
|
||||
Layouting::ItemContainer *root = fw->dropArea()->rootItem();
|
||||
item.setSize(fw->size().boundedTo(root->maxSizeHint()));
|
||||
item.setMinSize(root->minSize());
|
||||
item.setMaxSizeHint(root->maxSizeHint());
|
||||
item.setSize(wbd->size().boundedTo(wbd->maxSize()));
|
||||
item.setMinSize(wbd->minSize());
|
||||
item.setMaxSizeHint(wbd->maxSize());
|
||||
|
||||
Layouting::ItemContainer *container = relativeTo ? relativeTo->parentContainer()
|
||||
: m_rootItem;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "DragController_p.h"
|
||||
#include "Logging_p.h"
|
||||
#include "Utils_p.h"
|
||||
#include "DropArea_p.h"
|
||||
|
||||
using namespace KDDockWidgets;
|
||||
|
||||
@@ -102,3 +103,31 @@ QStringList WindowBeingDragged::affinities() const
|
||||
{
|
||||
return m_affinities;
|
||||
}
|
||||
|
||||
QSize WindowBeingDragged::size() const
|
||||
{
|
||||
if (m_floatingWindow)
|
||||
return m_floatingWindow->size();
|
||||
|
||||
return QSize();
|
||||
}
|
||||
|
||||
QSize WindowBeingDragged::minSize() const
|
||||
{
|
||||
if (m_floatingWindow) {
|
||||
Layouting::ItemContainer *root = m_floatingWindow->dropArea()->rootItem();
|
||||
return root->minSize();
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
QSize WindowBeingDragged::maxSize() const
|
||||
{
|
||||
if (m_floatingWindow) {
|
||||
Layouting::ItemContainer *root = m_floatingWindow->dropArea()->rootItem();
|
||||
return root->maxSizeHint();
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -42,6 +42,15 @@ public:
|
||||
///@brief returns the affinities of the window being dragged
|
||||
QStringList affinities() const;
|
||||
|
||||
///@brief size of the window being dragged contents
|
||||
QSize size() const;
|
||||
|
||||
/// @brief returns the min-size of the window being dragged contents
|
||||
QSize minSize() const;
|
||||
|
||||
/// @brief returns the max-size of the window being dragged contents
|
||||
QSize maxSize() const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(WindowBeingDragged)
|
||||
QPointer<FloatingWindow> m_floatingWindow;
|
||||
|
||||
Reference in New Issue
Block a user