mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
fixed bug on folders view navigation after using the search
This commit is contained in:
parent
b8b51b2ba5
commit
1c2590957e
@ -299,8 +299,6 @@ void LibraryWindow::doModels()
|
|||||||
dm = new TreeModel();
|
dm = new TreeModel();
|
||||||
//comics
|
//comics
|
||||||
dmCV = new TableModel();
|
dmCV = new TableModel();
|
||||||
//comics selection
|
|
||||||
sm = new QItemSelectionModel(dm);
|
|
||||||
|
|
||||||
setFoldersFilter("");
|
setFoldersFilter("");
|
||||||
}
|
}
|
||||||
@ -797,7 +795,6 @@ void LibraryWindow::loadLibrary(const QString & name)
|
|||||||
if(comparation == 0 || updated) //en caso de que la versión se igual que la actual
|
if(comparation == 0 || updated) //en caso de que la versión se igual que la actual
|
||||||
{
|
{
|
||||||
index = 0;
|
index = 0;
|
||||||
sm->clear();
|
|
||||||
|
|
||||||
dm->setupModelData(path);
|
dm->setupModelData(path);
|
||||||
foldersView->setModel(dm);
|
foldersView->setModel(dm);
|
||||||
@ -906,7 +903,6 @@ void LibraryWindow::loadLibrary(const QString & name)
|
|||||||
|
|
||||||
void LibraryWindow::loadCovers(const QModelIndex & mi)
|
void LibraryWindow::loadCovers(const QModelIndex & mi)
|
||||||
{
|
{
|
||||||
_rootIndexCV = mi;
|
|
||||||
unsigned long long int folderId = 1;
|
unsigned long long int folderId = 1;
|
||||||
if(mi.isValid())
|
if(mi.isValid())
|
||||||
{
|
{
|
||||||
@ -1002,7 +998,7 @@ void LibraryWindow::checkEmptyFolder(QStringList * paths)
|
|||||||
|
|
||||||
void LibraryWindow::reloadCovers()
|
void LibraryWindow::reloadCovers()
|
||||||
{
|
{
|
||||||
loadCovers(_rootIndexCV);
|
loadCovers(foldersView->currentIndex());
|
||||||
|
|
||||||
QModelIndex mi = dmCV->getIndexFromId(_comicIdEdited);
|
QModelIndex mi = dmCV->getIndexFromId(_comicIdEdited);
|
||||||
comicView->scrollTo(mi,QAbstractItemView::PositionAtCenter);
|
comicView->scrollTo(mi,QAbstractItemView::PositionAtCenter);
|
||||||
@ -1397,8 +1393,8 @@ void LibraryWindow::setFoldersFilter(QString filter)
|
|||||||
{
|
{
|
||||||
QModelIndex mi = dm->indexFromItem(index,column);
|
QModelIndex mi = dm->indexFromItem(index,column);
|
||||||
foldersView->scrollTo(mi,QAbstractItemView::PositionAtTop);
|
foldersView->scrollTo(mi,QAbstractItemView::PositionAtTop);
|
||||||
sm->select(mi,QItemSelectionModel::Select);
|
updateHistory(mi);
|
||||||
foldersView->setSelectionModel(sm);
|
foldersView->setCurrentIndex(mi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1704,6 +1700,8 @@ void LibraryWindow::forward()
|
|||||||
void LibraryWindow::updateHistory(const QModelIndex &mi)
|
void LibraryWindow::updateHistory(const QModelIndex &mi)
|
||||||
{
|
{
|
||||||
//remove history from current index
|
//remove history from current index
|
||||||
|
if(!mi.isValid())
|
||||||
|
return;
|
||||||
int numElementsToRemove = history.count() - (currentFolderNavigation+1);
|
int numElementsToRemove = history.count() - (currentFolderNavigation+1);
|
||||||
while(numElementsToRemove>0)
|
while(numElementsToRemove>0)
|
||||||
{
|
{
|
||||||
|
@ -95,7 +95,6 @@ private:
|
|||||||
YACReaderTreeView * foldersView;
|
YACReaderTreeView * foldersView;
|
||||||
YACReaderLibraryListWidget * selectedLibrary;
|
YACReaderLibraryListWidget * selectedLibrary;
|
||||||
TreeModel * dm;
|
TreeModel * dm;
|
||||||
QItemSelectionModel * sm;
|
|
||||||
TableModel * dmCV;
|
TableModel * dmCV;
|
||||||
//QStringList paths;
|
//QStringList paths;
|
||||||
QMap<QString,QString> libraries;
|
QMap<QString,QString> libraries;
|
||||||
@ -171,8 +170,8 @@ private:
|
|||||||
QString _lastAdded;
|
QString _lastAdded;
|
||||||
QString _sourceLastAdded;
|
QString _sourceLastAdded;
|
||||||
|
|
||||||
QModelIndex _rootIndex;
|
//QModelIndex _rootIndex;
|
||||||
QModelIndex _rootIndexCV;
|
//QModelIndex _rootIndexCV;
|
||||||
|
|
||||||
quint64 _comicIdEdited;
|
quint64 _comicIdEdited;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user