Skip to content

Commit

Permalink
Merge pull request #2422 from uklotzde/qobject_cast
Browse files Browse the repository at this point in the history
Use qobject_cast for accessing the sender() of received signals
  • Loading branch information
daschuer authored Jan 2, 2020
2 parents 8546643 + 18d1609 commit 8b88cb1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/library/sidebarmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ QModelIndex SidebarModel::translateSourceIndex(const QModelIndex& index) {
* For child models, this always the child models itself
*/

const QAbstractItemModel* model = dynamic_cast<QAbstractItemModel*>(sender());
const QAbstractItemModel* model = qobject_cast<QAbstractItemModel*>(sender());
VERIFY_OR_DEBUG_ASSERT(model != NULL) {
return QModelIndex();
}
Expand Down
2 changes: 1 addition & 1 deletion src/musicbrainz/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void NetworkTimeouts::addReply(QNetworkReply* reply) {
}

void NetworkTimeouts::replyFinished() {
QNetworkReply* reply = reinterpret_cast<QNetworkReply*>(sender());
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
if (m_timers.contains(reply)) {
killTimer(m_timers.take(reply));
}
Expand Down
2 changes: 1 addition & 1 deletion src/musicbrainz/tagfetcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void TagFetcher::cancel() {
}

void TagFetcher::fingerprintFound(int index) {
QFutureWatcher<QString>* watcher = reinterpret_cast<QFutureWatcher<QString>*>(sender());
QFutureWatcher<QString>* watcher = static_cast<QFutureWatcher<QString>*>(sender());
if (!watcher || index >= m_tracks.count()) {
return;
}
Expand Down

0 comments on commit 8b88cb1

Please sign in to comment.