From 0e18524a84d2aae65c54edc676d8ad7348f7d61c Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 15 May 2020 10:39:51 +0200 Subject: Remove Qt Labs Calendar This is getting its own repository as part of the move to the marketplace. Task-number: QTBUG-84172 Pick-to: 5.15 Change-Id: I2f963c298d6ef95e0832f95aa1e1ea809f4867a2 Reviewed-by: Volker Hilsheimer --- .cmake.conf | 1 + .prev_CMakeLists.txt | 3 +- CMakeLists.txt | 3 +- .../chattutorial/chapter1-settingup/CMakeLists.txt | 6 +- .../chattutorial/chapter2-lists/CMakeLists.txt | 6 +- .../chapter3-navigation/CMakeLists.txt | 6 +- .../chattutorial/chapter4-models/CMakeLists.txt | 6 +- .../chattutorial/chapter5-styling/CMakeLists.txt | 6 +- examples/quickcontrols2/contactlist/CMakeLists.txt | 6 +- examples/quickcontrols2/flatstyle/CMakeLists.txt | 6 +- examples/quickcontrols2/gallery/CMakeLists.txt | 6 +- .../imagine/automotive/CMakeLists.txt | 6 +- .../imagine/musicplayer/CMakeLists.txt | 6 +- examples/quickcontrols2/sidepanel/CMakeLists.txt | 6 +- .../quickcontrols2/swipetoremove/CMakeLists.txt | 6 +- .../quickcontrols2/texteditor/.prev_CMakeLists.txt | 69 +++ examples/quickcontrols2/texteditor/CMakeLists.txt | 6 +- examples/quickcontrols2/wearable/CMakeLists.txt | 6 +- src/imports/CMakeLists.txt | 1 - src/imports/calendar/CMakeLists.txt | 67 --- src/imports/calendar/DayOfWeekRow.qml | 85 ---- src/imports/calendar/MonthGrid.qml | 87 ---- src/imports/calendar/WeekNumberColumn.qml | 85 ---- src/imports/calendar/calendar.pri | 24 -- src/imports/calendar/calendar.pro | 23 - .../doc/images/qtlabscalendar-calendarmodel.png | Bin 4576 -> 0 bytes .../images/qtlabscalendar-dayofweekrow-layout.png | Bin 5816 -> 0 bytes .../doc/images/qtlabscalendar-dayofweekrow.png | Bin 1996 -> 0 bytes .../doc/images/qtlabscalendar-monthgrid-layout.png | Bin 6648 -> 0 bytes .../doc/images/qtlabscalendar-monthgrid.png | Bin 2819 -> 0 bytes .../qtlabscalendar-weeknumbercolumn-layout.png | Bin 3860 -> 0 bytes .../doc/images/qtlabscalendar-weeknumbercolumn.png | Bin 1432 -> 0 bytes src/imports/calendar/doc/qtlabscalendar.qdocconf | 41 -- .../doc/snippets/qtlabscalendar-calendarmodel.qml | 57 --- .../qtlabscalendar-dayofweekrow-layout.qml | 47 --- .../doc/snippets/qtlabscalendar-dayofweekrow.qml | 35 -- .../snippets/qtlabscalendar-monthgrid-layout.qml | 61 --- .../doc/snippets/qtlabscalendar-monthgrid.qml | 37 -- .../qtlabscalendar-weeknumbercolumn-layout.qml | 49 --- .../snippets/qtlabscalendar-weeknumbercolumn.qml | 37 -- .../calendar/doc/src/qtlabscalendar-index.qdoc | 51 --- .../calendar/doc/src/qtlabscalendar-qmltypes.qdoc | 58 --- src/imports/calendar/plugins.qmltypes | 435 ------------------- src/imports/calendar/qmldir | 6 - src/imports/calendar/qquickcalendar.cpp | 92 ---- src/imports/calendar/qquickcalendar_p.h | 99 ----- src/imports/calendar/qquickcalendarmodel.cpp | 290 ------------- src/imports/calendar/qquickcalendarmodel_p.h | 123 ------ src/imports/calendar/qquickdayofweekmodel.cpp | 135 ------ src/imports/calendar/qquickdayofweekmodel_p.h | 110 ----- src/imports/calendar/qquickdayofweekrow.cpp | 207 --------- src/imports/calendar/qquickdayofweekrow_p.h | 106 ----- src/imports/calendar/qquickmonthgrid.cpp | 463 --------------------- src/imports/calendar/qquickmonthgrid_p.h | 129 ------ src/imports/calendar/qquickmonthmodel.cpp | 240 ----------- src/imports/calendar/qquickmonthmodel_p.h | 129 ------ src/imports/calendar/qquickweeknumbercolumn.cpp | 275 ------------ src/imports/calendar/qquickweeknumbercolumn_p.h | 116 ------ src/imports/calendar/qquickweeknumbermodel.cpp | 194 --------- src/imports/calendar/qquickweeknumbermodel_p.h | 118 ------ src/imports/calendar/qtlabscalendarplugin.cpp | 93 ----- src/imports/controls/CMakeLists.txt | 2 +- src/imports/controls/doc/doc.pri | 1 - .../doc/src/qtquickcontrols2-differences.qdoc | 10 +- .../controls/doc/src/qtquickcontrols2-index.qdoc | 4 +- src/imports/imports.pro | 1 - tests/auto/CMakeLists.txt | 1 - tests/auto/accessibility/CMakeLists.txt | 5 + .../accessibility/data/defaults/dayofweekrow-2.qml | 4 - .../accessibility/data/defaults/dayofweekrow.qml | 6 - .../accessibility/data/defaults/monthgrid-2.qml | 6 - .../auto/accessibility/data/defaults/monthgrid.qml | 7 - .../data/defaults/weeknumbercolumn-2.qml | 4 - .../data/defaults/weeknumbercolumn.qml | 6 - .../accessibility/data/override/dayofweekrow-2.qml | 6 - .../accessibility/data/override/dayofweekrow.qml | 6 - .../accessibility/data/override/monthgrid-2.qml | 7 - .../auto/accessibility/data/override/monthgrid.qml | 7 - .../data/override/weeknumbercolumn-2.qml | 4 - .../data/override/weeknumbercolumn.qml | 6 - tests/auto/accessibility/tst_accessibility.cpp | 52 +-- tests/auto/auto.pro | 1 - tests/auto/calendar/CMakeLists.txt | 25 -- tests/auto/calendar/calendar.pro | 12 - tests/auto/calendar/data/tst_calendarmodel.qml | 125 ------ tests/auto/calendar/data/tst_dayofweekrow.qml | 95 ----- tests/auto/calendar/data/tst_monthgrid.qml | 284 ------------- tests/auto/calendar/data/tst_weeknumbercolumn.qml | 134 ------ tests/auto/calendar/tst_calendar.cpp | 38 -- tests/auto/qquickcontrol/CMakeLists.txt | 47 +++ tests/auto/sanity/tst_sanity.cpp | 1 - tests/auto/snippets/data/dependencies.qml | 1 - .../benchmarks/creationtime/data/dependencies.qml | 1 - tests/benchmarks/creationtime/tst_creationtime.cpp | 15 - tests/benchmarks/objectcount/data/dependencies.qml | 1 - 95 files changed, 222 insertions(+), 5068 deletions(-) create mode 100644 .cmake.conf create mode 100644 examples/quickcontrols2/texteditor/.prev_CMakeLists.txt delete mode 100644 src/imports/calendar/CMakeLists.txt delete mode 100644 src/imports/calendar/DayOfWeekRow.qml delete mode 100644 src/imports/calendar/MonthGrid.qml delete mode 100644 src/imports/calendar/WeekNumberColumn.qml delete mode 100644 src/imports/calendar/calendar.pri delete mode 100644 src/imports/calendar/calendar.pro delete mode 100644 src/imports/calendar/doc/images/qtlabscalendar-calendarmodel.png delete mode 100644 src/imports/calendar/doc/images/qtlabscalendar-dayofweekrow-layout.png delete mode 100644 src/imports/calendar/doc/images/qtlabscalendar-dayofweekrow.png delete mode 100644 src/imports/calendar/doc/images/qtlabscalendar-monthgrid-layout.png delete mode 100644 src/imports/calendar/doc/images/qtlabscalendar-monthgrid.png delete mode 100644 src/imports/calendar/doc/images/qtlabscalendar-weeknumbercolumn-layout.png delete mode 100644 src/imports/calendar/doc/images/qtlabscalendar-weeknumbercolumn.png delete mode 100644 src/imports/calendar/doc/qtlabscalendar.qdocconf delete mode 100644 src/imports/calendar/doc/snippets/qtlabscalendar-calendarmodel.qml delete mode 100644 src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml delete mode 100644 src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow.qml delete mode 100644 src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid-layout.qml delete mode 100644 src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid.qml delete mode 100644 src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml delete mode 100644 src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn.qml delete mode 100644 src/imports/calendar/doc/src/qtlabscalendar-index.qdoc delete mode 100644 src/imports/calendar/doc/src/qtlabscalendar-qmltypes.qdoc delete mode 100644 src/imports/calendar/plugins.qmltypes delete mode 100644 src/imports/calendar/qmldir delete mode 100644 src/imports/calendar/qquickcalendar.cpp delete mode 100644 src/imports/calendar/qquickcalendar_p.h delete mode 100644 src/imports/calendar/qquickcalendarmodel.cpp delete mode 100644 src/imports/calendar/qquickcalendarmodel_p.h delete mode 100644 src/imports/calendar/qquickdayofweekmodel.cpp delete mode 100644 src/imports/calendar/qquickdayofweekmodel_p.h delete mode 100644 src/imports/calendar/qquickdayofweekrow.cpp delete mode 100644 src/imports/calendar/qquickdayofweekrow_p.h delete mode 100644 src/imports/calendar/qquickmonthgrid.cpp delete mode 100644 src/imports/calendar/qquickmonthgrid_p.h delete mode 100644 src/imports/calendar/qquickmonthmodel.cpp delete mode 100644 src/imports/calendar/qquickmonthmodel_p.h delete mode 100644 src/imports/calendar/qquickweeknumbercolumn.cpp delete mode 100644 src/imports/calendar/qquickweeknumbercolumn_p.h delete mode 100644 src/imports/calendar/qquickweeknumbermodel.cpp delete mode 100644 src/imports/calendar/qquickweeknumbermodel_p.h delete mode 100644 src/imports/calendar/qtlabscalendarplugin.cpp delete mode 100644 tests/auto/accessibility/data/defaults/dayofweekrow-2.qml delete mode 100644 tests/auto/accessibility/data/defaults/dayofweekrow.qml delete mode 100644 tests/auto/accessibility/data/defaults/monthgrid-2.qml delete mode 100644 tests/auto/accessibility/data/defaults/monthgrid.qml delete mode 100644 tests/auto/accessibility/data/defaults/weeknumbercolumn-2.qml delete mode 100644 tests/auto/accessibility/data/defaults/weeknumbercolumn.qml delete mode 100644 tests/auto/accessibility/data/override/dayofweekrow-2.qml delete mode 100644 tests/auto/accessibility/data/override/dayofweekrow.qml delete mode 100644 tests/auto/accessibility/data/override/monthgrid-2.qml delete mode 100644 tests/auto/accessibility/data/override/monthgrid.qml delete mode 100644 tests/auto/accessibility/data/override/weeknumbercolumn-2.qml delete mode 100644 tests/auto/accessibility/data/override/weeknumbercolumn.qml delete mode 100644 tests/auto/calendar/CMakeLists.txt delete mode 100644 tests/auto/calendar/calendar.pro delete mode 100644 tests/auto/calendar/data/tst_calendarmodel.qml delete mode 100644 tests/auto/calendar/data/tst_dayofweekrow.qml delete mode 100644 tests/auto/calendar/data/tst_monthgrid.qml delete mode 100644 tests/auto/calendar/data/tst_weeknumbercolumn.qml delete mode 100644 tests/auto/calendar/tst_calendar.cpp create mode 100644 tests/auto/qquickcontrol/CMakeLists.txt diff --git a/.cmake.conf b/.cmake.conf new file mode 100644 index 00000000..93054804 --- /dev/null +++ b/.cmake.conf @@ -0,0 +1 @@ +set(QT_REPO_MODULE_VERSION "6.0.0") diff --git a/.prev_CMakeLists.txt b/.prev_CMakeLists.txt index 89d3074c..9708fb82 100644 --- a/.prev_CMakeLists.txt +++ b/.prev_CMakeLists.txt @@ -2,8 +2,9 @@ cmake_minimum_required(VERSION 3.15.0) +include(.cmake.conf) project(QtQuickControls2 - VERSION 6.0.0 + VERSION "${QT_REPO_MODULE_VERSION}" DESCRIPTION "Qt QuickControls2 Libraries" HOMEPAGE_URL "https://qt.io/" LANGUAGES CXX C diff --git a/CMakeLists.txt b/CMakeLists.txt index d9a9361f..05dcd0a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,9 @@ cmake_minimum_required(VERSION 3.15.0) +include(.cmake.conf) project(QtQuickControls2 - VERSION 6.0.0 + VERSION "${QT_REPO_MODULE_VERSION}" DESCRIPTION "Qt QuickControls2 Libraries" HOMEPAGE_URL "https://qt.io/" LANGUAGES CXX C diff --git a/examples/quickcontrols2/chattutorial/chapter1-settingup/CMakeLists.txt b/examples/quickcontrols2/chattutorial/chapter1-settingup/CMakeLists.txt index 90f06968..cc9fa12c 100644 --- a/examples/quickcontrols2/chattutorial/chapter1-settingup/CMakeLists.txt +++ b/examples/quickcontrols2/chattutorial/chapter1-settingup/CMakeLists.txt @@ -9,7 +9,11 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(INSTALL_EXAMPLEDIR "examples/quickcontrols2/chattutorial/chapter1-settingup") +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/chattutorial/chapter1-settingup") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) diff --git a/examples/quickcontrols2/chattutorial/chapter2-lists/CMakeLists.txt b/examples/quickcontrols2/chattutorial/chapter2-lists/CMakeLists.txt index 1d4d124d..5e8ff2f5 100644 --- a/examples/quickcontrols2/chattutorial/chapter2-lists/CMakeLists.txt +++ b/examples/quickcontrols2/chattutorial/chapter2-lists/CMakeLists.txt @@ -9,7 +9,11 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(INSTALL_EXAMPLEDIR "examples/quickcontrols2/chattutorial/chapter2-lists") +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/chattutorial/chapter2-lists") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) diff --git a/examples/quickcontrols2/chattutorial/chapter3-navigation/CMakeLists.txt b/examples/quickcontrols2/chattutorial/chapter3-navigation/CMakeLists.txt index 9b405c47..dcebc7dd 100644 --- a/examples/quickcontrols2/chattutorial/chapter3-navigation/CMakeLists.txt +++ b/examples/quickcontrols2/chattutorial/chapter3-navigation/CMakeLists.txt @@ -9,7 +9,11 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(INSTALL_EXAMPLEDIR "examples/quickcontrols2/chattutorial/chapter3-navigation") +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/chattutorial/chapter3-navigation") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) diff --git a/examples/quickcontrols2/chattutorial/chapter4-models/CMakeLists.txt b/examples/quickcontrols2/chattutorial/chapter4-models/CMakeLists.txt index dfccc0ca..f000e1d0 100644 --- a/examples/quickcontrols2/chattutorial/chapter4-models/CMakeLists.txt +++ b/examples/quickcontrols2/chattutorial/chapter4-models/CMakeLists.txt @@ -9,7 +9,11 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(INSTALL_EXAMPLEDIR "examples/quickcontrols2/chattutorial/chapter4-models") +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/chattutorial/chapter4-models") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/CMakeLists.txt b/examples/quickcontrols2/chattutorial/chapter5-styling/CMakeLists.txt index 73b493d1..d63eb4b1 100644 --- a/examples/quickcontrols2/chattutorial/chapter5-styling/CMakeLists.txt +++ b/examples/quickcontrols2/chattutorial/chapter5-styling/CMakeLists.txt @@ -9,7 +9,11 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(INSTALL_EXAMPLEDIR "examples/quickcontrols2/chattutorial/chapter5-styling") +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/chattutorial/chapter5-styling") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) diff --git a/examples/quickcontrols2/contactlist/CMakeLists.txt b/examples/quickcontrols2/contactlist/CMakeLists.txt index ee2a020f..b355902d 100644 --- a/examples/quickcontrols2/contactlist/CMakeLists.txt +++ b/examples/quickcontrols2/contactlist/CMakeLists.txt @@ -9,7 +9,11 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(INSTALL_EXAMPLEDIR "examples/quickcontrols2/contactlist") +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/contactlist") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) diff --git a/examples/quickcontrols2/flatstyle/CMakeLists.txt b/examples/quickcontrols2/flatstyle/CMakeLists.txt index 54b84b38..d8343b1f 100644 --- a/examples/quickcontrols2/flatstyle/CMakeLists.txt +++ b/examples/quickcontrols2/flatstyle/CMakeLists.txt @@ -9,7 +9,11 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(INSTALL_EXAMPLEDIR "examples/quickcontrols2/flatstyle") +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/flatstyle") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) diff --git a/examples/quickcontrols2/gallery/CMakeLists.txt b/examples/quickcontrols2/gallery/CMakeLists.txt index d62169e1..a175afa9 100644 --- a/examples/quickcontrols2/gallery/CMakeLists.txt +++ b/examples/quickcontrols2/gallery/CMakeLists.txt @@ -9,7 +9,11 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(INSTALL_EXAMPLEDIR "examples/quickcontrols2/gallery") +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/gallery") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) diff --git a/examples/quickcontrols2/imagine/automotive/CMakeLists.txt b/examples/quickcontrols2/imagine/automotive/CMakeLists.txt index 22b0bd7b..b5eb461f 100644 --- a/examples/quickcontrols2/imagine/automotive/CMakeLists.txt +++ b/examples/quickcontrols2/imagine/automotive/CMakeLists.txt @@ -9,7 +9,11 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(INSTALL_EXAMPLEDIR "examples/quickcontrols2/imagine/automotive") +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/imagine/automotive") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) diff --git a/examples/quickcontrols2/imagine/musicplayer/CMakeLists.txt b/examples/quickcontrols2/imagine/musicplayer/CMakeLists.txt index 28b17c95..4fdfd08d 100644 --- a/examples/quickcontrols2/imagine/musicplayer/CMakeLists.txt +++ b/examples/quickcontrols2/imagine/musicplayer/CMakeLists.txt @@ -9,7 +9,11 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(INSTALL_EXAMPLEDIR "examples/quickcontrols2/imagine/musicplayer") +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/imagine/musicplayer") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) diff --git a/examples/quickcontrols2/sidepanel/CMakeLists.txt b/examples/quickcontrols2/sidepanel/CMakeLists.txt index 4946dc2d..d10c48d4 100644 --- a/examples/quickcontrols2/sidepanel/CMakeLists.txt +++ b/examples/quickcontrols2/sidepanel/CMakeLists.txt @@ -9,7 +9,11 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(INSTALL_EXAMPLEDIR "examples/quickcontrols2/sidepanel") +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/sidepanel") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) diff --git a/examples/quickcontrols2/swipetoremove/CMakeLists.txt b/examples/quickcontrols2/swipetoremove/CMakeLists.txt index cf23122c..b6269283 100644 --- a/examples/quickcontrols2/swipetoremove/CMakeLists.txt +++ b/examples/quickcontrols2/swipetoremove/CMakeLists.txt @@ -9,7 +9,11 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(INSTALL_EXAMPLEDIR "examples/quickcontrols2/swipetoremove") +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/swipetoremove") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) diff --git a/examples/quickcontrols2/texteditor/.prev_CMakeLists.txt b/examples/quickcontrols2/texteditor/.prev_CMakeLists.txt new file mode 100644 index 00000000..743b62aa --- /dev/null +++ b/examples/quickcontrols2/texteditor/.prev_CMakeLists.txt @@ -0,0 +1,69 @@ +# Generated from texteditor.pro. + +cmake_minimum_required(VERSION 3.14) +project(texteditor LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/texteditor") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS QuickControls2) + +add_qt_gui_executable(texteditor + documenthandler.cpp documenthandler.h + texteditor.cpp +) +target_link_libraries(texteditor PUBLIC + Qt::Core + Qt::Gui + Qt::Quick + Qt::QuickControls2 +) + + +# Resources: +set(texteditor_resource_files + "+touch/texteditor.html" + "fonts/fontello.ttf" + "images/qt-logo.png" + "qml/+touch/texteditor.qml" + "qml/texteditor.qml" + "qtquickcontrols2.conf" + "texteditor.html" +) + +qt6_add_resources(texteditor "texteditor" + PREFIX + "/" + FILES + ${texteditor_resource_files} +) + +if(TARGET Qt::Widgets) + target_link_libraries(texteditor PUBLIC + Qt::Widgets + ) +endif() + +if(CMAKE_CROSSCOMPILING) + target_compile_definitions(texteditor PUBLIC + QT_EXTRA_FILE_SELECTOR=\\\"touch\\\" + ) +endif() + +install(TARGETS texteditor + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quickcontrols2/texteditor/CMakeLists.txt b/examples/quickcontrols2/texteditor/CMakeLists.txt index da3d78ed..8858bd22 100644 --- a/examples/quickcontrols2/texteditor/CMakeLists.txt +++ b/examples/quickcontrols2/texteditor/CMakeLists.txt @@ -9,7 +9,11 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(INSTALL_EXAMPLEDIR "examples/quickcontrols2/texteditor") +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/texteditor") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) diff --git a/examples/quickcontrols2/wearable/CMakeLists.txt b/examples/quickcontrols2/wearable/CMakeLists.txt index d0be1111..23f4f128 100644 --- a/examples/quickcontrols2/wearable/CMakeLists.txt +++ b/examples/quickcontrols2/wearable/CMakeLists.txt @@ -9,7 +9,11 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(INSTALL_EXAMPLEDIR "examples/quickcontrols2/wearable") +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/wearable") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) diff --git a/src/imports/CMakeLists.txt b/src/imports/CMakeLists.txt index 9bec7cd4..46b803f7 100644 --- a/src/imports/CMakeLists.txt +++ b/src/imports/CMakeLists.txt @@ -1,7 +1,6 @@ # Generated from imports.pro. add_subdirectory(controls) -add_subdirectory(calendar) add_subdirectory(platform) add_subdirectory(templates) add_subdirectory(controls/fusion) diff --git a/src/imports/calendar/CMakeLists.txt b/src/imports/calendar/CMakeLists.txt deleted file mode 100644 index bc9e7f08..00000000 --- a/src/imports/calendar/CMakeLists.txt +++ /dev/null @@ -1,67 +0,0 @@ -# Generated from calendar.pro. - -##################################################################### -## qtlabscalendarplugin Plugin: -##################################################################### - -qt_add_qml_module(qtlabscalendarplugin - URI "Qt.labs.calendar" - VERSION "1.0" - CLASSNAME QtLabsCalendarPlugin - SOURCES - qquickcalendar.cpp qquickcalendar_p.h - qquickcalendarmodel.cpp qquickcalendarmodel_p.h - qquickdayofweekmodel.cpp qquickdayofweekmodel_p.h - qquickdayofweekrow.cpp qquickdayofweekrow_p.h - qquickmonthgrid.cpp qquickmonthgrid_p.h - qquickmonthmodel.cpp qquickmonthmodel_p.h - qquickweeknumbercolumn.cpp qquickweeknumbercolumn_p.h - qquickweeknumbermodel.cpp qquickweeknumbermodel_p.h - qtlabscalendarplugin.cpp - DEFINES - QT_NO_CAST_FROM_ASCII - QT_NO_CAST_TO_ASCII - LIBRARIES - Qt::CorePrivate - Qt::GuiPrivate - Qt::QmlPrivate - Qt::QuickPrivate - Qt::QuickTemplates2Private - PUBLIC_LIBRARIES - Qt::Core - Qt::Gui - Qt::Qml - Qt::Quick -) - -#### Keys ignored in scope 1:.:.:calendar.pro:: -# IMPORT_VERSION = "1.0" -# OTHER_FILES = "qmldir" -# TARGETPATH = "Qt/labs/calendar" - -## Scopes: -##################################################################### - -set(qml_files - "DayOfWeekRow.qml" - "MonthGrid.qml" - "WeekNumberColumn.qml" -) -set_source_files_properties(DayOfWeekRow.qml PROPERTIES - QT_QML_SOURCE_VERSION "1.0" -) -set_source_files_properties(MonthGrid.qml PROPERTIES - QT_QML_SOURCE_VERSION "1.0" -) -set_source_files_properties(WeekNumberColumn.qml PROPERTIES - QT_QML_SOURCE_VERSION "1.0" -) - -qt6_target_qml_files(qtlabscalendarplugin - FILES - ${qml_files} -) -qt_add_docs(qtlabscalendarplugin - doc/qtlabscalendar.qdocconf -) - diff --git a/src/imports/calendar/DayOfWeekRow.qml b/src/imports/calendar/DayOfWeekRow.qml deleted file mode 100644 index e2eeb88b..00000000 --- a/src/imports/calendar/DayOfWeekRow.qml +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.12 -import Qt.labs.calendar 1.0 - -AbstractDayOfWeekRow { - id: control - - implicitWidth: Math.max(background ? background.implicitWidth : 0, - contentItem.implicitWidth + leftPadding + rightPadding) - implicitHeight: Math.max(background ? background.implicitHeight : 0, - contentItem.implicitHeight + topPadding + bottomPadding) - - spacing: 6 - topPadding: 6 - bottomPadding: 6 - font.bold: true - - //! [delegate] - delegate: Text { - text: model.shortName - font: control.font - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - //! [delegate] - - //! [contentItem] - contentItem: Row { - spacing: control.spacing - Repeater { - model: control.source - delegate: control.delegate - } - } - //! [contentItem] -} diff --git a/src/imports/calendar/MonthGrid.qml b/src/imports/calendar/MonthGrid.qml deleted file mode 100644 index 8947af08..00000000 --- a/src/imports/calendar/MonthGrid.qml +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.12 -import Qt.labs.calendar 1.0 - -AbstractMonthGrid { - id: control - - implicitWidth: Math.max(background ? background.implicitWidth : 0, - contentItem.implicitWidth + leftPadding + rightPadding) - implicitHeight: Math.max(background ? background.implicitHeight : 0, - contentItem.implicitHeight + topPadding + bottomPadding) - - spacing: 6 - - //! [delegate] - delegate: Text { - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - opacity: model.month === control.month ? 1 : 0 - text: model.day - font: control.font - } - //! [delegate] - - //! [contentItem] - contentItem: Grid { - rows: 6 - columns: 7 - rowSpacing: control.spacing - columnSpacing: control.spacing - - Repeater { - model: control.source - delegate: control.delegate - } - } - //! [contentItem] -} diff --git a/src/imports/calendar/WeekNumberColumn.qml b/src/imports/calendar/WeekNumberColumn.qml deleted file mode 100644 index c4fbca62..00000000 --- a/src/imports/calendar/WeekNumberColumn.qml +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.12 -import Qt.labs.calendar 1.0 - -AbstractWeekNumberColumn { - id: control - - implicitWidth: Math.max(background ? background.implicitWidth : 0, - contentItem.implicitWidth + leftPadding + rightPadding) - implicitHeight: Math.max(background ? background.implicitHeight : 0, - contentItem.implicitHeight + topPadding + bottomPadding) - - spacing: 6 - leftPadding: 6 - rightPadding: 6 - font.bold: true - - //! [delegate] - delegate: Text { - text: model.weekNumber - font: control.font - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - //! [delegate] - - //! [contentItem] - contentItem: Column { - spacing: control.spacing - Repeater { - model: control.source - delegate: control.delegate - } - } - //! [contentItem] -} diff --git a/src/imports/calendar/calendar.pri b/src/imports/calendar/calendar.pri deleted file mode 100644 index 00ed1209..00000000 --- a/src/imports/calendar/calendar.pri +++ /dev/null @@ -1,24 +0,0 @@ -QML_FILES = \ - DayOfWeekRow.qml \ - MonthGrid.qml \ - WeekNumberColumn.qml - -HEADERS += \ - $$PWD/qquickcalendar_p.h \ - $$PWD/qquickcalendarmodel_p.h \ - $$PWD/qquickdayofweekmodel_p.h \ - $$PWD/qquickdayofweekrow_p.h \ - $$PWD/qquickmonthgrid_p.h \ - $$PWD/qquickmonthmodel_p.h \ - $$PWD/qquickweeknumbercolumn_p.h \ - $$PWD/qquickweeknumbermodel_p.h - -SOURCES += \ - $$PWD/qquickcalendar.cpp \ - $$PWD/qquickcalendarmodel.cpp \ - $$PWD/qquickdayofweekmodel.cpp \ - $$PWD/qquickdayofweekrow.cpp \ - $$PWD/qquickmonthgrid.cpp \ - $$PWD/qquickmonthmodel.cpp \ - $$PWD/qquickweeknumbercolumn.cpp \ - $$PWD/qquickweeknumbermodel.cpp diff --git a/src/imports/calendar/calendar.pro b/src/imports/calendar/calendar.pro deleted file mode 100644 index 039906c1..00000000 --- a/src/imports/calendar/calendar.pro +++ /dev/null @@ -1,23 +0,0 @@ -TARGET = qtlabscalendarplugin -TARGETPATH = Qt/labs/calendar -IMPORT_VERSION = 1.0 - -QT += qml quick -QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private - -DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII - -QMAKE_DOCS = $$PWD/doc/qtlabscalendar.qdocconf - -OTHER_FILES += \ - qmldir - -SOURCES += \ - $$PWD/qtlabscalendarplugin.cpp - -include(calendar.pri) - -!static: CONFIG += qmlcache - -CONFIG += no_cxx_module -load(qml_plugin) diff --git a/src/imports/calendar/doc/images/qtlabscalendar-calendarmodel.png b/src/imports/calendar/doc/images/qtlabscalendar-calendarmodel.png deleted file mode 100644 index a0176823..00000000 Binary files a/src/imports/calendar/doc/images/qtlabscalendar-calendarmodel.png and /dev/null differ diff --git a/src/imports/calendar/doc/images/qtlabscalendar-dayofweekrow-layout.png b/src/imports/calendar/doc/images/qtlabscalendar-dayofweekrow-layout.png deleted file mode 100644 index 3a816e85..00000000 Binary files a/src/imports/calendar/doc/images/qtlabscalendar-dayofweekrow-layout.png and /dev/null differ diff --git a/src/imports/calendar/doc/images/qtlabscalendar-dayofweekrow.png b/src/imports/calendar/doc/images/qtlabscalendar-dayofweekrow.png deleted file mode 100644 index 7548e221..00000000 Binary files a/src/imports/calendar/doc/images/qtlabscalendar-dayofweekrow.png and /dev/null differ diff --git a/src/imports/calendar/doc/images/qtlabscalendar-monthgrid-layout.png b/src/imports/calendar/doc/images/qtlabscalendar-monthgrid-layout.png deleted file mode 100644 index f67501a7..00000000 Binary files a/src/imports/calendar/doc/images/qtlabscalendar-monthgrid-layout.png and /dev/null differ diff --git a/src/imports/calendar/doc/images/qtlabscalendar-monthgrid.png b/src/imports/calendar/doc/images/qtlabscalendar-monthgrid.png deleted file mode 100644 index a2f9a47f..00000000 Binary files a/src/imports/calendar/doc/images/qtlabscalendar-monthgrid.png and /dev/null differ diff --git a/src/imports/calendar/doc/images/qtlabscalendar-weeknumbercolumn-layout.png b/src/imports/calendar/doc/images/qtlabscalendar-weeknumbercolumn-layout.png deleted file mode 100644 index 19fbeefd..00000000 Binary files a/src/imports/calendar/doc/images/qtlabscalendar-weeknumbercolumn-layout.png and /dev/null differ diff --git a/src/imports/calendar/doc/images/qtlabscalendar-weeknumbercolumn.png b/src/imports/calendar/doc/images/qtlabscalendar-weeknumbercolumn.png deleted file mode 100644 index a73cccd5..00000000 Binary files a/src/imports/calendar/doc/images/qtlabscalendar-weeknumbercolumn.png and /dev/null differ diff --git a/src/imports/calendar/doc/qtlabscalendar.qdocconf b/src/imports/calendar/doc/qtlabscalendar.qdocconf deleted file mode 100644 index 9a88cb25..00000000 --- a/src/imports/calendar/doc/qtlabscalendar.qdocconf +++ /dev/null @@ -1,41 +0,0 @@ -include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) -include($QT_INSTALL_DOCS/config/exampleurl-qtquickcontrols2.qdocconf) - -project = QtLabsCalendar -description = Qt Labs Calendar Reference Documentation -version = $QT_VERSION - -qhp.projects = QtLabsCalendar - -qhp.QtLabsCalendar.file = qtlabscalendar.qhp -qhp.QtLabsCalendar.namespace = org.qt-project.qtlabscalendar.$QT_VERSION_TAG -qhp.QtLabsCalendar.virtualFolder = qtlabscalendar -qhp.QtLabsCalendar.indexTitle = Qt Labs Calendar -qhp.QtLabsCalendar.indexRoot = - -qhp.QtLabsCalendar.filterAttributes = qtlabscalendar $QT_VERSION qtrefdoc -qhp.QtLabsCalendar.customFilters.Qt.name = QtLabsCalendar $QT_VERSION -qhp.QtLabsCalendar.customFilters.Qt.filterAttributes = qtlabscalendar $QT_VERSION - -qhp.QtLabsCalendar.subprojects = qmltypes -qhp.QtLabsCalendar.subprojects.qmltypes.title = QML Types -qhp.QtLabsCalendar.subprojects.qmltypes.indexTitle = Qt Labs Calendar QML Types -qhp.QtLabsCalendar.subprojects.qmltypes.selectors = qmlclass -qhp.QtLabsCalendar.subprojects.qmltypes.sortPages = true - -depends = qtcore qtgui qtdoc qtqml qtquick qtquickcontrols - -# This module has no documented C++ types, clear the module header -moduleheader = - -headerdirs += ../ -sourcedirs += ../ src -exampledirs += ../ snippets -imagedirs += images - -navigation.landingpage = "Qt Labs Calendar" -navigation.qmltypespage = "Qt Labs Calendar QML Types" - -tagfile = qtlabscalendar.tags - -macro.labs = "\\note \\e{Types in Qt.labs modules are not guaranteed to remain compatible in future versions.}" diff --git a/src/imports/calendar/doc/snippets/qtlabscalendar-calendarmodel.qml b/src/imports/calendar/doc/snippets/qtlabscalendar-calendarmodel.qml deleted file mode 100644 index 6f6e8f2e..00000000 --- a/src/imports/calendar/doc/snippets/qtlabscalendar-calendarmodel.qml +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.12 -import Qt.labs.calendar 1.0 -import QtQuick.Controls 2.12 - -//! [1] -ListView { - id: listview - - width: 200; height: 200 - snapMode: ListView.SnapOneItem - orientation: ListView.Horizontal - highlightRangeMode: ListView.StrictlyEnforceRange - - model: CalendarModel { - from: new Date(2015, 0, 1) - to: new Date(2015, 11, 31) - } - - delegate: MonthGrid { - width: listview.width - height: listview.height - - month: model.month - year: model.year - locale: Qt.locale("en_US") - } - - ScrollIndicator.horizontal: ScrollIndicator { } -} -//! [1] diff --git a/src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml b/src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml deleted file mode 100644 index 2de76098..00000000 --- a/src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.12 -import QtQuick.Layouts 1.12 -import Qt.labs.calendar 1.0 - -//! [1] -ColumnLayout { - DayOfWeekRow { - locale: grid.locale - Layout.fillWidth: true - } - - MonthGrid { - id: grid - month: Calendar.December - year: 2015 - locale: Qt.locale("en_US") - Layout.fillWidth: true - } -} -//! [1] diff --git a/src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow.qml b/src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow.qml deleted file mode 100644 index e52ebb2d..00000000 --- a/src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow.qml +++ /dev/null @@ -1,35 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.12 -import Qt.labs.calendar 1.0 - -//! [1] -DayOfWeekRow { - locale: Qt.locale("en_US") -} -//! [1] diff --git a/src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid-layout.qml b/src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid-layout.qml deleted file mode 100644 index 5710b4dd..00000000 --- a/src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid-layout.qml +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.12 -import QtQuick.Layouts 1.12 -import Qt.labs.calendar 1.0 - -//! [1] -GridLayout { - columns: 2 - - DayOfWeekRow { - locale: grid.locale - - Layout.column: 1 - Layout.fillWidth: true - } - - WeekNumberColumn { - month: grid.month - year: grid.year - locale: grid.locale - - Layout.fillHeight: true - } - - MonthGrid { - id: grid - month: Calendar.December - year: 2015 - locale: Qt.locale("en_US") - - Layout.fillWidth: true - Layout.fillHeight: true - } -} -//! [1] diff --git a/src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid.qml b/src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid.qml deleted file mode 100644 index cdb7201e..00000000 --- a/src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid.qml +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.12 -import Qt.labs.calendar 1.0 - -//! [1] -MonthGrid { - month: Calendar.December - year: 2015 - locale: Qt.locale("en_US") -} -//! [1] diff --git a/src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml b/src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml deleted file mode 100644 index 18613f12..00000000 --- a/src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.12 -import QtQuick.Layouts 1.12 -import Qt.labs.calendar 1.0 - -//! [1] -RowLayout { - WeekNumberColumn { - month: grid.month - year: grid.year - locale: grid.locale - Layout.fillHeight: true - } - - MonthGrid { - id: grid - month: Calendar.December - year: 2015 - locale: Qt.locale("en_US") - Layout.fillHeight: true - } -} -//! [1] diff --git a/src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn.qml b/src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn.qml deleted file mode 100644 index f086468b..00000000 --- a/src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn.qml +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.12 -import Qt.labs.calendar 1.0 - -//! [1] -WeekNumberColumn { - month: Calendar.December - year: 2015 - locale: Qt.locale("en_US") -} -//! [1] diff --git a/src/imports/calendar/doc/src/qtlabscalendar-index.qdoc b/src/imports/calendar/doc/src/qtlabscalendar-index.qdoc deleted file mode 100644 index 065379ec..00000000 --- a/src/imports/calendar/doc/src/qtlabscalendar-index.qdoc +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page qtlabscalendar-index.html - \title Qt Labs Calendar - - \brief The experimental Qt Labs Calendar module provides a set of UI controls - for Qt Quick. - - The experimental Qt Labs Calendar module provides a set of types that can be - used to build calendars in Qt Quick. The module was introduced in Qt 5.7. - - \section1 QML Types - - \generatelist {qmltypesbymodule Qt.labs.calendar} - - \labs - - \section1 Related Information - - \list - \li \l{Qt Quick} - \li \l{Qt Quick Layouts} - \li \l{Qt Quick Controls} - \endlist -*/ diff --git a/src/imports/calendar/doc/src/qtlabscalendar-qmltypes.qdoc b/src/imports/calendar/doc/src/qtlabscalendar-qmltypes.qdoc deleted file mode 100644 index b63263a9..00000000 --- a/src/imports/calendar/doc/src/qtlabscalendar-qmltypes.qdoc +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \qmlmodule Qt.labs.calendar 1.0 - \title Qt Labs Calendar QML Types - \ingroup qmlmodules - \brief Provides QML types for calendars (Qt Labs Calendar). - - The \l{Qt Labs Calendar} module provides QML types for creating - calendars. These QML types work in conjunction with \l{Qt Quick} and - \l{Qt Quick Controls}. - - The QML types can be imported into your application using the - following import statement in your .qml file: - - \qml - import Qt.labs.calendar 1.0 - \endqml - - \section1 QML Types - - \generatelist {qmltypesbymodule Qt.labs.calendar} - - \labs - - \section1 Related Information - - \list - \li \l {Qt Quick Controls QML Types} - \endlist - - \noautolist -*/ diff --git a/src/imports/calendar/plugins.qmltypes b/src/imports/calendar/plugins.qmltypes deleted file mode 100644 index e004d63d..00000000 --- a/src/imports/calendar/plugins.qmltypes +++ /dev/null @@ -1,435 +0,0 @@ -import QtQuick.tooling 1.2 - -// This file describes the plugin-supplied types contained in the library. -// It is used for QML tooling purposes only. -// -// This file was auto-generated by: -// 'qmlplugindump -nonrelocatable Qt.labs.calendar 1.0' - -Module { - dependencies: ["QtQuick 2.12"] - Component { - name: "QAbstractItemModel" - prototype: "QObject" - Enum { - name: "LayoutChangeHint" - values: { - "NoLayoutChangeHint": 0, - "VerticalSortHint": 1, - "HorizontalSortHint": 2 - } - } - Enum { - name: "CheckIndexOption" - values: { - "NoOption": 0, - "IndexIsValid": 1, - "DoNotUseParent": 2, - "ParentIsInvalid": 4 - } - } - Signal { - name: "dataChanged" - Parameter { name: "topLeft"; type: "QModelIndex" } - Parameter { name: "bottomRight"; type: "QModelIndex" } - Parameter { name: "roles"; type: "QVector" } - } - Signal { - name: "dataChanged" - Parameter { name: "topLeft"; type: "QModelIndex" } - Parameter { name: "bottomRight"; type: "QModelIndex" } - } - Signal { - name: "headerDataChanged" - Parameter { name: "orientation"; type: "Qt::Orientation" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "layoutChanged" - Parameter { name: "parents"; type: "QList" } - Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } - } - Signal { - name: "layoutChanged" - Parameter { name: "parents"; type: "QList" } - } - Signal { name: "layoutChanged" } - Signal { - name: "layoutAboutToBeChanged" - Parameter { name: "parents"; type: "QList" } - Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } - } - Signal { - name: "layoutAboutToBeChanged" - Parameter { name: "parents"; type: "QList" } - } - Signal { name: "layoutAboutToBeChanged" } - Signal { - name: "rowsAboutToBeInserted" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "rowsInserted" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "rowsAboutToBeRemoved" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "rowsRemoved" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "columnsAboutToBeInserted" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "columnsInserted" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "columnsAboutToBeRemoved" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { - name: "columnsRemoved" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "first"; type: "int" } - Parameter { name: "last"; type: "int" } - } - Signal { name: "modelAboutToBeReset" } - Signal { name: "modelReset" } - Signal { - name: "rowsAboutToBeMoved" - Parameter { name: "sourceParent"; type: "QModelIndex" } - Parameter { name: "sourceStart"; type: "int" } - Parameter { name: "sourceEnd"; type: "int" } - Parameter { name: "destinationParent"; type: "QModelIndex" } - Parameter { name: "destinationRow"; type: "int" } - } - Signal { - name: "rowsMoved" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "start"; type: "int" } - Parameter { name: "end"; type: "int" } - Parameter { name: "destination"; type: "QModelIndex" } - Parameter { name: "row"; type: "int" } - } - Signal { - name: "columnsAboutToBeMoved" - Parameter { name: "sourceParent"; type: "QModelIndex" } - Parameter { name: "sourceStart"; type: "int" } - Parameter { name: "sourceEnd"; type: "int" } - Parameter { name: "destinationParent"; type: "QModelIndex" } - Parameter { name: "destinationColumn"; type: "int" } - } - Signal { - name: "columnsMoved" - Parameter { name: "parent"; type: "QModelIndex" } - Parameter { name: "start"; type: "int" } - Parameter { name: "end"; type: "int" } - Parameter { name: "destination"; type: "QModelIndex" } - Parameter { name: "column"; type: "int" } - } - Method { name: "submit"; type: "bool" } - Method { name: "revert" } - Method { - name: "hasIndex" - type: "bool" - Parameter { name: "row"; type: "int" } - Parameter { name: "column"; type: "int" } - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { - name: "hasIndex" - type: "bool" - Parameter { name: "row"; type: "int" } - Parameter { name: "column"; type: "int" } - } - Method { - name: "index" - type: "QModelIndex" - Parameter { name: "row"; type: "int" } - Parameter { name: "column"; type: "int" } - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { - name: "index" - type: "QModelIndex" - Parameter { name: "row"; type: "int" } - Parameter { name: "column"; type: "int" } - } - Method { - name: "parent" - type: "QModelIndex" - Parameter { name: "child"; type: "QModelIndex" } - } - Method { - name: "sibling" - type: "QModelIndex" - Parameter { name: "row"; type: "int" } - Parameter { name: "column"; type: "int" } - Parameter { name: "idx"; type: "QModelIndex" } - } - Method { - name: "rowCount" - type: "int" - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { name: "rowCount"; type: "int" } - Method { - name: "columnCount" - type: "int" - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { name: "columnCount"; type: "int" } - Method { - name: "hasChildren" - type: "bool" - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { name: "hasChildren"; type: "bool" } - Method { - name: "data" - type: "QVariant" - Parameter { name: "index"; type: "QModelIndex" } - Parameter { name: "role"; type: "int" } - } - Method { - name: "data" - type: "QVariant" - Parameter { name: "index"; type: "QModelIndex" } - } - Method { - name: "setData" - type: "bool" - Parameter { name: "index"; type: "QModelIndex" } - Parameter { name: "value"; type: "QVariant" } - Parameter { name: "role"; type: "int" } - } - Method { - name: "setData" - type: "bool" - Parameter { name: "index"; type: "QModelIndex" } - Parameter { name: "value"; type: "QVariant" } - } - Method { - name: "headerData" - type: "QVariant" - Parameter { name: "section"; type: "int" } - Parameter { name: "orientation"; type: "Qt::Orientation" } - Parameter { name: "role"; type: "int" } - } - Method { - name: "headerData" - type: "QVariant" - Parameter { name: "section"; type: "int" } - Parameter { name: "orientation"; type: "Qt::Orientation" } - } - Method { - name: "fetchMore" - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { - name: "canFetchMore" - type: "bool" - Parameter { name: "parent"; type: "QModelIndex" } - } - Method { - name: "flags" - type: "Qt::ItemFlags" - Parameter { name: "index"; type: "QModelIndex" } - } - Method { - name: "match" - type: "QModelIndexList" - Parameter { name: "start"; type: "QModelIndex" } - Parameter { name: "role"; type: "int" } - Parameter { name: "value"; type: "QVariant" } - Parameter { name: "hits"; type: "int" } - Parameter { name: "flags"; type: "Qt::MatchFlags" } - } - Method { - name: "match" - type: "QModelIndexList" - Parameter { name: "start"; type: "QModelIndex" } - Parameter { name: "role"; type: "int" } - Parameter { name: "value"; type: "QVariant" } - Parameter { name: "hits"; type: "int" } - } - Method { - name: "match" - type: "QModelIndexList" - Parameter { name: "start"; type: "QModelIndex" } - Parameter { name: "role"; type: "int" } - Parameter { name: "value"; type: "QVariant" } - } - } - Component { name: "QAbstractListModel"; prototype: "QAbstractItemModel" } - Component { - name: "QQuickCalendar" - prototype: "QObject" - exports: ["Qt.labs.calendar/Calendar 1.0"] - isCreatable: false - isSingleton: true - exportMetaObjectRevisions: [0] - Enum { - name: "Month" - values: { - "January": 0, - "February": 1, - "March": 2, - "April": 3, - "May": 4, - "June": 5, - "July": 6, - "August": 7, - "September": 8, - "October": 9, - "November": 10, - "December": 11 - } - } - } - Component { - name: "QQuickCalendarModel" - prototype: "QAbstractListModel" - exports: ["Qt.labs.calendar/CalendarModel 1.0"] - exportMetaObjectRevisions: [0] - Property { name: "from"; type: "QDate" } - Property { name: "to"; type: "QDate" } - Property { name: "count"; type: "int"; isReadonly: true } - Method { - name: "monthAt" - type: "int" - Parameter { name: "index"; type: "int" } - } - Method { - name: "yearAt" - type: "int" - Parameter { name: "index"; type: "int" } - } - Method { - name: "indexOf" - type: "int" - Parameter { name: "date"; type: "QDate" } - } - Method { - name: "indexOf" - type: "int" - Parameter { name: "year"; type: "int" } - Parameter { name: "month"; type: "int" } - } - } - Component { - name: "QQuickControl" - defaultProperty: "data" - prototype: "QQuickItem" - Property { name: "font"; type: "QFont" } - Property { name: "availableWidth"; type: "double"; isReadonly: true } - Property { name: "availableHeight"; type: "double"; isReadonly: true } - Property { name: "padding"; type: "double" } - Property { name: "topPadding"; type: "double" } - Property { name: "leftPadding"; type: "double" } - Property { name: "rightPadding"; type: "double" } - Property { name: "bottomPadding"; type: "double" } - Property { name: "spacing"; type: "double" } - Property { name: "locale"; type: "QLocale" } - Property { name: "mirrored"; type: "bool"; isReadonly: true } - Property { name: "focusPolicy"; type: "Qt::FocusPolicy" } - Property { name: "focusReason"; type: "Qt::FocusReason" } - Property { name: "visualFocus"; type: "bool"; isReadonly: true } - Property { name: "hovered"; type: "bool"; isReadonly: true } - Property { name: "hoverEnabled"; type: "bool" } - Property { name: "wheelEnabled"; type: "bool" } - Property { name: "background"; type: "QQuickItem"; isPointer: true } - Property { name: "contentItem"; type: "QQuickItem"; isPointer: true } - Property { name: "baselineOffset"; type: "double" } - Property { name: "palette"; revision: 3; type: "QPalette" } - Property { name: "horizontalPadding"; revision: 5; type: "double" } - Property { name: "verticalPadding"; revision: 5; type: "double" } - Property { name: "implicitContentWidth"; revision: 5; type: "double"; isReadonly: true } - Property { name: "implicitContentHeight"; revision: 5; type: "double"; isReadonly: true } - Property { name: "implicitBackgroundWidth"; revision: 5; type: "double"; isReadonly: true } - Property { name: "implicitBackgroundHeight"; revision: 5; type: "double"; isReadonly: true } - Property { name: "topInset"; revision: 5; type: "double" } - Property { name: "leftInset"; revision: 5; type: "double" } - Property { name: "rightInset"; revision: 5; type: "double" } - Property { name: "bottomInset"; revision: 5; type: "double" } - Signal { name: "paletteChanged"; revision: 3 } - Signal { name: "horizontalPaddingChanged"; revision: 5 } - Signal { name: "verticalPaddingChanged"; revision: 5 } - Signal { name: "implicitContentWidthChanged"; revision: 5 } - Signal { name: "implicitContentHeightChanged"; revision: 5 } - Signal { name: "implicitBackgroundWidthChanged"; revision: 5 } - Signal { name: "implicitBackgroundHeightChanged"; revision: 5 } - Signal { name: "topInsetChanged"; revision: 5 } - Signal { name: "leftInsetChanged"; revision: 5 } - Signal { name: "rightInsetChanged"; revision: 5 } - Signal { name: "bottomInsetChanged"; revision: 5 } - } - Component { - name: "QQuickDayOfWeekRow" - defaultProperty: "data" - prototype: "QQuickControl" - exports: ["Qt.labs.calendar/AbstractDayOfWeekRow 1.0"] - exportMetaObjectRevisions: [0] - Property { name: "source"; type: "QVariant" } - Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } - } - Component { - name: "QQuickMonthGrid" - defaultProperty: "data" - prototype: "QQuickControl" - exports: ["Qt.labs.calendar/AbstractMonthGrid 1.0"] - exportMetaObjectRevisions: [0] - Property { name: "month"; type: "int" } - Property { name: "year"; type: "int" } - Property { name: "source"; type: "QVariant" } - Property { name: "title"; type: "string" } - Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } - Signal { - name: "pressed" - Parameter { name: "date"; type: "QDate" } - } - Signal { - name: "released" - Parameter { name: "date"; type: "QDate" } - } - Signal { - name: "clicked" - Parameter { name: "date"; type: "QDate" } - } - Signal { - name: "pressAndHold" - Parameter { name: "date"; type: "QDate" } - } - } - Component { - name: "QQuickWeekNumberColumn" - defaultProperty: "data" - prototype: "QQuickControl" - exports: ["Qt.labs.calendar/AbstractWeekNumberColumn 1.0"] - exportMetaObjectRevisions: [0] - Property { name: "month"; type: "int" } - Property { name: "year"; type: "int" } - Property { name: "source"; type: "QVariant" } - Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } - } -} diff --git a/src/imports/calendar/qmldir b/src/imports/calendar/qmldir deleted file mode 100644 index 9b9e9031..00000000 --- a/src/imports/calendar/qmldir +++ /dev/null @@ -1,6 +0,0 @@ -module Qt.labs.calendar -plugin qtlabscalendarplugin -classname QtLabsCalendarPlugin -DayOfWeekRow 1.0 DayOfWeekRow.qml -MonthGrid 1.0 MonthGrid.qml -WeekNumberColumn 1.0 WeekNumberColumn.qml diff --git a/src/imports/calendar/qquickcalendar.cpp b/src/imports/calendar/qquickcalendar.cpp deleted file mode 100644 index cb36fd27..00000000 --- a/src/imports/calendar/qquickcalendar.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickcalendar_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \qmltype Calendar - \inherits QObject -//! \instantiates QQuickCalendar - \inqmlmodule Qt.labs.calendar - \brief A calendar namespace. - - The Calendar singleton provides miscellaneous calendar related - utilities. - - The Qt Labs Calendar module uses 0-based month numbers to be consistent - with the JavaScript Date type, that is used by the QML language. This - means that \c Date::getMonth() can be assigned to MonthGrid::month and - WeekNumberColumn::month as is. When dealing with month numbers - directly, it is highly recommended to use the following enumeration values - to avoid confusion. - - \value Calendar.January January (0) - \value Calendar.February February (1) - \value Calendar.March March (2) - \value Calendar.April April (3) - \value Calendar.May May (4) - \value Calendar.June June (5) - \value Calendar.July July (6) - \value Calendar.August August (7) - \value Calendar.September September (8) - \value Calendar.October October (9) - \value Calendar.November November (10) - \value Calendar.December December (11) - - \sa MonthGrid, DayOfWeekRow, WeekNumberColumn -*/ - -QQuickCalendar::QQuickCalendar(QObject *parent) : QObject(parent) -{ -} - -QT_END_NAMESPACE diff --git a/src/imports/calendar/qquickcalendar_p.h b/src/imports/calendar/qquickcalendar_p.h deleted file mode 100644 index 95f3e1df..00000000 --- a/src/imports/calendar/qquickcalendar_p.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKCALENDAR_P_H -#define QQUICKCALENDAR_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QQuickCalendar : public QObject -{ - Q_OBJECT - -public: - explicit QQuickCalendar(QObject *parent = nullptr); - - enum Month { - January, - February, - March, - April, - May, - June, - July, - August, - September, - October, - November, - December - }; - Q_ENUM(Month) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QQuickCalendar) - -#endif // QQUICKCALENDAR_P_H diff --git a/src/imports/calendar/qquickcalendarmodel.cpp b/src/imports/calendar/qquickcalendarmodel.cpp deleted file mode 100644 index 8826e92e..00000000 --- a/src/imports/calendar/qquickcalendarmodel.cpp +++ /dev/null @@ -1,290 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickcalendarmodel_p.h" - -#include - -QT_BEGIN_NAMESPACE - -/*! - \qmltype CalendarModel - \inherits QAbstractListModel -//! \instantiates QQuickCalendarModel - \inqmlmodule Qt.labs.calendar - \brief A calendar model. - - CalendarModel provides a way of creating a range of MonthGrid - instances. It is typically used as a model for a ListView that uses - MonthGrid as a delegate. - - \snippet qtlabscalendar-calendarmodel.qml 1 - - In addition to the \c index property, a list of model data roles - are available in the context of each delegate: - \table - \row \li \b model.month : int \li The number of the month - \row \li \b model.year : int \li The number of the year - \endtable - - The Qt Labs Calendar module uses 0-based month numbers to be consistent - with the JavaScript Date type, that is used by the QML language. This - means that \c Date::getMonth() can be passed to the methods as is. When - dealing with month numbers directly, it is highly recommended to use the - following enumeration values to avoid confusion. - - \value Calendar.January January (0) - \value Calendar.February February (1) - \value Calendar.March March (2) - \value Calendar.April April (3) - \value Calendar.May May (4) - \value Calendar.June June (5) - \value Calendar.July July (6) - \value Calendar.August August (7) - \value Calendar.September September (8) - \value Calendar.October October (9) - \value Calendar.November November (10) - \value Calendar.December December (11) - - \labs - - \sa MonthGrid, Calendar -*/ - -class QQuickCalendarModelPrivate : public QAbstractItemModelPrivate -{ - Q_DECLARE_PUBLIC(QQuickCalendarModel) - -public: - QQuickCalendarModelPrivate() : complete(false), - from(1,1,1), to(275759, 9, 25), count(0) - { - } - - static int getCount(const QDate& from, const QDate &to); - - void populate(const QDate &from, const QDate &to, bool force = false); - - bool complete; - QDate from; - QDate to; - int count; -}; - -int QQuickCalendarModelPrivate::getCount(const QDate& from, const QDate &to) -{ - if (!from.isValid() || !to.isValid()) - return 0; - - QDate f(from.year(), from.month(), 1); - QDate t(to.year(), to.month(), to.daysInMonth()); - int days = f.daysTo(t); - if (days < 0) - return 0; - - QDate r = QDate(1, 1, 1).addDays(days); - int years = r.year() - 1; - int months = r.month() - 1; - return 12 * years + months + (r.day() / t.day()); -} - -void QQuickCalendarModelPrivate::populate(const QDate &f, const QDate &t, bool force) -{ - Q_Q(QQuickCalendarModel); - if (!force && f == from && t == to) - return; - - int c = getCount(from, to); - if (c != count) { - q->beginResetModel(); - count = c; - q->endResetModel(); - emit q->countChanged(); - } else { - emit q->dataChanged(q->index(0, 0), q->index(c - 1, 0)); - } -} - -QQuickCalendarModel::QQuickCalendarModel(QObject *parent) : - QAbstractListModel(*(new QQuickCalendarModelPrivate), parent) -{ -} - -/*! - \qmlproperty date Qt.labs.calendar::CalendarModel::from - - This property holds the start date. -*/ -QDate QQuickCalendarModel::from() const -{ - Q_D(const QQuickCalendarModel); - return d->from; -} - -void QQuickCalendarModel::setFrom(const QDate &from) -{ - Q_D(QQuickCalendarModel); - if (d->from != from) { - if (d->complete) - d->populate(from, d->to); - d->from = from; - emit fromChanged(); - } -} - -/*! - \qmlproperty date Qt.labs.calendar::CalendarModel::to - - This property holds the end date. -*/ -QDate QQuickCalendarModel::to() const -{ - Q_D(const QQuickCalendarModel); - return d->to; -} - -void QQuickCalendarModel::setTo(const QDate &to) -{ - Q_D(QQuickCalendarModel); - if (d->to != to) { - if (d->complete) - d->populate(d->from, to); - d->to = to; - emit toChanged(); - } -} - -/*! - \qmlmethod int Qt.labs.calendar::CalendarModel::monthAt(int index) - - Returns the month number at the specified model \a index. -*/ -int QQuickCalendarModel::monthAt(int index) const -{ - Q_D(const QQuickCalendarModel); - return d->from.addMonths(index).month() - 1; -} - -/*! - \qmlmethod int Qt.labs.calendar::CalendarModel::yearAt(int index) - - Returns the year number at the specified model \a index. -*/ -int QQuickCalendarModel::yearAt(int index) const -{ - Q_D(const QQuickCalendarModel); - return d->from.addMonths(index).year(); -} - -/*! - \qmlmethod int Qt.labs.calendar::CalendarModel::indexOf(Date date) - - Returns the model index of the specified \a date. -*/ -int QQuickCalendarModel::indexOf(const QDate &date) const -{ - Q_D(const QQuickCalendarModel); - return d->getCount(d->from, date) - 1; -} - -/*! - \qmlmethod int Qt.labs.calendar::CalendarModel::indexOf(int year, int month) - - Returns the model index of the specified \a year and \a month. -*/ -int QQuickCalendarModel::indexOf(int year, int month) const -{ - return indexOf(QDate(year, month + 1, 1)); -} - -QVariant QQuickCalendarModel::data(const QModelIndex &index, int role) const -{ - Q_D(const QQuickCalendarModel); - if (index.isValid() && index.row() < d->count) { - switch (role) { - case MonthRole: - return monthAt(index.row()); - case YearRole: - return yearAt(index.row()); - default: - break; - } - } - return QVariant(); -} - -int QQuickCalendarModel::rowCount(const QModelIndex &parent) const -{ - Q_D(const QQuickCalendarModel); - if (!parent.isValid()) - return d->count; - return 0; -} - -QHash QQuickCalendarModel::roleNames() const -{ - QHash roles; - roles[MonthRole] = QByteArrayLiteral("month"); - roles[YearRole] = QByteArrayLiteral("year"); - return roles; -} - -void QQuickCalendarModel::classBegin() -{ -} - -void QQuickCalendarModel::componentComplete() -{ - Q_D(QQuickCalendarModel); - d->complete = true; - d->populate(d->from, d->to, true); -} - -QT_END_NAMESPACE diff --git a/src/imports/calendar/qquickcalendarmodel_p.h b/src/imports/calendar/qquickcalendarmodel_p.h deleted file mode 100644 index 9c442123..00000000 --- a/src/imports/calendar/qquickcalendarmodel_p.h +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKCALENDARMODEL_P_H -#define QQUICKCALENDARMODEL_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QQuickCalendarModelPrivate; - -class QQuickCalendarModel : public QAbstractListModel, public QQmlParserStatus -{ - Q_OBJECT - Q_INTERFACES(QQmlParserStatus) - Q_PROPERTY(QDate from READ from WRITE setFrom NOTIFY fromChanged FINAL) - Q_PROPERTY(QDate to READ to WRITE setTo NOTIFY toChanged FINAL) - Q_PROPERTY(int count READ rowCount NOTIFY countChanged) - -public: - explicit QQuickCalendarModel(QObject *parent = nullptr); - - QDate from() const; - void setFrom(const QDate &from); - - QDate to() const; - void setTo(const QDate &to); - - Q_INVOKABLE int monthAt(int index) const; - Q_INVOKABLE int yearAt(int index) const; - Q_INVOKABLE int indexOf(const QDate &date) const; - Q_INVOKABLE int indexOf(int year, int month) const; - - enum { - MonthRole, - YearRole - }; - - QHash roleNames() const override; - QVariant data(const QModelIndex &index, int role) const override; - int rowCount(const QModelIndex &parent = QModelIndex()) const override; - -Q_SIGNALS: - void fromChanged(); - void toChanged(); - void countChanged(); - -protected: - void classBegin() override; - void componentComplete() override; - -private: - Q_DISABLE_COPY(QQuickCalendarModel) - Q_DECLARE_PRIVATE(QQuickCalendarModel) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QQuickCalendarModel) - -#endif // QQUICKCALENDARMODEL_P_H diff --git a/src/imports/calendar/qquickdayofweekmodel.cpp b/src/imports/calendar/qquickdayofweekmodel.cpp deleted file mode 100644 index 6c478310..00000000 --- a/src/imports/calendar/qquickdayofweekmodel.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickdayofweekmodel_p.h" - -#include - -QT_BEGIN_NAMESPACE - -class QQuickDayOfWeekModelPrivate : public QAbstractItemModelPrivate -{ - Q_DECLARE_PUBLIC(QQuickDayOfWeekModel) - -public: - QLocale locale; -}; - -QQuickDayOfWeekModel::QQuickDayOfWeekModel(QObject *parent) : - QAbstractListModel(*(new QQuickDayOfWeekModelPrivate), parent) -{ -} - -QLocale QQuickDayOfWeekModel::locale() const -{ - Q_D(const QQuickDayOfWeekModel); - return d->locale; -} - -void QQuickDayOfWeekModel::setLocale(const QLocale &locale) -{ - Q_D(QQuickDayOfWeekModel); - if (d->locale != locale) { - d->locale = locale; - emit localeChanged(); - emit dataChanged(index(0, 0), index(6, 0)); - } -} - -int QQuickDayOfWeekModel::dayAt(int index) const -{ - Q_D(const QQuickDayOfWeekModel); - int day = d->locale.firstDayOfWeek() + index; - if (day > 7) - day -= 7; - if (day == 7) - day = 0; // Qt::Sunday = 7, but Sunday is 0 in JS Date - return day; -} - -QVariant QQuickDayOfWeekModel::data(const QModelIndex &index, int role) const -{ - Q_D(const QQuickDayOfWeekModel); - if (index.isValid() && index.row() < 7) { - int day = dayAt(index.row()); - switch (role) { - case DayRole: - return day; - case LongNameRole: - return d->locale.standaloneDayName(day == 0 ? Qt::Sunday : day, QLocale::LongFormat); - case ShortNameRole: - return d->locale.standaloneDayName(day == 0 ? Qt::Sunday : day, QLocale::ShortFormat); - case NarrowNameRole: - return d->locale.standaloneDayName(day == 0 ? Qt::Sunday : day, QLocale::NarrowFormat); - default: - break; - } - } - return QVariant(); -} - -int QQuickDayOfWeekModel::rowCount(const QModelIndex &parent) const -{ - if (parent.isValid()) - return 0; - return 7; -} - -QHash QQuickDayOfWeekModel::roleNames() const -{ - QHash roles; - roles[DayRole] = QByteArrayLiteral("day"); - roles[LongNameRole] = QByteArrayLiteral("longName"); - roles[ShortNameRole] = QByteArrayLiteral("shortName"); - roles[NarrowNameRole] = QByteArrayLiteral("narrowName"); - return roles; -} - -QT_END_NAMESPACE diff --git a/src/imports/calendar/qquickdayofweekmodel_p.h b/src/imports/calendar/qquickdayofweekmodel_p.h deleted file mode 100644 index 0dd9c9b3..00000000 --- a/src/imports/calendar/qquickdayofweekmodel_p.h +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKDAYOFWEEKMODEL_P_H -#define QQUICKDAYOFWEEKMODEL_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QQuickDayOfWeekModelPrivate; - -class QQuickDayOfWeekModel : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL) - Q_PROPERTY(int count READ rowCount CONSTANT FINAL) - -public: - explicit QQuickDayOfWeekModel(QObject *parent = nullptr); - - QLocale locale() const; - void setLocale(const QLocale &locale); - - Q_INVOKABLE int dayAt(int index) const; - - enum { - DayRole = Qt::UserRole + 1, - LongNameRole, - ShortNameRole, - NarrowNameRole - }; - - QHash roleNames() const override; - QVariant data(const QModelIndex &index, int role) const override; - int rowCount(const QModelIndex &parent = QModelIndex()) const override; - -Q_SIGNALS: - void localeChanged(); - -private: - Q_DISABLE_COPY(QQuickDayOfWeekModel) - Q_DECLARE_PRIVATE(QQuickDayOfWeekModel) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QQuickDayOfWeekModel) - -#endif // QQUICKDAYOFWEEKMODEL_P_H diff --git a/src/imports/calendar/qquickdayofweekrow.cpp b/src/imports/calendar/qquickdayofweekrow.cpp deleted file mode 100644 index faf8b8c6..00000000 --- a/src/imports/calendar/qquickdayofweekrow.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickdayofweekrow_p.h" -#include "qquickdayofweekmodel_p.h" - -#include - -QT_BEGIN_NAMESPACE - -/*! - \qmltype DayOfWeekRow - \inherits Control -//! \instantiates QQuickDayOfWeekRow - \inqmlmodule Qt.labs.calendar - \brief A row of names for the days in a week. - - DayOfWeekRow presents day of week names in a row. The names of the days - are ordered and formatted using the specified \l {Control::locale}{locale}. - - \image qtlabscalendar-dayofweekrow.png - \snippet qtlabscalendar-dayofweekrow.qml 1 - - DayOfWeekRow can be used as a standalone control, but it is most - often used in conjunction with MonthGrid. Regardless of the use case, - positioning of the row is left to the user. - - \image qtlabscalendar-dayofweekrow-layout.png - \snippet qtlabscalendar-dayofweekrow-layout.qml 1 - - The visual appearance of DayOfWeekRow can be changed by - implementing a \l {delegate}{custom delegate}. - - \labs - - \sa MonthGrid, WeekNumberColumn -*/ - -class QQuickDayOfWeekRowPrivate : public QQuickControlPrivate -{ -public: - QQuickDayOfWeekRowPrivate() : delegate(nullptr), model(nullptr) { } - - void resizeItems(); - - QVariant source; - QQmlComponent *delegate; - QQuickDayOfWeekModel *model; -}; - -void QQuickDayOfWeekRowPrivate::resizeItems() -{ - if (!contentItem) - return; - - QSizeF itemSize; - itemSize.setWidth((contentItem->width() - 6 * spacing) / 7); - itemSize.setHeight(contentItem->height()); - - const auto childItems = contentItem->childItems(); - for (QQuickItem *item : childItems) - item->setSize(itemSize); -} - -QQuickDayOfWeekRow::QQuickDayOfWeekRow(QQuickItem *parent) : - QQuickControl(*(new QQuickDayOfWeekRowPrivate), parent) -{ - Q_D(QQuickDayOfWeekRow); - d->model = new QQuickDayOfWeekModel(this); - d->source = QVariant::fromValue(d->model); -} - -/*! - \internal - \qmlproperty model Qt.labs.calendar::DayOfWeekRow::source - - This property holds the source model that is used as a data model - for the internal content row. -*/ -QVariant QQuickDayOfWeekRow::source() const -{ - Q_D(const QQuickDayOfWeekRow); - return d->source; -} - -void QQuickDayOfWeekRow::setSource(const QVariant &source) -{ - Q_D(QQuickDayOfWeekRow); - if (d->source != source) { - d->source = source; - emit sourceChanged(); - } -} - -/*! - \qmlproperty Component Qt.labs.calendar::DayOfWeekRow::delegate - - This property holds the item delegate that visualizes each day of the week. - - In addition to the \c index property, a list of model data roles - are available in the context of each delegate: - \table - \row \li \b model.day : int \li The day of week (\l Qt::DayOfWeek) - \row \li \b model.longName : string \li The long version of the day name; for example, "Monday" (\l QLocale::LongFormat) - \row \li \b model.shortName : string \li The short version of the day name; for example, "Mon" (\l QLocale::ShortFormat) - \row \li \b model.narrowName : string \li A special version of the day name for use when space is limited; for example, "M" (\l QLocale::NarrowFormat) - \endtable - - The following snippet presents the default implementation of the item - delegate. It can be used as a starting point for implementing custom - delegates. - - \snippet DayOfWeekRow.qml delegate -*/ -QQmlComponent *QQuickDayOfWeekRow::delegate() const -{ - Q_D(const QQuickDayOfWeekRow); - return d->delegate; -} - -void QQuickDayOfWeekRow::setDelegate(QQmlComponent *delegate) -{ - Q_D(QQuickDayOfWeekRow); - if (d->delegate != delegate) { - d->delegate = delegate; - emit delegateChanged(); - } -} - -void QQuickDayOfWeekRow::componentComplete() -{ - Q_D(QQuickDayOfWeekRow); - QQuickControl::componentComplete(); - d->resizeItems(); -} - -void QQuickDayOfWeekRow::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) -{ - Q_D(QQuickDayOfWeekRow); - QQuickControl::geometryChange(newGeometry, oldGeometry); - if (isComponentComplete()) - d->resizeItems(); -} - -void QQuickDayOfWeekRow::localeChange(const QLocale &newLocale, const QLocale &oldLocale) -{ - Q_D(QQuickDayOfWeekRow); - QQuickControl::localeChange(newLocale, oldLocale); - d->model->setLocale(newLocale); -} - -void QQuickDayOfWeekRow::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) -{ - Q_D(QQuickDayOfWeekRow); - QQuickControl::paddingChange(newPadding, oldPadding); - if (isComponentComplete()) - d->resizeItems(); -} - -QT_END_NAMESPACE diff --git a/src/imports/calendar/qquickdayofweekrow_p.h b/src/imports/calendar/qquickdayofweekrow_p.h deleted file mode 100644 index 87dc3163..00000000 --- a/src/imports/calendar/qquickdayofweekrow_p.h +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKDAYOFWEEKROW_P_H -#define QQUICKDAYOFWEEKROW_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -QT_BEGIN_NAMESPACE - -class QQmlComponent; -class QQuickDayOfWeekRowPrivate; - -class QQuickDayOfWeekRow : public QQuickControl -{ - Q_OBJECT - Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged FINAL) - Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL) - -public: - explicit QQuickDayOfWeekRow(QQuickItem *parent = nullptr); - - QVariant source() const; - void setSource(const QVariant &source); - - QQmlComponent *delegate() const; - void setDelegate(QQmlComponent *delegate); - -Q_SIGNALS: - void sourceChanged(); - void delegateChanged(); - -protected: - void componentComplete() override; - void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override; - void localeChange(const QLocale &newLocale, const QLocale &oldLocale) override; - void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) override; - -private: - Q_DISABLE_COPY(QQuickDayOfWeekRow) - Q_DECLARE_PRIVATE(QQuickDayOfWeekRow) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QQuickDayOfWeekRow) - -#endif // QQUICKDAYOFWEEKROW_P_H diff --git a/src/imports/calendar/qquickmonthgrid.cpp b/src/imports/calendar/qquickmonthgrid.cpp deleted file mode 100644 index 0999e2ab..00000000 --- a/src/imports/calendar/qquickmonthgrid.cpp +++ /dev/null @@ -1,463 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickmonthgrid_p.h" -#include "qquickmonthmodel_p.h" - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -/*! - \qmltype MonthGrid - \inherits Control -//! \instantiates QQuickMonthGrid - \inqmlmodule Qt.labs.calendar - \brief A grid of days for a calendar month. - - MonthGrid presents a calendar month in a grid. The contents are - calculated for a given \l month and \l year, using the specified - \l {Control::locale}{locale}. - - \image qtlabscalendar-monthgrid.png - \snippet qtlabscalendar-monthgrid.qml 1 - - MonthGrid can be used as a standalone control, but it is most often - used in conjunction with DayOfWeekRow and WeekNumberColumn. Regardless - of the use case, positioning of the grid is left to the user. - - \image qtlabscalendar-monthgrid-layout.png - \snippet qtlabscalendar-monthgrid-layout.qml 1 - - The visual appearance of MonthGrid can be changed by - implementing a \l {delegate}{custom delegate}. - - \labs - - \sa DayOfWeekRow, WeekNumberColumn, CalendarModel -*/ - -/*! - \qmlsignal Qt.labs.calendar::MonthGrid::pressed(date date) - - This signal is emitted when \a date is pressed. -*/ - -/*! - \qmlsignal Qt.labs.calendar::MonthGrid::released(date date) - - This signal is emitted when \a date is released. -*/ - -/*! - \qmlsignal Qt.labs.calendar::MonthGrid::clicked(date date) - - This signal is emitted when \a date is clicked. -*/ - -/*! - \qmlsignal Qt.labs.calendar::MonthGrid::pressAndHold(date date) - - This signal is emitted when \a date is pressed and held down. -*/ - -class QQuickMonthGridPrivate : public QQuickControlPrivate -{ - Q_DECLARE_PUBLIC(QQuickMonthGrid) - -public: - QQuickMonthGridPrivate() : pressTimer(0), pressedItem(nullptr), model(nullptr), delegate(nullptr) { } - - void resizeItems(); - - QQuickItem *cellAt(const QPointF &pos) const; - QDate dateOf(QQuickItem *cell) const; - - void updatePress(const QPointF &pos); - void clearPress(bool clicked); - - void handlePress(const QPointF &point) override; - void handleMove(const QPointF &point) override; - void handleRelease(const QPointF &point) override; - void handleUngrab() override; - - static void setContextProperty(QQuickItem *item, const QString &name, const QVariant &value); - - QString title; - QVariant source; - QDate pressedDate; - int pressTimer; - QQuickItem *pressedItem; - QQuickMonthModel *model; - QQmlComponent *delegate; -}; - -void QQuickMonthGridPrivate::resizeItems() -{ - if (!contentItem) - return; - - QSizeF itemSize; - itemSize.setWidth((contentItem->width() - 6 * spacing) / 7); - itemSize.setHeight((contentItem->height() - 5 * spacing) / 6); - - const auto childItems = contentItem->childItems(); - for (QQuickItem *item : childItems) { - if (!QQuickItemPrivate::get(item)->isTransparentForPositioner()) - item->setSize(itemSize); - } -} - -QQuickItem *QQuickMonthGridPrivate::cellAt(const QPointF &pos) const -{ - Q_Q(const QQuickMonthGrid); - if (contentItem) { - QPointF mapped = q->mapToItem(contentItem, pos); - return contentItem->childAt(mapped.x(), mapped.y()); - } - return nullptr; -} - -QDate QQuickMonthGridPrivate::dateOf(QQuickItem *cell) const -{ - if (contentItem) - return model->dateAt(contentItem->childItems().indexOf(cell)); - return QDate(); -} - -void QQuickMonthGridPrivate::updatePress(const QPointF &pos) -{ - Q_Q(QQuickMonthGrid); - clearPress(false); - pressedItem = cellAt(pos); - setContextProperty(pressedItem, QStringLiteral("pressed"), true); - pressedDate = dateOf(pressedItem); - if (pressedDate.isValid()) - emit q->pressed(pressedDate); -} - -void QQuickMonthGridPrivate::clearPress(bool clicked) -{ - Q_Q(QQuickMonthGrid); - setContextProperty(pressedItem, QStringLiteral("pressed"), false); - if (pressedDate.isValid()) { - emit q->released(pressedDate); - if (clicked) - emit q->clicked(pressedDate); - } - pressedDate = QDate(); - pressedItem = nullptr; -} - -void QQuickMonthGridPrivate::handlePress(const QPointF &point) -{ - Q_Q(QQuickMonthGrid); - QQuickControlPrivate::handlePress(point); - updatePress(point); - if (pressedDate.isValid()) - pressTimer = q->startTimer(qGuiApp->styleHints()->mousePressAndHoldInterval()); -} - -void QQuickMonthGridPrivate::handleMove(const QPointF &point) -{ - QQuickControlPrivate::handleMove(point); - updatePress(point); -} - -void QQuickMonthGridPrivate::handleRelease(const QPointF &point) -{ - QQuickControlPrivate::handleRelease(point); - clearPress(true); -} - -void QQuickMonthGridPrivate::handleUngrab() -{ - QQuickControlPrivate::handleUngrab(); - clearPress(false); -} - -void QQuickMonthGridPrivate::setContextProperty(QQuickItem *item, const QString &name, const QVariant &value) -{ - QQmlContext *context = qmlContext(item); - if (context && context->isValid()) { - context = context->parentContext(); - if (context && context->isValid()) - context->setContextProperty(name, value); - } -} - -QQuickMonthGrid::QQuickMonthGrid(QQuickItem *parent) : - QQuickControl(*(new QQuickMonthGridPrivate), parent) -{ - Q_D(QQuickMonthGrid); - setFlag(ItemIsFocusScope); - setActiveFocusOnTab(true); - setAcceptedMouseButtons(Qt::LeftButton); -#if QT_CONFIG(cursor) - setCursor(Qt::ArrowCursor); -#endif - - d->model = new QQuickMonthModel(this); - d->source = QVariant::fromValue(d->model); - connect(d->model, &QQuickMonthModel::monthChanged, this, &QQuickMonthGrid::monthChanged); - connect(d->model, &QQuickMonthModel::yearChanged, this, &QQuickMonthGrid::yearChanged); - connect(d->model, &QQuickMonthModel::titleChanged, this, &QQuickMonthGrid::titleChanged); -} - -/*! - \qmlproperty int Qt.labs.calendar::MonthGrid::month - - This property holds the number of the month. The default value is the - current month. - - The Qt Labs Calendar module uses 0-based month numbers to be consistent - with the JavaScript Date type, that is used by the QML language. This - means that \c Date::getMonth() can be assigned to this property as is. - When dealing with dealing with month numbers directly, it is highly - recommended to use the following enumeration values to avoid confusion. - - \value Calendar.January January (0) - \value Calendar.February February (1) - \value Calendar.March March (2) - \value Calendar.April April (3) - \value Calendar.May May (4) - \value Calendar.June June (5) - \value Calendar.July July (6) - \value Calendar.August August (7) - \value Calendar.September September (8) - \value Calendar.October October (9) - \value Calendar.November November (10) - \value Calendar.December December (11) - - \sa Calendar -*/ -int QQuickMonthGrid::month() const -{ - Q_D(const QQuickMonthGrid); - return d->model->month() - 1; -} - -void QQuickMonthGrid::setMonth(int month) -{ - Q_D(QQuickMonthGrid); - if (month < 0 || month > 11) { - qmlWarning(this) << "month " << month << " is out of range [0...11]"; - return; - } - d->model->setMonth(month + 1); -} - -/*! - \qmlproperty int Qt.labs.calendar::MonthGrid::year - - This property holds the number of the year. - - The value must be in the range from \c -271820 to \c 275759. The default - value is the current year. -*/ -int QQuickMonthGrid::year() const -{ - Q_D(const QQuickMonthGrid); - return d->model->year(); -} - -void QQuickMonthGrid::setYear(int year) -{ - Q_D(QQuickMonthGrid); - if (year < -271820 || year > 275759) { - qmlWarning(this) << "year " << year << " is out of range [-271820...275759]"; - return; - } - d->model->setYear(year); -} - -/*! - \internal - \qmlproperty model Qt.labs.calendar::MonthGrid::source - - This property holds the source model that is used as a data model - for the internal content column. -*/ -QVariant QQuickMonthGrid::source() const -{ - Q_D(const QQuickMonthGrid); - return d->source; -} - -void QQuickMonthGrid::setSource(const QVariant &source) -{ - Q_D(QQuickMonthGrid); - if (d->source != source) { - d->source = source; - emit sourceChanged(); - } -} - -/*! - \qmlproperty string Qt.labs.calendar::MonthGrid::title - - This property holds a title for the calendar. - - This property is provided for convenience. MonthGrid itself does - not visualize the title. The default value consists of the month name, - formatted using \l {Control::locale}{locale}, and the year number. -*/ -QString QQuickMonthGrid::title() const -{ - Q_D(const QQuickMonthGrid); - if (d->title.isNull()) - return d->model->title(); - return d->title; -} - -void QQuickMonthGrid::setTitle(const QString &title) -{ - Q_D(QQuickMonthGrid); - if (d->title != title) { - d->title = title; - emit titleChanged(); - } -} - -/*! - \qmlproperty Component Qt.labs.calendar::MonthGrid::delegate - - This property holds the item delegate that visualizes each day. - - In addition to the \c index property, a list of model data roles - are available in the context of each delegate: - \table - \row \li \b model.date : date \li The date of the cell - \row \li \b model.day : int \li The number of the day - \row \li \b model.today : bool \li Whether the delegate represents today - \row \li \b model.weekNumber : int \li The week number - \row \li \b model.month : int \li The number of the month - \row \li \b model.year : int \li The number of the year - \endtable - - The following snippet presents the default implementation of the item - delegate. It can be used as a starting point for implementing custom - delegates. - - \snippet MonthGrid.qml delegate -*/ -QQmlComponent *QQuickMonthGrid::delegate() const -{ - Q_D(const QQuickMonthGrid); - return d->delegate; -} - -void QQuickMonthGrid::setDelegate(QQmlComponent *delegate) -{ - Q_D(QQuickMonthGrid); - if (d->delegate != delegate) { - d->delegate = delegate; - emit delegateChanged(); - } -} - -void QQuickMonthGrid::componentComplete() -{ - Q_D(QQuickMonthGrid); - QQuickControl::componentComplete(); - if (d->contentItem) { - const auto childItems = d->contentItem->childItems(); - for (QQuickItem *child : childItems) { - if (!QQuickItemPrivate::get(child)->isTransparentForPositioner()) - d->setContextProperty(child, QStringLiteral("pressed"), false); - } - } - d->resizeItems(); -} - -void QQuickMonthGrid::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) -{ - Q_D(QQuickMonthGrid); - QQuickControl::geometryChange(newGeometry, oldGeometry); - if (isComponentComplete()) - d->resizeItems(); -} - -void QQuickMonthGrid::localeChange(const QLocale &newLocale, const QLocale &oldLocale) -{ - Q_D(QQuickMonthGrid); - QQuickControl::localeChange(newLocale, oldLocale); - d->model->setLocale(newLocale); -} - -void QQuickMonthGrid::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) -{ - Q_D(QQuickMonthGrid); - QQuickControl::paddingChange(newPadding, oldPadding); - if (isComponentComplete()) - d->resizeItems(); -} - -void QQuickMonthGrid::updatePolish() -{ - Q_D(QQuickMonthGrid); - QQuickControl::updatePolish(); - d->resizeItems(); -} - -void QQuickMonthGrid::timerEvent(QTimerEvent *event) -{ - Q_D(QQuickMonthGrid); - if (event->timerId() == d->pressTimer) { - if (d->pressedDate.isValid()) - emit pressAndHold(d->pressedDate); - killTimer(d->pressTimer); - } -} - -QT_END_NAMESPACE diff --git a/src/imports/calendar/qquickmonthgrid_p.h b/src/imports/calendar/qquickmonthgrid_p.h deleted file mode 100644 index 104dfbb5..00000000 --- a/src/imports/calendar/qquickmonthgrid_p.h +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKMONTHGRID_P_H -#define QQUICKMONTHGRID_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -QT_BEGIN_NAMESPACE - -class QQmlComponent; -class QQuickMonthGridPrivate; - -class QQuickMonthGrid : public QQuickControl -{ - Q_OBJECT - Q_PROPERTY(int month READ month WRITE setMonth NOTIFY monthChanged FINAL) - Q_PROPERTY(int year READ year WRITE setYear NOTIFY yearChanged FINAL) - Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged FINAL) - Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL) - Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL) - -public: - explicit QQuickMonthGrid(QQuickItem *parent = nullptr); - - int month() const; - void setMonth(int month); - - int year() const; - void setYear(int year); - - QVariant source() const; - void setSource(const QVariant &source); - - QString title() const; - void setTitle(const QString &title); - - QQmlComponent *delegate() const; - void setDelegate(QQmlComponent *delegate); - -Q_SIGNALS: - void monthChanged(); - void yearChanged(); - void sourceChanged(); - void titleChanged(); - void delegateChanged(); - - void pressed(const QDate &date); - void released(const QDate &date); - void clicked(const QDate &date); - void pressAndHold(const QDate &date); - -protected: - void componentComplete() override; - void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override; - void localeChange(const QLocale &newLocale, const QLocale &oldLocale) override; - void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) override; - void updatePolish() override; - - void timerEvent(QTimerEvent *event) override; - -private: - Q_DISABLE_COPY(QQuickMonthGrid) - Q_DECLARE_PRIVATE(QQuickMonthGrid) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QQuickMonthGrid) - -#endif // QQUICKMONTHGRID_P_H diff --git a/src/imports/calendar/qquickmonthmodel.cpp b/src/imports/calendar/qquickmonthmodel.cpp deleted file mode 100644 index 0d83ace3..00000000 --- a/src/imports/calendar/qquickmonthmodel.cpp +++ /dev/null @@ -1,240 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickmonthmodel_p.h" - -#include - -namespace { - static const int daysInAWeek = 7; - static const int weeksOnACalendarMonth = 6; - static const int daysOnACalendarMonth = daysInAWeek * weeksOnACalendarMonth; -} - -QT_BEGIN_NAMESPACE - -class QQuickMonthModelPrivate : public QAbstractItemModelPrivate -{ - Q_DECLARE_PUBLIC(QQuickMonthModel) - -public: - QQuickMonthModelPrivate() : dates(daysOnACalendarMonth) - { - today = QDate::currentDate(); - month = today.month(); - year = today.year(); - } - - bool populate(int month, int year, const QLocale &locale, bool force = false); - - int month; - int year; - QString title; - QLocale locale; - QVector dates; - QDate today; -}; - -bool QQuickMonthModelPrivate::populate(int m, int y, const QLocale &l, bool force) -{ - Q_Q(QQuickMonthModel); - if (!force && m == month && y == year && l.firstDayOfWeek() == locale.firstDayOfWeek()) - return false; - - // The actual first (1st) day of the month. - QDate firstDayOfMonthDate(y, m, 1); - int difference = ((firstDayOfMonthDate.dayOfWeek() - l.firstDayOfWeek()) + 7) % 7; - // The first day to display should never be the 1st of the month, as we want some days from - // the previous month to be visible. - if (difference == 0) - difference += 7; - QDate firstDateToDisplay = firstDayOfMonthDate.addDays(-difference); - - today = QDate::currentDate(); - for (int i = 0; i < daysOnACalendarMonth; ++i) - dates[i] = firstDateToDisplay.addDays(i); - - q->setTitle(l.standaloneMonthName(m) + QStringLiteral(" ") + QString::number(y)); - - return true; -} - -QQuickMonthModel::QQuickMonthModel(QObject *parent) : - QAbstractListModel(*(new QQuickMonthModelPrivate), parent) -{ - Q_D(QQuickMonthModel); - d->populate(d->month, d->year, d->locale, true); -} - -int QQuickMonthModel::month() const -{ - Q_D(const QQuickMonthModel); - return d->month; -} - -void QQuickMonthModel::setMonth(int month) -{ - Q_D(QQuickMonthModel); - if (d->month != month) { - if (d->populate(month, d->year, d->locale)) - emit dataChanged(index(0, 0), index(daysOnACalendarMonth - 1, 0)); - d->month = month; - emit monthChanged(); - } -} - -int QQuickMonthModel::year() const -{ - Q_D(const QQuickMonthModel); - return d->year; -} - -void QQuickMonthModel::setYear(int year) -{ - Q_D(QQuickMonthModel); - if (d->year != year) { - if (d->populate(d->month, year, d->locale)) - emit dataChanged(index(0, 0), index(daysOnACalendarMonth - 1, 0)); - d->year = year; - emit yearChanged(); - } -} - -QLocale QQuickMonthModel::locale() const -{ - Q_D(const QQuickMonthModel); - return d->locale; -} - -void QQuickMonthModel::setLocale(const QLocale &locale) -{ - Q_D(QQuickMonthModel); - if (d->locale != locale) { - if (d->populate(d->month, d->year, locale)) - emit dataChanged(index(0, 0), index(daysOnACalendarMonth - 1, 0)); - d->locale = locale; - emit localeChanged(); - } -} - -QString QQuickMonthModel::title() const -{ - Q_D(const QQuickMonthModel); - return d->title; -} - -void QQuickMonthModel::setTitle(const QString &title) -{ - Q_D(QQuickMonthModel); - if (d->title != title) { - d->title = title; - emit titleChanged(); - } -} - -QDate QQuickMonthModel::dateAt(int index) const -{ - Q_D(const QQuickMonthModel); - return d->dates.value(index); -} - -int QQuickMonthModel::indexOf(const QDate &date) const -{ - Q_D(const QQuickMonthModel); - if (date < d->dates.first() || date > d->dates.last()) - return -1; - return qMax(qint64(0), d->dates.first().daysTo(date)); -} - -QVariant QQuickMonthModel::data(const QModelIndex &index, int role) const -{ - Q_D(const QQuickMonthModel); - if (index.isValid() && index.row() < daysOnACalendarMonth) { - const QDate date = d->dates.at(index.row()); - switch (role) { - case DateRole: - return date; - case DayRole: - return date.day(); - case TodayRole: - return date == d->today; - case WeekNumberRole: - return date.weekNumber(); - case MonthRole: - return date.month() - 1; - case YearRole: - return date.year(); - default: - break; - } - } - return QVariant(); -} - -int QQuickMonthModel::rowCount(const QModelIndex &parent) const -{ - if (parent.isValid()) - return 0; - return daysOnACalendarMonth; -} - -QHash QQuickMonthModel::roleNames() const -{ - QHash roles; - roles[DateRole] = QByteArrayLiteral("date"); - roles[DayRole] = QByteArrayLiteral("day"); - roles[TodayRole] = QByteArrayLiteral("today"); - roles[WeekNumberRole] = QByteArrayLiteral("weekNumber"); - roles[MonthRole] = QByteArrayLiteral("month"); - roles[YearRole] = QByteArrayLiteral("year"); - return roles; -} - -QT_END_NAMESPACE diff --git a/src/imports/calendar/qquickmonthmodel_p.h b/src/imports/calendar/qquickmonthmodel_p.h deleted file mode 100644 index a0c7ab24..00000000 --- a/src/imports/calendar/qquickmonthmodel_p.h +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKMONTHMODEL_P_H -#define QQUICKMONTHMODEL_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QQuickMonthModelPrivate; - -class QQuickMonthModel : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(int month READ month WRITE setMonth NOTIFY monthChanged FINAL) - Q_PROPERTY(int year READ year WRITE setYear NOTIFY yearChanged FINAL) - Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL) - Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL) - Q_PROPERTY(int count READ rowCount CONSTANT FINAL) - -public: - explicit QQuickMonthModel(QObject *parent = nullptr); - - int month() const; - void setMonth(int month); - - int year() const; - void setYear(int year); - - QLocale locale() const; - void setLocale(const QLocale &locale); - - QString title() const; - void setTitle(const QString &title); - - Q_INVOKABLE QDate dateAt(int index) const; - Q_INVOKABLE int indexOf(const QDate &date) const; - - enum { - DateRole = Qt::UserRole + 1, - DayRole, - TodayRole, - WeekNumberRole, - MonthRole, - YearRole - }; - - QHash roleNames() const override; - QVariant data(const QModelIndex &index, int role) const override; - int rowCount(const QModelIndex &parent = QModelIndex()) const override; - -Q_SIGNALS: - void monthChanged(); - void yearChanged(); - void localeChanged(); - void titleChanged(); - -private: - Q_DISABLE_COPY(QQuickMonthModel) - Q_DECLARE_PRIVATE(QQuickMonthModel) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QQuickMonthModel) - -#endif // QQUICKMONTHMODEL_P_H diff --git a/src/imports/calendar/qquickweeknumbercolumn.cpp b/src/imports/calendar/qquickweeknumbercolumn.cpp deleted file mode 100644 index 55d32981..00000000 --- a/src/imports/calendar/qquickweeknumbercolumn.cpp +++ /dev/null @@ -1,275 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickweeknumbercolumn_p.h" -#include "qquickweeknumbermodel_p.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -/*! - \qmltype WeekNumberColumn - \inherits Control -//! \instantiates QQuickWeekNumberColumn - \inqmlmodule Qt.labs.calendar - \brief A column of week numbers. - - WeekNumberColumn presents week numbers in a column. The week numbers - are calculated for a given \l month and \l year, using the specified - \l {Control::locale}{locale}. - - \image qtlabscalendar-weeknumbercolumn.png - \snippet qtlabscalendar-weeknumbercolumn.qml 1 - - WeekNumberColumn can be used as a standalone control, but it is most - often used in conjunction with MonthGrid. Regardless of the use case, - positioning of the column is left to the user. - - \image qtlabscalendar-weeknumbercolumn-layout.png - \snippet qtlabscalendar-weeknumbercolumn-layout.qml 1 - - The visual appearance of WeekNumberColumn can be changed by - implementing a \l {delegate}{custom delegate}. - - \labs - - \sa MonthGrid, DayOfWeekRow -*/ - -class QQuickWeekNumberColumnPrivate : public QQuickControlPrivate -{ -public: - QQuickWeekNumberColumnPrivate() : delegate(nullptr), model(nullptr) { } - - void resizeItems(); - - QVariant source; - QQmlComponent *delegate; - QQuickWeekNumberModel *model; -}; - -void QQuickWeekNumberColumnPrivate::resizeItems() -{ - if (!contentItem) - return; - - QSizeF itemSize; - itemSize.setWidth(contentItem->width()); - itemSize.setHeight((contentItem->height() - 5 * spacing) / 6); - - const auto childItems = contentItem->childItems(); - for (QQuickItem *item : childItems) - item->setSize(itemSize); -} - -QQuickWeekNumberColumn::QQuickWeekNumberColumn(QQuickItem *parent) : - QQuickControl(*(new QQuickWeekNumberColumnPrivate), parent) -{ - Q_D(QQuickWeekNumberColumn); - d->model = new QQuickWeekNumberModel(this); - d->source = QVariant::fromValue(d->model); - connect(d->model, &QQuickWeekNumberModel::monthChanged, this, &QQuickWeekNumberColumn::monthChanged); - connect(d->model, &QQuickWeekNumberModel::yearChanged, this, &QQuickWeekNumberColumn::yearChanged); -} - -/*! - \qmlproperty int Qt.labs.calendar::WeekNumberColumn::month - - This property holds the number of the month that the week numbers are - calculated for. The default value is the current month. - - The Qt Labs Calendar module uses 0-based month numbers to be consistent - with the JavaScript Date type, that is used by the QML language. This - means that \c Date::getMonth() can be assigned to this property as is. - When dealing with dealing with month numbers directly, it is highly - recommended to use the following enumeration values to avoid confusion. - - \value Calendar.January January (0) - \value Calendar.February February (1) - \value Calendar.March March (2) - \value Calendar.April April (3) - \value Calendar.May May (4) - \value Calendar.June June (5) - \value Calendar.July July (6) - \value Calendar.August August (7) - \value Calendar.September September (8) - \value Calendar.October October (9) - \value Calendar.November November (10) - \value Calendar.December December (11) - - \sa Calendar -*/ -int QQuickWeekNumberColumn::month() const -{ - Q_D(const QQuickWeekNumberColumn); - return d->model->month() - 1; -} - -void QQuickWeekNumberColumn::setMonth(int month) -{ - Q_D(QQuickWeekNumberColumn); - if (month < 0 || month > 11) { - qmlWarning(this) << "month " << month << " is out of range [0...11]"; - return; - } - d->model->setMonth(month + 1); -} - -/*! - \qmlproperty int Qt.labs.calendar::WeekNumberColumn::year - - This property holds the number of the year that the week numbers are calculated for. - - The value must be in the range from \c -271820 to \c 275759. The default - value is the current year. -*/ -int QQuickWeekNumberColumn::year() const -{ - Q_D(const QQuickWeekNumberColumn); - return d->model->year(); -} - -void QQuickWeekNumberColumn::setYear(int year) -{ - Q_D(QQuickWeekNumberColumn); - if (year < -271820 || year > 275759) { - qmlWarning(this) << "year " << year << " is out of range [-271820...275759]"; - return; - } - d->model->setYear(year); -} - -/*! - \internal - \qmlproperty model Qt.labs.calendar::WeekNumberColumn::source - - This property holds the source model that is used as a data model - for the internal content column. -*/ -QVariant QQuickWeekNumberColumn::source() const -{ - Q_D(const QQuickWeekNumberColumn); - return d->source; -} - -void QQuickWeekNumberColumn::setSource(const QVariant &source) -{ - Q_D(QQuickWeekNumberColumn); - if (d->source != source) { - d->source = source; - emit sourceChanged(); - } -} - -/*! - \qmlproperty Component Qt.labs.calendar::WeekNumberColumn::delegate - - This property holds the item delegate that visualizes each week number. - - In addition to the \c index property, a list of model data roles - are available in the context of each delegate: - \table - \row \li \b model.weekNumber : int \li The week number - \endtable - - The following snippet presents the default implementation of the item - delegate. It can be used as a starting point for implementing custom - delegates. - - \snippet WeekNumberColumn.qml delegate -*/ -QQmlComponent *QQuickWeekNumberColumn::delegate() const -{ - Q_D(const QQuickWeekNumberColumn); - return d->delegate; -} - -void QQuickWeekNumberColumn::setDelegate(QQmlComponent *delegate) -{ - Q_D(QQuickWeekNumberColumn); - if (d->delegate != delegate) { - d->delegate = delegate; - emit delegateChanged(); - } -} - -void QQuickWeekNumberColumn::componentComplete() -{ - Q_D(QQuickWeekNumberColumn); - QQuickControl::componentComplete(); - d->resizeItems(); -} - -void QQuickWeekNumberColumn::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) -{ - Q_D(QQuickWeekNumberColumn); - QQuickControl::geometryChange(newGeometry, oldGeometry); - if (isComponentComplete()) - d->resizeItems(); -} - -void QQuickWeekNumberColumn::localeChange(const QLocale &newLocale, const QLocale &oldLocale) -{ - Q_D(QQuickWeekNumberColumn); - QQuickControl::localeChange(newLocale, oldLocale); - d->model->setLocale(newLocale); -} - -void QQuickWeekNumberColumn::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) -{ - Q_D(QQuickWeekNumberColumn); - QQuickControl::paddingChange(newPadding, oldPadding); - if (isComponentComplete()) - d->resizeItems(); -} - -QT_END_NAMESPACE diff --git a/src/imports/calendar/qquickweeknumbercolumn_p.h b/src/imports/calendar/qquickweeknumbercolumn_p.h deleted file mode 100644 index 6a6c337f..00000000 --- a/src/imports/calendar/qquickweeknumbercolumn_p.h +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEEKNUMBERCOLUMN_P_H -#define QQUICKWEEKNUMBERCOLUMN_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -QT_BEGIN_NAMESPACE - -class QQmlComponent; -class QQuickWeekNumberColumnPrivate; - -class QQuickWeekNumberColumn : public QQuickControl -{ - Q_OBJECT - Q_PROPERTY(int month READ month WRITE setMonth NOTIFY monthChanged FINAL) - Q_PROPERTY(int year READ year WRITE setYear NOTIFY yearChanged FINAL) - Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged FINAL) - Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL) - -public: - explicit QQuickWeekNumberColumn(QQuickItem *parent = nullptr); - - int month() const; - void setMonth(int month); - - int year() const; - void setYear(int year); - - QVariant source() const; - void setSource(const QVariant &source); - - QQmlComponent *delegate() const; - void setDelegate(QQmlComponent *delegate); - -Q_SIGNALS: - void monthChanged(); - void yearChanged(); - void sourceChanged(); - void delegateChanged(); - -protected: - void componentComplete() override; - void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override; - void localeChange(const QLocale &newLocale, const QLocale &oldLocale) override; - void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) override; - -private: - Q_DISABLE_COPY(QQuickWeekNumberColumn) - Q_DECLARE_PRIVATE(QQuickWeekNumberColumn) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QQuickWeekNumberColumn) - -#endif // QQUICKWEEKNUMBERCOLUMN_P_H diff --git a/src/imports/calendar/qquickweeknumbermodel.cpp b/src/imports/calendar/qquickweeknumbermodel.cpp deleted file mode 100644 index 28895790..00000000 --- a/src/imports/calendar/qquickweeknumbermodel.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qquickweeknumbermodel_p.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -class QQuickWeekNumberModelPrivate : public QAbstractItemModelPrivate -{ - Q_DECLARE_PUBLIC(QQuickWeekNumberModel) - -public: - QQuickWeekNumberModelPrivate() : month(-1), year(-1), weekNumbers{} - { - QDate date = QDate::currentDate(); - init(date.month(), date.year(), locale); - month = date.month(); - year = date.year(); - } - - void init(int month, int year, const QLocale &locale = QLocale()); - static QDate calculateFirst(int month, int year, const QLocale &locale); - - int month; - int year; - QLocale locale; - int weekNumbers[6]; -}; - -void QQuickWeekNumberModelPrivate::init(int m, int y, const QLocale &l) -{ - Q_Q(QQuickWeekNumberModel); - if (m == month && y == year && l.firstDayOfWeek() == locale.firstDayOfWeek()) - return; - - // The actual first (1st) day of the month. - QDate firstDayOfMonthDate(y, m, 1); - int difference = ((firstDayOfMonthDate.dayOfWeek() - l.firstDayOfWeek()) + 7) % 7; - // The first day to display should never be the 1st of the month, as we want some days from - // the previous month to be visible. - if (difference == 0) - difference += 7; - - for (int i = 0; i < 6; ++i) - weekNumbers[i] = firstDayOfMonthDate.addDays(i * 7 - difference).weekNumber(); - - if (q) // null at construction - emit q->dataChanged(q->index(0, 0), q->index(5, 0)); -} - -QQuickWeekNumberModel::QQuickWeekNumberModel(QObject *parent) : - QAbstractListModel(*(new QQuickWeekNumberModelPrivate), parent) -{ -} - -int QQuickWeekNumberModel::month() const -{ - Q_D(const QQuickWeekNumberModel); - return d->month; -} - -void QQuickWeekNumberModel::setMonth(int month) -{ - Q_D(QQuickWeekNumberModel); - if (d->month != month) { - d->init(month, d->year, d->locale); - d->month = month; - emit monthChanged(); - } -} - -int QQuickWeekNumberModel::year() const -{ - Q_D(const QQuickWeekNumberModel); - return d->year; -} - -void QQuickWeekNumberModel::setYear(int year) -{ - Q_D(QQuickWeekNumberModel); - if (d->year != year) { - d->init(d->month, year, d->locale); - d->year = year; - emit yearChanged(); - } -} - -QLocale QQuickWeekNumberModel::locale() const -{ - Q_D(const QQuickWeekNumberModel); - return d->locale; -} - -void QQuickWeekNumberModel::setLocale(const QLocale &locale) -{ - Q_D(QQuickWeekNumberModel); - if (d->locale != locale) { - d->init(d->month, d->year, locale); - d->locale = locale; - emit localeChanged(); - } -} - -int QQuickWeekNumberModel::weekNumberAt(int index) const -{ - Q_D(const QQuickWeekNumberModel); - if (index < 0 || index > 5) - return -1; - return d->weekNumbers[index]; -} - -int QQuickWeekNumberModel::indexOf(int weekNumber) const -{ - Q_D(const QQuickWeekNumberModel); - if (weekNumber < d->weekNumbers[0] || weekNumber > d->weekNumbers[5]) - return -1; - return weekNumber - d->weekNumbers[0]; -} - -QVariant QQuickWeekNumberModel::data(const QModelIndex &index, int role) const -{ - if (role == WeekNumberRole) { - int weekNumber = weekNumberAt(index.row()); - if (weekNumber != -1) - return weekNumber; - } - return QVariant(); -} - -int QQuickWeekNumberModel::rowCount(const QModelIndex &parent) const -{ - if (parent.isValid()) - return 0; - return 6; -} - -QHash QQuickWeekNumberModel::roleNames() const -{ - QHash roles; - roles[WeekNumberRole] = QByteArrayLiteral("weekNumber"); - return roles; -} - -QT_END_NAMESPACE diff --git a/src/imports/calendar/qquickweeknumbermodel_p.h b/src/imports/calendar/qquickweeknumbermodel_p.h deleted file mode 100644 index 1c6b7ef4..00000000 --- a/src/imports/calendar/qquickweeknumbermodel_p.h +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKWEEKNUMBERMODEL_P_H -#define QQUICKWEEKNUMBERMODEL_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QQuickWeekNumberModelPrivate; - -class QQuickWeekNumberModel : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(int month READ month WRITE setMonth NOTIFY monthChanged FINAL) - Q_PROPERTY(int year READ year WRITE setYear NOTIFY yearChanged FINAL) - Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL) - Q_PROPERTY(int count READ rowCount CONSTANT FINAL) - -public: - explicit QQuickWeekNumberModel(QObject *parent = nullptr); - - int month() const; - void setMonth(int month); - - int year() const; - void setYear(int year); - - QLocale locale() const; - void setLocale(const QLocale &locale); - - Q_INVOKABLE int weekNumberAt(int index) const; - Q_INVOKABLE int indexOf(int weekNumber) const; - - enum { - WeekNumberRole = Qt::UserRole + 1 - }; - - QHash roleNames() const override; - QVariant data(const QModelIndex &index, int role) const override; - int rowCount(const QModelIndex &parent = QModelIndex()) const override; - -Q_SIGNALS: - void monthChanged(); - void yearChanged(); - void localeChanged(); - -private: - Q_DISABLE_COPY(QQuickWeekNumberModel) - Q_DECLARE_PRIVATE(QQuickWeekNumberModel) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QQuickWeekNumberModel) - -#endif // QQUICKWEEKNUMBERMODEL_P_H diff --git a/src/imports/calendar/qtlabscalendarplugin.cpp b/src/imports/calendar/qtlabscalendarplugin.cpp deleted file mode 100644 index afeb8a40..00000000 --- a/src/imports/calendar/qtlabscalendarplugin.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Calendar module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "qquickdayofweekrow_p.h" -#include "qquickmonthgrid_p.h" -#include "qquickweeknumbercolumn_p.h" -#include "qquickcalendarmodel_p.h" -#include "qquickcalendar_p.h" - -QT_BEGIN_NAMESPACE - -class QtLabsCalendarPlugin: public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) - -public: - QtLabsCalendarPlugin(QObject *parent = nullptr); - void registerTypes(const char *uri) override; -}; - -QtLabsCalendarPlugin::QtLabsCalendarPlugin(QObject *parent) : QQmlExtensionPlugin(parent) -{ -} - -static QObject *calendarSingleton(QQmlEngine *engine, QJSEngine *scriptEngine) -{ - Q_UNUSED(engine); - Q_UNUSED(scriptEngine); - return new QQuickCalendar; -} - -void QtLabsCalendarPlugin::registerTypes(const char *uri) -{ - qmlRegisterType(uri, 1, 0, "AbstractDayOfWeekRow"); - qmlRegisterType(uri, 1, 0, "AbstractMonthGrid"); - qmlRegisterType(uri, 1, 0, "AbstractWeekNumberColumn"); - qmlRegisterType(uri, 1, 0, "CalendarModel"); - qmlRegisterSingletonType(uri, 1, 0, "Calendar", calendarSingleton); -} - -QT_END_NAMESPACE - -#include "qtlabscalendarplugin.moc" diff --git a/src/imports/controls/CMakeLists.txt b/src/imports/controls/CMakeLists.txt index 626155f8..3cef4d26 100644 --- a/src/imports/controls/CMakeLists.txt +++ b/src/imports/controls/CMakeLists.txt @@ -71,7 +71,7 @@ qt_add_resource(qtquickcontrols2plugin "qtquickcontrols2plugin" #### Keys ignored in scope 1:.:.:controls.pro:: # IMPORT_VERSION = "2.$$QT_MINOR_VERSION" -# OTHER_FILES = "qmldir" "$$QML_FILES" "$$PWD/snippets/*.qml" "$$PWD/src/*.qdoc" "$$PWD/src/calendar/*.qdoc" "$$PWD/src/templates/*.qdoc" +# OTHER_FILES = "qmldir" "$$QML_FILES" "$$PWD/snippets/*.qml" "$$PWD/src/*.qdoc" "$$PWD/src/templates/*.qdoc" # TARGETPATH = "QtQuick/Controls.2" # _REQUIREMENTS = "qtConfig(quickcontrols2-default)" diff --git a/src/imports/controls/doc/doc.pri b/src/imports/controls/doc/doc.pri index f1bf7e80..4bd8bd95 100644 --- a/src/imports/controls/doc/doc.pri +++ b/src/imports/controls/doc/doc.pri @@ -3,5 +3,4 @@ QMAKE_DOCS = $$PWD/qtquickcontrols.qdocconf OTHER_FILES += \ $$files($$PWD/snippets/*.qml) \ $$files($$PWD/src/*.qdoc) \ - $$files($$PWD/src/calendar/*.qdoc) \ $$files($$PWD/src/templates/*.qdoc) diff --git a/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc index bfb27dcb..7f8a066d 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc @@ -224,12 +224,12 @@ \row \li \l [QML QtQuickControls1] {Calendar} \li \mdash - \li \l [QML QtLabsCalendar] {MonthGrid},\br - \l [QML QtLabsCalendar] {DayOfWeekRow},\br - \l [QML QtLabsCalendar] {WeekNumberColumn} \br\sup {(Qt Labs Calendar)} + \li \l [QML QtQuickCalendar] {MonthGrid},\br + \l [QML QtQuickCalendar] {DayOfWeekRow},\br + \l [QML QtQuickCalendar] {WeekNumberColumn} \br\sup {(Qt Quick Calendar)} \li \list - \li \b {Qt Labs Calendar}: \c MonthGrid, \c DayOfWeek, and \c WeekNumberColumn - are \e experimental unstyled building blocks for calendar views. + \li \b {Qt Quick Calendar}: \c MonthGrid, \c DayOfWeek, and \c WeekNumberColumn + are \e unstyled building blocks for calendar views. \endlist \row \li \l [QML QtQuickControls1] {CheckBox} diff --git a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc index ac306aaa..fee009e6 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc @@ -90,7 +90,7 @@ \l {Material Style}{\c QtQuick.Controls.Material},\br \l {Universal Style}{\c QtQuick.Controls.Universal},\br \l {Qt Quick Templates 2 QML Types}{\c QtQuick.Templates} - \li \l {Qt Labs Calendar QML Types}{\c Qt.labs.calendar},\br + \li \l {Qt Quick Calendar QML Types}{\c QtQuick.Calendar},\br \l {Qt Labs Platform QML Types}{\c Qt.labs.platform} \row \li 5.7 @@ -182,7 +182,7 @@ \li \l{Qt Quick} \li \l{Qt Quick Layouts} \li \l{Qt Quick Templates 2} - \li \l{Qt Labs Calendar} + \li \l{Qt Quick Calendar} \li \l{Qt Labs Platform} \endlist */ diff --git a/src/imports/imports.pro b/src/imports/imports.pro index e32bded7..2345616e 100644 --- a/src/imports/imports.pro +++ b/src/imports/imports.pro @@ -1,7 +1,6 @@ TEMPLATE = subdirs SUBDIRS += \ controls \ - calendar \ platform \ templates diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt index 8976a7dd..31d13ca7 100644 --- a/tests/auto/CMakeLists.txt +++ b/tests/auto/CMakeLists.txt @@ -1,7 +1,6 @@ # Generated from auto.pro. add_subdirectory(accessibility) -add_subdirectory(calendar) add_subdirectory(controls) add_subdirectory(cursor) add_subdirectory(customization) diff --git a/tests/auto/accessibility/CMakeLists.txt b/tests/auto/accessibility/CMakeLists.txt index a1f67d17..9a8fa784 100644 --- a/tests/auto/accessibility/CMakeLists.txt +++ b/tests/auto/accessibility/CMakeLists.txt @@ -1,5 +1,9 @@ # Generated from accessibility.pro. +if(NOT QT_FEATURE_accessibility) + return() +endif() + ##################################################################### ## tst_accessibility Test: ##################################################################### @@ -32,6 +36,7 @@ qt_add_test(tst_accessibility #### Keys ignored in scope 1:.:.:accessibility.pro:: # OTHER_FILES = "data/*.qml" +# _REQUIREMENTS = "qtConfig(accessibility)" ## Scopes: ##################################################################### diff --git a/tests/auto/accessibility/data/defaults/dayofweekrow-2.qml b/tests/auto/accessibility/data/defaults/dayofweekrow-2.qml deleted file mode 100644 index 96c750cb..00000000 --- a/tests/auto/accessibility/data/defaults/dayofweekrow-2.qml +++ /dev/null @@ -1,4 +0,0 @@ -import QtQuick 2.12 -import Qt.labs.calendar 1.0 - -DayOfWeekRow { } diff --git a/tests/auto/accessibility/data/defaults/dayofweekrow.qml b/tests/auto/accessibility/data/defaults/dayofweekrow.qml deleted file mode 100644 index a2aa44ec..00000000 --- a/tests/auto/accessibility/data/defaults/dayofweekrow.qml +++ /dev/null @@ -1,6 +0,0 @@ -import QtQuick 2.12 -import Qt.labs.calendar 1.0 - -DayOfWeekRow { - Accessible.name: "DayOfWeekRow" -} diff --git a/tests/auto/accessibility/data/defaults/monthgrid-2.qml b/tests/auto/accessibility/data/defaults/monthgrid-2.qml deleted file mode 100644 index 6368d090..00000000 --- a/tests/auto/accessibility/data/defaults/monthgrid-2.qml +++ /dev/null @@ -1,6 +0,0 @@ -import QtQuick 2.12 -import Qt.labs.calendar 1.0 - -MonthGrid { - title: "MonthGrid" -} diff --git a/tests/auto/accessibility/data/defaults/monthgrid.qml b/tests/auto/accessibility/data/defaults/monthgrid.qml deleted file mode 100644 index 03de2499..00000000 --- a/tests/auto/accessibility/data/defaults/monthgrid.qml +++ /dev/null @@ -1,7 +0,0 @@ -import QtQuick 2.12 -import Qt.labs.calendar 1.0 - -MonthGrid { - title: "MonthGrid" - Accessible.name: title -} diff --git a/tests/auto/accessibility/data/defaults/weeknumbercolumn-2.qml b/tests/auto/accessibility/data/defaults/weeknumbercolumn-2.qml deleted file mode 100644 index 2c5b836b..00000000 --- a/tests/auto/accessibility/data/defaults/weeknumbercolumn-2.qml +++ /dev/null @@ -1,4 +0,0 @@ -import QtQuick 2.12 -import Qt.labs.calendar 1.0 - -WeekNumberColumn { } diff --git a/tests/auto/accessibility/data/defaults/weeknumbercolumn.qml b/tests/auto/accessibility/data/defaults/weeknumbercolumn.qml deleted file mode 100644 index 71d533ef..00000000 --- a/tests/auto/accessibility/data/defaults/weeknumbercolumn.qml +++ /dev/null @@ -1,6 +0,0 @@ -import QtQuick 2.12 -import Qt.labs.calendar 1.0 - -WeekNumberColumn { - Accessible.name: "WeekNumberColumn" -} diff --git a/tests/auto/accessibility/data/override/dayofweekrow-2.qml b/tests/auto/accessibility/data/override/dayofweekrow-2.qml deleted file mode 100644 index 344bd94c..00000000 --- a/tests/auto/accessibility/data/override/dayofweekrow-2.qml +++ /dev/null @@ -1,6 +0,0 @@ -import QtQuick 2.12 -import Qt.labs.calendar 1.0 - -DayOfWeekRow { - Accessible.name: "Override" -} diff --git a/tests/auto/accessibility/data/override/dayofweekrow.qml b/tests/auto/accessibility/data/override/dayofweekrow.qml deleted file mode 100644 index e1e682c5..00000000 --- a/tests/auto/accessibility/data/override/dayofweekrow.qml +++ /dev/null @@ -1,6 +0,0 @@ -import QtQuick 2.12 -import Qt.labs.calendar 1.0 - -DayOfWeekRow { - Accessible.name: "DayOfWeekRowOverride" -} diff --git a/tests/auto/accessibility/data/override/monthgrid-2.qml b/tests/auto/accessibility/data/override/monthgrid-2.qml deleted file mode 100644 index f56f7788..00000000 --- a/tests/auto/accessibility/data/override/monthgrid-2.qml +++ /dev/null @@ -1,7 +0,0 @@ -import QtQuick 2.12 -import Qt.labs.calendar 1.0 - -MonthGrid { - title: "MonthGrid" - Accessible.name: title + "Override" -} diff --git a/tests/auto/accessibility/data/override/monthgrid.qml b/tests/auto/accessibility/data/override/monthgrid.qml deleted file mode 100644 index f56f7788..00000000 --- a/tests/auto/accessibility/data/override/monthgrid.qml +++ /dev/null @@ -1,7 +0,0 @@ -import QtQuick 2.12 -import Qt.labs.calendar 1.0 - -MonthGrid { - title: "MonthGrid" - Accessible.name: title + "Override" -} diff --git a/tests/auto/accessibility/data/override/weeknumbercolumn-2.qml b/tests/auto/accessibility/data/override/weeknumbercolumn-2.qml deleted file mode 100644 index 2c5b836b..00000000 --- a/tests/auto/accessibility/data/override/weeknumbercolumn-2.qml +++ /dev/null @@ -1,4 +0,0 @@ -import QtQuick 2.12 -import Qt.labs.calendar 1.0 - -WeekNumberColumn { } diff --git a/tests/auto/accessibility/data/override/weeknumbercolumn.qml b/tests/auto/accessibility/data/override/weeknumbercolumn.qml deleted file mode 100644 index 7e182917..00000000 --- a/tests/auto/accessibility/data/override/weeknumbercolumn.qml +++ /dev/null @@ -1,6 +0,0 @@ -import QtQuick 2.12 -import Qt.labs.calendar 1.0 - -WeekNumberColumn { - Accessible.name: "WeekNumberColumnOverride" -} diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp index 6e5a37df..220facb3 100644 --- a/tests/auto/accessibility/tst_accessibility.cpp +++ b/tests/auto/accessibility/tst_accessibility.cpp @@ -144,10 +144,6 @@ void tst_accessibility::a11y_data() QTest::newRow("ToolButton") << "toolbutton" << QAccessible::Button << "ToolButton"; QTest::newRow("ToolTip") << "tooltip" << QAccessible::ToolTip << "ToolTip"; QTest::newRow("Tumbler") << "tumbler" << QAccessible::NoRole << ""; // TODO - - QTest::newRow("DayOfWeekRow") << "dayofweekrow" << QAccessible::NoRole << "DayOfWeekRow"; - QTest::newRow("MonthGrid") << "monthgrid" << QAccessible::NoRole << "MonthGrid"; - QTest::newRow("WeekNumberColumn") << "weeknumbercolumn" << QAccessible::NoRole << "WeekNumberColumn"; } void tst_accessibility::a11y() @@ -167,19 +163,15 @@ void tst_accessibility::a11y() #if QT_CONFIG(accessibility) QQuickAccessibleAttached *attached = QQuickAccessibleAttached::attachedProperties(item); - if (fileBaseName != QLatin1String("dayofweekrow") - && fileBaseName != QLatin1String("monthgrid") - && fileBaseName != QLatin1String("weeknumbercolumn")) { - if (QAccessible::isActive()) { - QVERIFY(attached); - } else { - QVERIFY(!attached); - QPlatformAccessibility *accessibility = platformAccessibility(); - if (!accessibility) - QSKIP("No QPlatformAccessibility available."); - accessibility->setActive(true); - attached = QQuickAccessibleAttached::attachedProperties(item); - } + if (QAccessible::isActive()) { + QVERIFY(attached); + } else { + QVERIFY(!attached); + QPlatformAccessibility *accessibility = platformAccessibility(); + if (!accessibility) + QSKIP("No QPlatformAccessibility available."); + accessibility->setActive(true); + attached = QQuickAccessibleAttached::attachedProperties(item); } QVERIFY(attached); QCOMPARE(attached->role(), role); @@ -237,10 +229,6 @@ void tst_accessibility::override_data() QTest::newRow("ToolButton") << QAccessible::Button; QTest::newRow("ToolTip") << QAccessible::ToolTip; QTest::newRow("Tumbler") << QAccessible::NoRole; - - QTest::newRow("DayOfWeekRow") << QAccessible::NoRole; - QTest::newRow("MonthGrid") << QAccessible::NoRole; - QTest::newRow("WeekNumberColumn") << QAccessible::NoRole; } void tst_accessibility::override() @@ -261,19 +249,15 @@ void tst_accessibility::override() #if QT_CONFIG(accessibility) QQuickAccessibleAttached *attached = QQuickAccessibleAttached::attachedProperties(item); - if (fileBaseName != QLatin1String("dayofweekrow") - && fileBaseName != QLatin1String("monthgrid") - && fileBaseName != QLatin1String("weeknumbercolumn")) { - if (QAccessible::isActive()) { - QVERIFY(attached); - } else { - QPlatformAccessibility *accessibility = platformAccessibility(); - if (!accessibility) - QSKIP("No QPlatformAccessibility available."); - accessibility->setActive(true); - if (!attached) - attached = QQuickAccessibleAttached::attachedProperties(item); - } + if (QAccessible::isActive()) { + QVERIFY(attached); + } else { + QPlatformAccessibility *accessibility = platformAccessibility(); + if (!accessibility) + QSKIP("No QPlatformAccessibility available."); + accessibility->setActive(true); + if (!attached) + attached = QQuickAccessibleAttached::attachedProperties(item); } QVERIFY(attached); diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 6059cf7b..03b6369d 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -1,7 +1,6 @@ TEMPLATE = subdirs SUBDIRS += \ accessibility \ - calendar \ controls \ cursor \ customization \ diff --git a/tests/auto/calendar/CMakeLists.txt b/tests/auto/calendar/CMakeLists.txt deleted file mode 100644 index 34937d14..00000000 --- a/tests/auto/calendar/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -# Generated from calendar.pro. - -##################################################################### -## tst_calendar Test: -##################################################################### - -# Collect test data -file(GLOB_RECURSE test_data_glob - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/data/tst_*) -list(APPEND test_data ${test_data_glob}) - -qt_add_test(tst_calendar - GUI - QMLTEST - SOURCES - tst_calendar.cpp - PUBLIC_LIBRARIES - Qt::Gui - TESTDATA ${test_data} -) - -#### Keys ignored in scope 1:.:.:calendar.pro:: -# OTHER_FILES = "$$PWD/data/*.qml" -# TEMPLATE = "app" diff --git a/tests/auto/calendar/calendar.pro b/tests/auto/calendar/calendar.pro deleted file mode 100644 index 9fdf20ad..00000000 --- a/tests/auto/calendar/calendar.pro +++ /dev/null @@ -1,12 +0,0 @@ -TEMPLATE = app -TARGET = tst_calendar -CONFIG += qmltestcase - -SOURCES += \ - $$PWD/tst_calendar.cpp - -OTHER_FILES += \ - $$PWD/data/*.qml - -TESTDATA += \ - $$PWD/data/tst_* diff --git a/tests/auto/calendar/data/tst_calendarmodel.qml b/tests/auto/calendar/data/tst_calendarmodel.qml deleted file mode 100644 index ccadd488..00000000 --- a/tests/auto/calendar/data/tst_calendarmodel.qml +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.12 -import QtTest 1.0 -import QtQml 2.2 -import Qt.labs.calendar 1.0 - -TestCase { - id: testCase - name: "CalendarModel" - - Component { - id: calendarModel - CalendarModel { } - } - - Component { - id: instantiator - Instantiator { - model: CalendarModel { - from: new Date(2016, 0, 1) - to: new Date(2016, 11, 31) - } - QtObject { - readonly property int month: model.month - readonly property int year: model.year - } - } - } - - function test_indices_data() { - return [ - { tag: "2013", from: "2013-01-01", to: "2013-12-31", count: 12 }, - { tag: "2016", from: "2016-01-01", to: "2016-03-31", count: 3 } - ] - } - - function test_indices(data) { - var model = calendarModel.createObject(testCase, {from: data.from, to: data.to}) - verify(model) - - compare(model.count, data.count) - - var y = parseInt(data.tag) - for (var m = 0; m < 12; ++m) { - compare(model.yearAt(m), y) - compare(model.indexOf(y, m), m) - compare(model.indexOf(new Date(y, m, 1)), m) - compare(model.monthAt(m), m) - } - - model.destroy() - } - - function test_invalid() { - var model = calendarModel.createObject(testCase) - verify(model) - - compare(model.indexOf(-1, -1), -1) - compare(model.indexOf(new Date(-1, -1, -1)), -1) - - model.destroy() - } - - function test_instantiator() { - var inst = instantiator.createObject(testCase) - verify(inst) - - compare(inst.count, 12) - for (var m = 0; m < inst.count; ++m) { - compare(inst.objectAt(m).month, m) - compare(inst.objectAt(m).year, 2016) - } - - inst.destroy() - } -} diff --git a/tests/auto/calendar/data/tst_dayofweekrow.qml b/tests/auto/calendar/data/tst_dayofweekrow.qml deleted file mode 100644 index f6615f78..00000000 --- a/tests/auto/calendar/data/tst_dayofweekrow.qml +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.12 -import QtTest 1.0 -import Qt.labs.calendar 1.0 - -TestCase { - id: testCase - width: 400 - height: 400 - visible: true - when: windowShown - name: "DayOfWeekRow" - - Component { - id: component - DayOfWeekRow { } - } - - function test_locale() { - var control = component.createObject(testCase) - - verify(control.contentItem.children[0]) - - control.locale = Qt.locale("en_US") - compare(control.contentItem.children[0].text, "Sun") - - control.locale = Qt.locale("no_NO") - compare(control.contentItem.children[0].text, "man.") - - control.locale = Qt.locale("fi_FI") - compare(control.contentItem.children[0].text, "ma") - - control.destroy() - } - - function test_font() { - var control = component.createObject(testCase) - - verify(control.contentItem.children[0]) - - control.font.pixelSize = 123 - compare(control.contentItem.children[0].font.pixelSize, 123) - - control.destroy() - } -} diff --git a/tests/auto/calendar/data/tst_monthgrid.qml b/tests/auto/calendar/data/tst_monthgrid.qml deleted file mode 100644 index 6d125712..00000000 --- a/tests/auto/calendar/data/tst_monthgrid.qml +++ /dev/null @@ -1,284 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.12 -import QtTest 1.0 -import Qt.labs.calendar 1.0 - -TestCase { - id: testCase - width: 400 - height: 400 - visible: true - when: windowShown - name: "MonthGrid" - - Component { - id: defaultGrid - MonthGrid { } - } - - Component { - id: delegateGrid - MonthGrid { - delegate: Item { - readonly property date date: model.date - readonly property int day: model.day - readonly property bool today: model.today - readonly property int weekNumber: model.weekNumber - readonly property int month: model.month - readonly property int year: model.year - } - } - } - - Component { - id: signalSpy - SignalSpy { } - } - - function test_locale() { - var control = delegateGrid.createObject(testCase, {month: 0, year: 2013}) - - compare(control.contentItem.children.length, 6 * 7 + 1) - - // January 2013 - compare(control.month, 0) - compare(control.year, 2013) - - // en_GB - control.locale = Qt.locale("en_GB") - compare(control.locale.name, "en_GB") - - // M T W T F S S - var en_GB = ["2012-12-31", "2013-01-01", "2013-01-02", "2013-01-03", "2013-01-04", "2013-01-05", "2013-01-06", - "2013-01-07", "2013-01-08", "2013-01-09", "2013-01-10", "2013-01-11", "2013-01-12", "2013-01-13", - "2013-01-14", "2013-01-15", "2013-01-16", "2013-01-17", "2013-01-18", "2013-01-19", "2013-01-20", - "2013-01-21", "2013-01-22", "2013-01-23", "2013-01-24", "2013-01-25", "2013-01-26", "2013-01-27", - "2013-01-28", "2013-01-29", "2013-01-30", "2013-01-31", "2013-02-01", "2013-02-02", "2013-02-03", - "2013-02-04", "2013-02-05", "2013-02-06", "2013-02-07", "2013-02-08", "2013-02-09", "2013-02-10"] - - for (var i = 0; i < 42; ++i) { - var cellDate = new Date(en_GB[i]) - compare(control.contentItem.children[i].date.getFullYear(), cellDate.getUTCFullYear()) - compare(control.contentItem.children[i].date.getMonth(), cellDate.getUTCMonth()) - compare(control.contentItem.children[i].date.getDate(), cellDate.getUTCDate()) - compare(control.contentItem.children[i].day, cellDate.getUTCDate()) - compare(control.contentItem.children[i].today, cellDate === new Date()) - compare(control.contentItem.children[i].month, cellDate.getUTCMonth()) - compare(control.contentItem.children[i].year, cellDate.getUTCFullYear()) - } - - // en_US - control.locale = Qt.locale("en_US") - compare(control.locale.name, "en_US") - - // S M T W T F S - var en_US = ["2012-12-30", "2012-12-31", "2013-01-01", "2013-01-02", "2013-01-03", "2013-01-04", "2013-01-05", - "2013-01-06", "2013-01-07", "2013-01-08", "2013-01-09", "2013-01-10", "2013-01-11", "2013-01-12", - "2013-01-13", "2013-01-14", "2013-01-15", "2013-01-16", "2013-01-17", "2013-01-18", "2013-01-19", - "2013-01-20", "2013-01-21", "2013-01-22", "2013-01-23", "2013-01-24", "2013-01-25", "2013-01-26", - "2013-01-27", "2013-01-28", "2013-01-29", "2013-01-30", "2013-01-31", "2013-02-01", "2013-02-02", - "2013-02-03", "2013-02-04", "2013-02-05", "2013-02-06", "2013-02-07", "2013-02-08", "2013-02-09"] - - for (var j = 0; j < 42; ++j) { - cellDate = new Date(en_US[j]) - compare(control.contentItem.children[j].date.getFullYear(), cellDate.getUTCFullYear()) - compare(control.contentItem.children[j].date.getMonth(), cellDate.getUTCMonth()) - compare(control.contentItem.children[j].date.getDate(), cellDate.getUTCDate()) - compare(control.contentItem.children[j].day, cellDate.getUTCDate()) - compare(control.contentItem.children[j].today, cellDate === new Date()) - compare(control.contentItem.children[j].month, cellDate.getUTCMonth()) - compare(control.contentItem.children[j].year, cellDate.getUTCFullYear()) - } - - control.destroy() - } - - function test_range() { - var control = defaultGrid.createObject(testCase) - - control.month = 0 - compare(control.month, 0) - - - ignoreWarning(/tst_monthgrid.qml:65:9: QML (Abstract)?MonthGrid: month -1 is out of range \[0...11\]$/) - control.month = -1 - compare(control.month, 0) - - control.month = 11 - compare(control.month, 11) - - ignoreWarning(/tst_monthgrid.qml:65:9: QML (Abstract)?MonthGrid: month 12 is out of range \[0...11\]$/) - control.month = 12 - compare(control.month, 11) - - control.year = -271820 - compare(control.year, -271820) - - ignoreWarning(/tst_monthgrid.qml:65:9: QML (Abstract)?MonthGrid: year -271821 is out of range \[-271820...275759\]$/) - control.year = -271821 - compare(control.year, -271820) - - control.year = 275759 - compare(control.year, 275759) - - ignoreWarning(/tst_monthgrid.qml:65:9: QML (Abstract)?MonthGrid: year 275760 is out of range \[-271820...275759\]$/) - control.year = 275760 - compare(control.year, 275759) - - control.destroy() - } - - function test_bce() { - var control = defaultGrid.createObject(testCase) - - compare(control.contentItem.children.length, 6 * 7 + 1) - - // fi_FI - control.locale = Qt.locale("fi_FI") - compare(control.locale.name, "fi_FI") - - // January 1 BCE - control.month = 0 - compare(control.month, 0) - control.year = -1 - compare(control.year, -1) - - // M T W T F S S - var jan1bce = [27, 28, 29, 30, 31, 1, 2, - 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, - 31, 1, 2, 3, 4, 5, 6] - - for (var i = 0; i < 42; ++i) - compare(control.contentItem.children[i].text, jan1bce[i].toString()) - - // February 1 BCE - control.month = 1 - compare(control.month, 1) - control.year = -1 - compare(control.year, -1) - - // M T W T F S S - var feb1bce = [31, 1, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, - 28, 29, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12] - - for (var j = 0; j < 42; ++j) - compare(control.contentItem.children[j].text, feb1bce[j].toString()) - - control.destroy() - } - - function test_font() { - var control = defaultGrid.createObject(testCase) - - verify(control.contentItem.children[0]) - - control.font.pixelSize = 123 - compare(control.contentItem.children[0].font.pixelSize, 123) - - control.destroy() - } - - function test_clicked_data() { - return [ - { tag: "mouse", touch: false }, - { tag: "touch", touch: true } - ] - } - - function test_clicked(data) { - var control = createTemporaryObject(defaultGrid, testCase) - verify(control) - - compare(control.contentItem.children.length, 6 * 7 + 1) - - var pressedSpy = signalSpy.createObject(control, {target: control, signalName: "pressed"}) - verify(pressedSpy.valid) - - var releasedSpy = signalSpy.createObject(control, {target: control, signalName: "released"}) - verify(releasedSpy.valid) - - var clickedSpy = signalSpy.createObject(control, {target: control, signalName: "clicked"}) - verify(clickedSpy.valid) - - var touch = touchEvent(control) - - for (var i = 0; i < 42; ++i) { - var cell = control.contentItem.children[i] - verify(cell) - - if (data.touch) - touch.press(0, cell).commit() - else - mousePress(cell) - - compare(pressedSpy.count, i + 1) - compare(releasedSpy.count, i) - compare(clickedSpy.count, i) - - if (data.touch) - touch.release(0, cell).commit() - else - mouseRelease(cell) - - compare(pressedSpy.count, i + 1) - compare(releasedSpy.count, i + 1) - compare(clickedSpy.count, i + 1) - } - } -} diff --git a/tests/auto/calendar/data/tst_weeknumbercolumn.qml b/tests/auto/calendar/data/tst_weeknumbercolumn.qml deleted file mode 100644 index d1b50339..00000000 --- a/tests/auto/calendar/data/tst_weeknumbercolumn.qml +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.12 -import QtTest 1.0 -import Qt.labs.calendar 1.0 - -TestCase { - id: testCase - width: 400 - height: 400 - visible: true - when: windowShown - name: "WeekNumberColumn" - - Component { - id: component - WeekNumberColumn { } - } - - function test_locale() { - var control = component.createObject(testCase) - - compare(control.contentItem.children.length, 6 + 1) - - control.month = 11 - control.year = 2015 - - // en_US: [48...53] - control.locale = Qt.locale("en_US") - for (var i = 0; i < 6; ++i) - compare(control.contentItem.children[i].text, (i + 48).toString()) - - // no_NO: [49...1] - control.locale = Qt.locale("no_NO") - for (var j = 0; j < 5; ++j) - compare(control.contentItem.children[j].text, (j + 49).toString()) - compare(control.contentItem.children[5].text, "1") - - control.destroy() - } - - function test_range() { - var control = component.createObject(testCase) - - control.month = 0 - compare(control.month, 0) - - ignoreWarning(/tst_weeknumbercolumn.qml:65:9: QML (Abstract)?WeekNumberColumn: month -1 is out of range \[0...11\]$/) - control.month = -1 - compare(control.month, 0) - - control.month = 11 - compare(control.month, 11) - - ignoreWarning(/tst_weeknumbercolumn.qml:65:9: QML (Abstract)?WeekNumberColumn: month 12 is out of range \[0...11\]$/) - control.month = 12 - compare(control.month, 11) - - control.year = -271820 - compare(control.year, -271820) - - ignoreWarning(/tst_weeknumbercolumn.qml:65:9: QML (Abstract)?WeekNumberColumn: year -271821 is out of range \[-271820...275759\]$/) - control.year = -271821 - compare(control.year, -271820) - - control.year = 275759 - compare(control.year, 275759) - - ignoreWarning(/tst_weeknumbercolumn.qml:65:9: QML (Abstract)?WeekNumberColumn: year 275760 is out of range \[-271820...275759\]$/) - control.year = 275760 - compare(control.year, 275759) - - control.destroy() - } - - function test_font() { - var control = component.createObject(testCase) - - verify(control.contentItem.children[0]) - - control.font.pixelSize = 123 - compare(control.contentItem.children[0].font.pixelSize, 123) - - control.destroy() - } -} diff --git a/tests/auto/calendar/tst_calendar.cpp b/tests/auto/calendar/tst_calendar.cpp deleted file mode 100644 index 0194be62..00000000 --- a/tests/auto/calendar/tst_calendar.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -QUICK_TEST_MAIN(tst_calendar) diff --git a/tests/auto/qquickcontrol/CMakeLists.txt b/tests/auto/qquickcontrol/CMakeLists.txt new file mode 100644 index 00000000..59e1ccb6 --- /dev/null +++ b/tests/auto/qquickcontrol/CMakeLists.txt @@ -0,0 +1,47 @@ +# Generated from qquickcontrol.pro. + +##################################################################### +## tst_qquickcontrol Test: +##################################################################### + +# Collect test data +file(GLOB_RECURSE test_data_glob + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + data/*) +list(APPEND test_data ${test_data_glob}) + +qt_add_test(tst_qquickcontrol + SOURCES + ../shared/qtest_quickcontrols.h + ../shared/util.cpp ../shared/util.h + ../shared/visualtestutil.cpp ../shared/visualtestutil.h + tst_qquickcontrol.cpp + DEFINES + QQC2_IMPORT_PATH=\\\"${CMAKE_CURRENT_SOURCE_DIR}/../../../src/imports\\\" + PUBLIC_LIBRARIES + Qt::CorePrivate + Qt::Gui + Qt::GuiPrivate + Qt::QmlPrivate + Qt::QuickControls2 + Qt::QuickPrivate + Qt::QuickTemplates2Private + Qt::TestPrivate + TESTDATA ${test_data} +) + +#### Keys ignored in scope 1:.:.:qquickcontrol.pro:: +# OTHER_FILES = "data/*.qml" + +## Scopes: +##################################################################### + +qt_extend_target(tst_qquickcontrol CONDITION ANDROID OR IOS + DEFINES + QT_QMLTEST_DATADIR=\\\":/data\\\" +) + +qt_extend_target(tst_qquickcontrol CONDITION NOT ANDROID AND NOT IOS + DEFINES + QT_QMLTEST_DATADIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/data\\\" +) diff --git a/tests/auto/sanity/tst_sanity.cpp b/tests/auto/sanity/tst_sanity.cpp index 78b86f00..b5d0054b 100644 --- a/tests/auto/sanity/tst_sanity.cpp +++ b/tests/auto/sanity/tst_sanity.cpp @@ -365,7 +365,6 @@ void tst_Sanity::attachedObjects() void tst_Sanity::attachedObjects_data() { QTest::addColumn("url"); - addTestRowForEachControl(&engine, "calendar", "Qt/labs/calendar"); addTestRowForEachControl(&engine, "controls", "QtQuick/Controls.2"); addTestRowForEachControl(&engine, "controls/fusion", "QtQuick/Controls.2", QStringList() << "CheckIndicator" << "RadioIndicator" << "SliderGroove" << "SliderHandle" << "SwitchIndicator"); addTestRowForEachControl(&engine, "controls/material", "QtQuick/Controls.2/Material", QStringList() << "Ripple" << "SliderHandle" << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator" << "BoxShadow" << "ElevationEffect" << "CursorDelegate"); diff --git a/tests/auto/snippets/data/dependencies.qml b/tests/auto/snippets/data/dependencies.qml index db0a968d..0fe2dbf0 100644 --- a/tests/auto/snippets/data/dependencies.qml +++ b/tests/auto/snippets/data/dependencies.qml @@ -3,6 +3,5 @@ import QtQuick.Layouts 1.12 import QtQuick.Controls 2.12 import QtQuick.Controls.Material 2.12 import QtQuick.Controls.Universal 2.12 -import Qt.labs.calendar 1.0 Control { } diff --git a/tests/benchmarks/creationtime/data/dependencies.qml b/tests/benchmarks/creationtime/data/dependencies.qml index 130ee37d..3ae7511b 100644 --- a/tests/benchmarks/creationtime/data/dependencies.qml +++ b/tests/benchmarks/creationtime/data/dependencies.qml @@ -4,6 +4,5 @@ import QtQuick.Controls.Fusion 2.12 import QtQuick.Controls.Imagine 2.12 import QtQuick.Controls.Material 2.12 import QtQuick.Controls.Universal 2.12 -import Qt.labs.calendar 1.0 Control { } diff --git a/tests/benchmarks/creationtime/tst_creationtime.cpp b/tests/benchmarks/creationtime/tst_creationtime.cpp index 41d7224d..3ebd9f2c 100644 --- a/tests/benchmarks/creationtime/tst_creationtime.cpp +++ b/tests/benchmarks/creationtime/tst_creationtime.cpp @@ -63,9 +63,6 @@ private slots: void universal(); void universal_data(); - void calendar(); - void calendar_data(); - private: QQmlEngine engine; }; @@ -150,18 +147,6 @@ void tst_CreationTime::universal_data() addTestRowForEachControl(&engine, "controls/universal", "QtQuick/Controls.2/Universal", QStringList() << "ApplicationWindow" << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator"); } -void tst_CreationTime::calendar() -{ - QFETCH(QUrl, url); - doBenchmark(&engine, url); -} - -void tst_CreationTime::calendar_data() -{ - QTest::addColumn("url"); - addTestRowForEachControl(&engine, "calendar", "Qt/labs/calendar"); -} - QTEST_MAIN(tst_CreationTime) #include "tst_creationtime.moc" diff --git a/tests/benchmarks/objectcount/data/dependencies.qml b/tests/benchmarks/objectcount/data/dependencies.qml index 130ee37d..3ae7511b 100644 --- a/tests/benchmarks/objectcount/data/dependencies.qml +++ b/tests/benchmarks/objectcount/data/dependencies.qml @@ -4,6 +4,5 @@ import QtQuick.Controls.Fusion 2.12 import QtQuick.Controls.Imagine 2.12 import QtQuick.Controls.Material 2.12 import QtQuick.Controls.Universal 2.12 -import Qt.labs.calendar 1.0 Control { } -- cgit v1.2.3