summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp12
-rw-r--r--tools/qml/browser/Browser.qml4
3 files changed, 15 insertions, 3 deletions
diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
index abab33c..9c71004 100644
--- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
@@ -279,7 +279,7 @@ void QDeclarativeFolderListModel::classBegin()
void QDeclarativeFolderListModel::componentComplete()
{
- if (!d->folder.isValid() || !QDir().exists(d->folder.toLocalFile()))
+ if (!d->folder.isValid() || d->folder.toLocalFile().isEmpty() || !QDir().exists(d->folder.toLocalFile()))
setFolder(QUrl(QLatin1String("file://")+QDir::currentPath()));
if (!d->folderIndex.isValid())
diff --git a/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp b/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp
index 21c7197..f19eb03 100644
--- a/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp
+++ b/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp
@@ -238,13 +238,25 @@ void tst_QDeclarativeViewer::loading()
delete viewer;
}
+static int numberOfWarnings = 0;
+static void checkWarnings(QtMsgType, const char *)
+{
+ numberOfWarnings++;
+}
+
void tst_QDeclarativeViewer::fileBrowser()
{
+ QtMsgHandler previousMsgHandler = qInstallMsgHandler(checkWarnings);
QDeclarativeViewer *viewer = new QDeclarativeViewer();
QVERIFY(viewer);
viewer->setUseNativeFileBrowser(false);
viewer->openFile();
viewer->show();
+ QCoreApplication::processEvents();
+ qInstallMsgHandler(previousMsgHandler);
+
+ // QTBUG-15720
+ QVERIFY(numberOfWarnings == 0);
QApplication::setActiveWindow(viewer);
QTest::qWaitForWindowShown(viewer);
diff --git a/tools/qml/browser/Browser.qml b/tools/qml/browser/Browser.qml
index ebed72f..b9573da 100644
--- a/tools/qml/browser/Browser.qml
+++ b/tools/qml/browser/Browser.qml
@@ -180,7 +180,7 @@ Rectangle {
GradientStop { id: t1; position: 0.0; color: palette.highlight }
GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) }
}
- width: view1.currentItem.width
+ width: view1.currentItem == null ? 0 : view1.currentItem.width
}
highlightMoveSpeed: 1000
pressDelay: 100
@@ -230,7 +230,7 @@ Rectangle {
GradientStop { id: t1; position: 0.0; color: palette.highlight }
GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) }
}
- width: view1.currentItem.width
+ width: view1.currentItem == null ? 0 : view1.currentItem.width
}
highlightMoveSpeed: 1000
pressDelay: 100