mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 07:31: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)
|
||||
{
|
||||
std::cout << "CDockAreaTabBar::setCurrentIndex " << index << std::endl;
|
||||
if (index == d->CurrentIndex)
|
||||
{
|
||||
return;
|
||||
@ -267,6 +268,7 @@ void CDockAreaTabBar::insertTab(int Index, CDockWidgetTab* Tab)
|
||||
//===========================================================================
|
||||
void CDockAreaTabBar::removeTab(CDockWidgetTab* Tab)
|
||||
{
|
||||
std::cout << "CDockAreaTabBar::removeTab " << std::endl;
|
||||
d->TabsLayout->removeWidget(Tab);
|
||||
disconnect(Tab, SIGNAL(clicked()), this, SLOT(onTabClicked()));
|
||||
d->MenuOutdated = true;
|
||||
@ -297,6 +299,10 @@ void CDockAreaTabBar::onTabClicked()
|
||||
}
|
||||
|
||||
int index = d->TabsLayout->indexOf(Tab);
|
||||
if (index < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
setCurrentIndex(index);
|
||||
std::cout << "emit tabBarClicked " << index << std::endl;
|
||||
emit tabBarClicked(index);
|
||||
|
@ -159,6 +159,7 @@ public:
|
||||
|
||||
void insertWidget(int index, QWidget* Widget)
|
||||
{
|
||||
Widget->setParent(0);
|
||||
if (index < 0)
|
||||
{
|
||||
index = m_Widgets.count();
|
||||
@ -643,7 +644,8 @@ void CDockAreaWidget::setCurrentIndex(int index)
|
||||
|
||||
emit currentChanging(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));
|
||||
|
||||
if (!dockManager()->isRestoringState())
|
||||
|
@ -255,9 +255,9 @@ void DockContainerWidgetPrivate::dropIntoSection(CFloatingDockContainer* Floatin
|
||||
if (area == CenterDockWidgetArea)
|
||||
{
|
||||
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
|
||||
FloatingWidget->deleteLater();
|
||||
|
Loading…
Reference in New Issue
Block a user