Add initial project structure with essential files including .gitignore, application resources, and various model and view components for the application. Implemented asynchronous parsing support and database structure checks.
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
#ifndef COMPONENTTABLEMODEL_H
|
||||
#define COMPONENTTABLEMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QObject>
|
||||
#include "componentmodel.h"
|
||||
|
||||
class ComponentTableModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QStringList propertyNames READ propertyNames WRITE setPropertyNames NOTIFY propertyNamesChanged FINAL)
|
||||
Q_PROPERTY(QStringList variants READ variants WRITE setVariants NOTIFY variantsChanged FINAL)
|
||||
public:
|
||||
explicit ComponentTableModel(QObject *parent = nullptr);
|
||||
|
||||
// Методы QAbstractTableModel
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
|
||||
// Методы для работы с компонентами
|
||||
void addComponent(ComponentModel *component);
|
||||
void removeComponent(int row);
|
||||
void clearComponents();
|
||||
ComponentModel* getComponent(int row) const;
|
||||
QList<ComponentModel*> getComponents() const;
|
||||
|
||||
// Методы для работы с вариантами
|
||||
QString currentVariant() const;
|
||||
void setCurrentVariant(const QString &variant);
|
||||
|
||||
// Методы для работы с именами свойств
|
||||
QStringList propertyNames() const;
|
||||
void setPropertyNames(const QStringList &newPropertyName);
|
||||
|
||||
QStringList variants() const;
|
||||
void setVariants(const QStringList &newVariants);
|
||||
|
||||
signals:
|
||||
void propertyNamesChanged();
|
||||
void currentVariantChanged();
|
||||
|
||||
void variantsChanged();
|
||||
|
||||
private:
|
||||
QList<ComponentModel*> m_components;
|
||||
QString m_currentVariant;
|
||||
QStringList m_columnHeaders;
|
||||
QStringList m_propertyNames;
|
||||
|
||||
// При смене варианта просто обновляем свойства компонентов
|
||||
void updateComponentProperties();
|
||||
QStringList m_variants;
|
||||
};
|
||||
|
||||
#endif // COMPONENTTABLEMODEL_H
|
||||
Reference in New Issue
Block a user