Forum: Ruby QtRuby: system tray

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cda95721958a4eb80f01dc66692832fa?d=identicon&s=25 Andrew Lepyokhin (bizzz)
on 2008-10-26 12:43
Hello, fellow rubyists!
I need an ability to hide my Qt-based app in tray and unhide it back :)
I've read C examples at
http://doc.trolltech.com/4.2/desktop-systray.html
but couldn't understand it enough to translate it in ruby.
If someone has done this before or can explain how to use the above
example, please help me.

Andrew
851acbab08553d1f7aa3eecad17f6aa9?d=identicon&s=25 Ken Bloom (Guest)
on 2008-10-26 18:40
(Received via mailing list)
On Sun, 26 Oct 2008 06:42:49 -0500, Andrew Lepyokhin wrote:

> Hello, fellow rubyists!
> I need an ability to hide my Qt-based app in tray and unhide it back :)
> I've read C examples at
> http://doc.trolltech.com/4.2/desktop-systray.html but couldn't
> understand it enough to translate it in ruby. If someone has done this
> before or can explain how to use the above example, please help me.

It's all about the QSystemTrayIcon class. Use the #hide and #show
methods
to hide it and make it reappear.

--Ken
Cda95721958a4eb80f01dc66692832fa?d=identicon&s=25 Andrew Lepyokhin (bizzz)
on 2008-10-26 20:15
Ken Bloom wrote:
> It's all about the QSystemTrayIcon class. Use the #hide and #show
> methods
> to hide it and make it reappear.
Thank you, Ken, i started to get it, but here's a problem:
t = Qt::SystemTrayIcon.new
t.setIcon('icon.png')
results in error:
`method_missing': undefined method `setIcon' for #<Qt::SystemTrayIcon:
C40020a47c6b625af6422b5b1302abaf?d=identicon&s=25 Stefano Crocco (crocco)
on 2008-10-26 20:23
(Received via mailing list)
Alle Sunday 26 October 2008, Andrew Lepyokhin ha scritto:
> Ken Bloom wrote:
> > It's all about the QSystemTrayIcon class. Use the #hide and #show
> > methods
> > to hide it and make it reappear.
>
> Thank you, Ken, i started to get it, but here's a problem:
> t = Qt::SystemTrayIcon.new
> t.setIcon('icon.png')
> results in error:
> `method_missing': undefined method `setIcon' for #<Qt::SystemTrayIcon:

setIcon requires a Qt::Icon, not the name of the icon file. You can do
this:

t.setIcon(Qt::Icon.new('icon.png'))

You can also write this in a more rubish way:

t.icon = Qt::Icon.new('icon.png')

Stefano
Cda95721958a4eb80f01dc66692832fa?d=identicon&s=25 Andrew Lepyokhin (bizzz)
on 2008-10-26 20:28
Thank you, Stefano!
That worked!
This topic is locked and can not be replied to.