qml: Dropping a dragged window now works

This commit is contained in:
Sergio Martins
2020-08-11 23:40:07 +01:00
parent b3ec7423e8
commit 0aee56114b
8 changed files with 74 additions and 17 deletions

View File

@@ -26,6 +26,7 @@ class DOCKS_EXPORT_FOR_UNIT_TESTS DropIndicatorOverlayInterface : public QWidget
{
Q_OBJECT
Q_PROPERTY(QRect hoveredFrameRect READ hoveredFrameRect NOTIFY hoveredFrameRectChanged)
Q_PROPERTY(KDDockWidgets::DropIndicatorOverlayInterface::DropLocation currentDropLocation READ currentDropLocation NOTIFY currentDropLocationChanged)
public:
enum Type {
TypeNone = 0,
@@ -53,12 +54,12 @@ public:
void setWindowBeingDragged(const FloatingWindow *);
QRect hoveredFrameRect() const;
bool isHovered() const;
DropLocation currentDropLocation() const { return m_currentDropLocation; }
DropLocation currentDropLocation() const;
Frame *hoveredFrame() const { return m_hoveredFrame; }
void setCurrentDropLocation(DropIndicatorOverlayInterface::DropLocation location);
virtual Type indicatorType() const = 0;
virtual void hover(QPoint globalPos) = 0;
void hover(QPoint globalPos);
virtual QPoint posForIndicator(DropLocation) const = 0; // Used by unit-tests only
@@ -67,17 +68,20 @@ public:
Q_SIGNALS:
void hoveredFrameChanged(KDDockWidgets::Frame *);
void hoveredFrameRectChanged();
void currentDropLocationChanged();
private:
void onFrameDestroyed();
void setHoveredFrameRect(QRect);
QRect m_hoveredFrameRect;
DropLocation m_currentDropLocation = DropLocation_None;
protected:
virtual void hover_impl(QPoint globalPos) = 0;
virtual void onHoveredFrameChanged(Frame *);
virtual void updateVisibility() = 0;
Frame *m_hoveredFrame = nullptr;
DropLocation m_currentDropLocation = DropLocation_None;
QPointer<const FloatingWindow> m_windowBeingDragged;
DropArea *const m_dropArea;
};