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

Q_ENUMS declaration missing from QProcess

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4: Low
    • Resolution: Done
    • Affects Version/s: 4.6.2
    • Fix Version/s: 5.6.0 RC
    • Component/s: Core: I/O
    • Labels:
      None
    • Commits:
      896da75550738a08f44dfeb72f09ace3a147b0ee

      Description

      Could you add Q_ENUMS for:
      enum ProcessState
      enum ProcessError
      enum ProcessChannel
      enum ProcessChannelMode
      enum ExitStatus

      So that QMetaObject class can be used to convert valueToKey.

      example:

      void MainWindow::on_myProcess_stateChanged(QProcess::ProcessState state)
      {
         QProcess* proc = qobject_cast<QProcess*>(sender());
         if (proc) {
             int enumIdx = proc->metaObject()->indexOfEnumerator("ProcessState");
             QMetaEnum enumData = proc->metaObject()->enumerator(enumIdx);
             QString stateName = enumData.valueToKey(state);
             qDebug() << __FUNCTION__ << state << stateName;
          }
      }
      

      I would expect to see something like:

      on_myProcess_stateChanged 1 "Starting" 
      on_myProcess_stateChanged 0 "NotRunning"
      

      The benefit from this would be that I could have dynamic debug messages. As of today the switch-case with static values is the only option..

        Attachments

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

          Activity

            People

            Assignee:
            jbornema Joerg Bornemann
            Reporter:
            juhapekka.piiroinen Juhapekka Piiroinen
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes