Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Tray icon is not launching the activated() signal
Forum Updated to NodeBB v4.3 + New Features

Tray icon is not launching the activated() signal

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alexandros
    wrote on last edited by
    #1

    Hello, I'm working in Ubuntu 11.10, and I have the following problem:
    I call this to connect the tray to the SIGNAL:
    @connect(trayIcon,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(clickSysTrayIcon(QSystemTrayIcon::ActivationReason)));@
    but as I checked, clickSysTrayIcon() function never launches! So, even if I've set to do something on single click (trigger) or to quit application on middle click, using this code:
    @void MainWindow::clickSysTrayIcon(QSystemTrayIcon::ActivationReason reason)
    {
    //reason is a variable that holds the type of activation or click done on the icon tray
    switch (reason) {
    case QSystemTrayIcon::Trigger:
    //normal click
    if(must_do_action){
    do_action();
    return;
    }
    if(!pref && !histor){//hide the icon
    trayIcon->hide();
    //show the main window
    this->showNormal();
    }
    break;

    case QSystemTrayIcon::MiddleClick:
        //quit the application
        close();
        break;
    case QSystemTrayIcon::Unknown:
        break;
    case QSystemTrayIcon::Context:
        break;
    default :
            ;
    }
    

    }@

    nothing's working... When I click the application the menu I've designed shows up and I can click the actions I've specified, which are working fine. Middle click to close app or normal click so as to do an action or to open the mainwindow, does not work.

    Any ideas?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      It works for me (no MiddleClick on the Mac, though).

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alexandros
        wrote on last edited by
        #3

        Hello Volker, thanks for the info. I (maybe :D) forgot to add that Ubuntu doesn't really support tray icons and by default accepts indicators. In some cases, (I think especially if tray icons are Qt ones) it does accept tray icons but it may have disabled some functions of them. This may cause the problem, but any other thoughts rather than this?

        PS: does QtCreator plan to make a library which supports indicators?

        Thanks!

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          That would be a feature of the Qt libs, not Creator :-) Unfortunately, I don't know about that. But with Ubuntu/Unity being based on Qt, I would say the chances are not too bad...

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved