mardi 23 juin 2015

Communication between models

My program loads records (one per line) from file in raw format.

I have some Views for displaying this data in different ways:

  • Byte View
  • Decimal View (by doing some calculations with byte ranges)

Both Views must provide the ability for editing values.

Here is some code:

class Record
{
public:
  void setByte (int position, Byte byte);
  void setValue (ValueType type, Value value);

  Byte getByte (int position) const;
  Value getValue (ValueType type) const;

private:
  RawData data;
}

I'm loading records in

QVector<Record> records;

Byte View is a simple table with hex bytes (row - line number, column - byte position). Decimal View is a table too (row - line number, one column - value).

So,what's the best way to design Model(s) for my Views with the ability to communicate with each other (f.e. sending signals when a data was modified from one of the Views)?

Sorry for my awful English.

Aucun commentaire:

Enregistrer un commentaire