Hello,
I need to develop a spreadsheet widget with sorting capabilities on columns, where the presentation of the data inside each cell would depend on the type of data, and I would like to do some operations on a selection of cells (calculate the sum of the cells' values for instance).
QTableWidget sounds a good option but the the Model/View Programming documentaiton warns against:
"A number of convenience classes are derived from the standard view classes for the benefit of applications that rely on Qt's item-based item view and table classes. They are not intended to be subclassed, but simply exist to provide a familiar interface to the equivalent classes in Qt 3. Examples of such classes include QListWidget, QTreeWidget, and QTableWidget; these provide similar behavior to the QListBox, QListView, and QTable classes in Qt 3.
These classes are less flexible than the view classes, and cannot be used with arbitrary models. We recommend that you use a model/view approach to handling data in item views unless you strongly need an item-based set of classes. " Pretty strong words!
Using the QTableView road, I used the QSortFilterProxyModel to sort the columns and it works fine. How should I go with the presentation of the cell's content (an equivalent to QTableWidgetItem would be nice) and what about the handling of selection (somethings like QTableWidgetSelectionRange would help)?
Many thanks in advance