4 QAbstractTableModel(parent) {
28 if (!index.isValid()) {
34 if(role == Qt::DecorationRole && index.column() ==
PREVIEW) {
37 auto linePatternByValue = std::dynamic_pointer_cast<
const lc::DxfLinePatternByValue>(linePattern);
39 if(linePatternByValue !=
nullptr) {
41 painter.drawLinePattern();
47 if(role == Qt::SizeHintRole && index.column() ==
PREVIEW) {
51 if(role == Qt::DisplayRole) {
52 switch (index.column()) {
54 return linePattern->name().c_str();
57 return linePattern->description().c_str();
65 if (orientation == Qt::Horizontal) {
66 if(role == Qt::DisplayRole) {
80 return QAbstractTableModel::headerData(section, orientation, role);
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.
std::vector< lc::DxfLinePatternByValue_CSPtr > _linePatterns
LinePatternModel(QObject *parent=0)
Create widget.
Painting line patterns on a QPaintDevice.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
lc::DxfLinePattern_CSPtr linePatternAt(const int index) const
Return line pattern at specific row.