Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions AdvancedDockingSystem/AdvancedDockingSystem.pri
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ HEADERS += \
$$PWD/include/ads/FloatingWidget.h \
$$PWD/include/ads/Internal.h \
$$PWD/include/ads/Serialization.h

INCLUDEPATH += $$PWD/include
DEPENDPATH += $$PWD/include
85 changes: 48 additions & 37 deletions AdvancedDockingSystem/src/API.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ ADS_NAMESPACE_BEGIN

static bool splitterContainsSectionWidget(QSplitter* splitter)
{
for (int i = 0; i < splitter->count(); ++i)
for (int i=0; i<splitter->count(); ++i)
{
QWidget* w = splitter->widget(i);
QSplitter* sp = qobject_cast<QSplitter*>(w);
SectionWidget* sw = NULL;
QSplitter* sp = qobject_cast<QSplitter*>(w);
if (sp && splitterContainsSectionWidget(sp))
{
return true;
else if ((sw = qobject_cast<SectionWidget*>(w)) != NULL)
}
else if (qobject_cast<SectionWidget*>(w) != nullptr)
{
return true;
}
}
return false;
}
Expand Down Expand Up @@ -49,49 +52,57 @@ void deleteEmptySplitter(ContainerWidget* container)

ContainerWidget* findParentContainerWidget(QWidget* w)
{
ContainerWidget* cw = 0;
QWidget* next = w;
do
{
if ((cw = dynamic_cast<ContainerWidget*>(next)) != 0)
{
break;
}
next = next->parentWidget();
}
while (next);
ContainerWidget* cw = nullptr;
if (w)
{
QWidget* next = w;
do
{
if ((cw = dynamic_cast<ContainerWidget*>(next)) != nullptr)
{
break;
}
next = next->parentWidget();
} while (next);
}

return cw;
}

SectionWidget* findParentSectionWidget(class QWidget* w)
{
SectionWidget* cw = 0;
QWidget* next = w;
do
{
if ((cw = dynamic_cast<SectionWidget*>(next)) != 0)
{
break;
}
next = next->parentWidget();
}
while (next);
SectionWidget* cw = nullptr;
if (w)
{
QWidget* next = w;
do
{
if ((cw = dynamic_cast<SectionWidget*>(next)) != nullptr)
{
break;
}
next = next->parentWidget();
} while (next);
}

return cw;
}

QSplitter* findParentSplitter(class QWidget* w)
{
QSplitter* cw = 0;
QWidget* next = w;
do
{
if ((cw = dynamic_cast<QSplitter*>(next)) != 0)
{
break;
}
next = next->parentWidget();
}
while (next);
QSplitter* cw = nullptr;
if (w)
{
QWidget* next = w;
do
{
if ((cw = dynamic_cast<QSplitter*>(next)) != nullptr)
{
break;
}
next = next->parentWidget();
} while (next);
}
return cw;
}

Expand Down
2 changes: 1 addition & 1 deletion AdvancedDockingSystem/src/ContainerWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ContainerWidget::ContainerWidget(QWidget *parent) :
_dropOverlay(new DropOverlay(this))
{
_mainLayout = new QGridLayout();
_mainLayout->setContentsMargins(9, 9, 9, 9);
_mainLayout->setContentsMargins(1, 1, 1, 1);
_mainLayout->setSpacing(0);
setLayout(_mainLayout);
}
Expand Down
4 changes: 2 additions & 2 deletions AdvancedDockingSystem/src/SectionTitleWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ void SectionTitleWidget::mouseMoveEvent(QMouseEvent* ev)
{
ev->accept();

int left, top, right, bottom;
getContentsMargins(&left, &top, &right, &bottom);
//int left, top, right, bottom;
//getContentsMargins(&left, &top, &right, &bottom);
QPoint moveToPos = mapToParent(ev->pos()) - _dragStartPos;
moveToPos.setY(0/* + top*/);
move(moveToPos);
Expand Down