PDA

View Full Version : Retreive QValueVector value



Rayven
1st March 2007, 17:42
NOTE: I am retyping this in, since the code is on a standalone machine with no internet access. Please ignore any spelling mistakes!

I have the following QValueVector declared:


struct TableData{
bool shown;
QVariant data;
QColor color;
}

QValueVector< QValueVector<TableData> > mDataTable;


Subclassing QTable using the TableData, sucessfully popluates the table, however I am trying to reimplement the header sorting functions and getting a compile error:



QValueVector< QValueVector<TableData> > sortedVector;
sortedVector.push_back( mDataTable[0] ); // Works just fine

QValueVector< QValueVector<TableData> >::iterator it;

for( int i = 1; i < mDataTable.size( ); i++ )
{
for( it = sortedVector.begin( ); it != sortedVector.end( ); it++ )
{
// Two errors on this line both dealing with accessing data from the vector
if( mDataTable[i][column].data.toString( ) < it[column].data.toString( ) )
:
:
}
}


The Error says:

Error: data is not a member of QValueVector<TableData>.
for both .data accesses. Is there something I am not understanding about Qt3 vectors?
Thanks

ToddAtWSU
1st March 2007, 17:55
I believe you need to change your if-statement to look like:


if( mDataTable[i][column].data.toString( ) < *( it->at( column ) ).data.toString( ) )

This should fix both of your compiler errors. :cool: