generic: cast pointers with QObject as base class via qobject_cast<T>()

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-06-01 21:36:17 +03:00
parent 2da4d8573a
commit 38cdd9c0f4
30 changed files with 65 additions and 93 deletions

View file

@ -477,7 +477,7 @@ void KateFileTemplates::slotOpenTemplate( const KUrl &url )
QWidget *KateFileTemplates::parentWindow()
{
return dynamic_cast<QWidget*>(application()->activeMainWindow());
return qobject_cast<QWidget*>(application()->activeMainWindow());
}
// The next part are tools to aid the creation and editing of templates

View file

@ -358,7 +358,7 @@ int ExpandingWidgetModel::basicRowHeight( const QModelIndex& idx_ ) const
{
QModelIndex idx(firstColumn(idx_));
ExpandingDelegate* delegate = dynamic_cast<ExpandingDelegate*>( treeView()->itemDelegate(idx) );
ExpandingDelegate* delegate = qobject_cast<ExpandingDelegate*>( treeView()->itemDelegate(idx) );
if( !delegate || !idx.isValid() ) {
kDebug( 13035 ) << "ExpandingWidgetModel::basicRowHeight: Could not get delegate";
return 15;

View file

@ -473,7 +473,7 @@ namespace KateMDI
if (ev->type() == QEvent::ContextMenu)
{
QContextMenuEvent *e = (QContextMenuEvent *) ev;
KMultiTabBarTab *bt = dynamic_cast<KMultiTabBarTab*>(obj);
KMultiTabBarTab *bt = qobject_cast<KMultiTabBarTab*>(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<Kate::PluginConfigPageInterface*>(w->plugin.data());
Kate::PluginConfigPageInterface* pcpi=qobject_cast<Kate::PluginConfigPageInterface*>(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<Kate::PluginConfigPageInterface*>(w->plugin.data());
Kate::PluginConfigPageInterface* pcpi=qobject_cast<Kate::PluginConfigPageInterface*>(w->plugin.data());
if (pcpi) {
if (pcpi->configPages()>0)
emit sigShowPluginConfigPage(pcpi,0);

View file

@ -93,7 +93,7 @@ void BookmarkListView::setModel(QAbstractItemModel * model)
KBookmarkModel* BookmarkListView::bookmarkModel() const
{
return dynamic_cast<KBookmarkModel*>(QTreeView::model());
return qobject_cast<KBookmarkModel*>(QTreeView::model());
}
KBookmark BookmarkListView::bookmarkForIndex(const QModelIndex & idx) const

View file

@ -66,8 +66,8 @@ KViewSearchLine::KViewSearchLine(QWidget *parent, QAbstractItemView *v) :
setClearButtonShown(true);
d->treeView = dynamic_cast<QTreeView *>(v);
d->listView = dynamic_cast<QListView *>(v);
d->treeView = qobject_cast<QTreeView *>(v);
d->listView = qobject_cast<QListView *>(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<QTreeView *>(v);
d->listView = dynamic_cast<QListView *>(v);
d->treeView = qobject_cast<QTreeView *>(v);
d->listView = qobject_cast<QListView *>(v);
if(view()) {
connect(view(), SIGNAL(destroyed()),

View file

@ -65,7 +65,7 @@ public:
QMenu* popupMenuFactory(const char *type)
{
QWidget * menu = factory()->container(type, this);
return dynamic_cast<QMenu *>(menu);
return qobject_cast<QMenu *>(menu);
}
KToggleAction* getToggleAction(const char *) const;

View file

@ -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<KMenu*>( factory()->container("help", this) ) );
m_helpAction->setMenu( qobject_cast<KMenu*>( factory()->container("help", this) ) );
menuBar()->hide();
QAction *aboutApp = actionCollection()->action("help_about_app");

View file

@ -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<KAction *>(krunnerApp->actionCollection()->action(QLatin1String( "Show System Activity" )));
KAction *showSystemActivityAction = qobject_cast<KAction *>(krunnerApp->actionCollection()->action(QLatin1String( "Show System Activity" )));
if (showSystemActivityAction) {
QString shortcut = showSystemActivityAction->globalShortcut().toString();
if (shortcut.isEmpty()) {

View file

@ -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<KAction *>(krunnerApp->actionCollection()->action(QLatin1String( "Show System Activity" )));
KAction *showSystemActivityAction = qobject_cast<KAction *>(krunnerApp->actionCollection()->action(QLatin1String( "Show System Activity" )));
if (showSystemActivityAction) {
QString shortcut = showSystemActivityAction->globalShortcut().toString();
if (shortcut.isEmpty()) {

View file

@ -255,7 +255,7 @@ void TopLevel::initStatusBar()
KSGRD::SensorMgr->sendRequest( "localhost", "mem/swap/used?",
(KSGRD::SensorClient*)this, 7 );
KToggleAction *sb = dynamic_cast<KToggleAction*>(action("options_show_statusbar"));
KToggleAction *sb = qobject_cast<KToggleAction*>(action("options_show_statusbar"));
if (sb)
connect(sb, SIGNAL(toggled(bool)), this, SLOT(updateStatusBar()));
setupGUI(QSize(800,600), ToolBar | Keys | StatusBar | Save | Create);

View file

@ -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<Unmanaged*>(this))
if (qobject_cast<Unmanaged*>(this))
addDamageFull();
return true;

View file

@ -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<Client*>(c);
Client* client = qobject_cast<Client*>(c);
if (client) {
m_wasClient = true;
no_border = client->noBorder();

View file

@ -517,8 +517,8 @@ void EffectsHandlerImpl::slotUnmanagedAdded(Unmanaged *u)
void EffectsHandlerImpl::slotClientShown(KWin::Toplevel *t)
{
Q_ASSERT(dynamic_cast<Client*>(t));
Client *c = static_cast<Client*>(t);
Q_ASSERT(qobject_cast<Client*>(t));
Client *c = qobject_cast<Client*>(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<Unmanaged*>(t));
Unmanaged *u = static_cast<Unmanaged*>(t);
Q_ASSERT(qobject_cast<Unmanaged*>(t));
Unmanaged *u = qobject_cast<Unmanaged*>(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<EffectWindowImpl*>(c)->window()))
if (Client* cl = qobject_cast< Client* >(static_cast<EffectWindowImpl*>(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<EffectWindowImpl*>(w)->window());
Client* cl = qobject_cast< Client* >(static_cast<EffectWindowImpl*>(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<EffectWindowImpl*>(w)->window());
Client* cl = qobject_cast< Client* >(static_cast<EffectWindowImpl*>(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<EffectWindowImpl*>(w)->window());
Client* cl = qobject_cast< Client* >(static_cast<EffectWindowImpl*>(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<Client*>(toplevel);
Client *client = qobject_cast<Client*>(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();
}

View file

@ -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<Client*>(toplevel);
Client *client = qobject_cast<Client*>(toplevel);
QRegion contents = clientShape();
QRegion center = toplevel->transparentRect();
QRegion decoration = (client && decorationPlugin()->hasAlpha() ?

View file

@ -435,8 +435,8 @@ void SceneXrender::Window::performPaint(int mask, QRegion region, WindowPaintDat
qreal yscale = 1;
bool scaled = false;
Client *client = dynamic_cast<Client*>(toplevel);
Deleted *deleted = dynamic_cast<Deleted*>(toplevel);
Client *client = qobject_cast<Client*>(toplevel);
Deleted *deleted = qobject_cast<Deleted*>(toplevel);
const QRect decorationRect = toplevel->decorationRect();
if (((client && !client->noBorder()) || (deleted && !deleted->noBorder())) &&
decorationPlugin()->hasAlpha()) {

View file

@ -294,7 +294,7 @@ void Toplevel::setReadyForPainting()
if (compositing()) {
addRepaintFull();
emit windowShown(this);
if (Client *cl = dynamic_cast<Client*>(this)) {
if (Client *cl = qobject_cast<Client*>(this)) {
if (cl->tabGroup() && cl->tabGroup()->current() == cl)
cl->tabGroup()->setCurrent(cl, true);
}

View file

@ -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<KonqIconViewWidget*>(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<KIO::CopyJob*>(job);
KonqIconViewWidget *iconView = dynamic_cast<KonqIconViewWidget*>(parent());
if (copyJob && iconView)
{
connect(copyJob, SIGNAL(aboutToCreate(KIO::Job*,QList<KIO::CopyInfo>)),
this, SLOT(slotAboutToCreate(KIO::Job*,QList<KIO::CopyInfo>)));
// TODO move this connect into the iconview!
connect(this, SIGNAL(aboutToCreate(QPoint,QList<KIO::CopyInfo>)),
iconView, SLOT(slotAboutToCreate(QPoint,QList<KIO::CopyInfo>)));
}
#endif
}
else // for link
slotResult( 0L );

View file

@ -432,7 +432,7 @@ void CalendarPrivate::popupMonthsMenu()
void Calendar::monthTriggered()
{
QAction *action = dynamic_cast<QAction*> (sender());
QAction *action = qobject_cast<QAction*> (sender());
if (action && action->property("month").type() == QVariant::Int) {
int newMonth = action->property("month").toInt();

View file

@ -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<QGridLayout *>(w->layout());
QGridLayout *gridLayout = qobject_cast<QGridLayout *>(w->layout());
if (gridLayout) {
gridLayout->setColumnMinimumWidth(0, d->backgroundDialogUi.wallpaperTypeLabel->geometry().right());
gridLayout->setColumnStretch(0, 0);

View file

@ -91,7 +91,7 @@ void AbstractSortingStrategy::handleGroup(TaskGroup *group)
void AbstractSortingStrategy::removeGroup()
{
TaskGroup *group = dynamic_cast<TaskGroup*>(sender());
TaskGroup *group = qobject_cast<TaskGroup*>(sender());
if (!group) {
return;
@ -117,7 +117,7 @@ void AbstractSortingStrategy::check(AbstractGroupableItem *itemToCheck)
{
AbstractGroupableItem *item;
if (!itemToCheck) {
item = dynamic_cast<AbstractGroupableItem *>(sender());
item = qobject_cast<AbstractGroupableItem *>(sender());
} else {
item = itemToCheck;
}

View file

@ -84,7 +84,7 @@ QList<QAction*> 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<TaskGroup*>(item);
d->tempGroup = qobject_cast<TaskGroup*>(item);
}
return actionList;

View file

@ -191,7 +191,7 @@ void ProgramGroupingStrategy::handleItem(AbstractGroupableItem *item)
return;
}
TaskItem *task = dynamic_cast<TaskItem*>(item);
TaskItem *task = qobject_cast<TaskItem*>(item);
if (task && !programGrouping(task, root)) {
//kDebug() << item->name() << "joined rootGroup ";
root->add(item);

View file

@ -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<TaskGroup*>(item), strategy));
addMenu(new BasicMenu(this, qobject_cast<TaskGroup*>(item), strategy));
} else {
addMenu(new BasicMenu(this, dynamic_cast<TaskItem*>(item), strategy, QList <QAction*>(), QList <QAction*>(), maxWidth));
addMenu(new BasicMenu(this, qobject_cast<TaskItem*>(item), strategy, QList <QAction*>(), QList <QAction*>(), maxWidth));
}
}
addSeparator();

View file

@ -168,8 +168,8 @@ int TaskGroup::totalSize()
void TaskGroup::add(AbstractGroupableItem *item, int insertIndex)
{
/* if (!item->itemType() == GroupItemType) {
if ((dynamic_cast<TaskItem*>(item))->task()) {
kDebug() << "Add item" << (dynamic_cast<TaskItem*>(item))->task()->visibleName();
if ((qobject_cast<TaskItem*>(item))->task()) {
kDebug() << "Add item" << (qobject_cast<TaskItem*>(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<TaskGroup*>(item))->name();
kDebug() << (qobject_cast<TaskGroup*>(item))->name();
} else {
kDebug() << (dynamic_cast<TaskItem*>(item))->task()->visibleName();
kDebug() << (qobject_cast<TaskItem*>(item))->task()->visibleName();
}
}*/
emit itemAdded(item);
@ -301,9 +301,9 @@ void TaskGroup::remove(AbstractGroupableItem *item)
/*
if (item->itemType() == GroupItemType) {
kDebug() << "Remove group" << (dynamic_cast<TaskGroup*>(item))->name();
} else if ((dynamic_cast<TaskItem*>(item))->task()) {
kDebug() << "Remove item" << (dynamic_cast<TaskItem*>(item))->task()->visibleName();
kDebug() << "Remove group" << (qobject_cast<TaskGroup*>(item))->name();
} else if ((qobject_cast<TaskItem*>(item))->task()) {
kDebug() << "Remove item" << (qobject_cast<TaskItem*>(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<TaskGroup*>(item))->name();
kDebug() << (qobject_cast<TaskGroup*>(item))->name();
} else {
kDebug() << (dynamic_cast<TaskItem*>(item))->task()->visibleName();
kDebug() << (qobject_cast<TaskItem*>(item))->task()->visibleName();
}
}*/

View file

@ -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<Kickoff::MenuView*>(w)) {
if (Kickoff::MenuView *view = qobject_cast<Kickoff::MenuView*>(w)) {
view->actionTriggered(action);
break;
}

View file

@ -47,7 +47,7 @@ void AppsEngine::sycocaChanged(const QStringList &changes)
Plasma::Service *AppsEngine::serviceForSource(const QString &name)
{
AppSource *source = dynamic_cast<AppSource*>(containerForSource(name));
AppSource *source = qobject_cast<AppSource*>(containerForSource(name));
// if source does not exist, return null service
if (!source) {
return Plasma::DataEngine::serviceForSource(name);

View file

@ -43,7 +43,7 @@ StatusNotifierItemEngine::~StatusNotifierItemEngine()
Plasma::Service* StatusNotifierItemEngine::serviceForSource(const QString &name)
{
StatusNotifierItemSource *source = dynamic_cast<StatusNotifierItemSource*>(containerForSource(name));
StatusNotifierItemSource *source = qobject_cast<StatusNotifierItemSource*>(containerForSource(name));
// if source does not exist, return null service
if (!source) {
return Plasma::DataEngine::serviceForSource(name);

View file

@ -34,7 +34,7 @@ TasksEngine::~TasksEngine()
Plasma::Service *TasksEngine::serviceForSource(const QString &name)
{
TaskSource *source = dynamic_cast<TaskSource*>(containerForSource(name));
TaskSource *source = qobject_cast<TaskSource*>(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);

View file

@ -268,7 +268,7 @@ void PanelAppletOverlay::mouseMoveEvent(QMouseEvent *event)
//kDebug() << "checking view" << view << m_applet->view();
if (!view) {
view = dynamic_cast<Plasma::View*>(parent());
view = qobject_cast<Plasma::View*>(parent());
}
if (!view) {

View file

@ -144,7 +144,7 @@ void SettingsBase::initToolBar()
setupGUI(Save|Create,QString());
menuBar()->hide();
// Toolbar & Configuration
helpActionMenu->setMenu( dynamic_cast<KMenu*>( factory()->container("help", this) ) );
helpActionMenu->setMenu( qobject_cast<KMenu*>( factory()->container("help", this) ) );
setMinimumSize(620,430);
toolBar()->setMovable(false); // We don't allow any changes
changeToolBar( BaseMode::Search | BaseMode::Configure | BaseMode::Quit );