diff --git a/qmlUiKirigami/Main.qml b/qmlUiKirigami/Main.qml --- a/qmlUiKirigami/Main.qml +++ b/qmlUiKirigami/Main.qml @@ -103,6 +103,16 @@ id: imageFolderModel sourceModel: Koko.ImageFolderModel { url: imagePathArgument + /** + * makes sure that operation only occurs after the model is populated + */ + onRowsInserted: { + if( indexForUrl(imagePathArgument) != -1) { + currentImage.model = this + currentImage.index = indexForUrl(imagePathArgument) + imageViewer.state = "open" + } + } } /* * filterRole is an Item property exposed by the QSortFilterProxyModel diff --git a/src/imagefoldermodel.h b/src/imagefoldermodel.h --- a/src/imagefoldermodel.h +++ b/src/imagefoldermodel.h @@ -71,7 +71,6 @@ Q_SIGNALS: void countChanged(); void urlChanged(); - void showImageViewer(int indexValue); private: QStringList m_mimeTypes; diff --git a/src/imagefoldermodel.cpp b/src/imagefoldermodel.cpp --- a/src/imagefoldermodel.cpp +++ b/src/imagefoldermodel.cpp @@ -92,7 +92,6 @@ } else { m_imagePath = url; directoryUrl = QUrl::fromLocalFile(url.left(url.lastIndexOf('/'))).toString(); - emit showImageViewer( indexForUrl(m_imagePath)); } if (dirLister()->url().path() == directoryUrl) {