[PyQt] Question regarding single model and multiple views...
bvz at c381.com
Thu Oct 1 01:08:40 BST 2009
I am new(ish) to PyQt and I am trying to build a simple app.
The app has several tables that I want to point to a single model (which
will load and store all the data).
Each table is responsible for displaying a different set of columns from the
model. I.e. table 1 will show columns 1-4, table 2 columns 5-11, etc...
The app does not know how many tables there will be ahead of time, nor does
it know how many columns will be displayed in each table. Both of these are
set by reading a config file.
I have a version working where I use a QTableWidget and manually sync the
data from the "model" (not actually a subclass of QAbstractTableModel). But
there are some issues with this and, anyway, it isn't the "correct" way of
working as far as I can tell.
I really want to update the app to use the QAbstractTableModel (no
delegates). I mostly understand the process and am pretty far along with
one exception. How do I translate the "actual" column index in the table to
the associated index in the model. I.e. if the user updates a cell in
column 3 of the 2nd table, that might actually be a bit of data that is in
column 7 of the model. I need to be able to map the table column to the
model column and vice versa.
So I am wondering, is there some way the table view can send along an offset
every time it tries to send data to or from the model? If I can get that
info, I can always translate inside the model and return/set the correct
View this message in context: http://www.nabble.com/Question-regarding-single-model-and-multiple-views...-tp25691301p25691301.html
Sent from the PyQt mailing list archive at Nabble.com.
More information about the PyQt