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. QT Application icon disappears after application restart
Forum Update on Monday, May 27th 2025

QT Application icon disappears after application restart

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

    I am using .desktop file for running my application. First time I run it the icon loads correctly, but whenever my application restarts from the code then the application is started without the icon.

    I use this code to restart my application (I think it is from documantation):

    @QString app = QApplication::applicationFilePath();
    QStringList arguments = QApplication::arguments();
    QString currPath = QDir::currentPath();
    QProcess::startDetached(app,arguments,currPath);
    QApplication::exit();@

    I know it does not work because it runs directly the binary file and not the .desktop file. I'd like to ask if there is a way to restart it and load the icon file.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Did you saw the "Setting the Application Icon" chapter of Qt's documentation ? It should contain the information you need

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • N Offline
        N Offline
        Noturnoz
        wrote on last edited by
        #3

        Well as far as I know the documentation does not say how to load the icon after in-code appplication restart.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          AFAIK (I may be wrong though) it's done be the desktop environment, which one are you using ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • N Offline
            N Offline
            Noturnoz
            wrote on last edited by
            #5

            Gnome and KDE. But for now I am trying to get it working on Gnome.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Then you should also check with the Gnome people

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              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