QtRuby: system tray

Discussion in 'Ruby' started by Andrew Lepyokhin, Oct 26, 2008.

  1. Andrew Lepyokhin, Oct 26, 2008
    #1
    1. Advertisements

  2. Andrew Lepyokhin

    Ken Bloom Guest

    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

    --
    Chanoch (Ken) Bloom. PhD candidate. Linguistic Cognition Laboratory.
    Department of Computer Science. Illinois Institute of Technology.
    http://www.iit.edu/~kbloom1/
     
    Ken Bloom, Oct 26, 2008
    #2
    1. Advertisements

  3. 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:
    --
    Posted via http://www.ruby-forum.com/.
     
    Andrew Lepyokhin, Oct 26, 2008
    #3
  4. 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
     
    Stefano Crocco, Oct 26, 2008
    #4
  5. Andrew Lepyokhin, Oct 26, 2008
    #5
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. balu
    Replies:
    1
    Views:
    719
    Peter Jausovec
    Dec 18, 2004
  2. Manish Hatwalne

    Re: show icon in system tray?

    Manish Hatwalne, Jul 15, 2003, in forum: Java
    Replies:
    1
    Views:
    542
    Joona I Palaste
    Jul 15, 2003
  3. Chandler

    Hide in System Tray

    Chandler, Sep 30, 2003, in forum: Java
    Replies:
    3
    Views:
    529
    Chandler
    Sep 30, 2003
  4. dushkin

    System tray message

    dushkin, Feb 5, 2006, in forum: Java
    Replies:
    5
    Views:
    4,533
    Roedy Green
    Feb 6, 2006
  5. varadha
    Replies:
    2
    Views:
    3,342
    SaltPeter
    Sep 15, 2003
  6. Trupti

    System Tray

    Trupti, Nov 5, 2004, in forum: C++
    Replies:
    4
    Views:
    507
    Ioannis Vranos
    Nov 5, 2004
  7. =?gb2312?B?s8Ig0fQ=?=

    [HELP] Tkinter Application Minimized to System Tray :)

    =?gb2312?B?s8Ig0fQ=?=, May 6, 2005, in forum: Python
    Replies:
    0
    Views:
    1,181
    =?gb2312?B?s8Ig0fQ=?=
    May 6, 2005
  8. 3c273

    Simple System Tray Icon

    3c273, Mar 2, 2006, in forum: Python
    Replies:
    7
    Views:
    5,775
    3c273
    Mar 2, 2006
Loading...