ddobrev / QtSharp

Mono/.NET bindings for Qt
Other
574 stars 51 forks source link

Missing Constructors #71

Closed DeathTBO closed 7 years ago

DeathTBO commented 7 years ago

I was trying to subscribe to an event, but every time the event is called I get an error saying the constructor for the type not found. This is the code I was going to use:

QTableView.SelectionModel.CurrentChanged += (QModelIndex x, QModelIndex y) => { CallMethod(); };

and it throws this when the event is called:

System.MissingMethodException: 'Constructor on type 'QtCore.QModelIndex' not found.'

The same error is thrown regardless of how I subscribe to the event, and additionally happens to several different types. Here are a few I've found, although there are probably more

QModelIndex

QItemSelection

QAbstractItemModel

QAbstractItemView

On a side note, the MouseDoubleClickEvent, MousePressEvent, MouseReleaseEvent, and MouseMoveEvent events for QTableView are not being called. I have SetMouseTracking set to true, but that has made no difference.

ddobrev commented 7 years ago

@DeathTBO do you use the binary release?

DeathTBO commented 7 years ago

@ddobrev I am using the latest binary release and QT MinGW 5.8.

I have QtCoreSharp, QtWidgetsSharp, and QtGUISharp added as references, and these libraries sent to the output directory:

CppSharp.Runtime.dll
icudt54.dll
icuin54.dll
icuuc54.dll
libEGL.dll
libgcc_s_dw2-1.dll
libGLESv2.dll
libstdc++-6.dll
libwinpthread.dll
Std.dll

QtCore.dll
QtCore-inlines.dll
QtWidgets.dll
QtWidgets-inlines.dll
QtGUI.dll
QtGUI-inlines.dll

I have a platforms directory with:

qminimal.dll
qoffscreen.dll
qindows.dll

I have an imageformats directory with:

qgif.dll
qico.dll
qjpeg.dll
ddobrev commented 7 years ago

I have published a new release for Qt 5.9.1 at https://gitlab.com/ddobrev/QtSharp/tags. Please check if it solves the problem.

DeathTBO commented 7 years ago

I updated my project to 5.9.1, and added the latest version of QtSharp. However, I am still getting the same error.

Are you moving to GitLab? Would it be easier for you if I setup a new issue over there?

ddobrev commented 7 years ago

@DeathTBO no need to, thank you. :) Would it be possible for you to share your project or at least a sample of it? I'll try it tomorrow.

DeathTBO commented 7 years ago

This will throw the same error (but a different type) on all three events in MainForm.InitUI();

DR-QTSharp-Test.zip

ddobrev commented 7 years ago

@DeathTBO thank you very much for the report and the reproduction. I have fixed the bug. Please get the latest release from GitLab.

DeathTBO commented 7 years ago

Thank you so much, it's working just fine.