| 19 | using namespace GammaRay; |
| 20 | |
| 21 | SelectionModelClient::SelectionModelClient(const QString &objectName, QAbstractItemModel *model, |
| 22 | QObject *parent) |
| 23 | : NetworkSelectionModel(objectName, model, parent) |
| 24 | , m_timer(new QTimer(this)) |
| 25 | { |
| 26 | m_timer->setSingleShot(true); |
| 27 | m_timer->setInterval(125); |
| 28 | Q_ASSERT(model); |
| 29 | // We do use a timer to group requests to avoid network overhead |
| 30 | auto startTimer = [this]() { m_timer->start(); }; |
| 31 | connect(model, &QAbstractItemModel::modelAboutToBeReset, this, &SelectionModelClient::clearPendingSelection); |
| 32 | connect(model, &QAbstractItemModel::rowsInserted, m_timer, startTimer); |
| 33 | connect(model, &QAbstractItemModel::rowsMoved, m_timer, startTimer); |
| 34 | connect(model, &QAbstractItemModel::columnsInserted, m_timer, startTimer); |
| 35 | connect(model, &QAbstractItemModel::columnsMoved, m_timer, startTimer); |
| 36 | connect(model, &QAbstractItemModel::layoutChanged, m_timer, startTimer); |
| 37 | connect(m_timer, &QTimer::timeout, this, &SelectionModelClient::timeout); |
| 38 | |
| 39 | m_myAddress = Client::instance()->objectAddress(objectName); |
| 40 | connect(Client::instance(), &Endpoint::objectRegistered, |
| 41 | this, &SelectionModelClient::serverRegistered); |
| 42 | connect(Client::instance(), &Endpoint::objectUnregistered, |
| 43 | this, &SelectionModelClient::serverUnregistered); |
| 44 | connectToServer(); |
| 45 | } |
| 46 | |
| 47 | SelectionModelClient::~SelectionModelClient() |
| 48 | { |
nothing calls this directly
no test coverage detected