It seems that you need to specify also the optional parameter. If you
substitute the line
item = Qt::TreeWidgetItem.new(@rootItem)
with
item = Qt::TreeWidgetItem.new(@rootItem, Qt::TreeWidgetItem::Type)
it should work (at least, it does on my system, with qt 4.2.3).
substitute the line
creation (the constructor have the same optional parameter)?
Thanks
Miquel
Looking at the Korudum forum
(http://rubyforge.org/forum/forum.php?forum_id=723), it seems there are
some
situations in which QtRuby fails to correctly resolve overloaded
methods. In
this case, the constructor which takes a Qt::ListWidget is resolved
correctly, the other isn’t. A similar situation occurred me using
Qt::MessageBox.question. Although the documentation says the buttons and
defaultButton parameters are optional, the method call failed in ruby
unless
they were both specified. Another example is mentioned on this thread of
the
Korundum forum: http://rubyforge.org/forum/message.php?msg_id=15576
The first one is used in the @rootNode object creation and the second
It seems that you need to specify also the optional parameter. If you
substitute the line
item = Qt::TreeWidgetItem.new(@rootItem)
with
item = Qt::TreeWidgetItem.new(@rootItem, Qt::TreeWidgetItem::Type)
it should work (at least, it does on my system, with qt 4.2.3).
I’ve found out what the problem is, and it’s already fixed in the kde
svn version of QtRuby. Here is the entry from the ChangeLog:
There is no way to distinguish between the two constructors:
QTreeWidgetItem (const QTreeWidgetItem & other)
QTreeWidgetItem (QTreeWidgetItem * parent, const QStringList &
strings, int type = Type)
when the latter has a single argument. So force the second variant
to
be called
QTreeWidgetItem ( QTreeWidgetItem * parent, int type = Type )
Stefano
Ok, I have reported this issue to the KDE bindings list and Richard Dale
is asking me some questions. If you are interested in final conclusions
I’ll post here
Thanks for all
Best regards
Miquel
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.