{"id":311,"date":"2008-07-19T20:41:50","date_gmt":"2008-07-20T02:41:50","guid":{"rendered":"http:\/\/blog.the-erm.com\/?p=311"},"modified":"2008-07-19T20:42:28","modified_gmt":"2008-07-20T02:42:28","slug":"code-snippit-ruby-qt-qpixmap","status":"publish","type":"post","link":"https:\/\/blog.the-erm.com\/?p=311","title":{"rendered":"Code snippit &#8211; ruby qt QPixmap"},"content":{"rendered":"<p>Here&#8217;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.<\/p>\n<p>It&#8217;s a far cry from &lt;img src=&#8221;file.jpg&#8221;&gt;<\/p>\n<p><code><br \/>\n#!\/usr\/bin\/ruby -w<br \/>\nrequire 'Qt'<br \/>\na = Qt::Application.new(ARGV)<br \/>\npixmap = Qt::Pixmap.new(\"myimage.png\")<br \/>\nlabel = Qt::Label.new(nil)<br \/>\nlabel.pixmap = pixmap<br \/>\na.mainWidget = label<br \/>\nlabel.show()<br \/>\na.exec()<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;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&#8217;s a far cry from &lt;img src=&#8221;file.jpg&#8221;&gt; #!\/usr\/bin\/ruby -w require &#8216;Qt&#8217; a = Qt::Application.new(ARGV) pixmap = Qt::Pixmap.new(&#8220;myimage.png&#8221;) label = Qt::Label.new(nil) label.pixmap = pixmap a.mainWidget = label label.show() [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59],"tags":[63,65,61,115],"class_list":["post-311","post","type-post","status-publish","format-standard","hentry","category-ruby","tag-image","tag-pixmap","tag-qt","tag-ruby"],"_links":{"self":[{"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=\/wp\/v2\/posts\/311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=311"}],"version-history":[{"count":0,"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=\/wp\/v2\/posts\/311\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.the-erm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}