Stefano Crocco
5/20/2009 5:54:00 PM
On Wednesday 20 May 2009, lolveley wrote:
> |hello,
> |
> |thank you for your answer, ken.
> |I still have an error : here is my program :
> |
> | require ('Qt')
> |
> | class Fen_princ < Qt::MainWindow
> |
> | def initialize
> | zone_centrale=Qt::Widget.new
> | nom=Qt::LineEdit.new
> | layout=Qt::FormLayout.new
> | layout.addRow("Votre nom :",nom)
> | zone_centrale.setLayout(layout)
> | setCentralWidget(zone_centrale)
> | <---- line 11
> |
> | end
> |
> | end
> |
> |
> |
> | app=Qt::Application.new(ARGV)
> | fenetre=Fen_princ.new() <-----
> | line 19
> | fenetre.show
> | app.exec
> |
> |
> |and here is the error :
> |
> | C:/Users/lolveley/Documents/Visual Studio
> |
> | 2008/Projects/test_qt_central_widget/test_qt_central_widget/rubyfile.rb:1
> |1:in `method_missing': Instance is not initialized, cannot call
You forgot to call the superclass's initialize method. Usually, when
subclassing Qt::Object or Qt::Widget, it's better to put a call to super as
first line of the initialize method (it's not required, as long as you don't
call any method of the base class before doing so, but it helps avoiding to
forget it).
I hope this helps
Stefano