puts it.operator++()
/mainform.ui.rb:33:in method_missing': undefined methodoperator’ for
#Qt::ListViewItemIterator:0xb6c08c24 (NoMethodError)
Well, the operator ++ is meant to be called directly ++ when written
in C++. In ruby, however, that won’t work as ++ is not an operator.
You might want to try (untested):
Well, the operator ++ is meant to be called directly ++ when written
in C++. In ruby, however, that won’t work as ++ is not an operator.
You might want to try (untested):
p it.send(:’++’)
No, that won’t work. You need to use ‘it += 1’ instead in QtRuby:
Well, the operator ++ is meant to be called directly ++ when written
in C++. In ruby, however, that won’t work as ++ is not an operator.
You might want to try (untested):
p it.send(:’++’)
That will nearly work, but the method is a C++ method in the Smoke
library, and so it is called ‘operator++’:
I’ve just added some each methods to various Qt3 QtRuby classes, and
made them enumerable, so you no longer need to use an external C++
style iterator with them. This is the comment from the ChangeLog:
* Made Qt::ListView, Qt::ListViewItem, Qt::BoxLayout, Qt::HBoxLayout,
Qt::VBoxLayout and Qt::GridLayout Enumerable with implementations
of each() so they don't need to use the Qt External iterators like
Qt::LayoutIterator anymore. For instance:
lv = Qt::ListView.new do
["one", "two", "three", "four"].each do |label|
Qt::ListViewItem.new(self, label, "zzz")
end
end
lv.each do |item|
p item.inspect
pp item.inspect
end
* Add inspect() and pretty_print() methods to Qt::ListViewItem so that
they show the text of their columns
The improvements will be in the next release of Qt3 QtRuby.
it = Qt::ListViewItemIterator.new(@listView)
puts it.operator++()
Well, the operator ++ is meant to be called directly ++ when
written in C++. In ruby, however, that won’t work as ++ is not an
operator. You might want to try (untested):
p it.send(:‘++’)
No, that won’t work. You need to use ‘it += 1’ instead in QtRuby:
That works for me - thanks very much
Nigel
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.