Any Qt users in here? Would love some advice!
I started developing a GUI app with a fairly straightforward structure. The main workspace consists of QWidget objects (each with their own set of basic widgets on them, like line edits, comboboxes, etc.) embedded on QTabWidget tabs. Navigation is supplemented by a QTreeWidget object that acts as a tab browser/explorer. The signals and slots are connected in a way that clicking on any item in the tree widget will activate the item's corresponding tab. To achieve this, I set each tab's widget as each corresponding tree widget item's data by using the QTreeWidgetItem class's setData method.
There's more to it, of course, but that's the crux of it. I'm seeking advice with respect to writing to and reading from disk. Although I'm toying with other methods, my initial inclination is to save in binary format via a QDataStream object. Unfortunately, objects subclassed directly from QWidget can't themselves be written to the stream. So, prior to writing each tree widget item, I need to write to the stream each QWidget object's component widgets (line edits, comboboxes, etc.), then reset the tree item's data to strip out the QWidget object, and finally write the tree widget item itself (the class of which has its own read/write methods to read from/write to a binary data stream). Of course, when I then read that data in, I've got a mass of unstructured data, and to re-structure (and, in essence, re-create) the file I more or less need to call my own custom tree-item/tab pair creation methods (which are used for creating tree-item/tab pairs outside of just reading/writing to disk) on each tree item that is read in.
Am I approaching this the right way? (I mean, I gave it a few cursory tests before going to bed last night, and it works, but it *feels* like a workaround hack, and I strive for something better than merely functioning, and since I was just toying around with this yesterday I haven't yet gotten the chance to see how long the read/write operations would take on a file heftier than a mere 20k.) Note that I'm using a Python binding for Qt, but that ought to be irrelevant for this.