Jul 19 2008

Code snippit – ruby qt QPixmap

Category: rubyerm @ 8:41 pm

Here’s an example on how to add images to ruby qt applications. The key is to create a label, and then to set the pixmap to the label.

It’s a far cry from <img src=”file.jpg”>


#!/usr/bin/ruby -w
require 'Qt'
a = Qt::Application.new(ARGV)
pixmap = Qt::Pixmap.new("myimage.png")
label = Qt::Label.new(nil)
label.pixmap = pixmap
a.mainWidget = label
label.show()
a.exec()

Tags: , , ,

Leave a Reply

You must be logged in to post a comment. Login now.