Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. can anybody explain evaluation of below complex statment in simple way?
Forum Updated to NodeBB v4.3 + New Features

can anybody explain evaluation of below complex statment in simple way?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 311 Views 1 Watching
  • 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.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on last edited by Qt embedded developer
    #1
    
    border.color: ((IsAlarming == false) && (IsAlerting == false)) ? (Name !== "") ? ((!IsCalibrated && IsReCalibratable && (InVivoAdapter.getInvivoParameterAdjusted(Name,  modelData.ModelName) === false)) ? (ProfileDetailsAdapter.DarkTheame ? ColorSchemes.blackColorCode : ColorSchemes.grayColorCode3) : (ProfileDetailsAdapter.DarkTheame ? "transparent" : ColorSchemes.grayColorCode3)): "transparent" : measureScreen.getBorderColor(IsAlarming,IsAlerting,AlarmPriority, Value)
    

    i also want to know is there simple way to write this statement ?

    SGaistS 1 Reply Last reply
    0
    • Q Qt embedded developer
      
      border.color: ((IsAlarming == false) && (IsAlerting == false)) ? (Name !== "") ? ((!IsCalibrated && IsReCalibratable && (InVivoAdapter.getInvivoParameterAdjusted(Name,  modelData.ModelName) === false)) ? (ProfileDetailsAdapter.DarkTheame ? ColorSchemes.blackColorCode : ColorSchemes.grayColorCode3) : (ProfileDetailsAdapter.DarkTheame ? "transparent" : ColorSchemes.grayColorCode3)): "transparent" : measureScreen.getBorderColor(IsAlarming,IsAlerting,AlarmPriority, Value)
      

      i also want to know is there simple way to write this statement ?

      SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      That's an abuse of ternary operator.

      Basically: <some_condition> ? execute_if_true : execute_if_false.

      You can chain them as shown in your snippet but at that level it's just plain wrong.

      You have to rewrite each item on the left of a ? as an if and what's left and right of : as the then and else part of the if.

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

      Q 1 Reply Last reply
      2
      • SGaistS SGaist

        Hi,

        That's an abuse of ternary operator.

        Basically: <some_condition> ? execute_if_true : execute_if_false.

        You can chain them as shown in your snippet but at that level it's just plain wrong.

        You have to rewrite each item on the left of a ? as an if and what's left and right of : as the then and else part of the if.

        Q Offline
        Q Offline
        Qt embedded developer
        wrote on last edited by Qt embedded developer
        #3

        @SGaist

        means i need to write it like

        if(((IsAlarming == false) && (IsAlerting == false)))
        {
        if(Name !=="")
        {
        if(((!IsCalibrated && IsReCalibratable && (InVivoAdapter.getInvivoParameterAdjusted(Name, modelData.ModelName) === false)))
        {
        if(ProfileDetailsAdapter.DarkTheame)
        {
        border.color = ColorSchemes.blackColorCode;
        }
        else
        {
        border.color =ColorSchemes.grayColorCode3;
        }
        }
        else{
        if(ProfileDetailsAdapter.DarkTheame)
        {
        border.color = "Transparent";
        }
        else
        {
        border.color =ColorSchemes.grayColorCode3;
        }
        }
        else
        {
        border.color = "Transparent";
        }
        }
        else
        {
        border.color =measureScreen.getBorderColor(IsAlarming,IsAlerting,AlarmPriority, Value);
        }

        SGaistS 1 Reply Last reply
        0
        • Q Qt embedded developer

          @SGaist

          means i need to write it like

          if(((IsAlarming == false) && (IsAlerting == false)))
          {
          if(Name !=="")
          {
          if(((!IsCalibrated && IsReCalibratable && (InVivoAdapter.getInvivoParameterAdjusted(Name, modelData.ModelName) === false)))
          {
          if(ProfileDetailsAdapter.DarkTheame)
          {
          border.color = ColorSchemes.blackColorCode;
          }
          else
          {
          border.color =ColorSchemes.grayColorCode3;
          }
          }
          else{
          if(ProfileDetailsAdapter.DarkTheame)
          {
          border.color = "Transparent";
          }
          else
          {
          border.color =ColorSchemes.grayColorCode3;
          }
          }
          else
          {
          border.color = "Transparent";
          }
          }
          else
          {
          border.color =measureScreen.getBorderColor(IsAlarming,IsAlerting,AlarmPriority, Value);
          }

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Qt-embedded-developer That's the idea yes.

          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
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved