[Kde-bindings] Yet another segfault

Richard Dale Richard_Dale at tipitina.demon.co.uk
Mon Oct 4 00:43:30 UTC 2004


On Sunday 03 October 2004 21:59, Han Holl wrote:
> On Sunday 03 October 2004 19:49, Richard Dale wrote:
> > Try this version of qtuby.rb, it is a lot more fussy about arg type
> > matching errors, and shouldn't crash if you make mistakes.
> >
> > -- Richard
>
> Hi Richard,
>
> Still everything isn'q quite right. Remember my awful blackout, with the
> misspelled Qstring& ? Correctly spelled it goes like this:
>
> require 'Qt'
>
> class Chooser <  Qt::Object
>   slots 'setStyle(const QString&)'
>
>   def setStyle(what)
>     puts what
>   end
> end
>
> a = Qt::Application.new(ARGV)
> w = Qt::ComboBox.new('combo') do
>   insertStringList %w{ abc def geh }
>   setCurrentText 'def'
> end
> c = Chooser.new
> Qt::Object.connect(w, SIGNAL('activated(const QString&)'), c,
> SLOT('setStyle(const QString&)'))
>
> a.mainWidget = w
> w.show
> a.exec
>
> And with your newest qtruby.rb, I get:
>
> /usr/lib/ruby/site_ruby/1.8/Qt/qtruby.rb:356:in `initialize': unresolved
> constructor call Qt::ComboBox (ArgumentError)
>         from /usr/lib/ruby/site_ruby/1.8/Qt/qtruby.rb:356:in `call'
>         from /usr/lib/ruby/site_ruby/1.8/Qt/qtruby.rb:356:in
> `try_initialize' from /usr/lib/ruby/site_ruby/1.8/Qt/qtruby.rb:353:in
> `callcc' from /usr/lib/ruby/site_ruby/1.8/Qt/qtruby.rb:353:in
> `try_initialize' from bug.rb:14:in `new'
>         from bug.rb:14
>
> It runs just fine with the original qtruby.rb
I think the latest qtruby.rb has correctly identified a programming error, 
that the previous one missed! There is no Qt::ComboBox constructor that takes 
a String arg:

baldhead duke 840% rbqtapi Qt::ComboBox
        static QComboBox::Policy QComboBox::AfterCurrent()
        static QComboBox::Policy QComboBox::AtBottom()
        static QComboBox::Policy QComboBox::AtCurrent()
        static QComboBox::Policy QComboBox::AtTop()
        static QComboBox::Policy QComboBox::BeforeCurrent()
        static QComboBox::Policy QComboBox::NoInsertion()
        QComboBox* QComboBox::QComboBox()
        QComboBox* QComboBox::QComboBox(QWidget*)
        QComboBox* QComboBox::QComboBox(QWidget*, const char*)
        QComboBox* QComboBox::QComboBox(bool)
        QComboBox* QComboBox::QComboBox(bool, QWidget*)
        QComboBox* QComboBox::QComboBox(bool, QWidget*, const char*)
        void QComboBox::activated(int)
        void QComboBox::activated(const QString&)
...

Try this instead:

w = Qt::ComboBox.new(nil, 'combo') do 
  insertStringList %w{ abc def geh }
  setCurrentText 'def'
end

-- Richard



More information about the Kde-bindings mailing list