mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
fixed resorting comics by drag&drop in tags and reading lists
This commit is contained in:
parent
8179092d56
commit
71d9254446
@ -119,6 +119,10 @@ bool ComicModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int
|
|||||||
QLOG_TRACE() << newSorting;
|
QLOG_TRACE() << newSorting;
|
||||||
|
|
||||||
int tempRow = row;
|
int tempRow = row;
|
||||||
|
|
||||||
|
if(tempRow < 0)
|
||||||
|
tempRow = _data.count();
|
||||||
|
|
||||||
foreach(qulonglong id, comicIds)
|
foreach(qulonglong id, comicIds)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -126,21 +130,28 @@ bool ComicModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int
|
|||||||
if(item->data(Id) == id)
|
if(item->data(Id) == id)
|
||||||
{
|
{
|
||||||
beginMoveRows(parent,i,i,parent,tempRow);
|
beginMoveRows(parent,i,i,parent,tempRow);
|
||||||
_data.removeAll(item);
|
|
||||||
_data.insert(tempRow++, item);
|
bool skipElement = i == tempRow || i + 1 == tempRow;
|
||||||
|
|
||||||
|
if(!skipElement)
|
||||||
|
{
|
||||||
|
if(i > tempRow)
|
||||||
|
_data.move(i, tempRow);
|
||||||
|
else
|
||||||
|
_data.move(i, tempRow - 1);
|
||||||
|
}
|
||||||
|
|
||||||
endMoveRows();
|
endMoveRows();
|
||||||
|
|
||||||
|
if(i > tempRow)
|
||||||
|
tempRow++;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if(!beginMoveRows(parent,currentIndexes.first(),currentIndexes.last(),parent,row))
|
|
||||||
return false;*/
|
|
||||||
_data = resortedData; //TODO No longer needed
|
|
||||||
|
|
||||||
|
|
||||||
//TODO emit signals
|
|
||||||
//TODO fix selection
|
//TODO fix selection
|
||||||
QList<qulonglong> allComicIds;
|
QList<qulonglong> allComicIds;
|
||||||
foreach (ComicItem *item, _data) {
|
foreach (ComicItem *item, _data) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user