-2

I need to connect a QAbstractItemModel on a client computer to data on a server computer. I already have a nice class which handles data requests/responses asynchronously across the network (from another project), which emits a signal when data arrives.

I'm just trying to figure out how to allow the QAbstractItemModel methods (like data and rowCount) to behave asynchronously. I can override these methods and insert an eventloop which exits on data arrival, but that doesn't feel right.

I'm sure I once saw an example of this online but cannot find it. Can someone offer or point to a way to achieve this?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
TSG
  • 4,242
  • 9
  • 61
  • 121

1 Answers1

0

From what I can find online, you should NOT use an eventloop to cause the QAIM to wait in any of its methods.

Instead, return an immediate value with an option 'datavalid' flag which the view should use to present/hide output. Then request data from the remote model, and upon receipt issue the data changed signal for the view to update the data onscreen.

TSG
  • 4,242
  • 9
  • 61
  • 121