Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can i collect them in a single if statement?
Forum Updated to NodeBB v4.3 + New Features

How can i collect them in a single if statement?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 234 Views
  • 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.
  • D Offline
    D Offline
    deleted286
    wrote on last edited by
    #1

    Is it a true approach that using or operand and collect all of them in a single if statement?
    Is there any more clear way to do?
    ```

            if(scln == "GPS Hdop")
            {
                gps[TM_GPS_hdop].f;
            }
            if(scln == "GPS Vdop")
            {
                gps[TM_GPS_vdop].f;
            }
            if(scln == "GPS UTC")
            {
                gps[TM_GPS_utc].f;
            }
    
            if(scln == "GPS Latitude")
            {
                gps[TM_GPS_lat].f;
            }
            if(scln == "GPS Longitude")
            {
               gps[TM_GPS_lon].f;
            }
            
            if(scln == "GPS Alt")
            {
               gps[TM_GPS_alt].f;
            }
            
            if(scln == "GPS Yer Hızı")
            {
               gps[TM_GPS_yer_hizi].f;
            }
            if(scln == "Dikey Hız")
            {
               gps[TM_GPS_dikey_hiz].f;
            }
            if(scln == "GPS Yatay Doğruluk")
            {
               gps[TM_GPS_yatay_dogruluk].f;
            }
            if(scln == "GPS Dikey Doğruluk")
            {
               gps[TM_GPS_dikey_dogruluk].f;
            }
    
    jsulmJ JonBJ 2 Replies Last reply
    0
    • D deleted286

      Is it a true approach that using or operand and collect all of them in a single if statement?
      Is there any more clear way to do?
      ```

              if(scln == "GPS Hdop")
              {
                  gps[TM_GPS_hdop].f;
              }
              if(scln == "GPS Vdop")
              {
                  gps[TM_GPS_vdop].f;
              }
              if(scln == "GPS UTC")
              {
                  gps[TM_GPS_utc].f;
              }
      
              if(scln == "GPS Latitude")
              {
                  gps[TM_GPS_lat].f;
              }
              if(scln == "GPS Longitude")
              {
                 gps[TM_GPS_lon].f;
              }
              
              if(scln == "GPS Alt")
              {
                 gps[TM_GPS_alt].f;
              }
              
              if(scln == "GPS Yer Hızı")
              {
                 gps[TM_GPS_yer_hizi].f;
              }
              if(scln == "Dikey Hız")
              {
                 gps[TM_GPS_dikey_hiz].f;
              }
              if(scln == "GPS Yatay Doğruluk")
              {
                 gps[TM_GPS_yatay_dogruluk].f;
              }
              if(scln == "GPS Dikey Doğruluk")
              {
                 gps[TM_GPS_dikey_dogruluk].f;
              }
      
      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @suslucoder https://doc.qt.io/qt-5/qmap.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      4
      • D deleted286

        Is it a true approach that using or operand and collect all of them in a single if statement?
        Is there any more clear way to do?
        ```

                if(scln == "GPS Hdop")
                {
                    gps[TM_GPS_hdop].f;
                }
                if(scln == "GPS Vdop")
                {
                    gps[TM_GPS_vdop].f;
                }
                if(scln == "GPS UTC")
                {
                    gps[TM_GPS_utc].f;
                }
        
                if(scln == "GPS Latitude")
                {
                    gps[TM_GPS_lat].f;
                }
                if(scln == "GPS Longitude")
                {
                   gps[TM_GPS_lon].f;
                }
                
                if(scln == "GPS Alt")
                {
                   gps[TM_GPS_alt].f;
                }
                
                if(scln == "GPS Yer Hızı")
                {
                   gps[TM_GPS_yer_hizi].f;
                }
                if(scln == "Dikey Hız")
                {
                   gps[TM_GPS_dikey_hiz].f;
                }
                if(scln == "GPS Yatay Doğruluk")
                {
                   gps[TM_GPS_yatay_dogruluk].f;
                }
                if(scln == "GPS Dikey Doğruluk")
                {
                   gps[TM_GPS_dikey_dogruluk].f;
                }
        
        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #3

        @suslucoder said in How can i collect them in a single if statement?:

        Is it a true approach that using or operand

        You certainly would not want to use an or here, since they do not execute the same statement as each other.

        1 Reply Last reply
        0

        • Login

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