13 if (parent.isValid()) {
22 if (parent.isValid()) {
31 if (index.row() < 0 || index.row() >=
m_MaskStack->count()) {
38 int col = index.column();
42 if (role == Qt::DecorationRole) {
43 return p->thumbnailImage();
44 }
else if (role == Qt::CheckStateRole) {
45 return (p->get_Used()?Qt::Checked:Qt::Unchecked);
46 }
else if (role == Qt::DisplayRole || role == Qt::EditRole) {
48 return p->get_Title();
53 if (role == Qt::DecorationRole) {
54 return p->thumbnailImage();
55 }
else if (role == Qt::SizeHintRole) {
56 return p->thumbnailImageSize();
59 if (role == Qt::CheckStateRole) {
60 return (p->get_Used()?Qt::Checked:Qt::Unchecked);
61 }
else if (role == Qt::SizeHintRole) {
65 if (role == Qt::DisplayRole || role == Qt::EditRole) {
66 return p->get_Title();
67 }
else if (role==Qt::SizeHintRole) {
82 if (orientation==Qt::Horizontal && role==Qt::DisplayRole) {
93 }
else if (orientation==Qt::Vertical && role==Qt::DisplayRole) {
103 if (!index.isValid()) {
104 return QAbstractItemModel::flags(index) | Qt::ItemIsDropEnabled;
107 return QAbstractItemModel::flags(index) | Qt::ItemIsSelectable |Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsUserCheckable;
112 printf(
"QxrdMaskStackModel::insertRows(%d,%d,...)\n", row, count);
119 printf(
"QxrdMaskStackModel::removeRows(%d,%d,...)\n", row, count);
127 if (index.column() == 0) {
128 if ((index.row() >= 0) && (index.row() <
m_MaskStack->count())) {
131 if ((role == Qt::EditRole || role == Qt::DisplayRole)) {
133 p->set_Title(value.toString());
136 emit dataChanged(index, index);
141 if (role == Qt::CheckStateRole) {
143 p->set_Used(!(p->get_Used()));
146 emit dataChanged(index, index);
153 if ((index.row() >= 0) && (index.row() <
m_MaskStack->count())) {
156 if (index.column() ==
TitleColumn && (role == Qt::EditRole || role == Qt::DisplayRole)) {
158 p->set_Title(value.toString());
161 emit dataChanged(index, index);
168 p->set_Used(!(p->get_Used()));
171 emit dataChanged(index, index);
187 return QAbstractItemModel::supportedDropActions() | Qt::MoveAction;
197 emit beginResetModel();
201 emit endResetModel();
206 emit beginResetModel();
208 emit endResetModel();
QxrdMaskStackPtr m_MaskStack
virtual QVariant data(const QModelIndex &index, int role) const
void setMaskStack(QxrdMaskStackPtr masks)
virtual Qt::ItemFlags flags(const QModelIndex &index) const
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
QxrdMaskStackPtr maskStack()
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
virtual bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex())
virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
QxrdMaskStackModel(QxrdMaskStackPtr masks)
static QString stackLevelName(int n)
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
virtual bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
virtual Qt::DropActions supportedDropActions() const
QSharedPointer< QcepMaskData > QcepMaskDataPtr