[Kde-bindings] PlasmaScripting::Applet: Unresolved constructor

David Palacio dpalacio at uninorte.edu.co
Mon Nov 17 14:28:37 UTC 2008


I need some custom widgets that Plasma does not provide for an applet I am 
developing. For that I use QGraphicsProxyWidget but I cannot set the 
PlasmaScripting::Applet applet as a parent for it.

Following is a piece of code that will reproduce the error. (I know this is 
not entirely correct but the result is exactly the same) (Does not work for 
4.2)

kdeapp #kapplication creator @ .irbrc
require 'plasma_applet'
o = Qt::Object.new #Dummy object to create a PlasmaScripting::Applet
class << o
def applet
end
end
a = PlasmaScripting::Applet.new o
p = Qt::GraphicsProxyWidget.new a
ArgumentError: unresolved constructor call Qt::GraphicsProxyWidget

        from /usr/lib/ruby/1.8/Qt/qtruby4.rb:2450:in `initialize'
        from /usr/lib/ruby/1.8/Qt/qtruby4.rb:2450:in `call'
        from /usr/lib/ruby/1.8/Qt/qtruby4.rb:2450:in `try_initialize'
        from /usr/lib/ruby/1.8/Qt/qtruby4.rb:2449:in `catch'
        from /usr/lib/ruby/1.8/Qt/qtruby4.rb:2449:in `try_initialize'
        from (irb):9:in `new'
        from (irb):9


This works fine:
p = Qt::GraphicsProxyWidget.new Qt::GraphicsItem.new

PS. I get this in both 4.1 and trunk/


P.P.S The actual applet:

require 'plasma_applet'

module PlasmaAppletHelloRuby

class Main < PlasmaScripting::Applet

  def initialize(parent, args = nil)
    super
  end

  def init
    resize(600, 400)
    @proxy = Qt::GraphicsProxyWidget.new
    STDERR.puts self.class.ancestors
    @proxy.setParentItem self
    @proxy.widget = main
  end

  def paintInterface(p, option, rect)
    p.pen = Qt::Color.new 'steelblue'
    p.scale 3, 3
    p.draw_text Qt::RectF.new( rect ), 'Hello Ruby'
  end

  def constraintsEvent(constraints)
  end

end

end




More information about the Kde-bindings mailing list