Alle gioved12 luglio 2007, anansi ha scritto: > Hi, > I tried it severaly times now but always failed. I want to make a ruby > application that uses QT but I'm lacking information about it. I'm never > succeding in getting that to work what I did. I know there is a ebook > for 10$ but I really don't have the money and I'm no professional coder > but a hobby coder. > So I wondered can anybody point me to free information about it ? > > > I know these links and the ones linked in them: > http://www.arachnoid.com/ruby/RubyGUIProject/index.html > http://developer.kde.org/language-bindings/ruby/index.html > > > > > If someone is itself familiar with ruby and qt maybe you can help me? > I generated with qt4-designer this rss.ui: > http://nopaste.php-q.net/309650 and converted it with rbuic to this > rss.rb: http://nopaste.php-q.net/309649 > > Now I try to show this Qt-window with that code: > > #!/usr/bin/qtrubyinit > require '/home/myuser/Desktop/rss.rb' > > class RssShow < MainWindow > def initialize(app) > super() > @app = app > end > end > > # create and show dialog > if $0 == __FILE__ > app = Qt::Application.new(ARGV) > dialog = RssShow.new(app) > app.mainWidget = dialog > dialog.show > app.exec > end > > > but it always fails and gives me that error: > $ ./rss-show.rb > /home/myuser/Desktop/rss.rb:15:in `const_missing': uninitialized > constant MainWindow::WType_TopLevel (NameError) > from /home/myuser/Desktop/rss.rb:15:in `initialize' > from ./rss-show.rb:6:in `initialize' > from /usr/lib/ruby/1.8/Qt/qtruby.rb:1682:in `call' > from /usr/lib/ruby/1.8/Qt/qtruby.rb:1682:in `try_initialize' > from /usr/lib/ruby/1.8/Qt/qtruby.rb:1681:in `catch' > from /usr/lib/ruby/1.8/Qt/qtruby.rb:1681:in `try_initialize' > from ./rss-show.rb:14:in `new' > from ./rss-show.rb:14 > > Does anybody know why? Or can point me to further information about ruby > and Qt? Qt is well documented. There's the qt reference (http://doc.trolltech.com/4.3/index.html), which, while witten for C++, can be translated to ruby almost directly. Besides, in the qtruby distribution (http://rubyforge.org/projects/korundum), there are a lot of example written in ruby (they're the ports to ruby of the C++ examples provided with Qt). The examples include the tutorial described in the qt documentation (http://doc.trolltech.com/4.3/examples.html#qt-tutorial). I hope this helps Stefano