From 2f5be55b697c1d406deabae95d095b70fe48d644 Mon Sep 17 00:00:00 2001 From: Dennis Oberst Date: Wed, 17 Jan 2024 11:28:11 +0100 Subject: [PATCH] Filesystem Explorer: Guard against mobile usage It was observed that users try to run this example on mobile platforms. It was never designed for such a usecase and is therefore not supported. Ref: https://camg.me/qt-mobile-2023/#filesystem Additionally mention that this is a desktop example in the docs. Change-Id: I55205e3f2cb3a45aaf18f2a52ea24f54ab8e39bd Reviewed-by: Mitch Curtis (cherry picked from commit 9e4f24e7491ebd8e26a7ca4d56046e558b57154c) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 15d27caf011f6cf1392585e10ae4b925d0257aba) --- examples/quickcontrols/CMakeLists.txt | 2 +- examples/quickcontrols/filesystemexplorer/CMakeLists.txt | 5 +++++ .../doc/src/qtquickcontrols-filesystemexplorer.qdoc | 4 ++-- .../quickcontrols/filesystemexplorer/filesystemexplorer.pro | 4 ++++ examples/quickcontrols/quickcontrols.pro | 5 ++++- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/examples/quickcontrols/CMakeLists.txt b/examples/quickcontrols/CMakeLists.txt index 63a443bd43..47f6281c75 100644 --- a/examples/quickcontrols/CMakeLists.txt +++ b/examples/quickcontrols/CMakeLists.txt @@ -13,7 +13,7 @@ qt_internal_add_example(texteditor) qt_internal_add_example(contactlist) qt_internal_add_example(wearable) qt_internal_add_example(imagine/automotive) -if (TARGET Qt6::Svg) +if (TARGET Qt6::Svg AND NOT ANDROID AND NOT IOS) qt_internal_add_example(filesystemexplorer) endif() if(TARGET Qt6::Widgets) diff --git a/examples/quickcontrols/filesystemexplorer/CMakeLists.txt b/examples/quickcontrols/filesystemexplorer/CMakeLists.txt index 53eeb7b4e6..4a676d28d8 100644 --- a/examples/quickcontrols/filesystemexplorer/CMakeLists.txt +++ b/examples/quickcontrols/filesystemexplorer/CMakeLists.txt @@ -4,6 +4,11 @@ cmake_minimum_required(VERSION 3.16) project(filesystemexplorer LANGUAGES CXX) +if (ANDROID OR IOS) + message(FATAL_ERROR "Platform is not supported") + return() +endif () + if (NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif () diff --git a/examples/quickcontrols/filesystemexplorer/doc/src/qtquickcontrols-filesystemexplorer.qdoc b/examples/quickcontrols/filesystemexplorer/doc/src/qtquickcontrols-filesystemexplorer.qdoc index 8c950a67c7..686c2ab48a 100644 --- a/examples/quickcontrols/filesystemexplorer/doc/src/qtquickcontrols-filesystemexplorer.qdoc +++ b/examples/quickcontrols/filesystemexplorer/doc/src/qtquickcontrols-filesystemexplorer.qdoc @@ -6,8 +6,8 @@ \meta tags {quickcontrols, layout, styling, treeview} \title File System Explorer \ingroup qtquickcontrols-examples - \brief A QML app utilizing customized Qt Quick Controls to display text - files from a filesystem. + \brief A desktop QML app utilizing customized Qt Quick Controls to display + text files from a filesystem. In this example, a modern layout is used that consists of three major components. There is an icon-based \e {Sidebar} to the left, followed by a diff --git a/examples/quickcontrols/filesystemexplorer/filesystemexplorer.pro b/examples/quickcontrols/filesystemexplorer/filesystemexplorer.pro index 3748d9577b..817c03c0d5 100644 --- a/examples/quickcontrols/filesystemexplorer/filesystemexplorer.pro +++ b/examples/quickcontrols/filesystemexplorer/filesystemexplorer.pro @@ -1,6 +1,10 @@ # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause +android|ios { + error( "Platform not supported" ) +} + QT += quick CONFIG += qmltypes diff --git a/examples/quickcontrols/quickcontrols.pro b/examples/quickcontrols/quickcontrols.pro index 44644e9ba9..7baf731218 100644 --- a/examples/quickcontrols/quickcontrols.pro +++ b/examples/quickcontrols/quickcontrols.pro @@ -5,8 +5,11 @@ SUBDIRS += \ texteditor \ contactlist \ wearable \ - filesystemexplorer \ imagine/automotive +win32|macos|unix { + qtHaveModule(svg): SUBDIRS += filesystemexplorer +} + qtHaveModule(sql): SUBDIRS += eventcalendar qtHaveModule(widgets): SUBDIRS += flatstyle