54 if (index.isValid() && (role == Qt::EditRole || role == Qt::DisplayRole)) {
60 nameList << comment.
name;
64 QString desiredName =
value.toString();
65 int splitPoint = desiredName.length();
66 while (desiredName.at(splitPoint - 1).isDigit()) {
70 const QString prefix = desiredName.left(splitPoint);
71 int existingNames = prefix.mid(splitPoint).toInt();
73 while(nameList.contains(desiredName)) {
75 desiredName = prefix + QString::number(existingNames);
79 Q_EMIT dataChanged(index, index);
84 if (index.isValid() && role == Qt::DecorationRole) {
86 Q_EMIT dataChanged(index, index);
141 const QModelIndex &destinationParent,
int destinationChild)
143 if (destinationChild == sourceRow || destinationChild == sourceRow + 1) {
146 if (destinationChild > sourceRow + count - 1) {
148 beginMoveRows(sourceParent, sourceRow, sourceRow + count - 1, destinationParent, destinationChild + count - 1);
149 destinationChild = destinationChild - count;
152 beginMoveRows(sourceParent, sourceRow, sourceRow + count - 1, destinationParent, destinationChild);
154 for (
int row = 0; row < count; row++) {
158 if (destinationChild + row < 0 || destinationChild + row >=
m_commentList.size()) {
195 int row,
int ,
const QModelIndex &parent)
197 if (action == Qt::IgnoreAction) {
200 if (action == Qt::MoveAction &&
data->hasFormat(
"application/x-krita-storyboard")) {
201 QByteArray bytes =
data->data(
"application/x-krita-storyboard");
202 QDataStream stream(&bytes, QIODevice::ReadOnly);
204 if (parent.isValid()) {
209 while (!stream.atEnd()) {
211 QModelIndex index = createIndex(sourceRow, 0);
212 moveRowIndexes.append(index);
214 moveRows(QModelIndex(), moveRowIndexes.at(0).row(), moveRowIndexes.count(), parent, row);