Not sure how to proceed and before getting in too deep I have a few questions. I will start with a small code example.
typedef struct mystructure {
int x;
QList<mystructure> children;
} mystructure;
QList<mystructure> mystructureList; // List of parent QTreeWidgetItem(s) only need these items as children references will be contained in mystructure
QHash<QTreeWidgetItem *,mystructure> mystructureFromItem; // lookup hash using QTreeWidgetItem index for mystructure
typedef struct mystructure {
QTreeWidgetItem *item;
int x;
QList<mystructure> children;
} mystructure;
QList<mystructure> mystructureList; // List of parent QTreeWidgetItem(s) only need these items as children references will be contained in mystructure
QHash<QTreeWidgetItem *,mystructure> mystructureFromItem; // lookup hash using QTreeWidgetItem index for mystructure
To copy to clipboard, switch view to plain text mode
My problem arises since I am not using pointers if I have already appended a mystructure to the QList and add more children after that fact they will not be stored.
If I Q_DECLARE_METATYPE(mystructure) I would have to implement == functionality for QList in order to use indexOf() features to just replace the entry with the updated data.
Should I just use a standard pointer linked list instead of forcing this into Qt mechanics? Or is there just something else I am missing?
Bob
EDIT: Forgot to add the question of making QList<mystructure> *mystructureList, and QList<mystructure> *children. In this case would I need to do my own memory release or would Qt's garbage collection take care of it?
Bookmarks