steg90
4th June 2008, 09:45
Hi,
Having to do some modifications to some code someone did well over 10 months ago. Part of this is to sort some data in ascending order within a QTableView. Now I noticed it uses a model ( QAbstractTableModel ). The data seems to be stored within a QList. The objects that are stored in this QList are of the following :
class ASignal
{
public:
ASignal() { }
char name[256];
char unit[256];
char strECU[20];
double dmaximum;
double dminimum;
double dfactor;
double doffset;
UINT istartbit;
UINT ilength;
double realvalue;
long rawvalue;
double byteorder;
};
I want to sort this QList<ASignal*> on the member name. What is the best and quickest way of achieving this? Before the data is inserted into the QList should I do some checking and use swap etc?
Kind regards,
Steve
Having to do some modifications to some code someone did well over 10 months ago. Part of this is to sort some data in ascending order within a QTableView. Now I noticed it uses a model ( QAbstractTableModel ). The data seems to be stored within a QList. The objects that are stored in this QList are of the following :
class ASignal
{
public:
ASignal() { }
char name[256];
char unit[256];
char strECU[20];
double dmaximum;
double dminimum;
double dfactor;
double doffset;
UINT istartbit;
UINT ilength;
double realvalue;
long rawvalue;
double byteorder;
};
I want to sort this QList<ASignal*> on the member name. What is the best and quickest way of achieving this? Before the data is inserted into the QList should I do some checking and use swap etc?
Kind regards,
Steve