Merged master

This commit is contained in:
Uwe Kindler 2022-11-18 21:50:38 +01:00
commit e060d99d96
8 changed files with 26 additions and 18 deletions

View File

@ -747,11 +747,11 @@ CMainWindow::CMainWindow(QWidget *parent) :
d->DockManager = new CDockManager(this); d->DockManager = new CDockManager(this);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
connect(d->PerspectiveComboBox, SIGNAL(activated(const QString&)), connect(d->PerspectiveComboBox, SIGNAL(activated(QString)),
d->DockManager, SLOT(openPerspective(const QString&))); d->DockManager, SLOT(openPerspective(QString)));
#else #else
connect(d->PerspectiveComboBox, SIGNAL(textActivated(const QString&)), connect(d->PerspectiveComboBox, SIGNAL(textActivated(QString)),
d->DockManager, SLOT(openPerspective(const QString&))); d->DockManager, SLOT(openPerspective(QString)));
#endif #endif
d->createContent(); d->createContent();

View File

@ -206,13 +206,17 @@ void DockInDockWidget::fillPerspectivesMenu( QMenu* menu )
if ( !perspectiveNames.isEmpty() ) if ( !perspectiveNames.isEmpty() )
{ {
QMenu* load = menu->addMenu( "Load perspective" ); QMenu* load = menu->addMenu( "Load perspective" );
for ( auto name : perspectiveNames ) for (const auto& name : perspectiveNames)
{
load->addAction(new LoadPerspectiveAction( load, name, *this)); load->addAction(new LoadPerspectiveAction( load, name, *this));
}
QMenu* remove = menu->addMenu( "Remove perspective" ); QMenu* remove = menu->addMenu( "Remove perspective" );
for ( auto name : perspectiveNames ) for (const auto& name : perspectiveNames)
{
remove->addAction( new RemovePerspectiveAction( remove, name, *this )); remove->addAction( new RemovePerspectiveAction( remove, name, *this ));
} }
} }
}
void DockInDockWidget::setNewPerspectiveDefaultName( const QString& defaultName ) void DockInDockWidget::setNewPerspectiveDefaultName( const QString& defaultName )
{ {

View File

@ -219,8 +219,10 @@ void PerspectivesManager::loadPerspectives()
// load group info: // load group info:
mainSettings->beginGroup(GROUP_PREFIX); mainSettings->beginGroup(GROUP_PREFIX);
for ( auto key : mainSettings->allKeys() ) for (const auto& key : mainSettings->allKeys())
{
m_perspectives[perspective].groups[key] = mainSettings->value( key ).toStringList(); m_perspectives[perspective].groups[key] = mainSettings->value( key ).toStringList();
}
mainSettings->endGroup(); mainSettings->endGroup();
} }
else else

View File

@ -203,7 +203,7 @@ void CDockAreaTabBar::insertTab(int Index, CDockWidgetTab* Tab)
connect(Tab, SIGNAL(clicked()), this, SLOT(onTabClicked())); connect(Tab, SIGNAL(clicked()), this, SLOT(onTabClicked()));
connect(Tab, SIGNAL(closeRequested()), this, SLOT(onTabCloseRequested())); connect(Tab, SIGNAL(closeRequested()), this, SLOT(onTabCloseRequested()));
connect(Tab, SIGNAL(closeOtherTabsRequested()), this, SLOT(onCloseOtherTabsRequested())); connect(Tab, SIGNAL(closeOtherTabsRequested()), this, SLOT(onCloseOtherTabsRequested()));
connect(Tab, SIGNAL(moved(const QPoint&)), this, SLOT(onTabWidgetMoved(const QPoint&))); connect(Tab, SIGNAL(moved(QPoint)), this, SLOT(onTabWidgetMoved(QPoint)));
connect(Tab, SIGNAL(elidedChanged(bool)), this, SIGNAL(elidedChanged(bool))); connect(Tab, SIGNAL(elidedChanged(bool)), this, SIGNAL(elidedChanged(bool)));
Tab->installEventFilter(this); Tab->installEventFilter(this);
Q_EMIT tabInserted(Index); Q_EMIT tabInserted(Index);

View File

@ -449,14 +449,13 @@ void CDockAreaTitleBar::onTabsMenuActionTriggered(QAction* Action)
//============================================================================ //============================================================================
void CDockAreaTitleBar::updateDockWidgetActionsButtons() void CDockAreaTitleBar::updateDockWidgetActionsButtons()
{ {
auto* const currentTab = d->TabBar->currentTab(); auto Tab = d->TabBar->currentTab();
if (currentTab == nullptr) if (!Tab)
{ {
// It's possible for this to be nullptr when restoring state
return; return;
} }
CDockWidget* DockWidget = currentTab->dockWidget(); CDockWidget* DockWidget = Tab->dockWidget();
if (!d->DockWidgetActionsButtons.isEmpty()) if (!d->DockWidgetActionsButtons.isEmpty())
{ {
for (auto Button : d->DockWidgetActionsButtons) for (auto Button : d->DockWidgetActionsButtons)

View File

@ -518,6 +518,11 @@ void CDockAreaWidget::insertDockWidget(int index, CDockWidget* DockWidget,
void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget) void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget)
{ {
ADS_PRINT("CDockAreaWidget::removeDockWidget"); ADS_PRINT("CDockAreaWidget::removeDockWidget");
if (!DockWidget)
{
return;
}
// If this dock area is in a auto hide container, then we can delete // If this dock area is in a auto hide container, then we can delete
// the auto hide container now // the auto hide container now
@ -1374,7 +1379,7 @@ bool CDockAreaWidget::isCentralWidgetArea() const
return false; return false;
} }
return dockManager()->centralWidget() == dockWidgets()[0]; return dockManager()->centralWidget() == dockWidgets().constFirst();
} }

View File

@ -599,7 +599,6 @@ void DockContainerWidgetPrivate::dropIntoSection(CFloatingDockContainer* Floatin
} }
else else
{ {
QList<int> NewSplitterSizes;
QSplitter* NewSplitter = newSplitter(InsertParam.orientation()); QSplitter* NewSplitter = newSplitter(InsertParam.orientation());
int TargetAreaSize = (InsertParam.orientation() == Qt::Horizontal) ? TargetArea->width() : TargetArea->height(); int TargetAreaSize = (InsertParam.orientation() == Qt::Horizontal) ? TargetArea->width() : TargetArea->height();
bool AdjustSplitterSizes = true; bool AdjustSplitterSizes = true;
@ -723,7 +722,6 @@ void DockContainerWidgetPrivate::moveToNewSection(QWidget* Widget, CDockAreaWidg
} }
else else
{ {
auto Sizes = TargetAreaSplitter->sizes();
int TargetAreaSize = (InsertParam.orientation() == Qt::Horizontal) ? TargetArea->width() : TargetArea->height(); int TargetAreaSize = (InsertParam.orientation() == Qt::Horizontal) ? TargetArea->width() : TargetArea->height();
QSplitter* NewSplitter = newSplitter(InsertParam.orientation()); QSplitter* NewSplitter = newSplitter(InsertParam.orientation());
NewSplitter->addWidget(TargetArea); NewSplitter->addWidget(TargetArea);

View File

@ -955,7 +955,7 @@ void CDockManager::removePerspective(const QString& Name)
void CDockManager::removePerspectives(const QStringList& Names) void CDockManager::removePerspectives(const QStringList& Names)
{ {
int Count = 0; int Count = 0;
for (auto Name : Names) for (const auto& Name : Names)
{ {
Count += d->Perspectives.remove(Name); Count += d->Perspectives.remove(Name);
} }