6 connect(masks, SIGNAL(maskChanged()),
this, SLOT(
onMaskChanged()));
11 if (parent.isValid()) {
20 if (parent.isValid()) {
29 if (index.row() < 0 || index.row() >=
m_MaskStack->count()) {
36 int col = index.column();
40 if (role == Qt::DecorationRole) {
41 return p->thumbnailImage();
42 }
else if (role == Qt::CheckStateRole) {
43 return (p->get_Used()?Qt::Checked:Qt::Unchecked);
44 }
else if (role == Qt::DisplayRole || role == Qt::EditRole) {
46 return p->get_Title();
51 if (role == Qt::DecorationRole) {
52 return p->thumbnailImage();
53 }
else if (role == Qt::SizeHintRole) {
54 return p->thumbnailImageSize();
57 if (role == Qt::CheckStateRole) {
58 return (p->get_Used()?Qt::Checked:Qt::Unchecked);
59 }
else if (role == Qt::SizeHintRole) {
63 if (role == Qt::DisplayRole || role == Qt::EditRole) {
64 return p->get_Title();
65 }
else if (role==Qt::SizeHintRole) {
80 if (orientation==Qt::Horizontal && role==Qt::DisplayRole) {
91 }
else if (orientation==Qt::Vertical && role==Qt::DisplayRole) {
101 if (!index.isValid()) {
102 return QAbstractItemModel::flags(index) | Qt::ItemIsDropEnabled;
105 return QAbstractItemModel::flags(index) | Qt::ItemIsSelectable |Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsUserCheckable;
110 printf(
"QxrdMaskListModel::insertRows(%d,%d,...)\n", row, count);
117 printf(
"QxrdMaskListModel::removeRows(%d,%d,...)\n", row, count);
125 if (index.column() == 0) {
126 if ((index.row() >= 0) && (index.row() <
m_MaskStack->count())) {
129 if ((role == Qt::EditRole || role == Qt::DisplayRole)) {
131 p->set_Title(value.toString());
134 emit dataChanged(index, index);
139 if ((role == Qt::CheckStateRole)) {
141 p->set_Used(!(p->get_Used()));
144 emit dataChanged(index, index);
151 if ((index.row() >= 0) && (index.row() <
m_MaskStack->count())) {
154 if (index.column() ==
TitleColumn && (role == Qt::EditRole || role == Qt::DisplayRole)) {
156 p->set_Title(value.toString());
159 emit dataChanged(index, index);
166 p->set_Used(!(p->get_Used()));
169 emit dataChanged(index, index);
185 return QAbstractItemModel::supportedDropActions() | Qt::MoveAction;
195 emit beginResetModel();
199 emit endResetModel();
204 emit beginResetModel();
206 emit endResetModel();
QxrdMaskStackPtr m_MaskStack
void setMaskStack(QxrdMaskStackPtr masks)
virtual Qt::ItemFlags flags(const QModelIndex &index) const
QxrdMaskListModel(QxrdMaskStackPtr masks)
virtual bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
virtual Qt::DropActions supportedDropActions() const
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
virtual bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex())
virtual QVariant data(const QModelIndex &index, int role) const
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
QxrdMaskStackPtr maskStack()
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const