Compare commits

..

4 Commits

Author SHA1 Message Date
Uwe Kindler
8d30fc9c3c Fix various clazy warnings 2022-11-18 21:36:31 +01:00
Uwe Kindler
ca1d3fcd38 normalize SIGNAL(),SLOT() signatures 2022-11-18 21:22:44 +01:00
Uwe Kindler
b82d23e59c Guard against null pointer access 2022-11-18 21:15:06 +01:00
Uwe Kindler
6d8e396e92 Prevent null pointer access 2022-11-18 21:12:17 +01:00
8 changed files with 30 additions and 15 deletions

View File

@@ -671,11 +671,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

@@ -390,7 +390,13 @@ void CDockAreaTitleBar::onTabsMenuActionTriggered(QAction* Action)
//============================================================================
void CDockAreaTitleBar::updateDockWidgetActionsButtons()
{
CDockWidget* DockWidget = d->TabBar->currentTab()->dockWidget();
auto Tab = d->TabBar->currentTab();
if (!Tab)
{
return;
}
CDockWidget* DockWidget = Tab->dockWidget();
if (!d->DockWidgetActionsButtons.isEmpty())
{
for (auto Button : d->DockWidgetActionsButtons)

View File

@@ -452,6 +452,11 @@ void CDockAreaWidget::insertDockWidget(int index, CDockWidget* DockWidget,
void CDockAreaWidget::removeDockWidget(CDockWidget* DockWidget)
{
ADS_PRINT("CDockAreaWidget::removeDockWidget");
if (!DockWidget)
{
return;
}
auto CurrentDockWidget = currentDockWidget();
auto NextOpenDockWidget = (DockWidget == CurrentDockWidget) ? nextOpenDockWidget(DockWidget) : nullptr;
@@ -1005,7 +1010,7 @@ bool CDockAreaWidget::isCentralWidgetArea() const
return false;
}
return dockManager()->centralWidget() == dockWidgets()[0];
return dockManager()->centralWidget() == dockWidgets().constFirst();
}

View File

@@ -568,7 +568,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;
@@ -692,7 +691,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

@@ -928,7 +928,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);
}