Skip to content

Commit

Permalink
Better handling of filter removal - prevent crash
Browse files Browse the repository at this point in the history
  • Loading branch information
bmatherly committed Oct 25, 2014
1 parent 037e572 commit 0dc318c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/glwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,9 @@ void GLWidget::setOffsetY(int y)

void GLWidget::setCurrentFilter(QmlFilter* filter, QmlMetadata* meta)
{
if (QFile::exists(meta->vuiFilePath())) {
rootContext()->setContextProperty("filter", filter);
setSource(QUrl());
rootContext()->setContextProperty("filter", filter);
if (meta && QFile::exists(meta->vuiFilePath())) {
setSource(QUrl::fromLocalFile(meta->vuiFilePath()));
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/qml/views/filter/filterview.qml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
onSelectedIndexChanged: {
filterConfig.source = ""
root.currentFilterRequested(selectedIndex)
filterConfig.source = metadata ? metadata.qmlFilePath : ""
}
Expand All @@ -83,7 +84,7 @@ Rectangle {
opacity: enabled ? 1.0 : 0.5
tooltip: qsTr('Remove Selected Filter')
onClicked: {
console.log("Remove Filter Requested", attachedFilters.selectedIndex)
filterConfig.source = ""
root.removeFilterRequested(attachedFilters.selectedIndex)
}
}
Expand Down

0 comments on commit 0dc318c

Please sign in to comment.