# Re: Qt4 not supported?

**URL:** <https://www.ruby-forum.com/t/re-qt4-not-supported/168431>\
**Category:** Ruby\
**Created:** [May 20, 2009, 7:41pm UTC](https://www.ruby-forum.com/t/re-qt4-not-supported/168431 "2009-05-20T19:41:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jolivierld](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/34f0e0/32.png) [@jolivierld](https://www.ruby-forum.com/u/jolivierld)\
**Post date:** [May 20, 2009, 7:41pm UTC](https://www.ruby-forum.com/t/re-qt4-not-supported/168431/1 "2009-05-20T19:41:57Z")

</div>

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:11:in
`method_missing': Instance is not initialized, cannot call
setCentralWidget (ArgumentError)
    from C:/Users/lolveley/Documents/Visual Studio
2008/Projects/test_qt_central_widget/test_qt_central_widget/rubyfile.rb:11:in
`initialize'
    from
c:/ruby/lib/ruby/gems/1.8/gems/qtruby4-1.4.10-mswin32/lib/Qt/qtruby4.rb:2398:in
`call'
    from
c:/ruby/lib/ruby/gems/1.8/gems/qtruby4-1.4.10-mswin32/lib/Qt/qtruby4.rb:2398:in
`try_initialize'
    from
c:/ruby/lib/ruby/gems/1.8/gems/qtruby4-1.4.10-mswin32/lib/Qt/qtruby4.rb:2397:in
`catch'
    from
c:/ruby/lib/ruby/gems/1.8/gems/qtruby4-1.4.10-mswin32/lib/Qt/qtruby4.rb:2397:in
`try_initialize'
    from C:/Users/lolveley/Documents/Visual Studio
2008/Projects/test_qt_central_widget/test_qt_central_widget/rubyfile.rb:19:in
`new'
    from C:/Users/lolveley/Documents/Visual Studio
2008/Projects/test_qt_central_widget/test_qt_central_widget/rubyfile.rb:19

```

can you help me?

lolveley.

* * *

Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son  
interface révolutionnaire.

> **[Yahoo](https://mail.yahoo.com/)**
>
> It's

---

<div class="post-metadata">

**Author:** ![jolivierld](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/34f0e0/32.png) [@jolivierld](https://www.ruby-forum.com/u/jolivierld)\
**Post date:** [May 20, 2009, 7:59pm UTC](https://www.ruby-forum.com/t/re-qt4-not-supported/168431/2 "2009-05-20T19:59:05Z")

</div>

On Wednesday 20 May 2009, lolveley wrote:

> | zone\_centrale=Qt::Widget.new  
> |  
> |  
> | 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

---

<div class="post-metadata">

**Author:** ![jolivierld](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/34f0e0/32.png) [@jolivierld](https://www.ruby-forum.com/u/jolivierld)\
**Post date:** [May 21, 2009, 12:38am UTC](https://www.ruby-forum.com/t/re-qt4-not-supported/168431/3 "2009-05-21T00:38:01Z")

</div>

Stefano C. a écrit :

> > |  
> > |  
> > |  
> > 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

thank you stefano, it is ok now.

olivier.

* * *

Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son  
interface révolutionnaire.

> **[Yahoo Mail](https://mail.yahoo.com/)**
>
> Take a trip into an upgraded, more organized inbox. Sign in and start exploring all the free, organizational tools for your email. Check out new themes, send GIFs, find every photo you've ever sent or received, and search your account faster than...
