diff --git a/openlp/plugins/songs/forms/duplicatesongremovalform.py b/openlp/plugins/songs/forms/duplicatesongremovalform.py index 29eb1b312..4642d6fdb 100644 --- a/openlp/plugins/songs/forms/duplicatesongremovalform.py +++ b/openlp/plugins/songs/forms/duplicatesongremovalform.py @@ -331,9 +331,7 @@ class DuplicateSongRemovalForm(OpenLPWizard): self.songs_horizontal_layout.addStretch() for duplicate in self.duplicate_song_list[-1]: song_review_widget = SongReviewWidget(self.review_page, duplicate) - QtCore.QObject.connect(song_review_widget, - QtCore.SIGNAL(u'song_remove_button_clicked(PyQt_PyObject)'), - self.remove_button_clicked) + song_review_widget.song_remove_button_clicked.connect(self.remove_button_clicked) self.songs_horizontal_layout.addWidget(song_review_widget) self.songs_horizontal_layout.addStretch() self.songs_horizontal_layout.addStretch() diff --git a/openlp/plugins/songs/forms/songreviewwidget.py b/openlp/plugins/songs/forms/songreviewwidget.py index af861205e..eb3dc0372 100644 --- a/openlp/plugins/songs/forms/songreviewwidget.py +++ b/openlp/plugins/songs/forms/songreviewwidget.py @@ -42,6 +42,18 @@ class SongReviewWidget(QtGui.QWidget): The remove logic is not implemented here, but a signal is provided when the remove button is clicked. """ + + # Signals have to be class variables and not instance variables. Otherwise + # they are not registered by Qt (missing emit and connect methods are artifacts of this). + # To use SongReviewWidget as a signal parameter one would have to assigning the class + # variable after the class is declared. While this is possible, it also messes Qts meta + # object system up. The result is an + # "Object::connect: Use the SIGNAL macro to bind SongReviewWidget::(QWidget*)" error on + # connect calls. + # That's why we cheat a little and use QWidget instead of SongReviewWidget as parameter. + # While not being entirely correct, it does work. + song_remove_button_clicked = QtCore.pyqtSignal(QtGui.QWidget) + def __init__(self, parent, song): """ ``parent`` @@ -168,4 +180,4 @@ class SongReviewWidget(QtGui.QWidget): """ Signal emitted when the "remove" button is clicked. """ - self.emit(QtCore.SIGNAL(u'song_remove_button_clicked(PyQt_PyObject)'), self) + self.song_remove_button_clicked.emit(self)