QVariant AttributesTableModel::data(const QModelIndex &index, int role) const{ if(!index.isValid()) return QVariant(); if(qLstAttributes->count()==0) return QVariant(); if(role == Qt::DisplayRole) { return qLstAttributes->at(index.row()).at(index.column()); } if (role == Qt::DecorationRole) { return QIcon(QApplication::applicationDirPath() + "1.png");//&qIcnOk; //ЗДЕСЬ ХОЧУ ОТОБРАЖАТЬ ИКОНКИ } if (role == Qt::TextAlignmentRole) { return QVariant(Qt::AlignVCenter | Qt::AlignLeft); } if (role == Qt::BackgroundColorRole) { if(index.column()==0) return QColor(210, 210, 210); } return QVariant();}
if (role == Qt::DecorationRole) { QIcon i;// = new QIcon(QApplication::applicationDirPath() + "1.png"); i.addFile(QApplication::applicationDirPath() + "1.png"); if(i.isNull()) return QVariant(); return i;//&qIcnOk; }
if (role == Qt::DecorationRole) { QIcon i;// = new QIcon(QApplication::applicationDirPath() + "1.png"); QString path = QApplication::applicationDirPath() + "/1.png"; i.addFile(path, QSize(20,20), QIcon::Active, QIcon::On); //i.actualSize(QSize(10,10)); if(i.isNull()) return QVariant(); return i;//&qIcnOk; return icon;//&qIcnOk; }