NewServerSettings qml rework

This commit is contained in:
Pokamest Nikak 2021-09-09 20:15:44 +03:00
parent 3175bc1e48
commit 40fa2d6779
34 changed files with 644 additions and 255 deletions

View file

@ -0,0 +1,39 @@
#ifndef SERVERSMODEL_H
#define SERVERSMODEL_H
#include <QAbstractListModel>
#include <vector>
#include <utility>
struct ServerModelContent {
QString desc;
QString address;
bool isDefault;
};
class ServersModel : public QAbstractListModel
{
Q_OBJECT
public:
ServersModel(QObject *parent = nullptr);
public:
enum SiteRoles {
DescRole = Qt::UserRole + 1,
AddressRole,
IsDefaultRole
};
void clearData();
void setContent(const std::vector<ServerModelContent>& data);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
protected:
QHash<int, QByteArray> roleNames() const override;
private:
std::vector<ServerModelContent> content;
};
#endif // SERVERSMODEL_H