| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause |
| 3 | |
| 4 | #include <QFileDialog> |
| 5 | #include <QtGui> |
| 6 | |
| 7 | int loadFileDialog() |
| 8 | { |
| 9 | //![0] |
| 10 | QList<QUrl> urls; |
| 11 | urls << QUrl::fromLocalFile(localfile: "/Users/foo/Code/qt5") |
| 12 | << QUrl::fromLocalFile(localfile: QStandardPaths::standardLocations(type: QStandardPaths::MusicLocation).first()); |
| 13 | |
| 14 | QFileDialog dialog; |
| 15 | dialog.setSidebarUrls(urls); |
| 16 | dialog.setFileMode(QFileDialog::AnyFile); |
| 17 | if (dialog.exec()) { |
| 18 | // ... |
| 19 | } |
| 20 | //![0] |
| 21 | return 1; |
| 22 | } |
| 23 |
