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. isSystemTrayAvailable() always crashes (Segfault) on Ubuntu 10.10 Desktop

isSystemTrayAvailable() always crashes (Segfault) on Ubuntu 10.10 Desktop

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 2.9k Views
  • 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.
  • R Offline
    R Offline
    ronM71
    wrote on last edited by
    #1

    Obviously the response should have been "true", as my icon gets there on the tray area as I requested when I comment out the crash causing "isSystemTrayAvailable()", but why does it crash?

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

      Can you post a code snippet, how you use it?

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

      1 Reply Last reply
      0
      • R Offline
        R Offline
        ronM71
        wrote on last edited by
        #3

        @int main(int argc, char *argv[])
        {
        Q_INIT_RESOURCE(stylesheet);

        try
        {
        
            if (!QSystemTrayIcon::isSystemTrayAvailable())   <--- CRASH HERE@
        
        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          You must construct a QApplication object first:

          The following snippet works, if you leave out the QApplication it crashes:

          @
          int main(int argc, char *argv[])
          {
          QApplication a(argc, argv);
          bool ok = QSystemTrayIcon::isSystemTrayAvailable();
          qDebug() << ok;

          return 0;
          

          }
          @

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

          1 Reply Last reply
          0
          • R Offline
            R Offline
            ronM71
            wrote on last edited by
            #5

            Much thanks. The interesting thing is that it works for OSX and Windows as is, but crashes on Ubuntu. Fine line there, I'll respect the rules.

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

              The sys tray is always available on OS X and Windows, so the the method returns a hard coded "true".

              On Linux (resp. X11) this is not always true:

              bq. from the docs:
              The QSystemTrayIcon class can be used on the following platforms: [...] All window managers for X11 that implement the freedesktop.org system tray specification, including recent versions of KDE and GNOME

              Some old fashioned window managers don't have it. Thus it must be determined at run time and for that the window system has to be set up before with QApplication.

              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