Fixed movement of witget on start of floating

This commit is contained in:
Uwe Kindler
2017-02-11 22:05:23 +01:00
parent 2bf1a51627
commit df97d17844
10 changed files with 223 additions and 217 deletions

View File

@@ -43,7 +43,6 @@ public:
explicit CContainerWidget(MainContainerWidget* MainContainerWidget, QWidget *parent = nullptr);
virtual ~CContainerWidget();
void moveFloatingWidget(const QPoint& TargetPos);
/**
* Returns the current zOrderIndex
*/
@@ -52,7 +51,7 @@ public:
void dropFloatingWidget(FloatingWidget* FloatingWidget,
const QPoint& TargetPos);
SectionWidget* sectionWidgetAt(const QPoint& pos) const;
SectionWidget* sectionWidgetAt(const QPoint& GlobalPos) const;
/**
* This function returns true if this container widgets z order index is
@@ -70,7 +69,18 @@ public:
*/
SectionWidget* addSectionContent(const SectionContent::RefPtr& sc, SectionWidget* sw = NULL, DropArea area = CenterDropArea);
void dumpLayout();
signals:
/*!
* Emits whenever the "isActiveTab" state of a SectionContent changes.
* Whenever the users sets another tab as active, this signal gets invoked
* for the old tab and the new active tab (the order is unspecified).
*/
void activeTabChanged(const SectionContent::RefPtr& sc, bool active);
protected:
void dropIntoContainer(FloatingWidget* FloatingWidget, DropArea area);
virtual bool event(QEvent *e) override;
SectionWidget* newSectionWidget();
void addSectionWidget(SectionWidget* section);
@@ -88,6 +98,9 @@ protected:
MainContainerWidget* m_MainContainerWidget = 0;
unsigned int m_zOrderIndex = 0;
static unsigned int zOrderCounter;
private slots:
void onActiveTabChanged();
};
} // namespace ads

View File

@@ -76,6 +76,8 @@ public:
public://private:
bool takeContent(InternalContentData& data);
void startFloating(const QPoint& Pos);
protected:
virtual void changeEvent(QEvent *event) override;
virtual void moveEvent(QMoveEvent *event) override;
@@ -95,7 +97,10 @@ private:
CContainerWidget* m_ContainerWidget;
CContainerWidget* m_DropContainer;
bool m_DraggingActive = false;
bool m_NonCLientDraggingActive = false;
unsigned int m_zOrderIndex = 0;
QPoint m_DragStartPosition;
QPoint m_DragStartMousePosition;
static unsigned int zOrderCounter;
};

View File

@@ -125,18 +125,7 @@ public:
static QSplitter* newSplitter(Qt::Orientation orientation = Qt::Horizontal, QWidget* parent = 0);
/**
* Filters the events of the floating widgets
*/
virtual bool event(QEvent *e) override;
private:
//
// Internal Stuff Begins Here
//
SectionWidget* dropContent(const InternalContentData& data, SectionWidget* targetSection, DropArea area, bool autoActive = true);
SectionWidget* sectionWidgetAt(const QPoint& pos) const;
// Serialization
QByteArray saveHierarchy() const;
void saveFloatingWidgets(QDataStream& out) const;
@@ -149,24 +138,15 @@ private:
bool restoreSectionWidgets(QDataStream& in, int version, QSplitter* currentSplitter, QList<SectionWidget*>& sections, QList<SectionContent::RefPtr>& contentsToHide);
bool takeContent(const SectionContent::RefPtr& sc, InternalContentData& data);
FloatingWidget* startFloating(SectionWidget* sectionwidget, int ContentUid, const QPoint& TargetPos);
void hideContainerOverlay();
void moveFloatingWidget(const QPoint& TargetPos);
private slots:
void onActiveTabChanged();
void onActionToggleSectionContentVisibility(bool visible);
signals:
void orientationChanged();
/*!
* Emits whenever the "isActiveTab" state of a SectionContent changes.
* Whenever the users sets another tab as active, this signal gets invoked
* for the old tab and the new active tab (the order is unspecified).
*/
void activeTabChanged(const SectionContent::RefPtr& sc, bool active);
/*!
* Emits whenever the visibility of a SectionContent changes.
* \see showSectionContent(), hideSectionContent()

View File

@@ -22,11 +22,14 @@ class SectionTitleWidget : public QFrame
friend class MainContainerWidget;
friend class SectionWidget;
friend class CContainerWidget;
SectionContent::RefPtr m_Content;
// Drag & Drop (Floating)
QPointer<FloatingWidget> m_FloatingWidget;
QPoint m_DragStartMousePosition;
QPoint m_DragStartGlobalMousePosition;
QPoint m_DragStartPosition;
// Drag & Drop (Title/Tabs)
@@ -48,6 +51,8 @@ public:
*/
bool isDraggingFloatingWidget() const;
virtual bool event(QEvent *e);
protected:
virtual void mousePressEvent(QMouseEvent* ev);
virtual void mouseReleaseEvent(QMouseEvent* ev);