LibreCAD
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
linepatternmodel.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <QAbstractTableModel>
4 #include <QIcon>
5 #include <QPixmap>
6 
7 #include <cad/meta/dxflinepattern.h>
8 
10 
11 #define PREVIEW_WIDTH 100
12 #define PREVIEW_HEIGHT 20
13 
18 class LinePatternModel : public QAbstractTableModel {
19  Q_OBJECT
20 
21  public:
22  enum columns {
27  };
28 
33  LinePatternModel(QObject* parent = 0);
34 
40  void setLinePatterns(std::vector<lc::DxfLinePatternByValue_CSPtr> linePatterns);
41 
47  lc::DxfLinePattern_CSPtr linePatternAt(const int index) const;
48 
49  int rowCount(const QModelIndex &parent = QModelIndex()) const;
50  int columnCount(const QModelIndex &parent = QModelIndex()) const;
51  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
52 
53  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
54 
55  private:
56  std::vector<lc::DxfLinePatternByValue_CSPtr> _linePatterns;
57 };
int rowCount(const QModelIndex &parent=QModelIndex()) const
int columnCount(const QModelIndex &parent=QModelIndex()) const
QVariant headerData(int section, Qt::Orientation orientation, int role) const
void setLinePatterns(std::vector< lc::DxfLinePatternByValue_CSPtr > linePatterns)
Set the new list of line patterns.
Model to display a list of DxfLinePatterns in a QTableView. Show preview, name and description...
std::vector< lc::DxfLinePatternByValue_CSPtr > _linePatterns
LinePatternModel(QObject *parent=0)
Create widget.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
lc::DxfLinePattern_CSPtr linePatternAt(const int index) const
Return line pattern at specific row.