mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 23:51:33 +08:00
Merge pull request #41 from kozodeevv/Conditional_prints
Make debug messages conditional.
This commit is contained in:
commit
554f26a614
@ -171,7 +171,7 @@ void CDockAreaTabBar::mouseReleaseEvent(QMouseEvent* ev)
|
|||||||
{
|
{
|
||||||
if (ev->button() == Qt::LeftButton)
|
if (ev->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
qDebug() << "CTabsScrollArea::mouseReleaseEvent";
|
ADS_PRINT("CTabsScrollArea::mouseReleaseEvent");
|
||||||
ev->accept();
|
ev->accept();
|
||||||
d->FloatingWidget = nullptr;
|
d->FloatingWidget = nullptr;
|
||||||
d->DragStartMousePos = QPoint();
|
d->DragStartMousePos = QPoint();
|
||||||
@ -215,7 +215,7 @@ void CDockAreaTabBar::mouseMoveEvent(QMouseEvent* ev)
|
|||||||
int DragDistance = (d->DragStartMousePos - ev->pos()).manhattanLength();
|
int DragDistance = (d->DragStartMousePos - ev->pos()).manhattanLength();
|
||||||
if (DragDistance >= CDockManager::startDragDistance())
|
if (DragDistance >= CDockManager::startDragDistance())
|
||||||
{
|
{
|
||||||
qDebug() << "CTabsScrollArea::startFloating";
|
ADS_PRINT("CTabsScrollArea::startFloating");
|
||||||
startFloating(d->DragStartMousePos);
|
startFloating(d->DragStartMousePos);
|
||||||
auto Overlay = d->DockArea->dockManager()->containerOverlay();
|
auto Overlay = d->DockArea->dockManager()->containerOverlay();
|
||||||
Overlay->setAllowedAreas(OuterDockAreas);
|
Overlay->setAllowedAreas(OuterDockAreas);
|
||||||
@ -321,7 +321,7 @@ void CDockAreaTabBar::removeTab(CDockWidgetTab* Tab)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
qDebug() << "CDockAreaTabBar::removeTab ";
|
ADS_PRINT("CDockAreaTabBar::removeTab ");
|
||||||
int NewCurrentIndex = currentIndex();
|
int NewCurrentIndex = currentIndex();
|
||||||
int RemoveIndex = d->TabsLayout->indexOf(Tab);
|
int RemoveIndex = d->TabsLayout->indexOf(Tab);
|
||||||
if (count() == 1)
|
if (count() == 1)
|
||||||
@ -364,7 +364,7 @@ void CDockAreaTabBar::removeTab(CDockWidgetTab* Tab)
|
|||||||
d->TabsLayout->removeWidget(Tab);
|
d->TabsLayout->removeWidget(Tab);
|
||||||
Tab->disconnect(this);
|
Tab->disconnect(this);
|
||||||
Tab->removeEventFilter(this);
|
Tab->removeEventFilter(this);
|
||||||
qDebug() << "NewCurrentIndex " << NewCurrentIndex;
|
ADS_PRINT("NewCurrentIndex " << NewCurrentIndex);
|
||||||
if (NewCurrentIndex != d->CurrentIndex)
|
if (NewCurrentIndex != d->CurrentIndex)
|
||||||
{
|
{
|
||||||
setCurrentIndex(NewCurrentIndex);
|
setCurrentIndex(NewCurrentIndex);
|
||||||
@ -492,7 +492,7 @@ void CDockAreaTabBar::onTabWidgetMoved(const QPoint& GlobalPos)
|
|||||||
{
|
{
|
||||||
if (MousePos.x() > tab(count() - 1)->geometry().right())
|
if (MousePos.x() > tab(count() - 1)->geometry().right())
|
||||||
{
|
{
|
||||||
qDebug() << "after all tabs";
|
ADS_PRINT("after all tabs");
|
||||||
toIndex = count() - 1;
|
toIndex = count() - 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -505,7 +505,7 @@ void CDockAreaTabBar::onTabWidgetMoved(const QPoint& GlobalPos)
|
|||||||
d->TabsLayout->insertWidget(toIndex, MovingTab);
|
d->TabsLayout->insertWidget(toIndex, MovingTab);
|
||||||
if (toIndex >= 0)
|
if (toIndex >= 0)
|
||||||
{
|
{
|
||||||
qDebug() << "tabMoved from " << fromIndex << " to " << toIndex;
|
ADS_PRINT("tabMoved from " << fromIndex << " to " << toIndex);
|
||||||
emit tabMoved(fromIndex, toIndex);
|
emit tabMoved(fromIndex, toIndex);
|
||||||
setCurrentIndex(toIndex);
|
setCurrentIndex(toIndex);
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@ void CDockAreaTitleBar::onTabsMenuAboutToShow()
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaTitleBar::onCloseButtonClicked()
|
void CDockAreaTitleBar::onCloseButtonClicked()
|
||||||
{
|
{
|
||||||
qDebug() << "CDockAreaTitleBar::onCloseButtonClicked";
|
ADS_PRINT("CDockAreaTitleBar::onCloseButtonClicked");
|
||||||
if (d->testConfigFlag(CDockManager::DockAreaCloseButtonClosesTab))
|
if (d->testConfigFlag(CDockManager::DockAreaCloseButtonClosesTab))
|
||||||
{
|
{
|
||||||
d->TabBar->closeTab(d->TabBar->currentIndex());
|
d->TabBar->closeTab(d->TabBar->currentIndex());
|
||||||
|
@ -356,7 +356,7 @@ CDockAreaWidget::CDockAreaWidget(CDockManager* DockManager, CDockContainerWidget
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
CDockAreaWidget::~CDockAreaWidget()
|
CDockAreaWidget::~CDockAreaWidget()
|
||||||
{
|
{
|
||||||
qDebug() << "~CDockAreaWidget()";
|
ADS_PRINT("~CDockAreaWidget()");
|
||||||
delete d->ContentsLayout;
|
delete d->ContentsLayout;
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
@ -409,7 +409,7 @@ void CDockAreaWidget::insertDockWidget(int index, CDockWidget* DockWidget,
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget)
|
void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget)
|
||||||
{
|
{
|
||||||
qDebug() << "CDockAreaWidget::removeDockWidget";
|
ADS_PRINT("CDockAreaWidget::removeDockWidget");
|
||||||
auto NextOpenDockWidget = nextOpenDockWidget(DockWidget);
|
auto NextOpenDockWidget = nextOpenDockWidget(DockWidget);
|
||||||
|
|
||||||
d->ContentsLayout->removeWidget(DockWidget);
|
d->ContentsLayout->removeWidget(DockWidget);
|
||||||
@ -423,7 +423,7 @@ void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget)
|
|||||||
}
|
}
|
||||||
else if (d->ContentsLayout->isEmpty() && DockContainer->dockAreaCount() > 1)
|
else if (d->ContentsLayout->isEmpty() && DockContainer->dockAreaCount() > 1)
|
||||||
{
|
{
|
||||||
qDebug() << "Dock Area empty";
|
ADS_PRINT("Dock Area empty");
|
||||||
DockContainer->removeDockArea(this);
|
DockContainer->removeDockArea(this);
|
||||||
this->deleteLater();
|
this->deleteLater();
|
||||||
}
|
}
|
||||||
@ -483,7 +483,7 @@ void CDockAreaWidget::hideAreaWithNoVisibleContent()
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaWidget::onTabCloseRequested(int Index)
|
void CDockAreaWidget::onTabCloseRequested(int Index)
|
||||||
{
|
{
|
||||||
qDebug() << "CDockAreaWidget::onTabCloseRequested " << Index;
|
ADS_PRINT("CDockAreaWidget::onTabCloseRequested " << Index);
|
||||||
dockWidget(Index)->toggleView(false);
|
dockWidget(Index)->toggleView(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -646,11 +646,11 @@ CDockWidget* CDockAreaWidget::dockWidget(int Index) const
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaWidget::reorderDockWidget(int fromIndex, int toIndex)
|
void CDockAreaWidget::reorderDockWidget(int fromIndex, int toIndex)
|
||||||
{
|
{
|
||||||
qDebug() << "CDockAreaWidget::reorderDockWidget";
|
ADS_PRINT("CDockAreaWidget::reorderDockWidget");
|
||||||
if (fromIndex >= d->ContentsLayout->count() || fromIndex < 0
|
if (fromIndex >= d->ContentsLayout->count() || fromIndex < 0
|
||||||
|| toIndex >= d->ContentsLayout->count() || toIndex < 0 || fromIndex == toIndex)
|
|| toIndex >= d->ContentsLayout->count() || toIndex < 0 || fromIndex == toIndex)
|
||||||
{
|
{
|
||||||
qDebug() << "Invalid index for tab movement" << fromIndex << toIndex;
|
ADS_PRINT("Invalid index for tab movement" << fromIndex << toIndex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,8 +705,8 @@ void CDockAreaWidget::saveState(QXmlStreamWriter& s) const
|
|||||||
auto CurrentDockWidget = currentDockWidget();
|
auto CurrentDockWidget = currentDockWidget();
|
||||||
QString Name = CurrentDockWidget ? CurrentDockWidget->objectName() : "";
|
QString Name = CurrentDockWidget ? CurrentDockWidget->objectName() : "";
|
||||||
s.writeAttribute("Current", Name);
|
s.writeAttribute("Current", Name);
|
||||||
qDebug() << "CDockAreaWidget::saveState TabCount: " << d->ContentsLayout->count()
|
ADS_PRINT("CDockAreaWidget::saveState TabCount: " << d->ContentsLayout->count()
|
||||||
<< " Current: " << Name;
|
<< " Current: " << Name);
|
||||||
for (int i = 0; i < d->ContentsLayout->count(); ++i)
|
for (int i = 0; i < d->ContentsLayout->count(); ++i)
|
||||||
{
|
{
|
||||||
dockWidget(i)->saveState(s);
|
dockWidget(i)->saveState(s);
|
||||||
|
@ -557,8 +557,8 @@ void DockContainerWidgetPrivate::saveChildNodesState(QXmlStreamWriter& s, QWidge
|
|||||||
s.writeStartElement("Splitter");
|
s.writeStartElement("Splitter");
|
||||||
s.writeAttribute("Orientation", (Splitter->orientation() == Qt::Horizontal) ? "-" : "|");
|
s.writeAttribute("Orientation", (Splitter->orientation() == Qt::Horizontal) ? "-" : "|");
|
||||||
s.writeAttribute("Count", QString::number(Splitter->count()));
|
s.writeAttribute("Count", QString::number(Splitter->count()));
|
||||||
qDebug() << "NodeSplitter orient: " << Splitter->orientation()
|
ADS_PRINT("NodeSplitter orient: " << Splitter->orientation()
|
||||||
<< " WidgetCont: " << Splitter->count();
|
<< " WidgetCont: " << Splitter->count());
|
||||||
for (int i = 0; i < Splitter->count(); ++i)
|
for (int i = 0; i < Splitter->count(); ++i)
|
||||||
{
|
{
|
||||||
saveChildNodesState(s, Splitter->widget(i));
|
saveChildNodesState(s, Splitter->widget(i));
|
||||||
@ -608,8 +608,8 @@ bool DockContainerWidgetPrivate::restoreSplitter(QXmlStreamReader& s,
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
qDebug() << "Restore NodeSplitter Orientation: " << Orientation <<
|
ADS_PRINT("Restore NodeSplitter Orientation: " << Orientation <<
|
||||||
" WidgetCount: " << WidgetCount;
|
" WidgetCount: " << WidgetCount);
|
||||||
QSplitter* Splitter = nullptr;
|
QSplitter* Splitter = nullptr;
|
||||||
if (!Testing)
|
if (!Testing)
|
||||||
{
|
{
|
||||||
@ -632,7 +632,7 @@ bool DockContainerWidgetPrivate::restoreSplitter(QXmlStreamReader& s,
|
|||||||
else if (s.name() == "Sizes")
|
else if (s.name() == "Sizes")
|
||||||
{
|
{
|
||||||
QString sSizes = s.readElementText().trimmed();
|
QString sSizes = s.readElementText().trimmed();
|
||||||
qDebug() << "Sizes: " << sSizes;
|
ADS_PRINT("Sizes: " << sSizes);
|
||||||
QTextStream TextStream(&sSizes);
|
QTextStream TextStream(&sSizes);
|
||||||
while (!TextStream.atEnd())
|
while (!TextStream.atEnd())
|
||||||
{
|
{
|
||||||
@ -656,8 +656,8 @@ bool DockContainerWidgetPrivate::restoreSplitter(QXmlStreamReader& s,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "ChildNode isVisible " << ChildNode->isVisible()
|
ADS_PRINT("ChildNode isVisible " << ChildNode->isVisible()
|
||||||
<< " isVisibleTo " << ChildNode->isVisibleTo(Splitter);
|
<< " isVisibleTo " << ChildNode->isVisibleTo(Splitter));
|
||||||
Splitter->addWidget(ChildNode);
|
Splitter->addWidget(ChildNode);
|
||||||
Visible |= ChildNode->isVisibleTo(Splitter);
|
Visible |= ChildNode->isVisibleTo(Splitter);
|
||||||
}
|
}
|
||||||
@ -703,8 +703,8 @@ bool DockContainerWidgetPrivate::restoreDockArea(QXmlStreamReader& s,
|
|||||||
|
|
||||||
|
|
||||||
QString CurrentDockWidget = s.attributes().value("Current").toString();
|
QString CurrentDockWidget = s.attributes().value("Current").toString();
|
||||||
qDebug() << "Restore NodeDockArea Tabs: " << Tabs << " Current: "
|
ADS_PRINT("Restore NodeDockArea Tabs: " << Tabs << " Current: "
|
||||||
<< CurrentDockWidget;
|
<< CurrentDockWidget);
|
||||||
|
|
||||||
CDockAreaWidget* DockArea = nullptr;
|
CDockAreaWidget* DockArea = nullptr;
|
||||||
if (!Testing)
|
if (!Testing)
|
||||||
@ -738,7 +738,7 @@ bool DockContainerWidgetPrivate::restoreDockArea(QXmlStreamReader& s,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "Dock Widget found - parent " << DockWidget->parent();
|
ADS_PRINT("Dock Widget found - parent " << DockWidget->parent());
|
||||||
// We hide the DockArea here to prevent the short display (the flashing)
|
// We hide the DockArea here to prevent the short display (the flashing)
|
||||||
// of the dock areas during application startup
|
// of the dock areas during application startup
|
||||||
DockArea->hide();
|
DockArea->hide();
|
||||||
@ -780,17 +780,17 @@ bool DockContainerWidgetPrivate::restoreChildNodes(QXmlStreamReader& s,
|
|||||||
if (s.name() == "Splitter")
|
if (s.name() == "Splitter")
|
||||||
{
|
{
|
||||||
Result = restoreSplitter(s, CreatedWidget, Testing);
|
Result = restoreSplitter(s, CreatedWidget, Testing);
|
||||||
qDebug() << "Splitter";
|
ADS_PRINT("Splitter");
|
||||||
}
|
}
|
||||||
else if (s.name() == "Area")
|
else if (s.name() == "Area")
|
||||||
{
|
{
|
||||||
Result = restoreDockArea(s, CreatedWidget, Testing);
|
Result = restoreDockArea(s, CreatedWidget, Testing);
|
||||||
qDebug() << "DockAreaWidget";
|
ADS_PRINT("DockAreaWidget");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s.skipCurrentElement();
|
s.skipCurrentElement();
|
||||||
qDebug() << "Unknown element";
|
ADS_PRINT("Unknown element");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -862,15 +862,17 @@ void DockContainerWidgetPrivate::dumpRecursive(int level, QWidget* widget)
|
|||||||
buf.fill(' ', level * 4);
|
buf.fill(' ', level * 4);
|
||||||
if (Splitter)
|
if (Splitter)
|
||||||
{
|
{
|
||||||
|
#ifdef ADS_DEBUG_PRINT
|
||||||
qDebug("%sSplitter %s v: %s c: %s",
|
qDebug("%sSplitter %s v: %s c: %s",
|
||||||
(const char*)buf,
|
(const char*)buf,
|
||||||
(Splitter->orientation() == Qt::Vertical) ? "--" : "|",
|
(Splitter->orientation() == Qt::Vertical) ? "--" : "|",
|
||||||
Splitter->isHidden() ? " " : "v",
|
Splitter->isHidden() ? " " : "v",
|
||||||
QString::number(Splitter->count()).toStdString().c_str());
|
QString::number(Splitter->count()).toStdString().c_str());
|
||||||
std::cout << (const char*)buf << "Splitter "
|
std::cout << (const char*)buf << "Splitter "
|
||||||
<< ((Splitter->orientation() == Qt::Vertical) ? "--" : "|") << " "
|
<< ((Splitter->orientation() == Qt::Vertical) ? "--" : "|") << " "
|
||||||
<< (Splitter->isHidden() ? " " : "v") << " "
|
<< (Splitter->isHidden() ? " " : "v") << " "
|
||||||
<< QString::number(Splitter->count()).toStdString() << std::endl;
|
<< QString::number(Splitter->count()).toStdString() << std::endl;
|
||||||
|
#endif
|
||||||
for (int i = 0; i < Splitter->count(); ++i)
|
for (int i = 0; i < Splitter->count(); ++i)
|
||||||
{
|
{
|
||||||
dumpRecursive(level + 1, Splitter->widget(i));
|
dumpRecursive(level + 1, Splitter->widget(i));
|
||||||
@ -883,6 +885,7 @@ void DockContainerWidgetPrivate::dumpRecursive(int level, QWidget* widget)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#ifdef ADS_DEBUG_PRINT
|
||||||
qDebug("%sDockArea", (const char*)buf);
|
qDebug("%sDockArea", (const char*)buf);
|
||||||
std::cout << (const char*)buf
|
std::cout << (const char*)buf
|
||||||
<< (DockArea->isHidden() ? " " : "v")
|
<< (DockArea->isHidden() ? " " : "v")
|
||||||
@ -896,7 +899,8 @@ void DockContainerWidgetPrivate::dumpRecursive(int level, QWidget* widget)
|
|||||||
std::cout << (DockWidget->isHidden() ? " " : "v");
|
std::cout << (DockWidget->isHidden() ? " " : "v");
|
||||||
std::cout << (DockWidget->isClosed() ? "c" : " ") << " ";
|
std::cout << (DockWidget->isClosed() ? "c" : " ") << " ";
|
||||||
std::cout << DockWidget->windowTitle().toStdString() << std::endl;
|
std::cout << DockWidget->windowTitle().toStdString() << std::endl;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(level);
|
Q_UNUSED(level);
|
||||||
@ -923,12 +927,12 @@ CDockAreaWidget* DockContainerWidgetPrivate::dockWidgetIntoDockArea(DockWidgetAr
|
|||||||
int index = TargetAreaSplitter ->indexOf(TargetDockArea);
|
int index = TargetAreaSplitter ->indexOf(TargetDockArea);
|
||||||
if (TargetAreaSplitter->orientation() == InsertParam.orientation())
|
if (TargetAreaSplitter->orientation() == InsertParam.orientation())
|
||||||
{
|
{
|
||||||
qDebug() << "TargetAreaSplitter->orientation() == InsertParam.orientation()";
|
ADS_PRINT("TargetAreaSplitter->orientation() == InsertParam.orientation()");
|
||||||
TargetAreaSplitter->insertWidget(index + InsertParam.insertOffset(), NewDockArea);
|
TargetAreaSplitter->insertWidget(index + InsertParam.insertOffset(), NewDockArea);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "TargetAreaSplitter->orientation() != InsertParam.orientation()";
|
ADS_PRINT("TargetAreaSplitter->orientation() != InsertParam.orientation()");
|
||||||
QSplitter* NewSplitter = newSplitter(InsertParam.orientation());
|
QSplitter* NewSplitter = newSplitter(InsertParam.orientation());
|
||||||
NewSplitter->addWidget(TargetDockArea);
|
NewSplitter->addWidget(TargetDockArea);
|
||||||
insertWidgetIntoSplitter(NewSplitter, NewDockArea, InsertParam.append());
|
insertWidgetIntoSplitter(NewSplitter, NewDockArea, InsertParam.append());
|
||||||
@ -1056,7 +1060,7 @@ void CDockContainerWidget::addDockArea(CDockAreaWidget* DockAreaWidget,
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockContainerWidget::removeDockArea(CDockAreaWidget* area)
|
void CDockContainerWidget::removeDockArea(CDockAreaWidget* area)
|
||||||
{
|
{
|
||||||
qDebug() << "CDockContainerWidget::removeDockArea";
|
ADS_PRINT("CDockContainerWidget::removeDockArea");
|
||||||
area->disconnect(this);
|
area->disconnect(this);
|
||||||
d->DockAreas.removeAll(area);
|
d->DockAreas.removeAll(area);
|
||||||
CDockSplitter* Splitter = internal::findParent<CDockSplitter*>(area);
|
CDockSplitter* Splitter = internal::findParent<CDockSplitter*>(area);
|
||||||
@ -1082,7 +1086,7 @@ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area)
|
|||||||
// avoid too many empty splitters
|
// avoid too many empty splitters
|
||||||
if (Splitter == d->RootSplitter)
|
if (Splitter == d->RootSplitter)
|
||||||
{
|
{
|
||||||
qDebug() << "Removed from RootSplitter";
|
ADS_PRINT("Removed from RootSplitter");
|
||||||
// If splitter is empty, we are finished
|
// If splitter is empty, we are finished
|
||||||
if (!Splitter->count())
|
if (!Splitter->count())
|
||||||
{
|
{
|
||||||
@ -1104,11 +1108,11 @@ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area)
|
|||||||
QLayoutItem* li = d->Layout->replaceWidget(Splitter, ChildSplitter);
|
QLayoutItem* li = d->Layout->replaceWidget(Splitter, ChildSplitter);
|
||||||
d->RootSplitter = ChildSplitter;
|
d->RootSplitter = ChildSplitter;
|
||||||
delete li;
|
delete li;
|
||||||
qDebug() << "RootSplitter replaced by child splitter";
|
ADS_PRINT("RootSplitter replaced by child splitter");
|
||||||
}
|
}
|
||||||
else if (Splitter->count() == 1)
|
else if (Splitter->count() == 1)
|
||||||
{
|
{
|
||||||
qDebug() << "Replacing splitter with content";
|
ADS_PRINT("Replacing splitter with content");
|
||||||
QSplitter* ParentSplitter = internal::findParent<QSplitter*>(Splitter);
|
QSplitter* ParentSplitter = internal::findParent<QSplitter*>(Splitter);
|
||||||
auto Sizes = ParentSplitter->sizes();
|
auto Sizes = ParentSplitter->sizes();
|
||||||
QWidget* widget = Splitter->widget(0);
|
QWidget* widget = Splitter->widget(0);
|
||||||
@ -1187,7 +1191,7 @@ int CDockContainerWidget::visibleDockAreaCount() const
|
|||||||
void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWidget,
|
void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWidget,
|
||||||
const QPoint& TargetPos)
|
const QPoint& TargetPos)
|
||||||
{
|
{
|
||||||
qDebug() << "CDockContainerWidget::dropFloatingWidget";
|
ADS_PRINT("CDockContainerWidget::dropFloatingWidget");
|
||||||
CDockAreaWidget* DockArea = dockAreaAt(TargetPos);
|
CDockAreaWidget* DockArea = dockAreaAt(TargetPos);
|
||||||
auto dropArea = InvalidDockWidgetArea;
|
auto dropArea = InvalidDockWidgetArea;
|
||||||
auto ContainerDropArea = d->DockManager->containerOverlay()->dropAreaUnderCursor();
|
auto ContainerDropArea = d->DockManager->containerOverlay()->dropAreaUnderCursor();
|
||||||
@ -1207,7 +1211,7 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
|
|||||||
|
|
||||||
if (dropArea != InvalidDockWidgetArea)
|
if (dropArea != InvalidDockWidgetArea)
|
||||||
{
|
{
|
||||||
qDebug() << "Dock Area Drop Content: " << dropArea;
|
ADS_PRINT("Dock Area Drop Content: " << dropArea);
|
||||||
d->dropIntoSection(FloatingWidget, DockArea, dropArea);
|
d->dropIntoSection(FloatingWidget, DockArea, dropArea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1216,7 +1220,7 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
|
|||||||
if (InvalidDockWidgetArea == dropArea)
|
if (InvalidDockWidgetArea == dropArea)
|
||||||
{
|
{
|
||||||
dropArea = ContainerDropArea;
|
dropArea = ContainerDropArea;
|
||||||
qDebug() << "Container Drop Content: " << dropArea;
|
ADS_PRINT("Container Drop Content: " << dropArea);
|
||||||
if (dropArea != InvalidDockWidgetArea)
|
if (dropArea != InvalidDockWidgetArea)
|
||||||
{
|
{
|
||||||
d->dropIntoContainer(FloatingWidget, dropArea);
|
d->dropIntoContainer(FloatingWidget, dropArea);
|
||||||
@ -1258,8 +1262,8 @@ QList<CDockAreaWidget*> CDockContainerWidget::openedDockAreas() const
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockContainerWidget::saveState(QXmlStreamWriter& s) const
|
void CDockContainerWidget::saveState(QXmlStreamWriter& s) const
|
||||||
{
|
{
|
||||||
qDebug() << "CDockContainerWidget::saveState isFloating "
|
ADS_PRINT("CDockContainerWidget::saveState isFloating "
|
||||||
<< isFloating();
|
<< isFloating());
|
||||||
|
|
||||||
s.writeStartElement("Container");
|
s.writeStartElement("Container");
|
||||||
s.writeAttribute("Floating", QString::number(isFloating() ? 1 : 0));
|
s.writeAttribute("Floating", QString::number(isFloating() ? 1 : 0));
|
||||||
@ -1282,7 +1286,7 @@ void CDockContainerWidget::saveState(QXmlStreamWriter& s) const
|
|||||||
bool CDockContainerWidget::restoreState(QXmlStreamReader& s, bool Testing)
|
bool CDockContainerWidget::restoreState(QXmlStreamReader& s, bool Testing)
|
||||||
{
|
{
|
||||||
bool IsFloating = s.attributes().value("Floating").toInt();
|
bool IsFloating = s.attributes().value("Floating").toInt();
|
||||||
qDebug() << "Restore CDockContainerWidget Floating" << IsFloating;
|
ADS_PRINT("Restore CDockContainerWidget Floating" << IsFloating);
|
||||||
|
|
||||||
QWidget*NewRootSplitter {};
|
QWidget*NewRootSplitter {};
|
||||||
if (!Testing)
|
if (!Testing)
|
||||||
@ -1294,7 +1298,7 @@ bool CDockContainerWidget::restoreState(QXmlStreamReader& s, bool Testing)
|
|||||||
|
|
||||||
if (IsFloating)
|
if (IsFloating)
|
||||||
{
|
{
|
||||||
qDebug() << "Restore floating widget";
|
ADS_PRINT("Restore floating widget");
|
||||||
if (!s.readNextStartElement() || s.name() != "Geometry")
|
if (!s.readNextStartElement() || s.name() != "Geometry")
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -174,7 +174,7 @@ bool DockManagerPrivate::restoreContainer(int Index, QXmlStreamReader& stream, b
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "d->Containers[i]->restoreState ";
|
ADS_PRINT("d->Containers[i]->restoreState ");
|
||||||
auto Container = Containers[Index];
|
auto Container = Containers[Index];
|
||||||
if (Container->isFloating())
|
if (Container->isFloating())
|
||||||
{
|
{
|
||||||
@ -211,7 +211,7 @@ bool DockManagerPrivate::restoreStateFromXml(const QByteArray &state, int versi
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
qDebug() << s.attributes().value("Version");
|
ADS_PRINT(s.attributes().value("Version"));
|
||||||
bool ok;
|
bool ok;
|
||||||
int v = s.attributes().value("Version").toInt(&ok);
|
int v = s.attributes().value("Version").toInt(&ok);
|
||||||
if (!ok || v != version)
|
if (!ok || v != version)
|
||||||
@ -221,7 +221,7 @@ bool DockManagerPrivate::restoreStateFromXml(const QByteArray &state, int versi
|
|||||||
|
|
||||||
bool Result = true;
|
bool Result = true;
|
||||||
int DockContainers = s.attributes().value("Containers").toInt();
|
int DockContainers = s.attributes().value("Containers").toInt();
|
||||||
qDebug() << DockContainers;
|
ADS_PRINT(DockContainers);
|
||||||
int DockContainerCount = 0;
|
int DockContainerCount = 0;
|
||||||
while (s.readNextStartElement())
|
while (s.readNextStartElement())
|
||||||
{
|
{
|
||||||
@ -345,7 +345,7 @@ bool DockManagerPrivate::restoreState(const QByteArray& State, int version)
|
|||||||
QByteArray state = State.startsWith("<?xml") ? State : qUncompress(State);
|
QByteArray state = State.startsWith("<?xml") ? State : qUncompress(State);
|
||||||
if (!checkFormat(state, version))
|
if (!checkFormat(state, version))
|
||||||
{
|
{
|
||||||
qDebug() << "checkFormat: Error checking format!!!!!!!";
|
ADS_PRINT("checkFormat: Error checking format!!!!!!!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ bool DockManagerPrivate::restoreState(const QByteArray& State, int version)
|
|||||||
|
|
||||||
if (!restoreStateFromXml(state, version))
|
if (!restoreStateFromXml(state, version))
|
||||||
{
|
{
|
||||||
qDebug() << "restoreState: Error restoring state!!!!!!!";
|
ADS_PRINT("restoreState: Error restoring state!!!!!!!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,7 +430,7 @@ CDockManager::~CDockManager()
|
|||||||
void CDockManager::registerFloatingWidget(CFloatingDockContainer* FloatingWidget)
|
void CDockManager::registerFloatingWidget(CFloatingDockContainer* FloatingWidget)
|
||||||
{
|
{
|
||||||
d->FloatingWidgets.append(FloatingWidget);
|
d->FloatingWidgets.append(FloatingWidget);
|
||||||
qDebug() << "d->FloatingWidgets.count() " << d->FloatingWidgets.count();
|
ADS_PRINT("d->FloatingWidgets.count() " << d->FloatingWidgets.count());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ CDockSplitter::CDockSplitter(Qt::Orientation orientation, QWidget *parent)
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
CDockSplitter::~CDockSplitter()
|
CDockSplitter::~CDockSplitter()
|
||||||
{
|
{
|
||||||
qDebug() << "~CDockSplitter";
|
ADS_PRINT("~CDockSplitter");
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ CDockWidget::CDockWidget(const QString &title, QWidget *parent) :
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
CDockWidget::~CDockWidget()
|
CDockWidget::~CDockWidget()
|
||||||
{
|
{
|
||||||
qDebug() << "~CDockWidget()";
|
ADS_PRINT("~CDockWidget()");
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,9 +193,9 @@ void DockWidgetTabPrivate::moveTab(QMouseEvent* ev)
|
|||||||
bool DockWidgetTabPrivate::startFloating(eDragState DraggingState)
|
bool DockWidgetTabPrivate::startFloating(eDragState DraggingState)
|
||||||
{
|
{
|
||||||
auto dockContainer = DockWidget->dockContainer();
|
auto dockContainer = DockWidget->dockContainer();
|
||||||
qDebug() << "isFloating " << dockContainer->isFloating();
|
ADS_PRINT("isFloating " << dockContainer->isFloating());
|
||||||
qDebug() << "areaCount " << dockContainer->dockAreaCount();
|
ADS_PRINT("areaCount " << dockContainer->dockAreaCount());
|
||||||
qDebug() << "widgetCount " << DockWidget->dockAreaWidget()->dockWidgetsCount();
|
ADS_PRINT("widgetCount " << DockWidget->dockAreaWidget()->dockWidgetsCount());
|
||||||
// if this is the last dock widget inside of this floating widget,
|
// if this is the last dock widget inside of this floating widget,
|
||||||
// then it does not make any sense, to make it floating because
|
// then it does not make any sense, to make it floating because
|
||||||
// it is already floating
|
// it is already floating
|
||||||
@ -206,7 +206,7 @@ bool DockWidgetTabPrivate::startFloating(eDragState DraggingState)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "startFloating";
|
ADS_PRINT("startFloating");
|
||||||
DragState = DraggingState;
|
DragState = DraggingState;
|
||||||
QSize Size = DockArea->size();
|
QSize Size = DockArea->size();
|
||||||
CFloatingDockContainer* FloatingWidget = nullptr;
|
CFloatingDockContainer* FloatingWidget = nullptr;
|
||||||
@ -251,7 +251,7 @@ CDockWidgetTab::CDockWidgetTab(CDockWidget* DockWidget, QWidget *parent) :
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
CDockWidgetTab::~CDockWidgetTab()
|
CDockWidgetTab::~CDockWidgetTab()
|
||||||
{
|
{
|
||||||
qDebug() << "~CDockWidgetTab()";
|
ADS_PRINT("~CDockWidgetTab()");
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ CFloatingDockContainer::CFloatingDockContainer(CDockWidget* DockWidget) :
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
CFloatingDockContainer::~CFloatingDockContainer()
|
CFloatingDockContainer::~CFloatingDockContainer()
|
||||||
{
|
{
|
||||||
qDebug() << "~CFloatingDockContainer";
|
ADS_PRINT("~CFloatingDockContainer");
|
||||||
if (d->DockManager)
|
if (d->DockManager)
|
||||||
{
|
{
|
||||||
d->DockManager->removeFloatingWidget(this);
|
d->DockManager->removeFloatingWidget(this);
|
||||||
@ -314,7 +314,7 @@ void CFloatingDockContainer::changeEvent(QEvent *event)
|
|||||||
QWidget::changeEvent(event);
|
QWidget::changeEvent(event);
|
||||||
if ((event->type() == QEvent::ActivationChange) && isActiveWindow())
|
if ((event->type() == QEvent::ActivationChange) && isActiveWindow())
|
||||||
{
|
{
|
||||||
qDebug() << "FloatingWidget::changeEvent QEvent::ActivationChange ";
|
ADS_PRINT("FloatingWidget::changeEvent QEvent::ActivationChange ");
|
||||||
d->zOrderIndex = ++zOrderCounter;
|
d->zOrderIndex = ++zOrderCounter;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -344,7 +344,7 @@ void CFloatingDockContainer::moveEvent(QMoveEvent *event)
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CFloatingDockContainer::closeEvent(QCloseEvent *event)
|
void CFloatingDockContainer::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
qDebug() << "CFloatingDockContainer closeEvent";
|
ADS_PRINT("CFloatingDockContainer closeEvent");
|
||||||
d->setState(DraggingInactive);
|
d->setState(DraggingInactive);
|
||||||
|
|
||||||
if (isClosable())
|
if (isClosable())
|
||||||
@ -414,13 +414,13 @@ bool CFloatingDockContainer::event(QEvent *e)
|
|||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 2))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 2))
|
||||||
if (e->type() == QEvent::NonClientAreaMouseButtonPress /*&& QGuiApplication::mouseButtons().testFlag(Qt::LeftButton)*/)
|
if (e->type() == QEvent::NonClientAreaMouseButtonPress /*&& QGuiApplication::mouseButtons().testFlag(Qt::LeftButton)*/)
|
||||||
{
|
{
|
||||||
qDebug() << "FloatingWidget::event Event::NonClientAreaMouseButtonPress" << e->type();
|
ADS_PRINT("FloatingWidget::event Event::NonClientAreaMouseButtonPress" << e->type());
|
||||||
d->setState(DraggingMousePressed);
|
d->setState(DraggingMousePressed);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (e->type() == QEvent::NonClientAreaMouseButtonPress && QGuiApplication::mouseButtons().testFlag(Qt::LeftButton))
|
if (e->type() == QEvent::NonClientAreaMouseButtonPress && QGuiApplication::mouseButtons().testFlag(Qt::LeftButton))
|
||||||
{
|
{
|
||||||
qDebug() << "FloatingWidget::event Event::NonClientAreaMouseButtonPress" << e->type();
|
ADS_PRINT("FloatingWidget::event Event::NonClientAreaMouseButtonPress" << e->type());
|
||||||
d->setState(DraggingMousePressed);
|
d->setState(DraggingMousePressed);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -431,7 +431,7 @@ bool CFloatingDockContainer::event(QEvent *e)
|
|||||||
switch (e->type())
|
switch (e->type())
|
||||||
{
|
{
|
||||||
case QEvent::NonClientAreaMouseButtonDblClick:
|
case QEvent::NonClientAreaMouseButtonDblClick:
|
||||||
qDebug() << "FloatingWidget::event QEvent::NonClientAreaMouseButtonDblClick";
|
ADS_PRINT("FloatingWidget::event QEvent::NonClientAreaMouseButtonDblClick");
|
||||||
d->setState(DraggingInactive);
|
d->setState(DraggingInactive);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -458,7 +458,7 @@ bool CFloatingDockContainer::event(QEvent *e)
|
|||||||
case DraggingFloatingWidget:
|
case DraggingFloatingWidget:
|
||||||
if (e->type() == QEvent::NonClientAreaMouseButtonRelease)
|
if (e->type() == QEvent::NonClientAreaMouseButtonRelease)
|
||||||
{
|
{
|
||||||
qDebug() << "FloatingWidget::event QEvent::NonClientAreaMouseButtonRelease";
|
ADS_PRINT("FloatingWidget::event QEvent::NonClientAreaMouseButtonRelease");
|
||||||
d->titleMouseReleaseEvent();
|
d->titleMouseReleaseEvent();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -480,7 +480,7 @@ bool CFloatingDockContainer::eventFilter(QObject *watched, QEvent *event)
|
|||||||
Q_UNUSED(watched);
|
Q_UNUSED(watched);
|
||||||
if (event->type() == QEvent::MouseButtonRelease && d->isState(DraggingFloatingWidget))
|
if (event->type() == QEvent::MouseButtonRelease && d->isState(DraggingFloatingWidget))
|
||||||
{
|
{
|
||||||
qDebug() << "FloatingWidget::eventFilter QEvent::MouseButtonRelease";
|
ADS_PRINT("FloatingWidget::eventFilter QEvent::MouseButtonRelease");
|
||||||
finishDragging();
|
finishDragging();
|
||||||
d->titleMouseReleaseEvent();
|
d->titleMouseReleaseEvent();
|
||||||
}
|
}
|
||||||
@ -536,7 +536,7 @@ bool CFloatingDockContainer::isClosable() const
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CFloatingDockContainer::onDockAreasAddedOrRemoved()
|
void CFloatingDockContainer::onDockAreasAddedOrRemoved()
|
||||||
{
|
{
|
||||||
qDebug() << "CFloatingDockContainer::onDockAreasAddedOrRemoved()";
|
ADS_PRINT("CFloatingDockContainer::onDockAreasAddedOrRemoved()");
|
||||||
auto TopLevelDockArea = d->DockContainer->topLevelDockArea();
|
auto TopLevelDockArea = d->DockContainer->topLevelDockArea();
|
||||||
if (TopLevelDockArea)
|
if (TopLevelDockArea)
|
||||||
{
|
{
|
||||||
@ -619,7 +619,7 @@ QList<CDockWidget*> CFloatingDockContainer::dockWidgets() const
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CFloatingDockContainer::finishDragging()
|
void CFloatingDockContainer::finishDragging()
|
||||||
{
|
{
|
||||||
qDebug() << "CFloatingDockContainer::finishDragging";
|
ADS_PRINT("CFloatingDockContainer::finishDragging");
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
setAttribute(Qt::WA_X11NetWmWindowTypeDock, false);
|
setAttribute(Qt::WA_X11NetWmWindowTypeDock, false);
|
||||||
setWindowOpacity(1);
|
setWindowOpacity(1);
|
||||||
|
@ -45,6 +45,12 @@
|
|||||||
#define ADS_EXPORT
|
#define ADS_EXPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ADS_DEBUG_PRINT
|
||||||
|
#define ADS_PRINT(s) qDebug() << s
|
||||||
|
#else
|
||||||
|
#define ADS_PRINT(s)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ADS_DEBUG_LEVEL 0
|
#define ADS_DEBUG_LEVEL 0
|
||||||
|
|
||||||
class QSplitter;
|
class QSplitter;
|
||||||
|
Loading…
Reference in New Issue
Block a user