LargeDataSetExample Example
#ifndef WINDOW_H
#define WINDOW_H
#include <QDate>
#include <DevMachines/QtitanGrid>
#include "DemoMainWindow.h"
class Window : public DemoMainWindow
{
Q_OBJECT
public:
Window();
QWidget* createSettingsWidget();
private Q_SLOTS:
void autoWidthStateChanged(int state);
void showResizeContentChanged(int state);
void fastScrollChanged(int state);
void dottedLineChanged(int state);
void selectGridLineStyles(int index);
void checkBoxAppearanceChanged(int index);
void zoomEnabledChanged(int state);
void zoomIndicatorChanged(int state);
void cellButtonAutoRaiseEnabled(int state);
void frozenRowsEnabled(int state);
void transparentBackgroundEnabled(int state);
void rowSizingEnabled(int);
void contextMenu(ContextMenuEventArgs* args);
void cellButtonClicked(CellButtonClickEventArgs* args);
void printPreview();
void editorModifying(GridEditor* editor);
void editorValidating(EditorValidationEventArgs* args);
void editorUpdated(GridEditor* editor);
void editorStarting(EditorEventArgs* args);
void setShadeColor(const QColor& color) override;
void zoomValueChanged(int value);
void focusRowChanged(int oldRowIndex, int rowIndex);
private:
Qtitan::Grid* m_grid;
};
class LargeDataSetModel: public QAbstractItemModel
{
Q_OBJECT
public:
LargeDataSetModel(QObject *parent = 0);
~LargeDataSetModel() override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant& value, int role) override;
QModelIndex parent(const QModelIndex &child) const override;
bool hasChildren(const QModelIndex &parent) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, 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;
private:
struct DataItem
{
bool v0;
int v1;
QString v2;
QDate v3;
QTime v4;
QString v5;
DataItem() : v0(false), v1(0) {}
};
QVector<QString> m_header;
QVector<DataItem> m_values;
};
#endif