From 93f9dd759d35f1e2fcf8355b906733a0c6aa85e2 Mon Sep 17 00:00:00 2001 From: Luca Di Sera Date: Wed, 20 Oct 2021 16:06:47 +0200 Subject: Remove deprecated usage of QQmlFileSelector::get in texteditor example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The text editor example adds a "touch" file selector to the qml engine that is used for the application such as to be able to provide an interface for touch based devices. The extra selectors were added by retrieving the engine's file selector trough QQmlFileSelector::get, which was deprecated in Qt 6.0, see commit 75563fa761b94e049de0a29e91591610b0d15745. This resulted in a deprecation warning when the example was built. To avoid the warning and the use of deprecated methods in examples, the example was modified to use the suggested replacement, `QQmlApplicationEngine::setExtraFileSelectors`. A line suggesting the use of the deprecated method was removed from `QQmlFileSelector`'s documentaton page. Fixes: QTBUG-97462 Change-Id: I6ee0306647fe16e75c2cd72f3b37be6c7c5f9261 Reviewed-by: Topi Reiniƶ Reviewed-by: Ulf Hermann (cherry picked from commit 325938018be24fa54b2d06d9e16b040a925580f3) Reviewed-by: Qt Cherry-pick Bot --- examples/quickcontrols2/texteditor/texteditor.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/quickcontrols2/texteditor/texteditor.cpp b/examples/quickcontrols2/texteditor/texteditor.cpp index 9b882dc803..72148c72ea 100644 --- a/examples/quickcontrols2/texteditor/texteditor.cpp +++ b/examples/quickcontrols2/texteditor/texteditor.cpp @@ -57,7 +57,6 @@ #include #include #include -#include #include #include "documenthandler.h" @@ -87,7 +86,7 @@ int main(int argc, char *argv[]) #endif QQmlApplicationEngine engine; - QQmlFileSelector::get(&engine)->setExtraSelectors(selectors); + engine.setExtraFileSelectors(selectors); engine.load(QUrl("qrc:/qml/texteditor.qml")); if (engine.rootObjects().isEmpty()) -- cgit v1.2.3