Uploaded image for project: 'Qt for MCUs'
  1. Qt for MCUs
  2. QTMCU-275

Enumerable conflict with previous enumeration

    XMLWordPrintable

Details

    • 7b168080, 1824f57e, c95a5996, 5e3bfff4

    Description

      User reported following:
      "
      Auto generated code from QML gives me error " 'Ukwn' conflicts with a previous declaration" Which I understand since it's not scoped, is there a way in Qt for MCU to scope enum definition and avoid these error.

      I have found several macros for full Qt, but nothing seems to work with QtMCU

      Below is my QML object:

      pragma Singleton
      import QtQuick

      Item {
      id:root

      readonly property alias length: props.length
      readonly property alias temperature: props.temperature
      readonly property alias velocity: props.velocity
      readonly property alias velocity2: props.velocity2
      readonly property alias consumption: props.consumption

      QtObject

      { id:props property int idxLength : VehicleSingleton.stUnit0_stLenUnit property int idxTemp : VehicleSingleton.stUnit0_stTUnit property int idxVelocity : VehicleSingleton.stUnit0_stVUnit property int idxVelocity2 : VehicleSingleton.stUnit0_stV2Unit property int idxConsumption : VehicleSingleton.stUnit0_stFlowCnsUnit property string length: idxLength === UnitHandler.LenUnit.Mtric ? "km" : idxLength === UnitHandler.LenUnit.Impl ? "mi" : "" property string temperature: idxTemp === UnitHandler.TUnit.Mtric ? "°C" : idxTemp === UnitHandler.TUnit.Impl ? "°F" : "" property string velocity: idxVelocity === UnitHandler.VUnit.Mtric ? "km/h" : idxVelocity === UnitHandler.VUnit.Impl ? "MPH" : "" property string velocity2: idxVelocity2 === UnitHandler.VUnit.Mtric ? "km/h" : idxVelocity2 === UnitHandler.VUnit.Impl ? "MPH" : "" property string consumption: idxConsumption === UnitHandler.FlowCnsUnit.Mtric_Len ? "L/100km" : idxConsumption === UnitHandler.FlowCnsUnit.Impl_Len ? "MPG" : idxConsumption === UnitHandler.FlowCnsUnit.Mtric_Ti ? "L/h" : idxConsumption === UnitHandler.FlowCnsUnit.Impl_Ti ? "Gal/h" : idxConsumption === UnitHandler.FlowCnsUnit.Mtric_Pwr ? "Wh/km" : idxConsumption === UnitHandler.FlowCnsUnit.Impl_Pwr ? "mi/kWh" : idxConsumption === UnitHandler.FlowCnsUnit.Invld ? "Invalid" :"" }

      enum TUnit

      { Ukwn, Mtric, Impl }
      enum LenUnit{ Ukwn, Mtric, Impl }

      enum VUnit

      { Ukwn, Mtric, Impl }

      enum FlowCnsUnit

      { Ukwn, Mtric_Len, Impl_Len, Mtric_Ti, Impl_Ti, Mtric_Pwr, Impl_Pwr, Invld = 255 }

      }
      "

      Attachments

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

        Activity

          People

            k0rahman Karim Abdelrahman
            tero.pelkonen Tero Pelkonen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes