Qt World Summit: Register Today!

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

  • 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!

  • Lifetime Qt Champion


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

  • @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!

Log in to reply