jerous86 / nimqt

Qt bindings for nim
GNU General Public License v2.0
93 stars 6 forks source link

QLayoutItem.widget missing #44

Closed ToTheZeroth closed 2 weeks ago

ToTheZeroth commented 3 months ago

Hello,

I've been trying these bindings and found them to work really well with a little detective work (I'm as new to Qt as I am to nimqt so I think that's as good as one might hope).

But it seems that this line is missing from qtwidgets/qlayoutitem.nim: proc widget*(this: ptr QLayoutItem): ptr QWidget {.header:headerFile, importcpp:"#.widget(@)".} # Public

I managed to get my local project working by importing qtwidgets/qwidget, adding the line, and then sorting out the circular dependencies this caused (I ended up taking out the QObject and QWidget classes to their own modules ­­– there might be a better way).

jerous86 commented 2 months ago

Yeah, I am aware of this problem. It is mentioned at the bottom of the page (https://github.com/jerous86/nimqt#generating-bindings). It is a long page to go through and indeed easy to miss.

As mentioned there, bindings are autogenerated. Detecting and solving all those circular dependencies is not something I want to solve in the already complex enough code. So for now, I decided to just skip those proc that cause problems.

I think you can also add the line proc widget*(this: ptr QLayoutItem): ptr QWidget {.header:headerFile, importcpp:"#.widget(@)".} in your own code.

Thank you for reporting!