Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-29197

[Mac] Option for not showing icon for QGuiApplication in Mac panel.

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • P3: Somewhat important
    • 5.2.0
    • 5.0.0
    • GUI: Workspace
    • None
    • Mac OS X 10.8

    • macOS

    Description

      In Qt4.x when QApplication was created with Tty type it didn't show up
      in Mac panel.

      There are no equivalent for such functionality in Qt5. Obsolete Type enum

      {Tty, GuiClient}

      was removed for reasons explained in [1].

      [1] https://bugreports.qt-project.org/browse/QTBUG-28093

      This is needed if we want to use console application with access to GUI classes, for example for precessing images in background...

      Example:

      #include <QtCore>
      #include <QtGui>
      #include <QtWidgets>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          qDebug() << qVersion();
          QString path("/Users/Qt/dev/icon/icon/icon");
          QProcess pr;
          pr.start(path);
      
          return a.exec();
      }
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv, false);
          qDebug() << qVersion();
          QFile file("out.txt");
          if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
              qDebug() << "failure";
      
          QTextStream out(&file);
          out << "Hello world\n";
      
          file.flush();
          file.close();
      
          QTimer *timer = new QTimer();
          QObject::connect(timer, SIGNAL(timeout()), qApp, SLOT(quit()));
          timer->setSingleShot(true);
          timer->start(1000);
      
          return a.exec();
      }
      

      When running first application we would see 2 icons for short period of time, which is not what one would expect.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tpochep Timur Pocheptsov
            paeglis Gatis Paeglis
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes