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.
Andrew L. (Guest)
on 2008-10-26 13: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
Ken B. (Guest)
on 2008-10-26 19:40
(Received via mailing list)
On Sun, 26 Oct 2008 06:42:49 -0500, Andrew L. 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
Andrew L. (Guest)
on 2008-10-26 21:15
Ken B. 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:
Stefano C. (Guest)
on 2008-10-26 21:23
(Received via mailing list)
Alle Sunday 26 October 2008, Andrew L. ha scritto:
> Ken B. 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
Andrew L. (Guest)
on 2008-10-26 21:28
Thank you, Stefano!
That worked!
This topic is locked and can not be replied to.