diff --git a/kdeplasma-addons/applets/icontasks/taskgroupitem.cpp b/kdeplasma-addons/applets/icontasks/taskgroupitem.cpp index 0cfca014..6e5bd870 100644 --- a/kdeplasma-addons/applets/icontasks/taskgroupitem.cpp +++ b/kdeplasma-addons/applets/icontasks/taskgroupitem.cpp @@ -755,7 +755,7 @@ void TaskGroupItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) if (groupable->itemType() == TaskManager::GroupItemType) { //TODO: recurse through sub-groups? } else { - TaskItem * item = dynamic_cast(groupable); + TaskItem * item = qobject_cast(groupable); if (item && item->task()) { ids << item->task()->info().win(); } diff --git a/kdeplasma-addons/applets/icontasks/taskitemlayout.cpp b/kdeplasma-addons/applets/icontasks/taskitemlayout.cpp index 2cb566ea..0da6a735 100644 --- a/kdeplasma-addons/applets/icontasks/taskitemlayout.cpp +++ b/kdeplasma-addons/applets/icontasks/taskitemlayout.cpp @@ -247,9 +247,9 @@ int TaskItemLayout::size() } if (item->abstractItem()->itemType() == TaskManager::GroupItemType) { - TaskGroupItem *group = static_cast(item); + TaskGroupItem *group = qobject_cast(item); if (!group->collapsed()) { - TaskItemLayout *layout = dynamic_cast(group->tasksLayout()); + TaskItemLayout *layout = qobject_cast(group->tasksLayout()); if (!layout) { kDebug() << "Error group has no layout"; continue; diff --git a/kdeplasma-addons/applets/icontasks/tooltips/tooltipmanager.cpp b/kdeplasma-addons/applets/icontasks/tooltips/tooltipmanager.cpp index 5ad22421..d9d7bac4 100644 --- a/kdeplasma-addons/applets/icontasks/tooltips/tooltipmanager.cpp +++ b/kdeplasma-addons/applets/icontasks/tooltips/tooltipmanager.cpp @@ -513,7 +513,7 @@ void ToolTipManagerPrivate::toolTipHovered(bool hovered) bool ToolTipManager::eventFilter(QObject *watched, QEvent *event) { - QGraphicsWidget * widget = dynamic_cast(watched); + QGraphicsWidget * widget = qobject_cast(watched); if (d->state != Activated || !widget) { return QObject::eventFilter(watched, event); } diff --git a/kdeplasma-addons/applets/timer/timer.cpp b/kdeplasma-addons/applets/timer/timer.cpp index e2313c54..b794dd6b 100644 --- a/kdeplasma-addons/applets/timer/timer.cpp +++ b/kdeplasma-addons/applets/timer/timer.cpp @@ -448,7 +448,7 @@ QList Timer::contextualActions() void Timer::startTimerFromAction() { - QAction *action = dynamic_cast (sender()); + QAction *action = qobject_cast (sender()); if (!action || action->property("seconds").type() != QVariant::Int) { return; } diff --git a/kdeplasma-addons/containments/groupingdesktop/lib/groupexplorer/groupiconlist.cpp b/kdeplasma-addons/containments/groupingdesktop/lib/groupexplorer/groupiconlist.cpp index 20048115..fb3b7fff 100644 --- a/kdeplasma-addons/containments/groupingdesktop/lib/groupexplorer/groupiconlist.cpp +++ b/kdeplasma-addons/containments/groupingdesktop/lib/groupexplorer/groupiconlist.cpp @@ -122,7 +122,7 @@ GroupIconList::~GroupIconList() bool GroupIconList::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::GraphicsSceneResize) { - QGraphicsWidget *widget = dynamic_cast(obj); + QGraphicsWidget *widget = qobject_cast(obj); if (widget == m_listWidget) { //the resize occurred with the list widget diff --git a/kmix/apps/kmix.cpp b/kmix/apps/kmix.cpp index c6e09434..245e1312 100644 --- a/kmix/apps/kmix.cpp +++ b/kmix/apps/kmix.cpp @@ -628,7 +628,7 @@ KMixWindow::recreateGUI(bool saveConfig, const QString& mixerId, QList activeGuiProfiles; for (int i = 0; i < m_wsMixers->count(); ++i) { - KMixerWidget* kmw = dynamic_cast(m_wsMixers->widget(i)); + KMixerWidget* kmw = qobject_cast(m_wsMixers->widget(i)); if (kmw) { activeGuiProfiles.append(kmw->getGuiprof()); @@ -981,7 +981,7 @@ KMixWindow::profileExists(QString guiProfileId) { for (int i = 0; i < m_wsMixers->count(); ++i) { - KMixerWidget* kmw = dynamic_cast(m_wsMixers->widget(i)); + KMixerWidget* kmw = qobject_cast(m_wsMixers->widget(i)); if (kmw && kmw->getGuiprof()->getId() == guiProfileId) return true; } diff --git a/kmix/gui/dialogviewconfiguration.cpp b/kmix/gui/dialogviewconfiguration.cpp index 20f150bf..05665c56 100644 --- a/kmix/gui/dialogviewconfiguration.cpp +++ b/kmix/gui/dialogviewconfiguration.cpp @@ -415,7 +415,7 @@ void DialogViewConfiguration::prepareControls(QAbstractItemModel* model, bool is // -2- Find the mdw, und update it ************************** foreach ( QWidget *qw, _view._mdws ) { - MixDeviceWidget *mdw = dynamic_cast(qw); + MixDeviceWidget *mdw = qobject_cast(qw); if ( !mdw ) { continue; } diff --git a/kmix/gui/mdwslider.cpp b/kmix/gui/mdwslider.cpp index f91dc455..daa2cd3c 100644 --- a/kmix/gui/mdwslider.cpp +++ b/kmix/gui/mdwslider.cpp @@ -862,12 +862,12 @@ MDWSlider::setColors( QColor high, QColor low, QColor back ) { for( int i=0; i(slider); + KSmallSlider *smallSlider = qobject_cast(slider); if ( smallSlider ) smallSlider->setColors( high, low, back ); } for( int i=0; i(slider); + KSmallSlider *smallSlider = qobject_cast(slider); if ( smallSlider ) smallSlider->setColors( high, low, back ); } } @@ -877,12 +877,12 @@ MDWSlider::setMutedColors( QColor high, QColor low, QColor back ) { for( int i=0; i(slider); + KSmallSlider *smallSlider = qobject_cast(slider); if ( smallSlider ) smallSlider->setGrayColors( high, low, back ); } for( int i=0; i(slider); + KSmallSlider *smallSlider = qobject_cast(slider); if ( smallSlider ) smallSlider->setGrayColors( high, low, back ); } } @@ -1043,9 +1043,9 @@ void MDWSlider::update() { QLabel *l; VerticalText *v; - if ((l = dynamic_cast(m_label))) + if ((l = qobject_cast(m_label))) l->setText(m_mixdevice->readableName()); - else if ((v = dynamic_cast(m_label))) + else if ((v = qobject_cast(m_label))) v->setText(m_mixdevice->readableName()); } } diff --git a/kmix/gui/verticaltext.h b/kmix/gui/verticaltext.h index 179ae2be..710a61c0 100644 --- a/kmix/gui/verticaltext.h +++ b/kmix/gui/verticaltext.h @@ -26,6 +26,7 @@ class VerticalText : public QWidget { + Q_OBJECT public: VerticalText(QWidget * parent, const QString&, Qt::WFlags f = 0); ~VerticalText(); diff --git a/okular/part.cpp b/okular/part.cpp index 0f24e8d9..34bbadd0 100644 --- a/okular/part.cpp +++ b/okular/part.cpp @@ -2064,7 +2064,7 @@ void Part::slotRenameBookmark( const DocumentViewport &viewport ) void Part::slotRenameBookmarkFromMenu() { - QAction *action = dynamic_cast(sender()); + QAction *action = qobject_cast(sender()); Q_ASSERT( action ); if ( action ) { @@ -2087,7 +2087,7 @@ void Part::slotAboutToShowContextMenu(KMenu * /*menu*/, QAction *action, QMenu * delete a; } - KBookmarkAction *ba = dynamic_cast(action); + KBookmarkAction *ba = qobject_cast(action); if (ba != NULL) { QAction *separatorAction = contextMenu->addSeparator(); @@ -2908,7 +2908,7 @@ void Part::rebuildBookmarkMenu( bool unplugActions ) QWidget *container = factory()->container("bookmarks", clients[i]); if (container && container->actions().contains(m_bookmarkActions.first())) { - Q_ASSERT(dynamic_cast(container)); + Q_ASSERT(qobject_cast(container)); disconnect(container, 0, this, 0); connect(container, SIGNAL(aboutToShowContextMenu(KMenu*,QAction*,QMenu*)), this, SLOT(slotAboutToShowContextMenu(KMenu*,QAction*,QMenu*))); containerFound = true; diff --git a/okular/tests/mainshelltest.cpp b/okular/tests/mainshelltest.cpp index 63da9a27..1ec8615e 100644 --- a/okular/tests/mainshelltest.cpp +++ b/okular/tests/mainshelltest.cpp @@ -240,8 +240,8 @@ void MainShellTest::testShell() QSet openUrls; Shell *s = findShell(); QVERIFY(s); - Okular::Part *part = dynamic_cast(s->m_tabs[0].part); - Okular::Part *part2 = dynamic_cast(s->m_tabs[1].part); + Okular::Part *part = qobject_cast(s->m_tabs[0].part); + Okular::Part *part2 = qobject_cast(s->m_tabs[1].part); QCOMPARE(s->m_tabs.count(), 2); QCOMPARE(part->url().url(), QString("file://%1").arg(paths[0])); QCOMPARE(part2->url().url(), QString("file://%1").arg(paths[1])); @@ -313,7 +313,7 @@ void MainShellTest::testShell() { // It is attaching to us so a second tab is there QCOMPARE(s->m_tabs.count(), 2); - Okular::Part *part2 = dynamic_cast(s->m_tabs[1].part); + Okular::Part *part2 = qobject_cast(s->m_tabs[1].part); QCOMPARE(part2->url().url(), QString("file://%1").arg(externalProcessPath)); QCOMPARE(partDocument(part2)->currentPage(), externalProcessExpectedPage); } @@ -353,12 +353,12 @@ void MainShellTest::testShell() if (unique) { QCOMPARE(s->m_tabs.count(), 1); - part = dynamic_cast(s->m_tabs[0].part); + part = qobject_cast(s->m_tabs[0].part); } else { QCOMPARE(s->m_tabs.count(), 2); - part = dynamic_cast(s->m_tabs[1].part); + part = qobject_cast(s->m_tabs[1].part); } for (int i = 0; presentationWidget(part) == 0 && i < 20; ++i) { diff --git a/okular/ui/minibar.cpp b/okular/ui/minibar.cpp index 296bdc3a..7fc9d888 100644 --- a/okular/ui/minibar.cpp +++ b/okular/ui/minibar.cpp @@ -225,7 +225,7 @@ void MiniBar::changeEvent( QEvent * event ) { if ( event->type() == QEvent::ParentChange ) { - QToolBar *tb = dynamic_cast( parent() ); + QToolBar *tb = qobject_cast( parent() ); if ( tb != m_oldToobarParent ) { if ( m_oldToobarParent ) diff --git a/partitionmanager/src/core/operationstack.cpp b/partitionmanager/src/core/operationstack.cpp index c33fa934..7810edf3 100644 --- a/partitionmanager/src/core/operationstack.cpp +++ b/partitionmanager/src/core/operationstack.cpp @@ -90,17 +90,17 @@ OperationStack::~OperationStack() */ bool OperationStack::mergeNewOperation(Operation*& currentOp, Operation*& pushedOp) { - NewOperation* newOp = dynamic_cast(currentOp); + NewOperation* newOp = qobject_cast(currentOp); if (newOp == NULL) return false; - DeleteOperation* pushedDeleteOp = dynamic_cast(pushedOp); - ResizeOperation* pushedResizeOp = dynamic_cast(pushedOp); - CopyOperation* pushedCopyOp = dynamic_cast(pushedOp); - SetFileSystemLabelOperation* pushedLabelOp = dynamic_cast(pushedOp); - CreateFileSystemOperation* pushedCreateFileSystemOp = dynamic_cast(pushedOp); - CheckOperation* pushedCheckOp = dynamic_cast(pushedOp); + DeleteOperation* pushedDeleteOp = qobject_cast(pushedOp); + ResizeOperation* pushedResizeOp = qobject_cast(pushedOp); + CopyOperation* pushedCopyOp = qobject_cast(pushedOp); + SetFileSystemLabelOperation* pushedLabelOp = qobject_cast(pushedOp); + CreateFileSystemOperation* pushedCreateFileSystemOp = qobject_cast(pushedOp); + CheckOperation* pushedCheckOp = qobject_cast(pushedOp); // -- 1 -- if (pushedDeleteOp && &newOp->newPartition() == &pushedDeleteOp->deletedPartition() && !pushedDeleteOp->deletedPartition().roles().has(PartitionRole::Extended)) @@ -229,13 +229,13 @@ bool OperationStack::mergeNewOperation(Operation*& currentOp, Operation*& pushed */ bool OperationStack::mergeCopyOperation(Operation*& currentOp, Operation*& pushedOp) { - CopyOperation* copyOp = dynamic_cast(currentOp); + CopyOperation* copyOp = qobject_cast(currentOp); if (copyOp == NULL) return false; - DeleteOperation* pushedDeleteOp = dynamic_cast(pushedOp); - CopyOperation* pushedCopyOp = dynamic_cast(pushedOp); + DeleteOperation* pushedDeleteOp = qobject_cast(pushedOp); + CopyOperation* pushedCopyOp = qobject_cast(pushedOp); // -- 1 -- if (pushedDeleteOp && ©Op->copiedPartition() == &pushedDeleteOp->deletedPartition()) @@ -285,12 +285,12 @@ bool OperationStack::mergeCopyOperation(Operation*& currentOp, Operation*& pushe */ bool OperationStack::mergeRestoreOperation(Operation*& currentOp, Operation*& pushedOp) { - RestoreOperation* restoreOp = dynamic_cast(currentOp); + RestoreOperation* restoreOp = qobject_cast(currentOp); if (restoreOp == NULL) return false; - DeleteOperation* pushedDeleteOp = dynamic_cast(pushedOp); + DeleteOperation* pushedDeleteOp = qobject_cast(pushedOp); if (pushedDeleteOp && &restoreOp->restorePartition() == &pushedDeleteOp->deletedPartition()) { @@ -328,12 +328,12 @@ bool OperationStack::mergeRestoreOperation(Operation*& currentOp, Operation*& pu */ bool OperationStack::mergePartFlagsOperation(Operation*& currentOp, Operation*& pushedOp) { - SetPartFlagsOperation* partFlagsOp = dynamic_cast(currentOp); + SetPartFlagsOperation* partFlagsOp = qobject_cast(currentOp); if (partFlagsOp == NULL) return false; - SetPartFlagsOperation* pushedFlagsOp = dynamic_cast(pushedOp); + SetPartFlagsOperation* pushedFlagsOp = qobject_cast(pushedOp); if (pushedFlagsOp && &partFlagsOp->flagPartition() == &pushedFlagsOp->flagPartition()) { @@ -360,12 +360,12 @@ bool OperationStack::mergePartFlagsOperation(Operation*& currentOp, Operation*& */ bool OperationStack::mergePartLabelOperation(Operation*& currentOp, Operation*& pushedOp) { - SetFileSystemLabelOperation* partLabelOp = dynamic_cast(currentOp); + SetFileSystemLabelOperation* partLabelOp = qobject_cast(currentOp); if (partLabelOp == NULL) return false; - SetFileSystemLabelOperation* pushedLabelOp = dynamic_cast(pushedOp); + SetFileSystemLabelOperation* pushedLabelOp = qobject_cast(pushedOp); if (pushedLabelOp && &partLabelOp->labeledPartition() == &pushedLabelOp->labeledPartition()) { @@ -392,13 +392,13 @@ bool OperationStack::mergePartLabelOperation(Operation*& currentOp, Operation*& */ bool OperationStack::mergeCreatePartitionTableOperation(Operation*& currentOp, Operation*& pushedOp) { - CreatePartitionTableOperation* pushedCreatePartitionTableOp = dynamic_cast(pushedOp); + CreatePartitionTableOperation* pushedCreatePartitionTableOp = qobject_cast(pushedOp); if (pushedCreatePartitionTableOp && currentOp->targets(pushedCreatePartitionTableOp->targetDevice())) { Log() << i18nc("@info/plain", "Creating new partition table, discarding previous operation on device."); - CreatePartitionTableOperation* createPartitionTableOp = dynamic_cast(currentOp); + CreatePartitionTableOperation* createPartitionTableOp = qobject_cast(currentOp); if (createPartitionTableOp != NULL) pushedCreatePartitionTableOp->setOldPartitionTable(createPartitionTableOp->oldPartitionTable());