Closed csdehaan closed 7 years ago
I think I found what I was looking for in ext/ruby/qtruby/src/qtruby.cpp. I followed the example of qitemselection_count() and qitemselection_at() to expose the polygon count and at functions and then mapped those into the Qt::Polygon(F) classes. Opened a pull request to include those changes.
closed by #130
When using any of the Enumerable methods (count, each, etc) of the polygon classes I get a SystemStackError. It appears that the problem is in the each method that is defined in lib/Qt/qtruby4.rb (line 1672 for Polygon and 1683 for PolygonF). The each method uses count to figure out how many points are in the polygon, but this can't work because the count method (from Enumerable) uses each to count the number of items in the Enumerable object. This causes an infinite recursion and therefore the stack error. It seems like the way to fix it would be to expose the count() function of the QPolygon(F) classes and use that instead of the Enumerable version of count. Unfortunately I do not know how to do this, can someone point me in the right direction? Also, here is a simple example that shows the problem: