mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-12 16:20:25 +08:00
Started refactoring to improve code quality, overall designa nd to gain knowledge of the impolemented functionality
This commit is contained in:
parent
abc8468989
commit
68b93f6fa9
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
*.pro.user
|
*.pro.user
|
||||||
|
/ build
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
TARGET = AdvancedDockingSystem
|
include($$(cetoni_repository)/build/qt/qtprojectsettings/shared_library.pri)
|
||||||
|
|
||||||
|
TARGET = $$qtLibraryTarget(AdvancedDockingSystem)
|
||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
VERSION = 1.0.0
|
#VERSION = 1.0.0
|
||||||
|
|
||||||
CONFIG += adsBuildShared
|
CONFIG += adsBuildShared
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ class ADS_EXPORT_API ContainerWidget : public QFrame
|
|||||||
friend class FloatingWidget;
|
friend class FloatingWidget;
|
||||||
friend class SectionTitleWidget;
|
friend class SectionTitleWidget;
|
||||||
friend class SectionContentWidget;
|
friend class SectionContentWidget;
|
||||||
|
friend class SectionWidgetTabsScrollArea;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ContainerWidget(QWidget *parent = NULL);
|
explicit ContainerWidget(QWidget *parent = NULL);
|
||||||
@ -143,6 +144,9 @@ private:
|
|||||||
|
|
||||||
bool takeContent(const SectionContent::RefPtr& sc, InternalContentData& data);
|
bool takeContent(const SectionContent::RefPtr& sc, InternalContentData& data);
|
||||||
|
|
||||||
|
void moveFloatingWidget(const QPoint& TargetPos);
|
||||||
|
FloatingWidget* startFloating(SectionWidget* sectionwidget, int ContentUid, const QPoint& TargetPos);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onActiveTabChanged();
|
void onActiveTabChanged();
|
||||||
void onActionToggleSectionContentVisibility(bool visible);
|
void onActionToggleSectionContentVisibility(bool visible);
|
||||||
|
@ -12,6 +12,7 @@ class ContainerWidget;
|
|||||||
class SectionTitleWidget;
|
class SectionTitleWidget;
|
||||||
class SectionContentWidget;
|
class SectionContentWidget;
|
||||||
class InternalContentData;
|
class InternalContentData;
|
||||||
|
class SectionWidget;
|
||||||
|
|
||||||
// FloatingWidget holds and displays SectionContent as a floating window.
|
// FloatingWidget holds and displays SectionContent as a floating window.
|
||||||
// It can be resized, moved and dropped back into a SectionWidget.
|
// It can be resized, moved and dropped back into a SectionWidget.
|
||||||
@ -23,7 +24,8 @@ class FloatingWidget : public QWidget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
FloatingWidget(ContainerWidget* container, SectionContent::RefPtr sc, SectionTitleWidget* titleWidget, SectionContentWidget* contentWidget, QWidget* parent = NULL);
|
FloatingWidget(ContainerWidget* container, SectionContent::RefPtr sc, SectionTitleWidget* titleWidget, SectionContentWidget* contentWidget, QWidget* parent = NULL);
|
||||||
virtual ~FloatingWidget();
|
FloatingWidget(SectionWidget* sectionWidget);
|
||||||
|
virtual ~FloatingWidget();
|
||||||
|
|
||||||
SectionContent::RefPtr content() const { return _content; }
|
SectionContent::RefPtr content() const { return _content; }
|
||||||
|
|
||||||
|
@ -21,17 +21,17 @@ class SectionTitleWidget : public QFrame
|
|||||||
friend class ContainerWidget;
|
friend class ContainerWidget;
|
||||||
friend class SectionWidget;
|
friend class SectionWidget;
|
||||||
|
|
||||||
SectionContent::RefPtr _content;
|
SectionContent::RefPtr m_Content;
|
||||||
|
|
||||||
// Drag & Drop (Floating)
|
// Drag & Drop (Floating)
|
||||||
QPointer<FloatingWidget> _fw;
|
QPointer<FloatingWidget> m_FloatingWidget;
|
||||||
QPoint _dragStartPos;
|
QPoint m_DragStartPosition;
|
||||||
|
|
||||||
// Drag & Drop (Title/Tabs)
|
// Drag & Drop (Title/Tabs)
|
||||||
bool _tabMoving;
|
bool m_TabMoving;
|
||||||
|
|
||||||
// Property values
|
// Property values
|
||||||
bool _activeTab;
|
bool m_IsActiveTab;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SectionTitleWidget(SectionContent::RefPtr content, QWidget* parent);
|
SectionTitleWidget(SectionContent::RefPtr content, QWidget* parent);
|
||||||
@ -45,6 +45,11 @@ protected:
|
|||||||
virtual void mouseReleaseEvent(QMouseEvent* ev);
|
virtual void mouseReleaseEvent(QMouseEvent* ev);
|
||||||
virtual void mouseMoveEvent(QMouseEvent* ev);
|
virtual void mouseMoveEvent(QMouseEvent* ev);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void moveFloatingWidget(QMouseEvent* ev, ContainerWidget* cw);
|
||||||
|
void startFloating(QMouseEvent* ev, ContainerWidget* cw, SectionWidget* sectionwidget);
|
||||||
|
void moveTab(QMouseEvent* ev);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void activeTabChanged();
|
void activeTabChanged();
|
||||||
void clicked();
|
void clicked();
|
||||||
|
@ -14,6 +14,7 @@ class QMenu;
|
|||||||
#include "ads/API.h"
|
#include "ads/API.h"
|
||||||
#include "ads/Internal.h"
|
#include "ads/Internal.h"
|
||||||
#include "ads/SectionContent.h"
|
#include "ads/SectionContent.h"
|
||||||
|
#include "ads/FloatingWidget.h"
|
||||||
|
|
||||||
ADS_NAMESPACE_BEGIN
|
ADS_NAMESPACE_BEGIN
|
||||||
class ContainerWidget;
|
class ContainerWidget;
|
||||||
@ -50,6 +51,8 @@ public:
|
|||||||
int currentIndex() const;
|
int currentIndex() const;
|
||||||
void moveContent(int from, int to);
|
void moveContent(int from, int to);
|
||||||
|
|
||||||
|
virtual bool eventFilter(QObject *watched, QEvent *event);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent*);
|
virtual void showEvent(QShowEvent*);
|
||||||
|
|
||||||
@ -96,7 +99,11 @@ public:
|
|||||||
virtual ~SectionWidgetTabsScrollArea();
|
virtual ~SectionWidgetTabsScrollArea();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
QPoint _dragStartPos;
|
||||||
|
QPointer<FloatingWidget> _fw;
|
||||||
virtual void wheelEvent(QWheelEvent*);
|
virtual void wheelEvent(QWheelEvent*);
|
||||||
|
virtual void mousePressEvent(QMouseEvent* ev);
|
||||||
|
virtual void mouseMoveEvent(QMouseEvent* ev);
|
||||||
};
|
};
|
||||||
|
|
||||||
ADS_NAMESPACE_END
|
ADS_NAMESPACE_END
|
||||||
|
@ -1111,7 +1111,7 @@ bool ContainerWidget::restoreFloatingWidgets(QDataStream& in, int version, QList
|
|||||||
fw->_contentWidget->setVisible(visible);
|
fw->_contentWidget->setVisible(visible);
|
||||||
}
|
}
|
||||||
floatings.append(fw);
|
floatings.append(fw);
|
||||||
data.titleWidget->_fw = fw; // $mfreiholz: Don't look at it :-< It's more than ugly...
|
data.titleWidget->m_FloatingWidget = fw; // $mfreiholz: Don't look at it :-< It's more than ugly...
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1249,7 +1249,7 @@ void ContainerWidget::onActiveTabChanged()
|
|||||||
SectionTitleWidget* stw = qobject_cast<SectionTitleWidget*>(sender());
|
SectionTitleWidget* stw = qobject_cast<SectionTitleWidget*>(sender());
|
||||||
if (stw)
|
if (stw)
|
||||||
{
|
{
|
||||||
emit activeTabChanged(stw->_content, stw->isActiveTab());
|
emit activeTabChanged(stw->m_Content, stw->isActiveTab());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1271,4 +1271,70 @@ void ContainerWidget::onActionToggleSectionContentVisibility(bool visible)
|
|||||||
hideSectionContent(sc);
|
hideSectionContent(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ContainerWidget::moveFloatingWidget(const QPoint& TargetPos)
|
||||||
|
{
|
||||||
|
// Mouse is over a SectionWidget
|
||||||
|
SectionWidget* sectionwidget = sectionAt(mapFromGlobal(QCursor::pos()));
|
||||||
|
if (sectionwidget)
|
||||||
|
{
|
||||||
|
qInfo() << "over sectionWidget";
|
||||||
|
_dropOverlay->setAllowedAreas(ADS_NS::AllAreas);
|
||||||
|
_dropOverlay->showDropOverlay(sectionwidget);
|
||||||
|
}
|
||||||
|
// Mouse is at the edge of the ContainerWidget
|
||||||
|
// Top, Right, Bottom, Left
|
||||||
|
else if (outerTopDropRect().contains(mapFromGlobal(QCursor::pos())))
|
||||||
|
{
|
||||||
|
_dropOverlay->setAllowedAreas(ADS_NS::TopDropArea);
|
||||||
|
_dropOverlay->showDropOverlay(this, outerTopDropRect());
|
||||||
|
}
|
||||||
|
else if (outerRightDropRect().contains(mapFromGlobal(QCursor::pos())))
|
||||||
|
{
|
||||||
|
_dropOverlay->setAllowedAreas(ADS_NS::RightDropArea);
|
||||||
|
_dropOverlay->showDropOverlay(this, outerRightDropRect());
|
||||||
|
}
|
||||||
|
else if (outerBottomDropRect().contains(mapFromGlobal(QCursor::pos())))
|
||||||
|
{
|
||||||
|
_dropOverlay->setAllowedAreas(ADS_NS::BottomDropArea);
|
||||||
|
_dropOverlay->showDropOverlay(this, outerBottomDropRect());
|
||||||
|
}
|
||||||
|
else if (outerLeftDropRect().contains(mapFromGlobal(QCursor::pos())))
|
||||||
|
{
|
||||||
|
_dropOverlay->setAllowedAreas(ADS_NS::LeftDropArea);
|
||||||
|
_dropOverlay->showDropOverlay(this, outerLeftDropRect());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_dropOverlay->hideDropOverlay();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FloatingWidget* ContainerWidget::startFloating(SectionWidget* sectionwidget, int ContentUid, const QPoint& TargetPos)
|
||||||
|
{
|
||||||
|
// Create floating widget.
|
||||||
|
InternalContentData data;
|
||||||
|
if (!sectionwidget->takeContent(ContentUid, data))
|
||||||
|
{
|
||||||
|
qWarning() << "THIS SHOULD NOT HAPPEN!!" << ContentUid;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
FloatingWidget* fw = new FloatingWidget(this, data.content, data.titleWidget, data.contentWidget, this);
|
||||||
|
fw->resize(sectionwidget->size());
|
||||||
|
_floatings.append(fw);
|
||||||
|
fw->move(TargetPos);
|
||||||
|
fw->show();
|
||||||
|
|
||||||
|
// Delete old section, if it is empty now.
|
||||||
|
if (sectionwidget->contents().isEmpty())
|
||||||
|
{
|
||||||
|
delete sectionwidget;
|
||||||
|
sectionwidget = NULL;
|
||||||
|
}
|
||||||
|
deleteEmptySplitter(this);
|
||||||
|
return fw;
|
||||||
|
}
|
||||||
|
|
||||||
ADS_NAMESPACE_END
|
ADS_NAMESPACE_END
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
ADS_NAMESPACE_BEGIN
|
ADS_NAMESPACE_BEGIN
|
||||||
|
|
||||||
@ -139,8 +141,8 @@ DropOverlay::DropOverlay(QWidget* parent) :
|
|||||||
areaWidgets.insert(ADS_NS::BottomDropArea, createDropIndicatorWidget(BottomDropArea));//createDropWidget(":/img/split-bottom.png"));
|
areaWidgets.insert(ADS_NS::BottomDropArea, createDropIndicatorWidget(BottomDropArea));//createDropWidget(":/img/split-bottom.png"));
|
||||||
areaWidgets.insert(ADS_NS::LeftDropArea, createDropIndicatorWidget(LeftDropArea));//createDropWidget(":/img/split-left.png"));
|
areaWidgets.insert(ADS_NS::LeftDropArea, createDropIndicatorWidget(LeftDropArea));//createDropWidget(":/img/split-left.png"));
|
||||||
areaWidgets.insert(ADS_NS::CenterDropArea, createDropIndicatorWidget(CenterDropArea));//createDropWidget(":/img/dock-center.png"));
|
areaWidgets.insert(ADS_NS::CenterDropArea, createDropIndicatorWidget(CenterDropArea));//createDropWidget(":/img/dock-center.png"));
|
||||||
_cross->setAreaWidgets(areaWidgets);
|
|
||||||
|
|
||||||
|
_cross->setAreaWidgets(areaWidgets);
|
||||||
_cross->setVisible(false);
|
_cross->setVisible(false);
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
}
|
}
|
||||||
@ -175,12 +177,16 @@ DropArea DropOverlay::cursorLocation() const
|
|||||||
|
|
||||||
DropArea DropOverlay::showDropOverlay(QWidget* target)
|
DropArea DropOverlay::showDropOverlay(QWidget* target)
|
||||||
{
|
{
|
||||||
|
qInfo() << "DropOverlay::showDropOverlay(QWidget* target)";
|
||||||
|
_fullAreaDrop = true;
|
||||||
if (_target == target)
|
if (_target == target)
|
||||||
{
|
{
|
||||||
|
qInfo() << "_target == target";
|
||||||
// Hint: We could update geometry of overlay here.
|
// Hint: We could update geometry of overlay here.
|
||||||
DropArea da = cursorLocation();
|
DropArea da = cursorLocation();
|
||||||
if (da != _lastLocation)
|
if (da != _lastLocation)
|
||||||
{
|
{
|
||||||
|
qInfo() << "repaint()";
|
||||||
repaint();
|
repaint();
|
||||||
_lastLocation = da;
|
_lastLocation = da;
|
||||||
}
|
}
|
||||||
@ -188,6 +194,7 @@ DropArea DropOverlay::showDropOverlay(QWidget* target)
|
|||||||
}
|
}
|
||||||
|
|
||||||
hideDropOverlay();
|
hideDropOverlay();
|
||||||
|
qInfo() << "_target != target, hideDropOverlay(), _fullAreaDrop = false";
|
||||||
_fullAreaDrop = false;
|
_fullAreaDrop = false;
|
||||||
_target = target;
|
_target = target;
|
||||||
_targetRect = QRect();
|
_targetRect = QRect();
|
||||||
@ -204,11 +211,11 @@ DropArea DropOverlay::showDropOverlay(QWidget* target)
|
|||||||
|
|
||||||
void DropOverlay::showDropOverlay(QWidget* target, const QRect& targetAreaRect)
|
void DropOverlay::showDropOverlay(QWidget* target, const QRect& targetAreaRect)
|
||||||
{
|
{
|
||||||
|
qInfo() << "DropOverlay::showDropOverlay(QWidget* target, const QRect& targetAreaRect)";
|
||||||
if (_target == target && _targetRect == targetAreaRect)
|
if (_target == target && _targetRect == targetAreaRect)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hideDropOverlay();
|
hideDropOverlay();
|
||||||
_fullAreaDrop = true;
|
_fullAreaDrop = true;
|
||||||
_target = target;
|
_target = target;
|
||||||
@ -226,6 +233,7 @@ void DropOverlay::showDropOverlay(QWidget* target, const QRect& targetAreaRect)
|
|||||||
|
|
||||||
void DropOverlay::hideDropOverlay()
|
void DropOverlay::hideDropOverlay()
|
||||||
{
|
{
|
||||||
|
qInfo() << "hideDropOverlay() _fullAreaDrop = false";
|
||||||
hide();
|
hide();
|
||||||
_fullAreaDrop = false;
|
_fullAreaDrop = false;
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||||
@ -240,29 +248,19 @@ void DropOverlay::hideDropOverlay()
|
|||||||
void DropOverlay::paintEvent(QPaintEvent*)
|
void DropOverlay::paintEvent(QPaintEvent*)
|
||||||
{
|
{
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
const QColor areaColor = palette().color(QPalette::Active, QPalette::Highlight);//QColor(0, 100, 255)
|
const QColor areaColor = palette().color(QPalette::Active, QPalette::Highlight);
|
||||||
|
|
||||||
// Always draw drop-rect over the entire rect()
|
|
||||||
if (_fullAreaDrop)
|
|
||||||
{
|
|
||||||
QRect r = rect();
|
|
||||||
p.fillRect(r, QBrush(areaColor, Qt::Dense4Pattern));
|
|
||||||
p.setBrush(QBrush(areaColor));
|
|
||||||
p.drawRect(r);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw rect based on location
|
// Draw rect based on location
|
||||||
QRect r = rect();
|
QRect r = rect();
|
||||||
const DropArea da = cursorLocation();
|
const DropArea da = cursorLocation();
|
||||||
switch (da)
|
switch (da)
|
||||||
{
|
{
|
||||||
case ADS_NS::TopDropArea:
|
case ADS_NS::TopDropArea:
|
||||||
r.setHeight(r.height() / 2);
|
r.setHeight(r.height() / 2);
|
||||||
break;
|
break;
|
||||||
case ADS_NS::RightDropArea:
|
case ADS_NS::RightDropArea:
|
||||||
r.setX(r.width() / 2);
|
r.setX(r.width() / 2);
|
||||||
break;
|
break;
|
||||||
case ADS_NS::BottomDropArea:
|
case ADS_NS::BottomDropArea:
|
||||||
r.setY(r.height() / 2);
|
r.setY(r.height() / 2);
|
||||||
break;
|
break;
|
||||||
@ -273,7 +271,7 @@ void DropOverlay::paintEvent(QPaintEvent*)
|
|||||||
r = rect();
|
r = rect();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
r = QRect();
|
r = QRect();
|
||||||
}
|
}
|
||||||
if (!r.isNull())
|
if (!r.isNull())
|
||||||
{
|
{
|
||||||
@ -304,11 +302,13 @@ void DropOverlay::hideEvent(QHideEvent*)
|
|||||||
|
|
||||||
void DropOverlay::resizeEvent(QResizeEvent* e)
|
void DropOverlay::resizeEvent(QResizeEvent* e)
|
||||||
{
|
{
|
||||||
|
qInfo() << "DropOverlay::resizeEvent" << e->size();
|
||||||
_cross->resize(e->size());
|
_cross->resize(e->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DropOverlay::moveEvent(QMoveEvent* e)
|
void DropOverlay::moveEvent(QMoveEvent* e)
|
||||||
{
|
{
|
||||||
|
qInfo() << "DropOverlay::moveEvent" << e->pos();
|
||||||
_cross->move(e->pos());
|
_cross->move(e->pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "ads/SectionTitleWidget.h"
|
#include "ads/SectionTitleWidget.h"
|
||||||
#include "ads/SectionContentWidget.h"
|
#include "ads/SectionContentWidget.h"
|
||||||
#include "ads/Internal.h"
|
#include "ads/Internal.h"
|
||||||
|
#include "ads/SectionWidget.h"
|
||||||
|
|
||||||
ADS_NAMESPACE_BEGIN
|
ADS_NAMESPACE_BEGIN
|
||||||
|
|
||||||
@ -54,6 +55,18 @@ FloatingWidget::FloatingWidget(ContainerWidget* container, SectionContent::RefPt
|
|||||||
// _container->_floatingWidgets.append(this);
|
// _container->_floatingWidgets.append(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FloatingWidget::FloatingWidget(SectionWidget* sectionWidget)
|
||||||
|
{
|
||||||
|
QBoxLayout* l = new QBoxLayout(QBoxLayout::TopToBottom);
|
||||||
|
l->setContentsMargins(0, 0, 0, 0);
|
||||||
|
l->setSpacing(0);
|
||||||
|
setLayout(l);
|
||||||
|
|
||||||
|
l->addWidget(sectionWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FloatingWidget::~FloatingWidget()
|
FloatingWidget::~FloatingWidget()
|
||||||
{
|
{
|
||||||
_container->_floatings.removeAll(this); // Note: I don't like this here, but we have to remove it from list...
|
_container->_floatings.removeAll(this); // Note: I don't like this here, but we have to remove it from list...
|
||||||
@ -81,4 +94,5 @@ void FloatingWidget::onCloseButtonClicked()
|
|||||||
_container->hideSectionContent(_content);
|
_container->hideSectionContent(_content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ADS_NAMESPACE_END
|
ADS_NAMESPACE_END
|
||||||
|
@ -26,9 +26,9 @@ ADS_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
SectionTitleWidget::SectionTitleWidget(SectionContent::RefPtr content, QWidget* parent) :
|
SectionTitleWidget::SectionTitleWidget(SectionContent::RefPtr content, QWidget* parent) :
|
||||||
QFrame(parent),
|
QFrame(parent),
|
||||||
_content(content),
|
m_Content(content),
|
||||||
_tabMoving(false),
|
m_TabMoving(false),
|
||||||
_activeTab(false)
|
m_IsActiveTab(false)
|
||||||
{
|
{
|
||||||
QBoxLayout* l = new QBoxLayout(QBoxLayout::LeftToRight);
|
QBoxLayout* l = new QBoxLayout(QBoxLayout::LeftToRight);
|
||||||
l->setContentsMargins(0, 0, 0, 0);
|
l->setContentsMargins(0, 0, 0, 0);
|
||||||
@ -39,19 +39,19 @@ SectionTitleWidget::SectionTitleWidget(SectionContent::RefPtr content, QWidget*
|
|||||||
|
|
||||||
SectionTitleWidget::~SectionTitleWidget()
|
SectionTitleWidget::~SectionTitleWidget()
|
||||||
{
|
{
|
||||||
layout()->removeWidget(_content->titleWidget());
|
layout()->removeWidget(m_Content->titleWidget());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SectionTitleWidget::isActiveTab() const
|
bool SectionTitleWidget::isActiveTab() const
|
||||||
{
|
{
|
||||||
return _activeTab;
|
return m_IsActiveTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SectionTitleWidget::setActiveTab(bool active)
|
void SectionTitleWidget::setActiveTab(bool active)
|
||||||
{
|
{
|
||||||
if (active != _activeTab)
|
if (active != m_IsActiveTab)
|
||||||
{
|
{
|
||||||
_activeTab = active;
|
m_IsActiveTab = active;
|
||||||
|
|
||||||
style()->unpolish(this);
|
style()->unpolish(this);
|
||||||
style()->polish(this);
|
style()->polish(this);
|
||||||
@ -66,7 +66,7 @@ void SectionTitleWidget::mousePressEvent(QMouseEvent* ev)
|
|||||||
if (ev->button() == Qt::LeftButton)
|
if (ev->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
ev->accept();
|
ev->accept();
|
||||||
_dragStartPos = ev->pos();
|
m_DragStartPosition = ev->pos();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QFrame::mousePressEvent(ev);
|
QFrame::mousePressEvent(ev);
|
||||||
@ -78,7 +78,7 @@ void SectionTitleWidget::mouseReleaseEvent(QMouseEvent* ev)
|
|||||||
ContainerWidget* cw = findParentContainerWidget(this);
|
ContainerWidget* cw = findParentContainerWidget(this);
|
||||||
|
|
||||||
// Drop contents of FloatingWidget into SectionWidget.
|
// Drop contents of FloatingWidget into SectionWidget.
|
||||||
if (_fw)
|
if (m_FloatingWidget)
|
||||||
{
|
{
|
||||||
SectionWidget* sw = cw->sectionAt(cw->mapFromGlobal(ev->globalPos()));
|
SectionWidget* sw = cw->sectionAt(cw->mapFromGlobal(ev->globalPos()));
|
||||||
if (sw)
|
if (sw)
|
||||||
@ -87,39 +87,11 @@ void SectionTitleWidget::mouseReleaseEvent(QMouseEvent* ev)
|
|||||||
DropArea loc = cw->_dropOverlay->showDropOverlay(sw);
|
DropArea loc = cw->_dropOverlay->showDropOverlay(sw);
|
||||||
if (loc != InvalidDropArea)
|
if (loc != InvalidDropArea)
|
||||||
{
|
{
|
||||||
#if !defined(ADS_ANIMATIONS_ENABLED)
|
|
||||||
InternalContentData data;
|
InternalContentData data;
|
||||||
_fw->takeContent(data);
|
m_FloatingWidget->takeContent(data);
|
||||||
_fw->deleteLater();
|
m_FloatingWidget->deleteLater();
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
m_FloatingWidget.clear();
|
||||||
_fw.clear();
|
|
||||||
#else
|
|
||||||
_fw = 0;
|
|
||||||
#endif
|
|
||||||
cw->dropContent(data, sw, loc, true);
|
cw->dropContent(data, sw, loc, true);
|
||||||
#else
|
|
||||||
QPropertyAnimation* moveAnim = new QPropertyAnimation(_fw, "pos", this);
|
|
||||||
moveAnim->setStartValue(_fw->pos());
|
|
||||||
moveAnim->setEndValue(sw->mapToGlobal(sw->rect().topLeft()));
|
|
||||||
moveAnim->setDuration(ADS_ANIMATION_DURATION);
|
|
||||||
|
|
||||||
QPropertyAnimation* resizeAnim = new QPropertyAnimation(_fw, "size", this);
|
|
||||||
resizeAnim->setStartValue(_fw->size());
|
|
||||||
resizeAnim->setEndValue(sw->size());
|
|
||||||
resizeAnim->setDuration(ADS_ANIMATION_DURATION);
|
|
||||||
|
|
||||||
QParallelAnimationGroup* animGroup = new QParallelAnimationGroup(this);
|
|
||||||
QObject::connect(animGroup, &QPropertyAnimation::finished, [this, data, sw, loc]()
|
|
||||||
{
|
|
||||||
InternalContentData data = _fw->takeContent();
|
|
||||||
_fw->deleteLater();
|
|
||||||
_fw.clear();
|
|
||||||
cw->dropContent(data, sw, loc);
|
|
||||||
});
|
|
||||||
animGroup->addAnimation(moveAnim);
|
|
||||||
animGroup->addAnimation(resizeAnim);
|
|
||||||
animGroup->start(QAbstractAnimation::DeleteWhenStopped);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Mouse is over a outer-edge drop area
|
// Mouse is over a outer-edge drop area
|
||||||
@ -137,152 +109,117 @@ void SectionTitleWidget::mouseReleaseEvent(QMouseEvent* ev)
|
|||||||
|
|
||||||
if (dropArea != ADS_NS::InvalidDropArea)
|
if (dropArea != ADS_NS::InvalidDropArea)
|
||||||
{
|
{
|
||||||
#if !defined(ADS_ANIMATIONS_ENABLED)
|
|
||||||
InternalContentData data;
|
InternalContentData data;
|
||||||
_fw->takeContent(data);
|
m_FloatingWidget->takeContent(data);
|
||||||
_fw->deleteLater();
|
m_FloatingWidget->deleteLater();
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
m_FloatingWidget.clear();
|
||||||
_fw.clear();
|
|
||||||
#else
|
|
||||||
_fw = 0;
|
|
||||||
#endif
|
|
||||||
cw->dropContent(data, NULL, dropArea, true);
|
cw->dropContent(data, NULL, dropArea, true);
|
||||||
#else
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// End of tab moving, change order now
|
// End of tab moving, change order now
|
||||||
else if (_tabMoving
|
else if (m_TabMoving
|
||||||
&& (section = findParentSectionWidget(this)) != NULL)
|
&& (section = findParentSectionWidget(this)) != NULL)
|
||||||
{
|
{
|
||||||
// Find tab under mouse
|
// Find tab under mouse
|
||||||
QPoint pos = ev->globalPos();
|
QPoint pos = ev->globalPos();
|
||||||
pos = section->mapFromGlobal(pos);
|
pos = section->mapFromGlobal(pos);
|
||||||
const int fromIndex = section->indexOfContent(_content);
|
int fromIndex = section->indexOfContent(m_Content);
|
||||||
const int toIndex = section->indexOfContentByTitlePos(pos, this);
|
int toIndex = section->indexOfContentByTitlePos(pos, this);
|
||||||
|
qInfo() << "fromIndex: " << fromIndex << " toIndex: " << toIndex;
|
||||||
|
if (-1 == toIndex)
|
||||||
|
{
|
||||||
|
toIndex = section->indexOfContent(section->contents().last());
|
||||||
|
}
|
||||||
section->moveContent(fromIndex, toIndex);
|
section->moveContent(fromIndex, toIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_dragStartPos.isNull())
|
if (!m_DragStartPosition.isNull())
|
||||||
emit clicked();
|
emit clicked();
|
||||||
|
|
||||||
// Reset
|
// Reset
|
||||||
_dragStartPos = QPoint();
|
m_DragStartPosition = QPoint();
|
||||||
_tabMoving = false;
|
m_TabMoving = false;
|
||||||
cw->_dropOverlay->hideDropOverlay();
|
cw->_dropOverlay->hideDropOverlay();
|
||||||
QFrame::mouseReleaseEvent(ev);
|
QFrame::mouseReleaseEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SectionTitleWidget::moveFloatingWidget(QMouseEvent* ev, ContainerWidget* cw)
|
||||||
|
{
|
||||||
|
const QPoint moveToPos = ev->globalPos() - (m_DragStartPosition + QPoint(ADS_WINDOW_FRAME_BORDER_WIDTH, ADS_WINDOW_FRAME_BORDER_WIDTH));
|
||||||
|
m_FloatingWidget->move(moveToPos);
|
||||||
|
cw->moveFloatingWidget(moveToPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SectionTitleWidget::startFloating(QMouseEvent* ev, ContainerWidget* cw, SectionWidget* sectionwidget)
|
||||||
|
{
|
||||||
|
QPoint moveToPos = ev->globalPos() - (m_DragStartPosition + QPoint(ADS_WINDOW_FRAME_BORDER_WIDTH, ADS_WINDOW_FRAME_BORDER_WIDTH));
|
||||||
|
m_FloatingWidget = cw->startFloating(sectionwidget, m_Content->uid(), moveToPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SectionTitleWidget::moveTab(QMouseEvent* ev)
|
||||||
|
{
|
||||||
|
ev->accept();
|
||||||
|
int left, top, right, bottom;
|
||||||
|
getContentsMargins(&left, &top, &right, &bottom);
|
||||||
|
QPoint moveToPos = mapToParent(ev->pos()) - m_DragStartPosition;
|
||||||
|
moveToPos.setY(0/* + top*/);
|
||||||
|
move(moveToPos);
|
||||||
|
}
|
||||||
|
|
||||||
void SectionTitleWidget::mouseMoveEvent(QMouseEvent* ev)
|
void SectionTitleWidget::mouseMoveEvent(QMouseEvent* ev)
|
||||||
{
|
{
|
||||||
ContainerWidget* cw = findParentContainerWidget(this);
|
if (!(ev->buttons() & Qt::LeftButton))
|
||||||
SectionWidget* section = NULL;
|
{
|
||||||
|
QFrame::mouseMoveEvent(ev);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ev->accept();
|
||||||
|
ContainerWidget* cw = findParentContainerWidget(this);
|
||||||
// Move already existing FloatingWidget
|
// Move already existing FloatingWidget
|
||||||
if (_fw && (ev->buttons() & Qt::LeftButton))
|
if (m_FloatingWidget)
|
||||||
{
|
{
|
||||||
ev->accept();
|
moveFloatingWidget(ev, cw);
|
||||||
|
|
||||||
const QPoint moveToPos = ev->globalPos() - (_dragStartPos + QPoint(ADS_WINDOW_FRAME_BORDER_WIDTH, ADS_WINDOW_FRAME_BORDER_WIDTH));
|
|
||||||
_fw->move(moveToPos);
|
|
||||||
|
|
||||||
// Show drop indicator
|
|
||||||
if (true)
|
|
||||||
{
|
|
||||||
// Mouse is over a SectionWidget
|
|
||||||
section = cw->sectionAt(cw->mapFromGlobal(QCursor::pos()));
|
|
||||||
if (section)
|
|
||||||
{
|
|
||||||
cw->_dropOverlay->setAllowedAreas(ADS_NS::AllAreas);
|
|
||||||
cw->_dropOverlay->showDropOverlay(section);
|
|
||||||
}
|
|
||||||
// Mouse is at the edge of the ContainerWidget
|
|
||||||
// Top, Right, Bottom, Left
|
|
||||||
else if (cw->outerTopDropRect().contains(cw->mapFromGlobal(QCursor::pos())))
|
|
||||||
{
|
|
||||||
cw->_dropOverlay->setAllowedAreas(ADS_NS::TopDropArea);
|
|
||||||
cw->_dropOverlay->showDropOverlay(cw, cw->outerTopDropRect());
|
|
||||||
}
|
|
||||||
else if (cw->outerRightDropRect().contains(cw->mapFromGlobal(QCursor::pos())))
|
|
||||||
{
|
|
||||||
cw->_dropOverlay->setAllowedAreas(ADS_NS::RightDropArea);
|
|
||||||
cw->_dropOverlay->showDropOverlay(cw, cw->outerRightDropRect());
|
|
||||||
}
|
|
||||||
else if (cw->outerBottomDropRect().contains(cw->mapFromGlobal(QCursor::pos())))
|
|
||||||
{
|
|
||||||
cw->_dropOverlay->setAllowedAreas(ADS_NS::BottomDropArea);
|
|
||||||
cw->_dropOverlay->showDropOverlay(cw, cw->outerBottomDropRect());
|
|
||||||
}
|
|
||||||
else if (cw->outerLeftDropRect().contains(cw->mapFromGlobal(QCursor::pos())))
|
|
||||||
{
|
|
||||||
cw->_dropOverlay->setAllowedAreas(ADS_NS::LeftDropArea);
|
|
||||||
cw->_dropOverlay->showDropOverlay(cw, cw->outerLeftDropRect());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cw->_dropOverlay->hideDropOverlay();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SectionWidget* sectionwidget = findParentSectionWidget(this);
|
||||||
|
if (!sectionwidget)
|
||||||
|
{
|
||||||
|
QFrame::mouseMoveEvent(ev);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// move tab
|
||||||
|
if (m_TabMoving)
|
||||||
|
{
|
||||||
|
moveTab(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
// leave if dragging is not active
|
||||||
|
if (m_DragStartPosition.isNull())
|
||||||
|
{
|
||||||
|
QFrame::mouseMoveEvent(ev);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Begin to drag/float the SectionContent.
|
// Begin to drag/float the SectionContent.
|
||||||
else if (!_fw && !_dragStartPos.isNull() && (ev->buttons() & Qt::LeftButton)
|
if (!sectionwidget->titleAreaGeometry().contains(sectionwidget->mapFromGlobal(ev->globalPos())))
|
||||||
&& (section = findParentSectionWidget(this)) != NULL
|
|
||||||
&& !section->titleAreaGeometry().contains(section->mapFromGlobal(ev->globalPos())))
|
|
||||||
{
|
{
|
||||||
ev->accept();
|
startFloating(ev, cw, sectionwidget);
|
||||||
|
|
||||||
// Create floating widget.
|
|
||||||
InternalContentData data;
|
|
||||||
if (!section->takeContent(_content->uid(), data))
|
|
||||||
{
|
|
||||||
qWarning() << "THIS SHOULD NOT HAPPEN!!" << _content->uid() << _content->uniqueName();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_fw = new FloatingWidget(cw, data.content, data.titleWidget, data.contentWidget, cw);
|
|
||||||
_fw->resize(section->size());
|
|
||||||
cw->_floatings.append(_fw); // Note: I don't like this...
|
|
||||||
|
|
||||||
const QPoint moveToPos = ev->globalPos() - (_dragStartPos + QPoint(ADS_WINDOW_FRAME_BORDER_WIDTH, ADS_WINDOW_FRAME_BORDER_WIDTH));
|
|
||||||
_fw->move(moveToPos);
|
|
||||||
_fw->show();
|
|
||||||
|
|
||||||
// Delete old section, if it is empty now.
|
|
||||||
if (section->contents().isEmpty())
|
|
||||||
{
|
|
||||||
delete section;
|
|
||||||
section = NULL;
|
|
||||||
}
|
|
||||||
deleteEmptySplitter(cw);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Handle movement of this tab
|
|
||||||
else if (_tabMoving
|
|
||||||
&& (section = findParentSectionWidget(this)) != NULL)
|
|
||||||
{
|
|
||||||
ev->accept();
|
|
||||||
|
|
||||||
int left, top, right, bottom;
|
|
||||||
getContentsMargins(&left, &top, &right, &bottom);
|
|
||||||
QPoint moveToPos = mapToParent(ev->pos()) - _dragStartPos;
|
|
||||||
moveToPos.setY(0/* + top*/);
|
|
||||||
move(moveToPos);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Begin to drag title inside the title area to switch its position inside the SectionWidget.
|
// Begin to drag title inside the title area to switch its position inside the SectionWidget.
|
||||||
else if (!_dragStartPos.isNull() && (ev->buttons() & Qt::LeftButton)
|
else if ((ev->pos() - m_DragStartPosition).manhattanLength() >= QApplication::startDragDistance() // Wait a few pixels before start moving
|
||||||
&& (ev->pos() - _dragStartPos).manhattanLength() >= QApplication::startDragDistance() // Wait a few pixels before start moving
|
&& sectionwidget->titleAreaGeometry().contains(sectionwidget->mapFromGlobal(ev->globalPos())))
|
||||||
&& (section = findParentSectionWidget(this)) != NULL
|
|
||||||
&& section->titleAreaGeometry().contains(section->mapFromGlobal(ev->globalPos())))
|
|
||||||
{
|
{
|
||||||
ev->accept();
|
m_TabMoving = true;
|
||||||
|
|
||||||
_tabMoving = true;
|
|
||||||
raise(); // Raise current title-widget above other tabs
|
raise(); // Raise current title-widget above other tabs
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QFrame::mouseMoveEvent(ev);
|
QFrame::mouseMoveEvent(ev);
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
#if defined(ADS_ANIMATIONS_ENABLED)
|
#if defined(ADS_ANIMATIONS_ENABLED)
|
||||||
#include <QGraphicsDropShadowEffect>
|
#include <QGraphicsDropShadowEffect>
|
||||||
@ -349,7 +350,7 @@ void SectionWidget::setCurrentIndex(int index)
|
|||||||
{
|
{
|
||||||
stw->setActiveTab(true);
|
stw->setActiveTab(true);
|
||||||
_tabsScrollArea->ensureWidgetVisible(stw);
|
_tabsScrollArea->ensureWidgetVisible(stw);
|
||||||
if (stw->_content->flags().testFlag(SectionContent::Closeable))
|
if (stw->m_Content->flags().testFlag(SectionContent::Closeable))
|
||||||
_closeButton->setEnabled(true);
|
_closeButton->setEnabled(true);
|
||||||
else
|
else
|
||||||
_closeButton->setEnabled(false);
|
_closeButton->setEnabled(false);
|
||||||
@ -422,6 +423,11 @@ int SectionWidget::GetNextUid()
|
|||||||
return ++NextUid;
|
return ++NextUid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SectionWidget::eventFilter(QObject *watched, QEvent *event)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
SectionWidgetTabsScrollArea::SectionWidgetTabsScrollArea(SectionWidget*,
|
SectionWidgetTabsScrollArea::SectionWidgetTabsScrollArea(SectionWidget*,
|
||||||
@ -455,4 +461,44 @@ void SectionWidgetTabsScrollArea::wheelEvent(QWheelEvent* e)
|
|||||||
horizontalScrollBar()->setValue(horizontalScrollBar()->value() - 20);
|
horizontalScrollBar()->setValue(horizontalScrollBar()->value() - 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SectionWidgetTabsScrollArea::mousePressEvent(QMouseEvent* ev)
|
||||||
|
{
|
||||||
|
qInfo() << "mousePressEvent " << ev->type();
|
||||||
|
if (ev->button() == Qt::LeftButton)
|
||||||
|
{
|
||||||
|
ev->accept();
|
||||||
|
_dragStartPos = ev->pos();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QScrollArea::mousePressEvent(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SectionWidgetTabsScrollArea::mouseMoveEvent(QMouseEvent* ev)
|
||||||
|
{
|
||||||
|
/*if (_fw)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ContainerWidget* cw = findParentContainerWidget(this);
|
||||||
|
SectionWidget* sectionWidget = findParentSectionWidget(this);
|
||||||
|
|
||||||
|
qInfo() << "mousePressEvent " << ev->type();
|
||||||
|
ev->accept();
|
||||||
|
|
||||||
|
_fw = new FloatingWidget(sectionWidget);
|
||||||
|
_fw->resize(sectionWidget->size());
|
||||||
|
cw->_floatings.append(_fw); // Note: I don't like this...
|
||||||
|
|
||||||
|
const QPoint moveToPos = ev->globalPos() - (_dragStartPos + QPoint(ADS_WINDOW_FRAME_BORDER_WIDTH, ADS_WINDOW_FRAME_BORDER_WIDTH));
|
||||||
|
_fw->move(moveToPos);
|
||||||
|
_fw->show();
|
||||||
|
|
||||||
|
//delete sectionWidget;
|
||||||
|
deleteEmptySplitter(cw);*/
|
||||||
|
QScrollArea::mouseMoveEvent(ev);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ADS_NAMESPACE_END
|
ADS_NAMESPACE_END
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
include($$(cetoni_repository)/build/qt/qtprojectsettings/common.pri)
|
||||||
|
|
||||||
TARGET = AdvancedDockingSystemDemo
|
TARGET = AdvancedDockingSystemDemo
|
||||||
|
|
||||||
QT += core gui
|
QT += core gui
|
||||||
@ -47,8 +49,8 @@ FORMS += \
|
|||||||
#else:unix: PRE_TARGETDEPS += $$OUT_PWD/../AdvancedDockingSystem/libAdvancedDockingSystem.a
|
#else:unix: PRE_TARGETDEPS += $$OUT_PWD/../AdvancedDockingSystem/libAdvancedDockingSystem.a
|
||||||
|
|
||||||
# Dependency: AdvancedDockingSystem (shared)
|
# Dependency: AdvancedDockingSystem (shared)
|
||||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../AdvancedDockingSystem/release/ -lAdvancedDockingSystem1
|
win32:CONFIG(release, debug|release): LIBS += -l$$qtLinkLibrary(AdvancedDockingSystem)
|
||||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../AdvancedDockingSystem/debug/ -lAdvancedDockingSystem1
|
else:win32:CONFIG(debug, debug|release): LIBS += -l$$qtLinkLibrary(AdvancedDockingSystem)
|
||||||
else:unix: LIBS += -L$$OUT_PWD/../AdvancedDockingSystem/ -lAdvancedDockingSystem
|
else:unix: LIBS += -L$$OUT_PWD/../AdvancedDockingSystem/ -lAdvancedDockingSystem
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD/../AdvancedDockingSystem/include
|
INCLUDEPATH += $$PWD/../AdvancedDockingSystem/include
|
||||||
|
@ -104,7 +104,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
setCentralWidget(_container);
|
setCentralWidget(_container);
|
||||||
|
|
||||||
// Optional: Use custom drop area widgets.
|
// Optional: Use custom drop area widgets.
|
||||||
if (false)
|
if (false)
|
||||||
{
|
{
|
||||||
QHash<ADS_NS::DropArea, QWidget*> areaWidgets;
|
QHash<ADS_NS::DropArea, QWidget*> areaWidgets;
|
||||||
areaWidgets.insert(ADS_NS::TopDropArea, new QPushButton("TOP"));
|
areaWidgets.insert(ADS_NS::TopDropArea, new QPushButton("TOP"));
|
||||||
@ -122,18 +122,18 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
ADS_NS::ContainerWidget* cw = _container;
|
ADS_NS::ContainerWidget* cw = _container;
|
||||||
ADS_NS::SectionWidget* sw = NULL;
|
ADS_NS::SectionWidget* sw = NULL;
|
||||||
|
|
||||||
sw = _container->addSectionContent(createLongTextLabelSC(cw), sw, ADS_NS::CenterDropArea);
|
sw = _container->addSectionContent(createLongTextLabelSC(cw), nullptr, ADS_NS::CenterDropArea);
|
||||||
sw = _container->addSectionContent(createCalendarSC(cw), sw, ADS_NS::RightDropArea);
|
sw = _container->addSectionContent(createCalendarSC(cw), nullptr, ADS_NS::LeftDropArea);
|
||||||
sw = _container->addSectionContent(createFileSystemTreeSC(cw), sw, ADS_NS::CenterDropArea);
|
sw = _container->addSectionContent(createFileSystemTreeSC(cw), nullptr, ADS_NS::BottomDropArea);
|
||||||
|
|
||||||
_container->addSectionContent(createCalendarSC(_container));
|
/*_container->addSectionContent(createCalendarSC(_container));
|
||||||
_container->addSectionContent(createLongTextLabelSC(_container));
|
_container->addSectionContent(createLongTextLabelSC(_container));
|
||||||
_container->addSectionContent(createLongTextLabelSC(_container));
|
_container->addSectionContent(createLongTextLabelSC(_container));
|
||||||
_container->addSectionContent(createLongTextLabelSC(_container));
|
_container->addSectionContent(createLongTextLabelSC(_container));
|
||||||
|
|
||||||
ADS_NS::SectionContent::RefPtr sc = createLongTextLabelSC(cw);
|
ADS_NS::SectionContent::RefPtr sc = createLongTextLabelSC(cw);
|
||||||
sc->setFlags(ADS_NS::SectionContent::AllFlags ^ ADS_NS::SectionContent::Closeable);
|
sc->setFlags(ADS_NS::SectionContent::AllFlags ^ ADS_NS::SectionContent::Closeable);
|
||||||
_container->addSectionContent(sc);
|
_container->addSectionContent(sc);*/
|
||||||
}
|
}
|
||||||
else if (false)
|
else if (false)
|
||||||
{
|
{
|
||||||
@ -155,7 +155,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
restoreGeometry(loadDataHelper("MainWindow"));
|
restoreGeometry(loadDataHelper("MainWindow"));
|
||||||
|
|
||||||
// ADS - Restore geometries and states of contents.
|
// ADS - Restore geometries and states of contents.
|
||||||
_container->restoreState(loadDataHelper("ContainerWidget"));
|
//_container->restoreState(loadDataHelper("ContainerWidget"));
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
include($$(cetoni_repository)/build/qt/qtprojectsettings/common.pri)
|
||||||
|
|
||||||
TARGET = AdvancedDockingSystemUnitTests
|
TARGET = AdvancedDockingSystemUnitTests
|
||||||
|
|
||||||
QT += core gui testlib
|
QT += core gui testlib
|
||||||
@ -11,4 +13,4 @@ INCLUDEPATH += $$PWD/../AdvancedDockingSystem/include
|
|||||||
DEPENDPATH += $$PWD/../AdvancedDockingSystem/include
|
DEPENDPATH += $$PWD/../AdvancedDockingSystem/include
|
||||||
|
|
||||||
include(AdvancedDockingSystemUnitTests.pri)
|
include(AdvancedDockingSystemUnitTests.pri)
|
||||||
include(../AdvancedDockingSystem/AdvancedDockingSystem.pri)
|
include(../AdvancedDockingSystem/AdvancedDockingSystem.pri)
|
||||||
|
Loading…
Reference in New Issue
Block a user