diff --git a/kate/addons/kate/filetemplates/plugin/filetemplates.cpp b/kate/addons/kate/filetemplates/plugin/filetemplates.cpp index 784be29c..851ece6f 100644 --- a/kate/addons/kate/filetemplates/plugin/filetemplates.cpp +++ b/kate/addons/kate/filetemplates/plugin/filetemplates.cpp @@ -477,7 +477,7 @@ void KateFileTemplates::slotOpenTemplate( const KUrl &url ) QWidget *KateFileTemplates::parentWindow() { - return dynamic_cast(application()->activeMainWindow()); + return qobject_cast(application()->activeMainWindow()); } // The next part are tools to aid the creation and editing of templates diff --git a/kate/part/completion/expandingtree/expandingwidgetmodel.cpp b/kate/part/completion/expandingtree/expandingwidgetmodel.cpp index e5671f43..ea64e9e0 100644 --- a/kate/part/completion/expandingtree/expandingwidgetmodel.cpp +++ b/kate/part/completion/expandingtree/expandingwidgetmodel.cpp @@ -358,12 +358,12 @@ int ExpandingWidgetModel::basicRowHeight( const QModelIndex& idx_ ) const { QModelIndex idx(firstColumn(idx_)); - ExpandingDelegate* delegate = dynamic_cast( treeView()->itemDelegate(idx) ); - if( !delegate || !idx.isValid() ) { + ExpandingDelegate* delegate = qobject_cast( treeView()->itemDelegate(idx) ); + if( !delegate || !idx.isValid() ) { kDebug( 13035 ) << "ExpandingWidgetModel::basicRowHeight: Could not get delegate"; return 15; - } - return delegate->basicSizeHint( idx ).height(); + } + return delegate->basicSizeHint( idx ).height(); } diff --git a/kate/src/app/katemdi.cpp b/kate/src/app/katemdi.cpp index 533c8bc2..d4557b3e 100644 --- a/kate/src/app/katemdi.cpp +++ b/kate/src/app/katemdi.cpp @@ -473,7 +473,7 @@ namespace KateMDI if (ev->type() == QEvent::ContextMenu) { QContextMenuEvent *e = (QContextMenuEvent *) ev; - KMultiTabBarTab *bt = dynamic_cast(obj); + KMultiTabBarTab *bt = qobject_cast(obj); if (bt) { //kDebug() << "Request for popup"; @@ -487,7 +487,7 @@ namespace KateMDI KMenu *p = new KMenu (this); if (!w->plugin.isNull()) { - Kate::PluginConfigPageInterface* pcpi=dynamic_cast(w->plugin.data()); + Kate::PluginConfigPageInterface* pcpi=qobject_cast(w->plugin.data()); if (pcpi) { if (pcpi->configPages()>0) p->addAction(i18n("Configure ..."))->setData(20); @@ -559,7 +559,7 @@ namespace KateMDI // configure actionCollection if (id==20) { if (!w->plugin.isNull()) { - Kate::PluginConfigPageInterface* pcpi=dynamic_cast(w->plugin.data()); + Kate::PluginConfigPageInterface* pcpi=qobject_cast(w->plugin.data()); if (pcpi) { if (pcpi->configPages()>0) emit sigShowPluginConfigPage(pcpi,0); diff --git a/keditbookmarks/bookmarklistview.cpp b/keditbookmarks/bookmarklistview.cpp index 00219b48..3a8e2439 100644 --- a/keditbookmarks/bookmarklistview.cpp +++ b/keditbookmarks/bookmarklistview.cpp @@ -93,7 +93,7 @@ void BookmarkListView::setModel(QAbstractItemModel * model) KBookmarkModel* BookmarkListView::bookmarkModel() const { - return dynamic_cast(QTreeView::model()); + return qobject_cast(QTreeView::model()); } KBookmark BookmarkListView::bookmarkForIndex(const QModelIndex & idx) const diff --git a/keditbookmarks/kebsearchline.cpp b/keditbookmarks/kebsearchline.cpp index c8a9f61e..f71e5893 100644 --- a/keditbookmarks/kebsearchline.cpp +++ b/keditbookmarks/kebsearchline.cpp @@ -66,8 +66,8 @@ KViewSearchLine::KViewSearchLine(QWidget *parent, QAbstractItemView *v) : setClearButtonShown(true); - d->treeView = dynamic_cast(v); - d->listView = dynamic_cast(v); + d->treeView = qobject_cast(v); + d->listView = qobject_cast(v); connect(this, SIGNAL(textChanged(QString)), this, SLOT(queueSearch(QString))); @@ -184,8 +184,8 @@ void KViewSearchLine::setView(QAbstractItemView *v) disconnect(model(), SIGNAL(modelReset()), this, SLOT(slotModelReset())); } - d->treeView = dynamic_cast(v); - d->listView = dynamic_cast(v); + d->treeView = qobject_cast(v); + d->listView = qobject_cast(v); if(view()) { connect(view(), SIGNAL(destroyed()), diff --git a/keditbookmarks/toplevel.h b/keditbookmarks/toplevel.h index dcd8b80d..49b70ff4 100644 --- a/keditbookmarks/toplevel.h +++ b/keditbookmarks/toplevel.h @@ -65,7 +65,7 @@ public: QMenu* popupMenuFactory(const char *type) { QWidget * menu = factory()->container(type, this); - return dynamic_cast(menu); + return qobject_cast(menu); } KToggleAction* getToggleAction(const char *) const; diff --git a/kinfocenter/infocenter.cpp b/kinfocenter/infocenter.cpp index 2ac627d0..b46e6580 100644 --- a/kinfocenter/infocenter.cpp +++ b/kinfocenter/infocenter.cpp @@ -90,7 +90,7 @@ KInfoCenter::KInfoCenter() : KXmlGuiWindow( 0, Qt::WindowContextHelpButtonHint ) m_toolTips = new ToolTipManager(m_sideMenu); setupGUI(QSize(640,480), ToolBar | Keys | Save | Create,"kinfocenterui.rc"); - m_helpAction->setMenu( dynamic_cast( factory()->container("help", this) ) ); + m_helpAction->setMenu( qobject_cast( factory()->container("help", this) ) ); menuBar()->hide(); QAction *aboutApp = actionCollection()->action("help_about_app"); diff --git a/krunner/interfaces/default/interface.cpp b/krunner/interfaces/default/interface.cpp index 82dd9883..6d43c48d 100644 --- a/krunner/interfaces/default/interface.cpp +++ b/krunner/interfaces/default/interface.cpp @@ -268,7 +268,7 @@ void Interface::updateSystemActivityToolTip() { /* Set the tooltip for the Show System Activity button to include the global shortcut */ KRunnerApp *krunnerApp = KRunnerApp::self(); - KAction *showSystemActivityAction = dynamic_cast(krunnerApp->actionCollection()->action(QLatin1String( "Show System Activity" ))); + KAction *showSystemActivityAction = qobject_cast(krunnerApp->actionCollection()->action(QLatin1String( "Show System Activity" ))); if (showSystemActivityAction) { QString shortcut = showSystemActivityAction->globalShortcut().toString(); if (shortcut.isEmpty()) { diff --git a/krunner/interfaces/quicksand/qs_dialog.cpp b/krunner/interfaces/quicksand/qs_dialog.cpp index d6b96e9b..559a9af4 100644 --- a/krunner/interfaces/quicksand/qs_dialog.cpp +++ b/krunner/interfaces/quicksand/qs_dialog.cpp @@ -308,7 +308,7 @@ void QsDialog::updateSystemActivityToolTip() { /* Set the tooltip for the Show System Activity button to include the global shortcut */ KRunnerApp *krunnerApp = KRunnerApp::self(); - KAction *showSystemActivityAction = dynamic_cast(krunnerApp->actionCollection()->action(QLatin1String( "Show System Activity" ))); + KAction *showSystemActivityAction = qobject_cast(krunnerApp->actionCollection()->action(QLatin1String( "Show System Activity" ))); if (showSystemActivityAction) { QString shortcut = showSystemActivityAction->globalShortcut().toString(); if (shortcut.isEmpty()) { diff --git a/ksysguard/gui/ksysguard.cpp b/ksysguard/gui/ksysguard.cpp index 2d4a66bd..7a1bf117 100644 --- a/ksysguard/gui/ksysguard.cpp +++ b/ksysguard/gui/ksysguard.cpp @@ -255,7 +255,7 @@ void TopLevel::initStatusBar() KSGRD::SensorMgr->sendRequest( "localhost", "mem/swap/used?", (KSGRD::SensorClient*)this, 7 ); - KToggleAction *sb = dynamic_cast(action("options_show_statusbar")); + KToggleAction *sb = qobject_cast(action("options_show_statusbar")); if (sb) connect(sb, SIGNAL(toggled(bool)), this, SLOT(updateStatusBar())); setupGUI(QSize(800,600), ToolBar | Keys | StatusBar | Save | Create); diff --git a/kwin/composite.cpp b/kwin/composite.cpp index 43d28805..3ce9fd92 100644 --- a/kwin/composite.cpp +++ b/kwin/composite.cpp @@ -779,7 +779,7 @@ bool Toplevel::setupCompositing() // and us setting up damage tracking. If the client wins we won't get a damage event even // though the window has been painted. To avoid this we mark the whole window as damaged // and schedule a repaint immediately after creating the damage object. - if (dynamic_cast(this)) + if (qobject_cast(this)) addDamageFull(); return true; diff --git a/kwin/deleted.cpp b/kwin/deleted.cpp index 8c0c359d..8e40625c 100644 --- a/kwin/deleted.cpp +++ b/kwin/deleted.cpp @@ -71,7 +71,7 @@ void Deleted::discard() void Deleted::copyToDeleted(Toplevel* c) { - assert(dynamic_cast< Deleted* >(c) == NULL); + assert(qobject_cast< Deleted* >(c) == NULL); Toplevel::copyToDeleted(c); desk = c->desktop(); contentsRect = QRect(c->clientPos(), c->clientSize()); @@ -79,7 +79,7 @@ void Deleted::copyToDeleted(Toplevel* c) m_layer = c->layer(); if (WinInfo* cinfo = dynamic_cast< WinInfo* >(info)) cinfo->disable(); - Client* client = dynamic_cast(c); + Client* client = qobject_cast(c); if (client) { m_wasClient = true; no_border = client->noBorder(); diff --git a/kwin/effects.cpp b/kwin/effects.cpp index 93e37a8c..9e643c1c 100644 --- a/kwin/effects.cpp +++ b/kwin/effects.cpp @@ -517,8 +517,8 @@ void EffectsHandlerImpl::slotUnmanagedAdded(Unmanaged *u) void EffectsHandlerImpl::slotClientShown(KWin::Toplevel *t) { - Q_ASSERT(dynamic_cast(t)); - Client *c = static_cast(t); + Q_ASSERT(qobject_cast(t)); + Client *c = qobject_cast(t); setupClientConnections(c); if (!c->tabGroup()) // the "window" has already been there emit windowAdded(c->effectWindow()); @@ -526,8 +526,8 @@ void EffectsHandlerImpl::slotClientShown(KWin::Toplevel *t) void EffectsHandlerImpl::slotUnmanagedShown(KWin::Toplevel *t) { // regardless, unmanaged windows are -yet?- not synced anyway - Q_ASSERT(dynamic_cast(t)); - Unmanaged *u = static_cast(t); + Q_ASSERT(qobject_cast(t)); + Unmanaged *u = qobject_cast(t); setupUnmanagedConnections(u); emit windowAdded(u->effectWindow()); } @@ -834,7 +834,7 @@ void EffectsHandlerImpl::deleteRootProperty(long atom) const void EffectsHandlerImpl::activateWindow(EffectWindow* c) { - if (Client* cl = dynamic_cast< Client* >(static_cast(c)->window())) + if (Client* cl = qobject_cast< Client* >(static_cast(c)->window())) Workspace::self()->activateClient(cl, true); } @@ -845,7 +845,7 @@ EffectWindow* EffectsHandlerImpl::activeWindow() const void EffectsHandlerImpl::moveWindow(EffectWindow* w, const QPoint& pos, bool snap, double snapAdjust) { - Client* cl = dynamic_cast< Client* >(static_cast(w)->window()); + Client* cl = qobject_cast< Client* >(static_cast(w)->window()); if (!cl || !cl->isMovable()) return; @@ -857,14 +857,14 @@ void EffectsHandlerImpl::moveWindow(EffectWindow* w, const QPoint& pos, bool sna void EffectsHandlerImpl::windowToDesktop(EffectWindow* w, int desktop) { - Client* cl = dynamic_cast< Client* >(static_cast(w)->window()); + Client* cl = qobject_cast< Client* >(static_cast(w)->window()); if (cl && !cl->isDesktop() && !cl->isDock()) Workspace::self()->sendClientToDesktop(cl, desktop, true); } void EffectsHandlerImpl::windowToScreen(EffectWindow* w, int screen) { - Client* cl = dynamic_cast< Client* >(static_cast(w)->window()); + Client* cl = qobject_cast< Client* >(static_cast(w)->window()); if (cl && !cl->isDesktop() && !cl->isDock()) Workspace::self()->sendClientToScreen(cl, screen); } @@ -1017,7 +1017,7 @@ void EffectsHandlerImpl::setElevatedWindow(EffectWindow* w, bool set) void EffectsHandlerImpl::setTabBoxWindow(EffectWindow* w) { #ifdef KWIN_BUILD_TABBOX - if (Client* c = dynamic_cast< Client* >(static_cast< EffectWindowImpl* >(w)->window())) { + if (Client* c = qobject_cast< Client* >(static_cast< EffectWindowImpl* >(w)->window())) { TabBox::TabBox::self()->setCurrentClient(c); } #else @@ -1138,7 +1138,7 @@ QRect EffectsHandlerImpl::clientArea(clientAreaOption opt, int screen, int deskt QRect EffectsHandlerImpl::clientArea(clientAreaOption opt, const EffectWindow* c) const { const Toplevel* t = static_cast< const EffectWindowImpl* >(c)->window(); - if (const Client* cl = dynamic_cast< const Client* >(t)) + if (const Client* cl = qobject_cast< const Client* >(t)) return Workspace::self()->clientArea(opt, cl); else return Workspace::self()->clientArea(opt, t->geometry().center(), VirtualDesktopManager::self()->current()); @@ -1239,7 +1239,7 @@ void EffectsHandlerImpl::unreserveElectricBorder(ElectricBorder border, Effect * unsigned long EffectsHandlerImpl::xrenderBufferPicture() { #ifdef KWIN_BUILD_COMPOSITE - if (SceneXrender* s = dynamic_cast< SceneXrender* >(m_scene)) + if (SceneXrender* s = qobject_cast< SceneXrender* >(m_scene)) return s->bufferPicture(); #endif return None; @@ -1640,21 +1640,21 @@ void EffectWindowImpl::disablePainting(int reason) const EffectWindowGroup* EffectWindowImpl::group() const { - if (Client* c = dynamic_cast< Client* >(toplevel)) + if (Client* c = qobject_cast< Client* >(toplevel)) return c->group()->effectGroup(); return NULL; // TODO } void EffectWindowImpl::refWindow() { - if (Deleted* d = dynamic_cast< Deleted* >(toplevel)) + if (Deleted* d = qobject_cast< Deleted* >(toplevel)) return d->refWindow(); abort(); // TODO } void EffectWindowImpl::unrefWindow() { - if (Deleted* d = dynamic_cast< Deleted* >(toplevel)) + if (Deleted* d = qobject_cast< Deleted* >(toplevel)) return d->unrefWindow(); // delays deletion in case abort(); // TODO } @@ -1677,7 +1677,7 @@ QRegion EffectWindowImpl::shape() const QRect EffectWindowImpl::decorationInnerRect() const { - Client *client = dynamic_cast(toplevel); + Client *client = qobject_cast(toplevel); return client ? client->transparentRect() : contentsRect(); } @@ -1693,7 +1693,7 @@ void EffectWindowImpl::deleteProperty(long int atom) const EffectWindow* EffectWindowImpl::findModal() { - if (Client* c = dynamic_cast< Client* >(toplevel)) { + if (Client* c = qobject_cast< Client* >(toplevel)) { if (Client* c2 = c->findModal()) return c2->effectWindow(); } diff --git a/kwin/scene.cpp b/kwin/scene.cpp index 26d43f18..1c9c0e9a 100644 --- a/kwin/scene.cpp +++ b/kwin/scene.cpp @@ -671,7 +671,7 @@ void Scene::Window::discardShape() const QRegion &Scene::Window::shape() const { if (!shape_valid) { - Client* c = dynamic_cast< Client* >(toplevel); + Client* c = qobject_cast< Client* >(toplevel); if (toplevel->shape() || (c != NULL && !c->mask().isEmpty())) { int count, order; XRectangle* rects = XShapeGetRectangles(display(), toplevel->frameId(), @@ -771,7 +771,7 @@ WindowQuadList Scene::Window::buildQuads(bool force) const if (toplevel->clientPos() == QPoint(0, 0) && toplevel->clientSize() == toplevel->decorationRect().size()) ret = makeQuads(WindowQuadContents, shape()); // has no decoration else { - Client *client = dynamic_cast(toplevel); + Client *client = qobject_cast(toplevel); QRegion contents = clientShape(); QRegion center = toplevel->transparentRect(); QRegion decoration = (client && decorationPlugin()->hasAlpha() ? diff --git a/kwin/scene_xrender.cpp b/kwin/scene_xrender.cpp index 7b57ac23..1ab08ab2 100644 --- a/kwin/scene_xrender.cpp +++ b/kwin/scene_xrender.cpp @@ -435,8 +435,8 @@ void SceneXrender::Window::performPaint(int mask, QRegion region, WindowPaintDat qreal yscale = 1; bool scaled = false; - Client *client = dynamic_cast(toplevel); - Deleted *deleted = dynamic_cast(toplevel); + Client *client = qobject_cast(toplevel); + Deleted *deleted = qobject_cast(toplevel); const QRect decorationRect = toplevel->decorationRect(); if (((client && !client->noBorder()) || (deleted && !deleted->noBorder())) && decorationPlugin()->hasAlpha()) { diff --git a/kwin/toplevel.cpp b/kwin/toplevel.cpp index 50860499..514df1b6 100644 --- a/kwin/toplevel.cpp +++ b/kwin/toplevel.cpp @@ -294,7 +294,7 @@ void Toplevel::setReadyForPainting() if (compositing()) { addRepaintFull(); emit windowShown(this); - if (Client *cl = dynamic_cast(this)) { + if (Client *cl = qobject_cast(this)) { if (cl->tabGroup() && cl->tabGroup()->current() == cl) cl->tabGroup()->setCurrent(cl, true); } diff --git a/libs/konq/konq_operations.cpp b/libs/konq/konq_operations.cpp index a2a61bae..c9aa430f 100644 --- a/libs/konq/konq_operations.cpp +++ b/libs/konq/konq_operations.cpp @@ -509,22 +509,6 @@ void KonqOperations::doDropFileCopy() { // Neither control, shift or alt are pressed => show popup menu - // TODO move this code out somehow. Allow user of KonqOperations to add his own actions... -#if 0 - KonqIconViewWidget *iconView = dynamic_cast(parent()); - bool bSetWallpaper = false; - if ( iconView && iconView->maySetWallpaper() && lst.count() == 1 ) - { - KUrl url = lst.first(); - KMimeType::Ptr mime = KMimeType::findByUrl( url ); - if ( mime && ( ( KImageIO::isSupported(mime->name(), KImageIO::Reading) ) || - mime->is( "image/svg+xml" ) ) ) - { - bSetWallpaper = true; - } - } -#endif - // Check what the source can do // we'll assume it's the same for all URLs (hack) // TODO: if we had a KFileItemList instead of a KUrl::List, @@ -780,18 +764,6 @@ void KonqOperations::setOperation( KIO::Job * job, Operation method, const KUrl job->ui()->setWindow(parentWidget()); connect( job, SIGNAL(result(KJob*)), SLOT(slotResult(KJob*)) ); -#if 0 - KIO::CopyJob *copyJob = dynamic_cast(job); - KonqIconViewWidget *iconView = dynamic_cast(parent()); - if (copyJob && iconView) - { - connect(copyJob, SIGNAL(aboutToCreate(KIO::Job*,QList)), - this, SLOT(slotAboutToCreate(KIO::Job*,QList))); - // TODO move this connect into the iconview! - connect(this, SIGNAL(aboutToCreate(QPoint,QList)), - iconView, SLOT(slotAboutToCreate(QPoint,QList))); - } -#endif } else // for link slotResult( 0L ); diff --git a/libs/plasmaclock/calendar.cpp b/libs/plasmaclock/calendar.cpp index 3ccb084b..8ac08cb6 100644 --- a/libs/plasmaclock/calendar.cpp +++ b/libs/plasmaclock/calendar.cpp @@ -432,7 +432,7 @@ void CalendarPrivate::popupMonthsMenu() void Calendar::monthTriggered() { - QAction *action = dynamic_cast (sender()); + QAction *action = qobject_cast (sender()); if (action && action->property("month").type() == QVariant::Int) { int newMonth = action->property("month").toInt(); diff --git a/libs/plasmagenericshell/backgrounddialog.cpp b/libs/plasmagenericshell/backgrounddialog.cpp index 3f4e485f..1fd75f3d 100644 --- a/libs/plasmagenericshell/backgrounddialog.cpp +++ b/libs/plasmagenericshell/backgrounddialog.cpp @@ -376,7 +376,7 @@ void BackgroundDialog::changeBackgroundMode(int index) if (!w) { w = new QWidget(d->backgroundDialogUi.wallpaperGroup); } else if (w->layout()) { - QGridLayout *gridLayout = dynamic_cast(w->layout()); + QGridLayout *gridLayout = qobject_cast(w->layout()); if (gridLayout) { gridLayout->setColumnMinimumWidth(0, d->backgroundDialogUi.wallpaperTypeLabel->geometry().right()); gridLayout->setColumnStretch(0, 0); diff --git a/libs/taskmanager/abstractsortingstrategy.cpp b/libs/taskmanager/abstractsortingstrategy.cpp index 27752c30..bb84668a 100644 --- a/libs/taskmanager/abstractsortingstrategy.cpp +++ b/libs/taskmanager/abstractsortingstrategy.cpp @@ -91,7 +91,7 @@ void AbstractSortingStrategy::handleGroup(TaskGroup *group) void AbstractSortingStrategy::removeGroup() { - TaskGroup *group = dynamic_cast(sender()); + TaskGroup *group = qobject_cast(sender()); if (!group) { return; @@ -117,7 +117,7 @@ void AbstractSortingStrategy::check(AbstractGroupableItem *itemToCheck) { AbstractGroupableItem *item; if (!itemToCheck) { - item = dynamic_cast(sender()); + item = qobject_cast(sender()); } else { item = itemToCheck; } diff --git a/libs/taskmanager/strategies/manualgroupingstrategy.cpp b/libs/taskmanager/strategies/manualgroupingstrategy.cpp index 82840629..087c9d02 100644 --- a/libs/taskmanager/strategies/manualgroupingstrategy.cpp +++ b/libs/taskmanager/strategies/manualgroupingstrategy.cpp @@ -84,7 +84,7 @@ QList ManualGroupingStrategy::strategyActions(QObject *parent, Abstrac QAction *a = new QAction(i18n("Remove Group"), parent); connect(a, SIGNAL(triggered()), this, SLOT(removeGroup())); actionList.append(a); - d->tempGroup = dynamic_cast(item); + d->tempGroup = qobject_cast(item); } return actionList; diff --git a/libs/taskmanager/strategies/programgroupingstrategy.cpp b/libs/taskmanager/strategies/programgroupingstrategy.cpp index ce633757..6999733f 100644 --- a/libs/taskmanager/strategies/programgroupingstrategy.cpp +++ b/libs/taskmanager/strategies/programgroupingstrategy.cpp @@ -191,7 +191,7 @@ void ProgramGroupingStrategy::handleItem(AbstractGroupableItem *item) return; } - TaskItem *task = dynamic_cast(item); + TaskItem *task = qobject_cast(item); if (task && !programGrouping(task, root)) { //kDebug() << item->name() << "joined rootGroup "; root->add(item); diff --git a/libs/taskmanager/taskactions.cpp b/libs/taskmanager/taskactions.cpp index dbd3d518..73ee59cc 100644 --- a/libs/taskmanager/taskactions.cpp +++ b/libs/taskmanager/taskactions.cpp @@ -645,9 +645,9 @@ BasicMenu::BasicMenu(QWidget *parent, TaskGroup* group, GroupManager *strategy, foreach (AbstractGroupableItem * item, group->members()) { if (item->itemType() == GroupItemType) { - addMenu(new BasicMenu(this, dynamic_cast(item), strategy)); + addMenu(new BasicMenu(this, qobject_cast(item), strategy)); } else { - addMenu(new BasicMenu(this, dynamic_cast(item), strategy, QList (), QList (), maxWidth)); + addMenu(new BasicMenu(this, qobject_cast(item), strategy, QList (), QList (), maxWidth)); } } addSeparator(); diff --git a/libs/taskmanager/taskgroup.cpp b/libs/taskmanager/taskgroup.cpp index db93ce31..06dc2462 100644 --- a/libs/taskmanager/taskgroup.cpp +++ b/libs/taskmanager/taskgroup.cpp @@ -168,8 +168,8 @@ int TaskGroup::totalSize() void TaskGroup::add(AbstractGroupableItem *item, int insertIndex) { /* if (!item->itemType() == GroupItemType) { - if ((dynamic_cast(item))->task()) { - kDebug() << "Add item" << (dynamic_cast(item))->task()->visibleName(); + if ((qobject_cast(item))->task()) { + kDebug() << "Add item" << (qobject_cast(item))->task()->visibleName(); } kDebug() << " to Group " << name(); } @@ -253,9 +253,9 @@ void TaskGroup::add(AbstractGroupableItem *item, int insertIndex) //For debug /* foreach (AbstractGroupableItem *item, d->members) { if (item->itemType() == GroupItemType) { - kDebug() << (dynamic_cast(item))->name(); + kDebug() << (qobject_cast(item))->name(); } else { - kDebug() << (dynamic_cast(item))->task()->visibleName(); + kDebug() << (qobject_cast(item))->task()->visibleName(); } }*/ emit itemAdded(item); @@ -301,9 +301,9 @@ void TaskGroup::remove(AbstractGroupableItem *item) /* if (item->itemType() == GroupItemType) { - kDebug() << "Remove group" << (dynamic_cast(item))->name(); - } else if ((dynamic_cast(item))->task()) { - kDebug() << "Remove item" << (dynamic_cast(item))->task()->visibleName(); + kDebug() << "Remove group" << (qobject_cast(item))->name(); + } else if ((qobject_cast(item))->task()) { + kDebug() << "Remove item" << (qobject_cast(item))->task()->visibleName(); } kDebug() << "from Group: " << name(); */ @@ -311,9 +311,9 @@ void TaskGroup::remove(AbstractGroupableItem *item) /* kDebug() << "GroupMembers: "; foreach (AbstractGroupableItem *item, d->members) { if (item->itemType() == GroupItemType) { - kDebug() << (dynamic_cast(item))->name(); + kDebug() << (qobject_cast(item))->name(); } else { - kDebug() << (dynamic_cast(item))->task()->visibleName(); + kDebug() << (qobject_cast(item))->task()->visibleName(); } }*/ diff --git a/plasma/applets/kickoff/simpleapplet/simpleapplet.cpp b/plasma/applets/kickoff/simpleapplet/simpleapplet.cpp index 38cdc00f..cc9a7cb6 100644 --- a/plasma/applets/kickoff/simpleapplet/simpleapplet.cpp +++ b/plasma/applets/kickoff/simpleapplet/simpleapplet.cpp @@ -803,7 +803,7 @@ void MenuLauncherApplet::actionTriggered(QAction *action) return; } for (QWidget* w = action->parentWidget(); w; w = w->parentWidget()) { - if (Kickoff::MenuView *view = dynamic_cast(w)) { + if (Kickoff::MenuView *view = qobject_cast(w)) { view->actionTriggered(action); break; } diff --git a/plasma/dataengines/apps/appsengine.cpp b/plasma/dataengines/apps/appsengine.cpp index a644d0f2..7ae476fd 100644 --- a/plasma/dataengines/apps/appsengine.cpp +++ b/plasma/dataengines/apps/appsengine.cpp @@ -47,7 +47,7 @@ void AppsEngine::sycocaChanged(const QStringList &changes) Plasma::Service *AppsEngine::serviceForSource(const QString &name) { - AppSource *source = dynamic_cast(containerForSource(name)); + AppSource *source = qobject_cast(containerForSource(name)); // if source does not exist, return null service if (!source) { return Plasma::DataEngine::serviceForSource(name); diff --git a/plasma/dataengines/statusnotifieritem/statusnotifieritem_engine.cpp b/plasma/dataengines/statusnotifieritem/statusnotifieritem_engine.cpp index 562b59e8..f89a98c8 100644 --- a/plasma/dataengines/statusnotifieritem/statusnotifieritem_engine.cpp +++ b/plasma/dataengines/statusnotifieritem/statusnotifieritem_engine.cpp @@ -43,7 +43,7 @@ StatusNotifierItemEngine::~StatusNotifierItemEngine() Plasma::Service* StatusNotifierItemEngine::serviceForSource(const QString &name) { - StatusNotifierItemSource *source = dynamic_cast(containerForSource(name)); + StatusNotifierItemSource *source = qobject_cast(containerForSource(name)); // if source does not exist, return null service if (!source) { return Plasma::DataEngine::serviceForSource(name); diff --git a/plasma/dataengines/tasks/tasksengine.cpp b/plasma/dataengines/tasks/tasksengine.cpp index b2b4cc14..6c4b3077 100644 --- a/plasma/dataengines/tasks/tasksengine.cpp +++ b/plasma/dataengines/tasks/tasksengine.cpp @@ -34,7 +34,7 @@ TasksEngine::~TasksEngine() Plasma::Service *TasksEngine::serviceForSource(const QString &name) { - TaskSource *source = dynamic_cast(containerForSource(name)); + TaskSource *source = qobject_cast(containerForSource(name)); // if source does not exist or it represents a startup task, return a null service if (!source || !source->task()) { return Plasma::DataEngine::serviceForSource(name); diff --git a/plasma/shells/plasma-desktop/panelappletoverlay.cpp b/plasma/shells/plasma-desktop/panelappletoverlay.cpp index 10839596..0e0085bf 100644 --- a/plasma/shells/plasma-desktop/panelappletoverlay.cpp +++ b/plasma/shells/plasma-desktop/panelappletoverlay.cpp @@ -268,7 +268,7 @@ void PanelAppletOverlay::mouseMoveEvent(QMouseEvent *event) //kDebug() << "checking view" << view << m_applet->view(); if (!view) { - view = dynamic_cast(parent()); + view = qobject_cast(parent()); } if (!view) { diff --git a/systemsettings/app/SettingsBase.cpp b/systemsettings/app/SettingsBase.cpp index 15c54224..04f902fd 100644 --- a/systemsettings/app/SettingsBase.cpp +++ b/systemsettings/app/SettingsBase.cpp @@ -144,7 +144,7 @@ void SettingsBase::initToolBar() setupGUI(Save|Create,QString()); menuBar()->hide(); // Toolbar & Configuration - helpActionMenu->setMenu( dynamic_cast( factory()->container("help", this) ) ); + helpActionMenu->setMenu( qobject_cast( factory()->container("help", this) ) ); setMinimumSize(620,430); toolBar()->setMovable(false); // We don't allow any changes changeToolBar( BaseMode::Search | BaseMode::Configure | BaseMode::Quit );