[Kde-bindings] Re: Re: qtruby: Qt::TextView issue?
Navindra Umanee
navindra at cs.mcgill.ca
Thu Sep 23 16:08:17 UTC 2004
Arash Abedinzadeh <thunfisch at thunfisch.org> wrote:
> class MyImage < Qt::Widget
> def initialize
> super()
> @image = Qt::Image.new("/path/to/image.png")
> end
> end
Here you're just creating a class that contains an image in a field.
It isn't doing anything. If you ask it to show, there's nothing to
show.
I think you should use Qt::Label to display pictures or text.
http://doc.trolltech.com/3.3/qlabel.html#setPixmap
Try this:
---------------
require 'Qt'
a = Qt::Application.new(ARGV)
image = Qt::Image.new("/home/navindra/out.png")
pixmap = Qt::Pixmap.new(image)
label = Qt::Label.new(nil)
label.setPixmap(pixmap)
label.show
a.setMainWidget(label)
a.exec
---------------
I just got this by playing around, maybe someone will know a better
way or approach or correct my syntax.
Cheers,
Navin.
More information about the Kde-bindings
mailing list