QtRuby: system tray


#1

Hello, fellow rubyists!
I need an ability to hide my Qt-based app in tray and unhide it back :slight_smile:
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


#2

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 :slight_smile:
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


#3

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 methodsetIcon’ for #<Qt::SystemTrayIcon:


#4

Thank you, Stefano!
That worked!


#5

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 methodsetIcon’ 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