Here are patches to qtruby that fix the issue reported below. The draggableicons and puzzle examples now work!<br><br>diff --git a/ext/ruby/qtruby/src/Qt.cpp b/ext/ruby/qtruby/src/Qt.cpp<br>index 36fcddd..d0c3288 100644<br>
--- a/ext/ruby/qtruby/src/Qt.cpp<br>+++ b/ext/ruby/qtruby/src/Qt.cpp<br>@@ -526,6 +526,7 @@ findMethod(VALUE /*self*/, VALUE c_value, VALUE name_value)<br> VALUE result = rb_ary_new();<br> Smoke::ModuleIndex classId = Smoke::findClass(c); <br>
Smoke::ModuleIndex meth = Smoke::NullModuleIndex;<br>+ QList<Smoke::ModuleIndex> milist;<br> if (classId.smoke != 0) {<br> meth = classId.smoke->findMethod(c, name);<br> }<br>@@ -540,39 +541,47 @@ findMethod(VALUE /*self*/, VALUE c_value, VALUE name_value)<br>
Smoke::ModuleIndex mnid = s->idMethodName(name);<br> if (!cid.index || !mnid.index) continue;<br> meth = s->idMethod(cid.index, mnid.index);<br>- if (meth.index) break;<br>
+ if (meth.index) milist.append(meth);<br> }<br> #ifdef DEBUG<br> if (do_debug & qtdb_calls) qWarning("Found method QGlobalSpace::%s => %d", name, meth.index);<br> #endif<br> }<br>
+ else<br>+ {<br>+ milist.append(meth);<br>+ }<br> <br>- if (meth.index == 0) {<br>+ if (milist.count() == 0) {<br> return result;<br> // empty list<br>- } else if (meth.index > 0) {<br>
- Smoke::Index i = meth.smoke->methodMaps[meth.index].method;<br>- if (i == 0) { // shouldn't happen<br>- rb_raise(rb_eArgError, "Corrupt method %s::%s", c, name);<br>- } else if(i > 0) { // single match<br>
- const Smoke::Method &methodRef = meth.smoke->methods[i];<br>- if ((methodRef.flags & Smoke::mf_internal) == 0) {<br>- rb_ary_push(result, rb_funcall(moduleindex_class, rb_intern("new"), 2, INT2NUM(smokeList.indexOf(meth.smoke)), INT2NUM(i)));<br>
- }<br>- } else { // multiple match<br>- i = -i; // turn into ambiguousMethodList index<br>- while (meth.smoke->ambiguousMethodList[i]) {<br>- const Smoke::Method &methodRef = meth.smoke->methods[meth.smoke->ambiguousMethodList[i]];<br>
- if ((methodRef.flags & Smoke::mf_internal) == 0) {<br>- rb_ary_push(result, rb_funcall(moduleindex_class, rb_intern("new"), 2, INT2NUM(smokeList.indexOf(meth.smoke)), INT2NUM(meth.smoke->ambiguousMethodList[i])));<br>
+ } else {<br>+ foreach (Smoke::ModuleIndex meth, milist) { <br>+ if (meth.index > 0) {<br>+ Smoke::Index i = meth.smoke->methodMaps[meth.index].method;<br>+ if (i == 0) { // shouldn't happen<br>
+ rb_raise(rb_eArgError, "Corrupt method %s::%s", c, name);<br>+ } else if(i > 0) { // single match<br>+ const Smoke::Method &methodRef = meth.smoke->methods[i];<br>
+ if ((methodRef.flags & Smoke::mf_internal) == 0) {<br>+ rb_ary_push(result, rb_funcall(moduleindex_class, rb_intern("new"), 2, INT2NUM(smokeList.indexOf(meth.smoke)), INT2NUM(i)));<br>
+ }<br>+ } else { // multiple match<br>+ i = -i; // turn into ambiguousMethodList index<br>+ while (meth.smoke->ambiguousMethodList[i]) {<br>
+ const Smoke::Method &methodRef = meth.smoke->methods[meth.smoke->ambiguousMethodList[i]];<br>+ if ((methodRef.flags & Smoke::mf_internal) == 0) {<br>+ rb_ary_push(result, rb_funcall(moduleindex_class, rb_intern("new"), 2, INT2NUM(smokeList.indexOf(meth.smoke)), INT2NUM(meth.smoke->ambiguousMethodList[i])));<br>
//#ifdef DEBUG<br>- if (do_debug & qtdb_calls) qWarning("Ambiguous Method %s::%s => %d", c, name, meth.smoke->ambiguousMethodList[i]);<br>+ if (do_debug & qtdb_calls) qWarning("Ambiguous Method %s::%s => %d", c, name, meth.smoke->ambiguousMethodList[i]);<br>
//#endif<br> <br>- }<br>- i++;<br>+ }<br>+ i++;<br>+ }<br>+ }<br> }<br>- }<br>+ }<br> }<br>
return result;<br> }<br><br>diff --git a/lib/Qt/qtruby4.rb b/lib/Qt/qtruby4.rb<br>index 7acb006..cf235c7 100755<br>--- a/lib/Qt/qtruby4.rb<br>+++ b/lib/Qt/qtruby4.rb<br>@@ -2740,11 +2740,11 @@ module Qt<br> # Multiple matches are an error; the equality test below _cannot_ be commented out.<br>
# If ambiguous matches occur the problem must be fixed be adjusting the relative<br> # ranking of the arg types involved in checkarg().<br>- elsif current_match == best_match<br>
+ elsif current_match == best_match && id.smoke == chosen.smoke<br> puts "multiple methods matching, this is an error" if debug_level >= DebugLevel::Minimal<br>
chosen = nil<br> end<br>- puts "match => #{id.index} score: #{current_match}" if debug_level >= DebugLevel::High<br>+ puts "match => #{id.index} score: #{current_match} chosen: #{chosen}" if debug_level >= DebugLevel::High<br>
end<br> <br> puts "Resolved to id: #{chosen.index}" if !chosen.nil? && debug_level >= DebugLevel::High<br>@@ -2764,7 +2764,7 @@ module Qt<br> method_ids = hash.values_at(*constructor_names).flatten<br>
puts dumpCandidates(method_ids)<br> else<br>- puts "setCurrentMethod(smokeList index: #{chosen.smoke}, meth index: #{chosen.index})" if debug_level >= DebugLevel::High<br>
+ puts "setCurrentMethod(smokeList index: #{chosen.smoke}, meth index: #{chosen.index})" if debug_level >= DebugLevel::High && chosen<br> end<br> setCurrentMethod(chosen) if chosen<br>
return nil<br><br><br><div class="gmail_quote">On Mon, Sep 20, 2010 at 10:09 PM, Ryan Melton <span dir="ltr"><<a href="mailto:ryanmelt@gmail.com">ryanmelt@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Looks like this is probably the same probable affecting me in qtruby. I'll work on a patch.<br><font color="#888888">Ryan</font><div><div></div><div class="h5"><br><br><div class="gmail_quote">On Thu, Sep 2, 2010 at 8:49 PM, Chris Michael Burel <span dir="ltr"><<a href="mailto:chrisburel@gmail.com" target="_blank">chrisburel@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">SVN commit 1171223 by burel:<br>
<br>
When calling a method in QGlobalSpace, don't stop when you find the first smoke module that provides the method you're looking for. Look through all smoke modules. This was breaking when calling operator<< on a QPixmap, because that method was defined by the QtGui module. The code would find the methods from QtCore and stop there.<br>
<br>
I think the other bindings may want this too. I checked Ruby, and it looked incorrect to me.<br>
<br>
CCMAIL: <a href="mailto:kde-bindings@kde.org" target="_blank">kde-bindings@kde.org</a><br>
<br>
M +7 -4 QtCore4.xs<br>
<br>
<br>
--- trunk/KDE/kdebindings/perl/qtcore/src/QtCore4.xs #1171222:1171223<br>
@@ -48,21 +48,23 @@<br>
char* classname<br>
char* methodname<br>
PPCODE:<br>
- Smoke::ModuleIndex mi;<br>
+ QList<Smoke::ModuleIndex> milist;<br>
if ( strcmp( classname, "QGlobalSpace" ) == 0 ) {<br>
// All modules put their global functions in "QGlobalSpace". So we<br>
// have to use each smoke object to look for this method.<br>
for (int i = 0; i < smokeList.size(); ++i) {<br>
- mi = smokeList.at(i)->findMethod(classname, methodname);<br>
+ Smoke::ModuleIndex mi = smokeList.at(i)->findMethod(classname, methodname);<br>
if( mi.smoke ) {<br>
- break;<br>
+ // Found a result, add it to the return<br>
+ milist.append(mi);<br>
}<br>
}<br>
}<br>
else {<br>
// qtcore_Smoke will be able to find any method not in QGlobalSpace<br>
- mi = qtcore_Smoke->findMethod(classname, methodname);<br>
+ milist.append( qtcore_Smoke->findMethod(classname, methodname) );<br>
}<br>
+ foreach (Smoke::ModuleIndex mi, milist) {<br>
if ( !mi.index ) {<br>
// empty list<br>
}<br>
@@ -95,6 +97,7 @@<br>
}<br>
}<br>
}<br>
+ }<br>
<br>
#// Args: none<br>
#// Returns: an array of all classes that qtcore_Smoke knows about<br>
_______________________________________________<br>
Kde-bindings mailing list<br>
<a href="mailto:Kde-bindings@kde.org" target="_blank">Kde-bindings@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kde-bindings" target="_blank">https://mail.kde.org/mailman/listinfo/kde-bindings</a><br>
</blockquote></div><br>
</div></div></blockquote></div><br>