diff options
Diffstat (limited to 'examples')
19 files changed, 100 insertions, 114 deletions
diff --git a/examples/qml/doc/src/qml-extending.qdoc b/examples/qml/doc/src/qml-extending.qdoc index 310436759e..ca244d7fce 100644 --- a/examples/qml/doc/src/qml-extending.qdoc +++ b/examples/qml/doc/src/qml-extending.qdoc @@ -165,7 +165,7 @@ developed in the previous examples into two types - a \c Boy and a \c Girl. \section1 Declare Boy and Girl -\snippet referenceexamples/coercion/person.h 0 +\snippet referenceexamples/coercion/person.h 1 The Person class remains unaltered in this example and the Boy and Girl C++ classes are trivial extensions of it. The types and their QML name are diff --git a/examples/qml/networkaccessmanagerfactory/view.qml b/examples/qml/networkaccessmanagerfactory/view.qml index da90e531b5..1c496bd623 100644 --- a/examples/qml/networkaccessmanagerfactory/view.qml +++ b/examples/qml/networkaccessmanagerfactory/view.qml @@ -53,5 +53,5 @@ import QtQuick 2.0 Image { width: 200 height: 100 - source: "http://doc.qt.io/qt-5/images/logo.png" + source: "http://doc.qt.io/qt-6/images/logo.png" } diff --git a/examples/qml/referenceexamples/coercion/person.h b/examples/qml/referenceexamples/coercion/person.h index 1ec095e841..aa2100f2da 100644 --- a/examples/qml/referenceexamples/coercion/person.h +++ b/examples/qml/referenceexamples/coercion/person.h @@ -77,8 +77,7 @@ private: int m_shoeSize = 0; }; - -// ![0] +// ![1] class Boy : public Person { Q_OBJECT @@ -97,6 +96,6 @@ public: }; //! [girl class] -// ![0] +// ![1] #endif // PERSON_H diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt index 28efcaace8..101fcb036b 100644 --- a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt +++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt @@ -44,3 +44,5 @@ install(TARGETS chartsplugin BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qmldir + DESTINATION "${INSTALL_EXAMPLEDIR}") diff --git a/examples/quickcontrols2/chattutorial/chapter1/chapter1.pro b/examples/quickcontrols2/chattutorial/chapter1/chapter1.pro index 221bb855f5..6b50809f20 100644 --- a/examples/quickcontrols2/chattutorial/chapter1/chapter1.pro +++ b/examples/quickcontrols2/chattutorial/chapter1/chapter1.pro @@ -5,8 +5,9 @@ CONFIG += c++11 SOURCES += main.cpp -RESOURCES += \ - main.qml \ +resources.files = main.qml +resources.prefix = chapter1/ +RESOURCES += resources \ qtquickcontrols2.conf target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter1 diff --git a/examples/quickcontrols2/chattutorial/chapter2/chapter2.pro b/examples/quickcontrols2/chattutorial/chapter2/chapter2.pro index e217934b7e..15429b7c89 100644 --- a/examples/quickcontrols2/chattutorial/chapter2/chapter2.pro +++ b/examples/quickcontrols2/chattutorial/chapter2/chapter2.pro @@ -5,7 +5,7 @@ CONFIG += c++11 SOURCES += main.cpp -RESOURCES += \ +resources.files = \ images/Albert_Einstein.png \ images/Albert_Einstein@2x.png \ images/Albert_Einstein@3x.png \ @@ -18,7 +18,9 @@ RESOURCES += \ images/Hans_Gude@2x.png \ images/Hans_Gude@3x.png \ images/Hans_Gude@4x.png \ - main.qml \ + main.qml +resources.prefix = chapter2/ +RESOURCES += resources \ qtquickcontrols2.conf target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter2 diff --git a/examples/quickcontrols2/chattutorial/chapter3/chapter3.pro b/examples/quickcontrols2/chattutorial/chapter3/chapter3.pro index a5e500d9db..42adc69fe9 100644 --- a/examples/quickcontrols2/chattutorial/chapter3/chapter3.pro +++ b/examples/quickcontrols2/chattutorial/chapter3/chapter3.pro @@ -5,7 +5,7 @@ CONFIG += c++11 SOURCES += main.cpp -RESOURCES += \ +resources.files = \ ContactPage.qml \ ConversationPage.qml \ images/Albert_Einstein.png \ @@ -20,7 +20,9 @@ RESOURCES += \ images/Hans_Gude@2x.png \ images/Hans_Gude@3x.png \ images/Hans_Gude@4x.png \ - main.qml \ + main.qml +resources.prefix = chapter3/ +RESOURCES += resources \ qtquickcontrols2.conf target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter3 diff --git a/examples/quickcontrols2/chattutorial/chapter4/chapter4.pro b/examples/quickcontrols2/chattutorial/chapter4/chapter4.pro index dd2241355b..ae8141f7f1 100644 --- a/examples/quickcontrols2/chattutorial/chapter4/chapter4.pro +++ b/examples/quickcontrols2/chattutorial/chapter4/chapter4.pro @@ -10,7 +10,7 @@ SOURCES += main.cpp \ sqlcontactmodel.cpp \ sqlconversationmodel.cpp -RESOURCES += \ +resources.files = \ ContactPage.qml \ ConversationPage.qml \ images/Albert_Einstein.png \ @@ -25,7 +25,9 @@ RESOURCES += \ images/Hans_Gude@2x.png \ images/Hans_Gude@3x.png \ images/Hans_Gude@4x.png \ - main.qml \ + main.qml +resources.prefix = chapter4/ +RESOURCES += resources \ qtquickcontrols2.conf target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter4 diff --git a/examples/quickcontrols2/chattutorial/chapter5/chapter5.pro b/examples/quickcontrols2/chattutorial/chapter5/chapter5.pro index 1ca8998427..625642d7b5 100644 --- a/examples/quickcontrols2/chattutorial/chapter5/chapter5.pro +++ b/examples/quickcontrols2/chattutorial/chapter5/chapter5.pro @@ -10,7 +10,7 @@ SOURCES += main.cpp \ sqlcontactmodel.cpp \ sqlconversationmodel.cpp -RESOURCES += \ +resources.files = \ +Material/ChatToolBar.qml \ ChatToolBar.qml \ ContactPage.qml \ @@ -27,7 +27,9 @@ RESOURCES += \ images/Hans_Gude@2x.png \ images/Hans_Gude@3x.png \ images/Hans_Gude@4x.png \ - main.qml \ + main.qml +resources.prefix = chapter5/ +RESOURCES += resources \ qtquickcontrols2.conf target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter5 diff --git a/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc b/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc index 990b56715a..f4480873d3 100644 --- a/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc +++ b/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc @@ -203,7 +203,7 @@ project. The \c SOURCES variable lists all of the source files that should be compiled. A similar variable, \c HEADERS, is available for header files. -\printline RESOURCES +\printuntil qtquickcontrols2 The next line tells \c qmake that we have a collection of \l {The Qt Resource System}{resources} that should be built into the diff --git a/examples/quickcontrols2/eventcalendar/doc/src/qtquickcontrols2-eventcalendar.qdoc b/examples/quickcontrols2/eventcalendar/doc/src/qtquickcontrols2-eventcalendar.qdoc index 16246dd074..dba4b4b224 100644 --- a/examples/quickcontrols2/eventcalendar/doc/src/qtquickcontrols2-eventcalendar.qdoc +++ b/examples/quickcontrols2/eventcalendar/doc/src/qtquickcontrols2-eventcalendar.qdoc @@ -32,7 +32,7 @@ \ingroup qtquickcontrols2-examples \brief A simple event calendar. - \image qtquickcontrols2-gallery-menu.png + \image qtquickcalendar-eventcalendar.png The Event Calendar example is a simple application that shows how to use \l DayOfWeekRow, \l WeekNumberColumn, and \l MonthGrid to create a calendar. diff --git a/examples/quickcontrols2/gallery/CMakeLists.txt b/examples/quickcontrols2/gallery/CMakeLists.txt index 3d689fe6b1..fff4253b4b 100644 --- a/examples/quickcontrols2/gallery/CMakeLists.txt +++ b/examples/quickcontrols2/gallery/CMakeLists.txt @@ -11,16 +11,76 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/gallery") find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick QuickControls2) -qt_add_executable(gallery_controls2 +qt_add_executable(galleryexample WIN32 MACOSX_BUNDLE gallery.cpp ) -set_target_properties(gallery_controls2 PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE +qt_add_qml_module(galleryexample + URI gallery + VERSION 1.0 + NO_RESOURCE_TARGET_PATH + QML_FILES + "+Material/ToolBar.qml" + "ToolBar.qml" + "gallery.qml" + "pages/BusyIndicatorPage.qml" + "pages/ButtonPage.qml" + "pages/CheckBoxPage.qml" + "pages/ComboBoxPage.qml" + "pages/DelayButtonPage.qml" + "pages/DelegatePage.qml" + "pages/DialPage.qml" + "pages/DialogPage.qml" + "pages/FramePage.qml" + "pages/GroupBoxPage.qml" + "pages/PageIndicatorPage.qml" + "pages/ProgressBarPage.qml" + "pages/RadioButtonPage.qml" + "pages/RangeSliderPage.qml" + "pages/ScrollBarPage.qml" + "pages/ScrollIndicatorPage.qml" + "pages/ScrollablePage.qml" + "pages/SliderPage.qml" + "pages/SpinBoxPage.qml" + "pages/StackViewPage.qml" + "pages/SwipeViewPage.qml" + "pages/SwitchPage.qml" + "pages/TabBarPage.qml" + "pages/TextAreaPage.qml" + "pages/TextFieldPage.qml" + "pages/ToolTipPage.qml" + "pages/TumblerPage.qml" + RESOURCES + "icons/gallery/20x20/back.png" + "icons/gallery/20x20/drawer.png" + "icons/gallery/20x20/menu.png" + "icons/gallery/20x20@2/back.png" + "icons/gallery/20x20@2/drawer.png" + "icons/gallery/20x20@2/menu.png" + "icons/gallery/20x20@3/back.png" + "icons/gallery/20x20@3/drawer.png" + "icons/gallery/20x20@3/menu.png" + "icons/gallery/20x20@4/back.png" + "icons/gallery/20x20@4/drawer.png" + "icons/gallery/20x20@4/menu.png" + "icons/gallery/index.theme" + "images/arrow.png" + "images/arrow@2x.png" + "images/arrow@3x.png" + "images/arrow@4x.png" + "images/arrows.png" + "images/arrows@2x.png" + "images/arrows@3x.png" + "images/arrows@4x.png" + "images/qt-logo.png" + "images/qt-logo@2x.png" + "images/qt-logo@3x.png" + "images/qt-logo@4x.png" + "qmldir" + "qtquickcontrols2.conf" ) -target_link_libraries(gallery_controls2 PUBLIC +target_link_libraries(galleryexample PUBLIC Qt::Core Qt::Gui Qt::Quick @@ -31,78 +91,10 @@ if(UNIX AND NOT APPLE AND CMAKE_CROSSCOMPILING) find_package(Qt6 REQUIRED COMPONENTS QuickTemplates2) # Work around QTBUG-86533 - target_link_libraries(gallery_controls2 PRIVATE Qt::QuickTemplates2) + target_link_libraries(galleryexample PRIVATE Qt::QuickTemplates2) endif() -# Resources: -set(qmake_immediate_resource_files - "+Material/ToolBar.qml" - "ToolBar.qml" - "gallery.qml" - "icons/gallery/20x20/back.png" - "icons/gallery/20x20/drawer.png" - "icons/gallery/20x20/menu.png" - "icons/gallery/20x20@2/back.png" - "icons/gallery/20x20@2/drawer.png" - "icons/gallery/20x20@2/menu.png" - "icons/gallery/20x20@3/back.png" - "icons/gallery/20x20@3/drawer.png" - "icons/gallery/20x20@3/menu.png" - "icons/gallery/20x20@4/back.png" - "icons/gallery/20x20@4/drawer.png" - "icons/gallery/20x20@4/menu.png" - "icons/gallery/index.theme" - "images/arrow.png" - "images/arrow@2x.png" - "images/arrow@3x.png" - "images/arrow@4x.png" - "images/arrows.png" - "images/arrows@2x.png" - "images/arrows@3x.png" - "images/arrows@4x.png" - "images/qt-logo.png" - "images/qt-logo@2x.png" - "images/qt-logo@3x.png" - "images/qt-logo@4x.png" - "pages/BusyIndicatorPage.qml" - "pages/ButtonPage.qml" - "pages/CheckBoxPage.qml" - "pages/ComboBoxPage.qml" - "pages/DelayButtonPage.qml" - "pages/DelegatePage.qml" - "pages/DialPage.qml" - "pages/DialogPage.qml" - "pages/FramePage.qml" - "pages/GroupBoxPage.qml" - "pages/PageIndicatorPage.qml" - "pages/ProgressBarPage.qml" - "pages/RadioButtonPage.qml" - "pages/RangeSliderPage.qml" - "pages/ScrollBarPage.qml" - "pages/ScrollIndicatorPage.qml" - "pages/ScrollablePage.qml" - "pages/SliderPage.qml" - "pages/SpinBoxPage.qml" - "pages/StackViewPage.qml" - "pages/SwipeViewPage.qml" - "pages/SwitchPage.qml" - "pages/TabBarPage.qml" - "pages/TextAreaPage.qml" - "pages/TextFieldPage.qml" - "pages/ToolTipPage.qml" - "pages/TumblerPage.qml" - "qmldir" - "qtquickcontrols2.conf" -) - -qt6_add_resources(gallery_controls2 "qmake_immediate" - PREFIX - "/" - FILES - ${qmake_immediate_resource_files} -) - -install(TARGETS gallery_controls2 +install(TARGETS galleryexample RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" diff --git a/examples/quickcontrols2/gallery/gallery.qml b/examples/quickcontrols2/gallery/gallery.qml index 58d1b49ece..1888a6b4c6 100644 --- a/examples/quickcontrols2/gallery/gallery.qml +++ b/examples/quickcontrols2/gallery/gallery.qml @@ -66,7 +66,7 @@ ApplicationWindow { let displayingControl = listView.currentIndex !== -1 let currentControlName = displayingControl ? listView.model.get(listView.currentIndex).title.toLowerCase() : "" - let url = "https://doc.qt.io/qt-5/" + let url = "https://doc.qt.io/qt-6/" + (displayingControl ? "qml-qtquick-controls2-" + currentControlName + ".html" : "qtquick-controls2-qmlmodule.html"); diff --git a/examples/quickcontrols2/texteditor/CMakeLists.txt b/examples/quickcontrols2/texteditor/CMakeLists.txt index 52851f1b9b..f8e41b4f0c 100644 --- a/examples/quickcontrols2/texteditor/CMakeLists.txt +++ b/examples/quickcontrols2/texteditor/CMakeLists.txt @@ -30,7 +30,6 @@ set(texteditor_resource_files "images/qt-logo.png" "qml/+touch/texteditor.qml" "qml/texteditor.qml" - "qtquickcontrols2.conf" "texteditor.html" ) diff --git a/examples/quickcontrols2/texteditor/example.md b/examples/quickcontrols2/texteditor/example.md index 0ee17cdb9b..e385227e3b 100644 --- a/examples/quickcontrols2/texteditor/example.md +++ b/examples/quickcontrols2/texteditor/example.md @@ -71,9 +71,9 @@ John MacFarlane writes: ## Hyperlinks Hyperlinks can be written with the link text first, and the URL immediately -following: [Qt Assistant](http://doc.qt.io/qt-5/qtassistant-index.html) +following: [Qt Assistant](http://doc.qt.io/qt-6/qtassistant-index.html) -A plain url is automatically recognized: https://doc.qt.io/qt-5/qml-qtquick-text.html +A plain url is automatically recognized: https://doc.qt.io/qt-6/qml-qtquick-text.html There are also "reference links" where the link text is first labeled and then the URL for the label is given elsewhere: @@ -104,7 +104,7 @@ to form a task list. - List items can include images: ![red square](red.png) - and even nested quotes, like this: - The [Qt Documentation](https://doc.qt.io/qt-5/qml-qtquick-textedit.html#details) + The [Qt Documentation](https://doc.qt.io/qt-6/qml-qtquick-textedit.html#details) points out that > The TextEdit item displays a block of editable, formatted text. > @@ -155,7 +155,7 @@ One of the GitHub extensions is support for tables: # Related Work Some Qt Widgets also support Markdown. -[QTextEdit](https://doc.qt.io/qt-5/qtextedit.html) has similar WYSIWYG +[QTextEdit](https://doc.qt.io/qt-6/qtextedit.html) has similar WYSIWYG editing features as TextEdit and TextArea: you can edit the rendered text directly. You can use [QTextDocument::toMarkdown](https://doc-snapshots.qt.io/qt5-dev/qtextdocument.html#toMarkdown) diff --git a/examples/quickcontrols2/texteditor/qml/+touch/texteditor.qml b/examples/quickcontrols2/texteditor/qml/+touch/texteditor.qml index 7d7554f44b..677d25fbd9 100644 --- a/examples/quickcontrols2/texteditor/qml/+touch/texteditor.qml +++ b/examples/quickcontrols2/texteditor/qml/+touch/texteditor.qml @@ -149,9 +149,6 @@ ApplicationWindow { footer: ToolBar { visible: !textArea.readOnly && textArea.activeFocus - Material.primary: "#E0E0E0" - Material.elevation: 0 - Flickable { anchors.fill: parent contentWidth: toolRow.implicitWidth diff --git a/examples/quickcontrols2/texteditor/qml/texteditor.qml b/examples/quickcontrols2/texteditor/qml/texteditor.qml index 5f47223bd3..05b05ac89a 100644 --- a/examples/quickcontrols2/texteditor/qml/texteditor.qml +++ b/examples/quickcontrols2/texteditor/qml/texteditor.qml @@ -200,7 +200,7 @@ ApplicationWindow { selectedNameFilter.index: 1 nameFilters: ["Text files (*.txt)", "HTML files (*.html *.htm)", "Markdown files (*.md *.markdown)"] currentFolder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation) - onAccepted: document.load(file) + onAccepted: document.load(selectedFile) } FileDialog { diff --git a/examples/quickcontrols2/texteditor/qtquickcontrols2.conf b/examples/quickcontrols2/texteditor/qtquickcontrols2.conf deleted file mode 100644 index ecac617fcb..0000000000 --- a/examples/quickcontrols2/texteditor/qtquickcontrols2.conf +++ /dev/null @@ -1,11 +0,0 @@ -[Controls] -Style=Material - -[Material] -Primary=White -Foreground=#444444 -Accent=Blue -Theme=System - -[Universal] -Theme=System diff --git a/examples/quickcontrols2/texteditor/texteditor.qrc b/examples/quickcontrols2/texteditor/texteditor.qrc index 8f2da8432b..cdb7225a39 100644 --- a/examples/quickcontrols2/texteditor/texteditor.qrc +++ b/examples/quickcontrols2/texteditor/texteditor.qrc @@ -1,6 +1,5 @@ <RCC> <qresource prefix="/"> - <file>qtquickcontrols2.conf</file> <file>images/qt-logo.png</file> <file>fonts/fontello.ttf</file> <file>qml/texteditor.qml</file> |