diff --git a/plugins/cvs/checkoutdialog.cpp b/plugins/cvs/checkoutdialog.cpp --- a/plugins/cvs/checkoutdialog.cpp +++ b/plugins/cvs/checkoutdialog.cpp @@ -56,7 +56,7 @@ } // The job finished, now let's check the output is everything was OK - CvsJob* cvsjob = dynamic_cast(job); + CvsJob* cvsjob = static_cast(job); static QRegExp re_file("^.\\s(.*)"); bool error = false; diff --git a/plugins/cvs/importdialog.cpp b/plugins/cvs/importdialog.cpp --- a/plugins/cvs/importdialog.cpp +++ b/plugins/cvs/importdialog.cpp @@ -63,7 +63,7 @@ } // The job finished, now let's check the output is everything was OK - CvsJob* cvsjob = dynamic_cast(job); + CvsJob* cvsjob = static_cast(job); static QRegExp re_file("^[IN]\\s(.*)"); bool error = false; diff --git a/plugins/docker/dockerplugin.cpp b/plugins/docker/dockerplugin.cpp --- a/plugins/docker/dockerplugin.cpp +++ b/plugins/docker/dockerplugin.cpp @@ -99,10 +99,10 @@ QList urls; if ( context->type() == KDevelop::Context::FileContext ) { - KDevelop::FileContext* filectx = dynamic_cast( context ); + KDevelop::FileContext* filectx = static_cast(context); urls = filectx->urls(); } else if ( context->type() == KDevelop::Context::ProjectItemContext ) { - KDevelop::ProjectItemContext* projctx = dynamic_cast( context ); + KDevelop::ProjectItemContext* projctx = static_cast(context); foreach( KDevelop::ProjectBaseItem* item, projctx->items() ) { if ( item->file() ) { urls << item->path().toUrl(); diff --git a/plugins/documentview/kdevdocumentmodel.cpp b/plugins/documentview/kdevdocumentmodel.cpp --- a/plugins/documentview/kdevdocumentmodel.cpp +++ b/plugins/documentview/kdevdocumentmodel.cpp @@ -96,7 +96,7 @@ for ( int i = 0; i < rowCount(); ++i ) { - if ( KDevFileItem * item = dynamic_cast( child( i ) ) ->fileItem() ) + if (KDevFileItem* item = static_cast(child(i))->fileItem()) lst.append( item ); } @@ -143,9 +143,7 @@ QList lst; for ( int i = 0; i < rowCount() ; ++i ) { - if ( KDevCategoryItem * categoryitem = dynamic_cast( item( i ) ) ->categoryItem() ) - { - + if (KDevCategoryItem* categoryitem = static_cast(item(i))->categoryItem()) { lst.append( categoryitem ); } } diff --git a/plugins/documentview/kdevdocumentview.cpp b/plugins/documentview/kdevdocumentview.cpp --- a/plugins/documentview/kdevdocumentview.cpp +++ b/plugins/documentview/kdevdocumentview.cpp @@ -254,8 +254,7 @@ QList allItems = m_documentModel->findItems(QStringLiteral("*"), Qt::MatchWildcard | Qt::MatchRecursive); foreach (QStandardItem* item, allItems) { - if (KDevFileItem * fileItem = dynamic_cast(item)->fileItem()) - { + if (KDevFileItem* fileItem = static_cast(item)->fileItem()) { if (m_selectionModel->isSelected(m_proxy->mapFromSource(m_documentModel->indexFromItem(fileItem)))) m_selectedDocs << fileItem->url(); else diff --git a/plugins/externalscript/externalscriptplugin.cpp b/plugins/externalscript/externalscriptplugin.cpp --- a/plugins/externalscript/externalscriptplugin.cpp +++ b/plugins/externalscript/externalscriptplugin.cpp @@ -173,10 +173,10 @@ int folderCount = 0; if ( context->type() == KDevelop::Context::FileContext ) { - KDevelop::FileContext* filectx = dynamic_cast( context ); + KDevelop::FileContext* filectx = static_cast(context); m_urls = filectx->urls(); } else if ( context->type() == KDevelop::Context::ProjectItemContext ) { - KDevelop::ProjectItemContext* projctx = dynamic_cast( context ); + KDevelop::ProjectItemContext* projctx = static_cast(context); foreach( KDevelop::ProjectBaseItem* item, projctx->items() ) { if ( item->file() ) { m_urls << item->file()->path().toUrl(); @@ -186,7 +186,7 @@ } } } else if ( context->type() == KDevelop::Context::EditorContext ) { - KDevelop::EditorContext *econtext = dynamic_cast(context); + KDevelop::EditorContext* econtext = static_cast(context); m_urls << econtext->url(); } diff --git a/plugins/flatpak/flatpakplugin.cpp b/plugins/flatpak/flatpakplugin.cpp --- a/plugins/flatpak/flatpakplugin.cpp +++ b/plugins/flatpak/flatpakplugin.cpp @@ -153,10 +153,10 @@ QList urls; if ( context->type() == KDevelop::Context::FileContext ) { - KDevelop::FileContext* filectx = dynamic_cast( context ); + KDevelop::FileContext* filectx = static_cast(context); urls = filectx->urls(); } else if ( context->type() == KDevelop::Context::ProjectItemContext ) { - KDevelop::ProjectItemContext* projctx = dynamic_cast( context ); + KDevelop::ProjectItemContext* projctx = static_cast(context); foreach( KDevelop::ProjectBaseItem* item, projctx->items() ) { if ( item->file() ) { urls << item->file()->path().toUrl(); diff --git a/plugins/grepview/grepoutputmodel.cpp b/plugins/grepview/grepoutputmodel.cpp --- a/plugins/grepview/grepoutputmodel.cpp +++ b/plugins/grepview/grepoutputmodel.cpp @@ -260,7 +260,7 @@ return QModelIndex(); } else - current_item = dynamic_cast(itemFromIndex(currentIdx)); + current_item = static_cast(itemFromIndex(currentIdx)); if (current_item->parent() != nullptr) { int row = currentIdx.row(); @@ -299,10 +299,10 @@ if (!currentIdx.isValid()) { QStandardItem *it = item(0,0); if (!it) return QModelIndex(); - current_item = dynamic_cast(it); + current_item = static_cast(it); } else - current_item = dynamic_cast(itemFromIndex(currentIdx)); + current_item = static_cast(itemFromIndex(currentIdx)); if (current_item->parent() == nullptr) { // root item with overview of search results diff --git a/plugins/grepview/grepviewplugin.cpp b/plugins/grepview/grepviewplugin.cpp --- a/plugins/grepview/grepviewplugin.cpp +++ b/plugins/grepview/grepviewplugin.cpp @@ -126,7 +126,7 @@ { KDevelop::ContextMenuExtension extension = KDevelop::IPlugin::contextMenuExtension(context); if( context->type() == KDevelop::Context::ProjectItemContext ) { - KDevelop::ProjectItemContext* ctx = dynamic_cast( context ); + KDevelop::ProjectItemContext* ctx = static_cast(context); QList items = ctx->items(); // verify if there is only one folder selected if ((items.count() == 1) && (items.first()->folder())) { @@ -139,16 +139,16 @@ } if ( context->type() == KDevelop::Context::EditorContext ) { - KDevelop::EditorContext *econtext = dynamic_cast(context); + KDevelop::EditorContext* econtext = static_cast(context); if ( econtext->view()->selection() ) { QAction* action = new QAction(QIcon::fromTheme(QStringLiteral("edit-find")), i18n("&Find/Replace in Files..."), this); connect(action, &QAction::triggered, this, &GrepViewPlugin::showDialogFromMenu); extension.addAction(KDevelop::ContextMenuExtension::ExtensionGroup, action); } } if(context->type() == KDevelop::Context::FileContext) { - KDevelop::FileContext *fcontext = dynamic_cast(context); + KDevelop::FileContext* fcontext = static_cast(context); // TODO: just stat() or QFileInfo().isDir() for local files? should be faster than mime type checking QMimeType mimetype = QMimeDatabase().mimeTypeForUrl(fcontext->urls().at(0)); static const QMimeType directoryMime = QMimeDatabase().mimeTypeForName(QStringLiteral("inode/directory")); diff --git a/plugins/patchreview/patchreview.cpp b/plugins/patchreview/patchreview.cpp --- a/plugins/patchreview/patchreview.cpp +++ b/plugins/patchreview/patchreview.cpp @@ -580,17 +580,17 @@ QList urls; if ( context->type() == KDevelop::Context::FileContext ) { - KDevelop::FileContext* filectx = dynamic_cast( context ); + KDevelop::FileContext* filectx = static_cast(context); urls = filectx->urls(); } else if ( context->type() == KDevelop::Context::ProjectItemContext ) { - KDevelop::ProjectItemContext* projctx = dynamic_cast( context ); + KDevelop::ProjectItemContext* projctx = static_cast(context); foreach( KDevelop::ProjectBaseItem* item, projctx->items() ) { if ( item->file() ) { urls << item->file()->path().toUrl(); } } } else if ( context->type() == KDevelop::Context::EditorContext ) { - KDevelop::EditorContext *econtext = dynamic_cast( context ); + KDevelop::EditorContext* econtext = static_cast(context); urls << econtext->url(); } diff --git a/plugins/projectmanagerview/projectmanagerviewplugin.cpp b/plugins/projectmanagerview/projectmanagerviewplugin.cpp --- a/plugins/projectmanagerview/projectmanagerviewplugin.cpp +++ b/plugins/projectmanagerview/projectmanagerviewplugin.cpp @@ -199,7 +199,7 @@ if( context->type() != KDevelop::Context::ProjectItemContext ) return IPlugin::contextMenuExtension( context ); - KDevelop::ProjectItemContext* ctx = dynamic_cast( context ); + KDevelop::ProjectItemContext* ctx = static_cast(context); QList items = ctx->items(); d->ctxProjectItemList.clear(); @@ -386,7 +386,7 @@ } else { - KDevelop::ProjectItemContext* ctx = dynamic_cast(ICore::self()->selectionController()->currentSelection()); + KDevelop::ProjectItemContext* ctx = static_cast(ICore::self()->selectionController()->currentSelection()); items = ctx->items(); } @@ -660,7 +660,7 @@ void ProjectManagerViewPlugin::copyFromContextMenu() { - KDevelop::ProjectItemContext* ctx = dynamic_cast(ICore::self()->selectionController()->currentSelection()); + KDevelop::ProjectItemContext* ctx = static_cast(ICore::self()->selectionController()->currentSelection()); QList urls; foreach (ProjectBaseItem* item, ctx->items()) { if (item->folder() || item->file()) { @@ -692,7 +692,7 @@ void ProjectManagerViewPlugin::pasteFromContextMenu() { - KDevelop::ProjectItemContext* ctx = dynamic_cast(ICore::self()->selectionController()->currentSelection()); + KDevelop::ProjectItemContext* ctx = static_cast(ICore::self()->selectionController()->currentSelection()); if (ctx->items().count() != 1) { return; //do nothing if multiple or none items are selected } diff --git a/shell/launchconfigurationdialog.cpp b/shell/launchconfigurationdialog.cpp --- a/shell/launchconfigurationdialog.cpp +++ b/shell/launchconfigurationdialog.cpp @@ -956,7 +956,7 @@ QWidget* LaunchConfigurationModelDelegate::createEditor ( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const { - const LaunchConfigurationsModel* model = dynamic_cast( index.model() ); + const LaunchConfigurationsModel* model = static_cast(index.model()); ILaunchMode* mode = model->modeForIndex( index ); LaunchConfiguration* config = model->configForIndex( index ); if( index.column() == 1 && mode && config ) @@ -986,7 +986,7 @@ void LaunchConfigurationModelDelegate::setEditorData ( QWidget* editor, const QModelIndex& index ) const { - const LaunchConfigurationsModel* model = dynamic_cast( index.model() ); + const LaunchConfigurationsModel* model = static_cast(index.model()); LaunchConfiguration* config = model->configForIndex( index ); if( index.column() == 1 && config ) { @@ -1001,7 +1001,7 @@ void LaunchConfigurationModelDelegate::setModelData ( QWidget* editor, QAbstractItemModel* model, const QModelIndex& index ) const { - LaunchConfigurationsModel* lmodel = dynamic_cast( model ); + LaunchConfigurationsModel* lmodel = static_cast(model); LaunchConfiguration* config = lmodel->configForIndex( index ); if( index.column() == 1 && config ) { diff --git a/shell/project.cpp b/shell/project.cpp --- a/shell/project.cpp +++ b/shell/project.cpp @@ -557,7 +557,7 @@ foreach(ProjectBaseItem* item, d->itemsForPath( file ) ) { if( item->type() == ProjectBaseItem::File ) - items << dynamic_cast( item ); + items << static_cast(item); } return items; } @@ -568,7 +568,7 @@ foreach(ProjectBaseItem* item, d->itemsForPath( folder ) ) { if( item->type() == ProjectBaseItem::Folder || item->type() == ProjectBaseItem::BuildFolder ) - items << dynamic_cast( item ); + items << static_cast(item); } return items; } diff --git a/shell/runcontroller.cpp b/shell/runcontroller.cpp --- a/shell/runcontroller.cpp +++ b/shell/runcontroller.cpp @@ -214,7 +214,7 @@ qMakePair( mode->id(), launcher->id() ), contextItem->project(), contextItem->text() ); - LaunchConfiguration* launch = dynamic_cast( ilaunch ); + LaunchConfiguration* launch = static_cast(ilaunch); type->configureLaunchFromItem( launch->config(), contextItem ); launch->config().writeEntry(Strings::ConfiguredFromProjectItemEntry(), itemPath); //qCDebug(SHELL) << "created config, launching"; @@ -401,7 +401,7 @@ qCDebug(SHELL) << "execute called without launch config!"; return nullptr; } - LaunchConfiguration *run = dynamic_cast(launch); + LaunchConfiguration* run = static_cast(launch); //TODO: Port to launch framework, probably needs to be part of the launcher //if(!run.dependencies().isEmpty()) // ICore::self()->documentController()->saveAllDocuments(IDocument::Silent); @@ -974,7 +974,7 @@ d->contextItem = nullptr; ContextMenuExtension ext; if( ctx->type() == Context::ProjectItemContext ) { - KDevelop::ProjectItemContext* prjctx = dynamic_cast( ctx ); + KDevelop::ProjectItemContext* prjctx = static_cast(ctx); if( prjctx->items().count() == 1 ) { ProjectBaseItem* itm = prjctx->items().at( 0 ); diff --git a/shell/sourceformattercontroller.cpp b/shell/sourceformattercontroller.cpp --- a/shell/sourceformattercontroller.cpp +++ b/shell/sourceformattercontroller.cpp @@ -606,12 +606,12 @@ if(m_formatTextAction->isEnabled()) ext.addAction(KDevelop::ContextMenuExtension::EditGroup, m_formatTextAction); } else if (context->hasType(KDevelop::Context::FileContext)) { - KDevelop::FileContext* filectx = dynamic_cast(context); + KDevelop::FileContext* filectx = static_cast(context); m_urls = filectx->urls(); ext.addAction(KDevelop::ContextMenuExtension::EditGroup, m_formatFilesAction); } else if (context->hasType(KDevelop::Context::CodeContext)) { } else if (context->hasType(KDevelop::Context::ProjectItemContext)) { - KDevelop::ProjectItemContext* prjctx = dynamic_cast(context); + KDevelop::ProjectItemContext* prjctx = static_cast(context); m_prjItems = prjctx->items(); if ( !m_prjItems.isEmpty() ) { ext.addAction(KDevelop::ContextMenuExtension::ExtensionGroup, m_formatFilesAction); diff --git a/sublime/idealbuttonbarwidget.cpp b/sublime/idealbuttonbarwidget.cpp --- a/sublime/idealbuttonbarwidget.cpp +++ b/sublime/idealbuttonbarwidget.cpp @@ -192,7 +192,7 @@ { QWidget::removeAction(widgetAction); - auto action = dynamic_cast(widgetAction); + auto action = static_cast(widgetAction); action->button()->deleteLater(); delete action; @@ -332,7 +332,7 @@ void IdealButtonBarWidget::showWidget(QAction *action, bool checked) { - auto widgetAction = dynamic_cast(action); + auto widgetAction = static_cast(action); IdealToolButton* button = widgetAction->button(); Q_ASSERT(button); @@ -359,7 +359,7 @@ IdealDockWidget * IdealButtonBarWidget::widgetForAction(QAction *_action) const { - return dynamic_cast(_action)->dockWidget(); + return static_cast(_action)->dockWidget(); } #include "idealbuttonbarwidget.moc"