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. Error message: Request for member ' ' in ' ' which is of non-class Type QString
Forum Updated to NodeBB v4.3 + New Features

Error message: Request for member ' ' in ' ' which is of non-class Type QString

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 5.8k 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.
  • E Offline
    E Offline
    engsml
    wrote on last edited by
    #1

    I have a struct as follows:

    struct MyStruct {
    double col1;
    double col2;
    };

    That I use for the elements in a QVector called MyArray of type MyStruct. I am wondering why these statements compile:

    double xMax, xMin, yMax, yMin;
    xMax = MyArray.value(0).col1;
    xMin = MyArray.value(0).col1;

    but these don't and display the error message: "Request for member 'value ' in 'myArray ' which is of non-class Type QString":

    yMax = myArray.value(0).col2;
    yMin = my Array.value(0).col2;

    I am just trying to get the first elements to use for comparisons of max and min values in a for loop. I am confused why the xMax and xMin compiles, but the yMax and yMin doesn't compile even though they are instantiated the exact same way? Any help would be appreciated!

    aha_1980A 1 Reply Last reply
    0
    • E engsml

      I have a struct as follows:

      struct MyStruct {
      double col1;
      double col2;
      };

      That I use for the elements in a QVector called MyArray of type MyStruct. I am wondering why these statements compile:

      double xMax, xMin, yMax, yMin;
      xMax = MyArray.value(0).col1;
      xMin = MyArray.value(0).col1;

      but these don't and display the error message: "Request for member 'value ' in 'myArray ' which is of non-class Type QString":

      yMax = myArray.value(0).col2;
      yMin = my Array.value(0).col2;

      I am just trying to get the first elements to use for comparisons of max and min values in a for loop. I am confused why the xMax and xMin compiles, but the yMax and yMin doesn't compile even though they are instantiated the exact same way? Any help would be appreciated!

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @engsml

      It might be a silly questions, but is there a difference between myArray and MyArray?

      Qt has to stay free or it will die.

      E 1 Reply Last reply
      2
      • aha_1980A aha_1980

        @engsml

        It might be a silly questions, but is there a difference between myArray and MyArray?

        E Offline
        E Offline
        engsml
        wrote on last edited by
        #3

        @aha_1980 that was the error! I realized a few seconds after I posted the question. I didn't capitalize the "m" in MyArray and it led to that error. I guess it was just some weird C++ that the error message had nothing to do with the variable name I guess!

        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