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);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
connect(d->PerspectiveComboBox, SIGNAL(activated(const QString&)),
d->DockManager, SLOT(openPerspective(const QString&)));
connect(d->PerspectiveComboBox, SIGNAL(activated(QString)),
d->DockManager, SLOT(openPerspective(QString)));
#else
connect(d->PerspectiveComboBox, SIGNAL(textActivated(const QString&)),
d->DockManager, SLOT(openPerspective(const QString&)));
connect(d->PerspectiveComboBox, SIGNAL(textActivated(QString)),
d->DockManager, SLOT(openPerspective(QString)));
#endif
d->createContent();

View File

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

View File

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

View File

@ -203,7 +203,7 @@ void CDockAreaTabBar::insertTab(int Index, CDockWidgetTab* Tab)
connect(Tab, SIGNAL(clicked()), this, SLOT(onTabClicked()));
connect(Tab, SIGNAL(closeRequested()), this, SLOT(onTabCloseRequested()));
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)));
Tab->installEventFilter(this);
Q_EMIT tabInserted(Index);

View File

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

View File

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

View File

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

View File

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