Announcement

Collapse
No announcement yet.

Beginner question about QtDesigner and all the Qt stuff

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Beginner question about QtDesigner and all the Qt stuff

    Hi,
    I'm a beginner at kubuntu. I moved to kubuntu because I want to learn QtRuby, but it seems like there's some complication.
    First of all I installed all the packages that *looks* like they relates to Qt and Ruby. But after I installed all those packages (using Adept Manager), I simply can't confirm whether they've been installed or not. Because there is nothing new in the Application Menu. I double checked and Adept manager said that everything I chose had been installed. Now I can't find QtDesigner anywhere?
    And also, I've installed the libraries I thought are needed for QtRuby. Here's my Hello World program:
    Code:
    require 'Qt'
    app = Qt::Application.new(ARGV)
    label = Qt::Label.new("Hello World", nil)
    label.resize(150,30)
    app.setMainWidget(label)
    label.show()
    app.exec
    I ran it using "ruby helloworld.rb" and here's the message returned:
    Code:
    helloworld.rb:5:in `method_missing': undefined method `setMainWidget' for #<Qt::Application:0xb637367c objectName="helloworld.rb"> (NoMethodError)
        from helloworld.rb:5
    I really don't know what I've been missing. Could you please help me with it?

    #2
    Re: Beginner question about QtDesigner and all the Qt stuff

    Try this:

    1) Open Adept Manager, click the drop-down arrow for QtDesigner, and click the details button; then click the "Installed Files" tab and thumb through the list looking an executable for the app (probably something like "qtdesigner.desktop") and its directory location - if there is not a "qtdesigner.desktop" executable, look for something like "/usr/bin/qtdesigner".

    2) Press Alt-F2 and type the location of the app and run the command. If it works, you've got the right location, if it doesn't, look through Adept's list for another (it's sometimes trial and error). [I would guess it's probably something /usr/bin/qtdesigner]

    3) If you want to create a link to it in the KMenu, right-click the menu button, and choose "Edit Applications Menu". Then, right-click the directory in which you want to create the link (probably under "Development"), and choose "New Item". Type the name you want to call it and click OK; then, in the "Command" box, type the executable (if it's /usr/bin/qtdesigner, all you should have to type is "qtdesigner", "designer-qt3" maybe), then save and you're done!

    My system has Qt3 Designer installed to run off the command "designer-qt3"; it's probably the same for you, but if not, try the above
    Asus G1S-X3:
    Intel Core2 Duo T7500, Nvidia GeForce 8600M GT, 4Gb PC2-5300, 320Gb Hitachi 7k320, Linux ( )

    Comment


      #3
      Re: Beginner question about QtDesigner and all the Qt stuff

      Originally posted by caole261188
      And also, I've installed the libraries I thought are needed for QtRuby. Here's my Hello World program:
      Code:
      require 'Qt'
      app = Qt::Application.new(ARGV)
      label = Qt::Label.new("Hello World", nil)
      label.resize(150,30)
      app.mainWidget(label)
      label.show()
      app.exec
      I ran it using "ruby helloworld.rb" and here's the message returned:
      Code:
      helloworld.rb:5:in `method_missing': undefined method `setMainWidget' for #<Qt::Application:0xb637367c objectName="helloworld.rb"> (NoMethodError)
          from helloworld.rb:5
      I really don't know what I've been missing. Could you please help me with it?
      Your error indicates that Qt is installed (otherwise you would get 'LoadError: no such file to load' error). But you are using the bindings incorrectly. Try this code:
      Code:
      require 'Qt'
      app = Qt::Application.new(ARGV)
      label = Qt::Label.new("Hello World", nil)
      label.resize(150,30)
      app.mainWidget = label
      label.show()
      app.exec
      The problem was with app.setMainWidget(label) use "app.mainWidget = value" insted.
      Check this link for further information Ruby Qt Bindings

      Comment


        #4
        Re: Beginner question about QtDesigner and all the Qt stuff

        Thanks for your help. I'm gonna try that

        Comment


          #5
          Re: Beginner question about QtDesigner and all the Qt stuff

          I am already able to get qtdesigner to run it looks great
          but the problem with qtruby binding code still persists.
          I changed my helloworld exactly as you told me:
          Code:
          require 'Qt'
          app = Qt::Application.new(ARGV)
          label = Qt::Label.new("Hello World", nil)
          label.resize(150,30)
          app.mainWidget = label
          label.show()
          app.exec
          Then I run it using ruby helloworld.rb, and here's the error message:
          Code:
          helloworld.rb:5:in `method_missing': undefined method `mainWidget=' for #<Qt::Application:0xb63cb6b0 objectName="helloworld.rb"> (NoMethodError)
              from helloworld.rb:5
          Please help me with this. And thank you very much for helping me.

          Comment


            #6
            Re: Beginner question about QtDesigner and all the Qt stuff

            Please try MainWidget insted of mainWidget.

            Comment


              #7
              Re: Beginner question about QtDesigner and all the Qt stuff

              Just as a reference, the KDE Developer's Corner gives the following as its example code:
              Code:
               #!/usr/bin/ruby -w
                 require 'Qt'
                 a = Qt::Application.new(ARGV)
                 hello = Qt::PushButton.new("Hello World!", nil)
                 hello.resize(100, 30)
                 a.mainWidget = hello
                 hello.show()
                 a.exec()

              Comment

              Working...
              X