aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/models/threadedfetchmore/fetchworker.h
blob: 6aee317516bbd105727937e562a48bd15deab118 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#ifndef FETCHWORKER_H
#define FETCHWORKER_H

#include <QObject>

class FetchWorker : public QObject
{
    Q_OBJECT
public:
    struct DataBlock
    {
        QString title;
        QString subtitle;
        int number;
    };

    explicit FetchWorker(QObject *parent = nullptr);

signals:
    void dataFetched(const QList<FetchWorker::DataBlock> &items);
    void noMoreToFetch();

public slots:
    void fetchDataBlock();

private:
    static QList<FetchWorker::DataBlock> slowDataConstruction(int fromIndex);
    int m_existingItemsCount{0};
};

#endif // FETCHWORKER_H