title: Declare const in Qt and access from 2 different classes
body: <p>I develop in Qt5 and want some advice.</p>
  
  <p>I want to declare const variable in one class and use this variable in other classes.
  what is the best way to do that?</p>
  
  <p>Now i get error in my code:</p>
  
  <p>protocolcommands.cpp</p>
  
  <pre><code>const QString CNT_FIRMWARE_ACK = "ACK";
  const QString CNT_FIRMWARE_NAK = "NAK";
  const QString CNT_FIRMWARE_NYET = "NYET";
  const QString CNT_FIRMWARE_STALL = "STALL";
  const QString CNT_FIRMWARE_HEARTBEAT = "HEARTBEAT";
  
  QString ProtocolCommands::parseCommand(QByteArray ba)
  {
  
      QString s;
      if (ba[2] == 0x02)
      {
          s = "flow control";
          if (ba[3] == 0x01 &amp;&amp; ba[4] == 0x01)
            return CNT_FIRMWARE_ACK;
          if (ba[3] == 0x01 &amp;&amp; ba[4] == 0x02)
            return CNT_FIRMWARE_NAK;
          if (ba[3] == 0x01 &amp;&amp; ba[4] == 0x03)
            return CNT_FIRMWARE_STALL;
          if (ba[3] == 0x01 &amp;&amp; ba[4] == 0x04)
            return CNT_FIRMWARE_NYET;
      }
      else if (ba[2] == 0x03)
      {
          s = "data packet";
          qDebug() &lt;&lt; ba.toHex();
          if (ba[3] == 0x1a &amp;&amp; ba[4] == 0x02)
           return "getJsonStringFor_GetStimulatorOperaionType";
  
      }
      else if (ba[2] == 0x04)
      {
            return CNT_FIRMWARE_HEARTBEAT;
      }
     // return "";
  }
  </code></pre>
  
  <p>engine.cpp:</p>
  
  <pre><code>void Engine::onSerialArrivedMsg(QByteArray msg)
  {
  ProtocolCommands pc;
  qDebug() &lt;&lt; "somthing has arrived : " &lt;&lt; msg.toHex();
  //if we here - this is new message from the firmware
  //this function refer just to one message at a time
  
  //first check if we are in the middle of flow:
  if (mode)
  {
       qDebug() &lt;&lt; "mode = true";
       switch (curr_step_in_flow) {
       case 1:  //last command send to FW was [Set SinglePulse Parameters]
           if (pc.parseCommand(msg) == ProtocolCommands::CNT_FIRMWARE_ACK)    // compile eror
           {
              qDebug() &lt;&lt; "ack recieved";
              curr_step_in_flow = 2;
           }
           else if (pc.parseCommand(msg) == CNT_FIRMWARE_HEARTBEAT ) // compile error
           {
               //heartbeat msg
               //send signal to the heartbeat thread
               emit fwHeartBeatArrived();
           }
           break;
       default:
           break;
       }
  
  }
  else
  {
     if (pc.parseCommand(msg) == CNT_FIRMWARE_HEARTBEAT)  // compile eror
     {
         //heartbeat msg
         //send signal to the heartbeat thread
         emit fwHeartBeatArrived();
     }
  
  }
  
  }
  </code></pre>