Ticket #84 (new defect)

Opened 4 years ago

Last modified 4 years ago

QObject::disconnect() missing

Reported by: Andrej08 Assigned to:
Priority: major Version:
Keywords: Cc:

Description

Using XP32, Qt 2010.04, DMD 2.052, QtD changeset 405.

These 3 projects were ported from Qt C++ examples. Extract all of them to \qtd\examples\dialogs, and run build.bat for each one if you're on Windows:

configdialog - Runtime Error:

qtd.meta.Runtime.MetaException@D:\dev\lib\D\qtd\d2\qtd\meta\Runtime.d(90): QMetaObject: Failed to connect signal qt.gui.QListWidget.QListWidget.currentItemChanged to slot configdialog.ConfigDialog.changePage. Make sure the signal and slot exist and match.
An exception was thrown while finalizing an instance of class qt.gui.QListWidgetItem.QListWidgetItem

findfiles - Runtime Error:

qtd.meta.Runtime.MetaException@D:\dev\lib\D\qtd\d2\qtd\meta\Runtime.d(90): QMetaObject: Failed to connect signal qt.gui.QPushButton.QPushButton.clicked to slot
window.Window.browse. Make sure the signal and slot exist and match.
object.Error: Access Violation

licensewizard - Compile Error:

licensewizard.d(415): Error: undefined identifier disconnect

If you comment out the call to disconnect(), this example will have runtime errors as well:

qtd.meta.Runtime.MetaException@D:\dev\lib\D\qtd\d2\qtd\meta\Runtime.d(90): QMetaObject: Failed to connect signal licensewizard.LicenseWizard.helpRequested to slot licensewizard.LicenseWizard.showHelp. Make sure the signal and slot exist and match.
An exception was thrown while finalizing an instance of class licensewizard.DetailsPage

Attachments

DialogPortedQtExamples.zip (146.8 kB) - added by Andrej08 on 03/17/11 23:45:17.

Change History

03/17/11 23:45:17 changed by Andrej08

  • attachment DialogPortedQtExamples.zip added.

03/18/11 18:07:50 changed by klickverbot

  • summary changed from Runtime errors with signals and slots, and missing disconnect() function to QObject::disconnect() missing.

Contrary to Qt with C++, there is no slot »attribute« in QtD; instead the name of slots needs to be prefixed with slot_ – your slots should be found then. Do you have any suggestions on where you would expect to find this in the QtD docs?

Regarding QObject::disconnect(): I just checked, it really seems to be missing from QtD at the moment – Eldar, Max?

03/18/11 20:48:16 changed by Andrej08

Prepending _slot to function names did the trick, thanks. I didn't know I had to do that, since connecting existing function names from the QtD library seems to work fine. E.g.:

connect(button, "clicked", button, "setVisible");

I'd say make a new section titled "Using slots and signals" at http://www.dsource.org/projects/qtd/wiki/Docs and add that bit of information there.

Hopefully I'll be able to port a good amount of demos and examples from Qt. I have a small sed script which does a blunt conversion of QtD C++ code to D and I do the rest by hand. I only work with D2 though.