mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 23:51:33 +08:00
Fixed dropping of floating widgets with multiple dock widgets
This commit is contained in:
parent
0e85431405
commit
c3a5e3ef21
@ -199,6 +199,7 @@ void CDockAreaTabBar::startFloating(const QPoint& Pos)
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaTabBar::setCurrentIndex(int index)
|
void CDockAreaTabBar::setCurrentIndex(int index)
|
||||||
{
|
{
|
||||||
|
std::cout << "CDockAreaTabBar::setCurrentIndex " << index << std::endl;
|
||||||
if (index == d->CurrentIndex)
|
if (index == d->CurrentIndex)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -267,6 +268,7 @@ void CDockAreaTabBar::insertTab(int Index, CDockWidgetTab* Tab)
|
|||||||
//===========================================================================
|
//===========================================================================
|
||||||
void CDockAreaTabBar::removeTab(CDockWidgetTab* Tab)
|
void CDockAreaTabBar::removeTab(CDockWidgetTab* Tab)
|
||||||
{
|
{
|
||||||
|
std::cout << "CDockAreaTabBar::removeTab " << std::endl;
|
||||||
d->TabsLayout->removeWidget(Tab);
|
d->TabsLayout->removeWidget(Tab);
|
||||||
disconnect(Tab, SIGNAL(clicked()), this, SLOT(onTabClicked()));
|
disconnect(Tab, SIGNAL(clicked()), this, SLOT(onTabClicked()));
|
||||||
d->MenuOutdated = true;
|
d->MenuOutdated = true;
|
||||||
@ -297,6 +299,10 @@ void CDockAreaTabBar::onTabClicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int index = d->TabsLayout->indexOf(Tab);
|
int index = d->TabsLayout->indexOf(Tab);
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
setCurrentIndex(index);
|
setCurrentIndex(index);
|
||||||
std::cout << "emit tabBarClicked " << index << std::endl;
|
std::cout << "emit tabBarClicked " << index << std::endl;
|
||||||
emit tabBarClicked(index);
|
emit tabBarClicked(index);
|
||||||
|
@ -159,6 +159,7 @@ public:
|
|||||||
|
|
||||||
void insertWidget(int index, QWidget* Widget)
|
void insertWidget(int index, QWidget* Widget)
|
||||||
{
|
{
|
||||||
|
Widget->setParent(0);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
{
|
{
|
||||||
index = m_Widgets.count();
|
index = m_Widgets.count();
|
||||||
@ -643,7 +644,8 @@ void CDockAreaWidget::setCurrentIndex(int index)
|
|||||||
|
|
||||||
emit currentChanging(index);
|
emit currentChanging(index);
|
||||||
d->TabBar->setCurrentIndex(index);
|
d->TabBar->setCurrentIndex(index);
|
||||||
auto Features = d->TabBar->currentTab()->dockWidget()->features();
|
CDockWidgetTab* CurrentTab = d->TabBar->currentTab();
|
||||||
|
auto Features = CurrentTab->dockWidget()->features();
|
||||||
d->CloseButton->setVisible(Features.testFlag(CDockWidget::DockWidgetClosable));
|
d->CloseButton->setVisible(Features.testFlag(CDockWidget::DockWidgetClosable));
|
||||||
|
|
||||||
if (!dockManager()->isRestoringState())
|
if (!dockManager()->isRestoringState())
|
||||||
|
@ -255,9 +255,9 @@ void DockContainerWidgetPrivate::dropIntoSection(CFloatingDockContainer* Floatin
|
|||||||
if (area == CenterDockWidgetArea)
|
if (area == CenterDockWidgetArea)
|
||||||
{
|
{
|
||||||
auto NewDockWidgets = FloatingContainer->dockWidgets();
|
auto NewDockWidgets = FloatingContainer->dockWidgets();
|
||||||
for (auto DockWidget : NewDockWidgets)
|
for (int i = 0; i < NewDockWidgets.count(); ++i)
|
||||||
{
|
{
|
||||||
TargetArea->insertDockWidget(0, DockWidget, false);
|
TargetArea->insertDockWidget(i, NewDockWidgets[i], false);
|
||||||
}
|
}
|
||||||
TargetArea->setCurrentIndex(0); // make the topmost widget active
|
TargetArea->setCurrentIndex(0); // make the topmost widget active
|
||||||
FloatingWidget->deleteLater();
|
FloatingWidget->deleteLater();
|
||||||
|
Loading…
Reference in New Issue
Block a user