diff options
author | Luca Di Sera <luca.disera@qt.io> | 2021-10-20 16:06:47 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-10-22 14:47:26 +0000 |
commit | 93f9dd759d35f1e2fcf8355b906733a0c6aa85e2 (patch) | |
tree | 40637b8dfa1d68ba009d87eb8f72c4077743dfd0 /examples | |
parent | f9eaa917ae807fb8e4d3a29421d5853b0a8dc543 (diff) |
Remove deprecated usage of QQmlFileSelector::get in texteditor example
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ƶ <topi.reinio@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 325938018be24fa54b2d06d9e16b040a925580f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/quickcontrols2/texteditor/texteditor.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
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 <QDebug> #include <QQmlApplicationEngine> #include <QQmlContext> -#include <QQmlFileSelector> #include <QQuickStyle> #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()) |