From c943543b84129bd82c17858d5eb91486af78111c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 21 Apr 2016 10:46:55 +0200 Subject: fix example installs this includes renaming the first-level subdir of examples/. Change-Id: Idf14164533c247e5c0cc5acdb405ac97f7c33ac5 Reviewed-by: J-P Nurmi --- examples/examples.pro | 5 +- .../quick/controls/basiclayouts/basiclayouts.pro | 12 - .../controls/basiclayouts/basiclayouts.qmlproject | 16 - examples/quick/controls/basiclayouts/main.qml | 135 ---- examples/quick/controls/basiclayouts/resources.qrc | 5 - examples/quick/controls/basiclayouts/src/main.cpp | 51 -- examples/quick/controls/basiclayouts/src/src.pri | 2 - examples/quick/controls/calendar/calendar.pro | 11 - .../controls/calendar/images/eventindicator.png | Bin 2914 -> 0 bytes examples/quick/controls/calendar/qml/main.qml | 216 ------- examples/quick/controls/calendar/resources.qrc | 6 - examples/quick/controls/calendar/src/event.cpp | 85 --- examples/quick/controls/calendar/src/event.h | 76 --- examples/quick/controls/calendar/src/main.cpp | 54 -- .../quick/controls/calendar/src/sqleventmodel.cpp | 103 --- .../quick/controls/calendar/src/sqleventmodel.h | 62 -- examples/quick/controls/calendar/src/src.pri | 9 - examples/quick/controls/controls.pro | 17 - .../filesystembrowser/filesystembrowser.pro | 7 - examples/quick/controls/filesystembrowser/main.cpp | 152 ----- examples/quick/controls/filesystembrowser/main.qml | 129 ---- examples/quick/controls/filesystembrowser/qml.qrc | 5 - examples/quick/controls/gallery/gallery.pro | 20 - examples/quick/controls/gallery/gallery.qrc | 12 - examples/quick/controls/gallery/main.cpp | 58 -- examples/quick/controls/gallery/main.qml | 162 ----- examples/quick/controls/gallery/qml/+android/UI.js | 45 -- examples/quick/controls/gallery/qml/+ios/UI.js | 45 -- examples/quick/controls/gallery/qml/+osx/UI.js | 45 -- examples/quick/controls/gallery/qml/ButtonPage.qml | 130 ---- examples/quick/controls/gallery/qml/InputPage.qml | 116 ---- .../quick/controls/gallery/qml/ProgressPage.qml | 92 --- examples/quick/controls/gallery/qml/UI.js | 45 -- .../controls/shared/qtquickcontrolsapplication.h | 60 -- examples/quick/controls/shared/shared.pri | 7 - examples/quick/controls/styles/images/bubble.png | Bin 214 -> 0 bytes .../controls/styles/images/button-pressed.png | Bin 3094 -> 0 bytes examples/quick/controls/styles/images/button.png | Bin 3164 -> 0 bytes .../controls/styles/images/progress-background.png | Bin 456 -> 0 bytes .../quick/controls/styles/images/progress-fill.png | Bin 507 -> 0 bytes .../quick/controls/styles/images/slider-handle.png | Bin 3523 -> 0 bytes examples/quick/controls/styles/images/tab.png | Bin 9877 -> 0 bytes .../quick/controls/styles/images/tab_selected.png | Bin 10184 -> 0 bytes .../quick/controls/styles/images/textfield.png | Bin 3023 -> 0 bytes examples/quick/controls/styles/main.cpp | 53 -- examples/quick/controls/styles/main.qml | 397 ------------ examples/quick/controls/styles/styles.pro | 10 - examples/quick/controls/styles/styles.qrc | 14 - examples/quick/controls/tableview/main.qml | 188 ------ examples/quick/controls/tableview/src/main.cpp | 59 -- .../tableview/src/sortfilterproxymodel.cpp | 189 ------ .../controls/tableview/src/sortfilterproxymodel.h | 111 ---- examples/quick/controls/tableview/src/src.pri | 8 - examples/quick/controls/tableview/tableview.pro | 11 - examples/quick/controls/tableview/tableview.qrc | 5 - examples/quick/controls/texteditor/example.html | 79 --- .../controls/texteditor/qml/ToolBarSeparator.qml | 61 -- .../controls/texteditor/qml/images/editcopy.png | Bin 1468 -> 0 bytes .../controls/texteditor/qml/images/editcut.png | Bin 1512 -> 0 bytes .../controls/texteditor/qml/images/editpaste.png | Bin 1906 -> 0 bytes .../controls/texteditor/qml/images/editredo.png | Bin 1752 -> 0 bytes .../controls/texteditor/qml/images/editundo.png | Bin 1746 -> 0 bytes .../controls/texteditor/qml/images/exportpdf.png | Bin 1215 -> 0 bytes .../controls/texteditor/qml/images/filenew.png | Bin 1172 -> 0 bytes .../controls/texteditor/qml/images/fileopen.png | Bin 2168 -> 0 bytes .../controls/texteditor/qml/images/fileprint.png | Bin 2087 -> 0 bytes .../controls/texteditor/qml/images/filesave.png | Bin 1206 -> 0 bytes .../controls/texteditor/qml/images/qt-logo.png | Bin 3531 -> 0 bytes .../controls/texteditor/qml/images/textbold.png | Bin 1611 -> 0 bytes .../controls/texteditor/qml/images/textcenter.png | Bin 1404 -> 0 bytes .../controls/texteditor/qml/images/textitalic.png | Bin 1164 -> 0 bytes .../controls/texteditor/qml/images/textjustify.png | Bin 1257 -> 0 bytes .../controls/texteditor/qml/images/textleft.png | Bin 1235 -> 0 bytes .../controls/texteditor/qml/images/textright.png | Bin 1406 -> 0 bytes .../controls/texteditor/qml/images/textunder.png | Bin 1183 -> 0 bytes .../controls/texteditor/qml/images/zoomin.png | Bin 1696 -> 0 bytes .../controls/texteditor/qml/images/zoomout.png | Bin 1662 -> 0 bytes examples/quick/controls/texteditor/qml/main.qml | 357 ----------- examples/quick/controls/texteditor/resources.qrc | 27 - .../controls/texteditor/src/documenthandler.cpp | 335 ---------- .../controls/texteditor/src/documenthandler.h | 171 ----- examples/quick/controls/texteditor/src/main.cpp | 53 -- examples/quick/controls/texteditor/src/src.pri | 9 - examples/quick/controls/texteditor/texteditor.pro | 13 - .../controls/touch/content/AndroidDelegate.qml | 88 --- .../quick/controls/touch/content/ButtonPage.qml | 172 ----- examples/quick/controls/touch/content/ListPage.qml | 78 --- .../controls/touch/content/ProgressBarPage.qml | 110 ---- .../quick/controls/touch/content/SliderPage.qml | 102 --- .../quick/controls/touch/content/TabBarPage.qml | 98 --- .../quick/controls/touch/content/TextInputPage.qml | 102 --- examples/quick/controls/touch/images/NOTICE.txt | 2 - .../quick/controls/touch/images/button_default.png | Bin 1406 -> 0 bytes .../quick/controls/touch/images/button_pressed.png | Bin 1694 -> 0 bytes .../controls/touch/images/navigation_next_item.png | Bin 1341 -> 0 bytes .../touch/images/navigation_previous_item.png | Bin 1343 -> 0 bytes .../quick/controls/touch/images/tab_selected.png | Bin 217 -> 0 bytes .../quick/controls/touch/images/tabs_standard.png | Bin 1230 -> 0 bytes examples/quick/controls/touch/images/textinput.png | Bin 4132 -> 0 bytes examples/quick/controls/touch/images/toolbar.png | Bin 1643 -> 0 bytes examples/quick/controls/touch/main.qml | 147 ----- examples/quick/controls/touch/resources.qrc | 20 - examples/quick/controls/touch/src/main.cpp | 51 -- examples/quick/controls/touch/src/src.pri | 2 - examples/quick/controls/touch/touch.pro | 19 - examples/quick/controls/touch/touch.qmlproject | 16 - examples/quick/controls/uiforms/MainForm.ui.qml | 98 --- examples/quick/controls/uiforms/main.cpp | 61 -- examples/quick/controls/uiforms/main.qml | 131 ---- .../quick/controls/uiforms/qml/CustomerModel.qml | 144 ----- examples/quick/controls/uiforms/qml/History.qml | 76 --- .../quick/controls/uiforms/qml/HistoryForm.ui.qml | 80 --- examples/quick/controls/uiforms/qml/Notes.qml | 76 --- .../quick/controls/uiforms/qml/NotesForm.ui.qml | 85 --- examples/quick/controls/uiforms/qml/Settings.qml | 96 --- .../quick/controls/uiforms/qml/SettingsForm.ui.qml | 259 -------- examples/quick/controls/uiforms/uiforms.pro | 21 - examples/quick/controls/uiforms/uiforms.qrc | 13 - examples/quick/dialogs/dialogs.pro | 4 - .../quick/dialogs/systemdialogs/ColorDialogs.qml | 144 ----- .../quick/dialogs/systemdialogs/CustomDialogs.qml | 339 ---------- .../quick/dialogs/systemdialogs/FileDialogs.qml | 186 ------ .../quick/dialogs/systemdialogs/FontDialogs.qml | 153 ----- .../quick/dialogs/systemdialogs/MessageDialogs.qml | 326 ---------- .../doc/images/systemdialogs-example.jpg | Bin 47413 -> 0 bytes .../systemdialogs/doc/src/systemdialogs.qdoc | 49 -- examples/quick/dialogs/systemdialogs/main.cpp | 59 -- .../quick/dialogs/systemdialogs/systemdialogs.pro | 19 - .../quick/dialogs/systemdialogs/systemdialogs.qml | 75 --- .../quick/dialogs/systemdialogs/systemdialogs.qrc | 10 - examples/quick/extras/dashboard/dashboard.pro | 18 - examples/quick/extras/dashboard/dashboard.qrc | 13 - .../quick/extras/dashboard/fonts/DejaVuSans.ttf | Bin 720856 -> 0 bytes examples/quick/extras/dashboard/fonts/LICENSE | 99 --- .../quick/extras/dashboard/images/fuel-icon.png | Bin 409 -> 0 bytes .../extras/dashboard/images/temperature-icon.png | Bin 3302 -> 0 bytes examples/quick/extras/dashboard/main.cpp | 57 -- .../extras/dashboard/qml/DashboardGaugeStyle.qml | 164 ----- .../quick/extras/dashboard/qml/IconGaugeStyle.qml | 124 ---- .../quick/extras/dashboard/qml/TachometerStyle.qml | 116 ---- .../quick/extras/dashboard/qml/TurnIndicator.qml | 104 --- .../quick/extras/dashboard/qml/ValueSource.qml | 320 ---------- examples/quick/extras/dashboard/qml/dashboard.qml | 174 ----- examples/quick/extras/extras.pro | 5 - examples/quick/extras/flat/Content.qml | 706 --------------------- examples/quick/extras/flat/SettingsIcon.qml | 118 ---- examples/quick/extras/flat/flat.pro | 16 - examples/quick/extras/flat/flat.qrc | 16 - .../quick/extras/flat/images/piemenu-bw-normal.png | Bin 1716 -> 0 bytes .../extras/flat/images/piemenu-bw-pressed.png | Bin 1394 -> 0 bytes .../quick/extras/flat/images/piemenu-image-bw.jpg | Bin 1065560 -> 0 bytes .../quick/extras/flat/images/piemenu-image-rgb.jpg | Bin 1152261 -> 0 bytes .../extras/flat/images/piemenu-image-sepia.jpg | Bin 1513238 -> 0 bytes .../extras/flat/images/piemenu-rgb-normal.png | Bin 1665 -> 0 bytes .../extras/flat/images/piemenu-rgb-pressed.png | Bin 1571 -> 0 bytes .../extras/flat/images/piemenu-sepia-normal.png | Bin 1410 -> 0 bytes .../extras/flat/images/piemenu-sepia-pressed.png | Bin 1386 -> 0 bytes examples/quick/extras/flat/main.cpp | 62 -- examples/quick/extras/flat/main.qml | 479 -------------- examples/quick/extras/gallery/fonts/LICENSE.txt | 202 ------ .../extras/gallery/fonts/OpenSans-Regular.ttf | Bin 217360 -> 0 bytes examples/quick/extras/gallery/gallery.pro | 31 - examples/quick/extras/gallery/gallery.qrc | 36 -- .../extras/gallery/images/background-light.png | Bin 46832 -> 0 bytes .../quick/extras/gallery/images/background.png | Bin 45497 -> 0 bytes .../quick/extras/gallery/images/center-light.png | Bin 2113 -> 0 bytes examples/quick/extras/gallery/images/center.png | Bin 2260 -> 0 bytes examples/quick/extras/gallery/images/icon-back.png | Bin 614 -> 0 bytes examples/quick/extras/gallery/images/icon-go.png | Bin 1435 -> 0 bytes .../quick/extras/gallery/images/icon-settings.png | Bin 1786 -> 0 bytes examples/quick/extras/gallery/images/info.png | Bin 709 -> 0 bytes .../quick/extras/gallery/images/needle-light.png | Bin 2105 -> 0 bytes examples/quick/extras/gallery/images/needle.png | Bin 4891 -> 0 bytes examples/quick/extras/gallery/images/qt-logo.png | Bin 5149 -> 0 bytes examples/quick/extras/gallery/images/zoom_in.png | Bin 829 -> 0 bytes examples/quick/extras/gallery/images/zoom_out.png | Bin 779 -> 0 bytes examples/quick/extras/gallery/main.cpp | 51 -- .../extras/gallery/qml/BlackButtonBackground.qml | 71 --- .../quick/extras/gallery/qml/BlackButtonStyle.qml | 97 --- .../extras/gallery/qml/CircularGaugeDarkStyle.qml | 96 --- .../gallery/qml/CircularGaugeDefaultStyle.qml | 46 -- .../extras/gallery/qml/CircularGaugeLightStyle.qml | 97 --- .../quick/extras/gallery/qml/CircularGaugeView.qml | 230 ------- examples/quick/extras/gallery/qml/ControlLabel.qml | 49 -- examples/quick/extras/gallery/qml/ControlView.qml | 188 ------ .../extras/gallery/qml/ControlViewToolbar.qml | 91 --- .../quick/extras/gallery/qml/CustomizerLabel.qml | 48 -- .../quick/extras/gallery/qml/CustomizerSlider.qml | 75 --- .../quick/extras/gallery/qml/CustomizerSwitch.qml | 46 -- .../extras/gallery/qml/FlickableMoreIndicator.qml | 76 --- .../extras/gallery/qml/PieMenuControlView.qml | 187 ------ .../quick/extras/gallery/qml/PieMenuDarkStyle.qml | 46 -- .../extras/gallery/qml/PieMenuDefaultStyle.qml | 44 -- examples/quick/extras/gallery/qml/StylePicker.qml | 98 --- examples/quick/extras/gallery/qml/gallery.qml | 439 ------------- .../controls/basiclayouts/basiclayouts.pro | 15 + .../controls/basiclayouts/basiclayouts.qmlproject | 16 + .../quickcontrols/controls/basiclayouts/main.qml | 135 ++++ .../controls/basiclayouts/resources.qrc | 5 + .../controls/basiclayouts/src/main.cpp | 51 ++ .../controls/basiclayouts/src/src.pri | 2 + .../quickcontrols/controls/calendar/calendar.pro | 14 + .../controls/calendar/images/eventindicator.png | Bin 0 -> 2914 bytes .../quickcontrols/controls/calendar/qml/main.qml | 216 +++++++ .../quickcontrols/controls/calendar/resources.qrc | 6 + .../quickcontrols/controls/calendar/src/event.cpp | 85 +++ .../quickcontrols/controls/calendar/src/event.h | 76 +++ .../quickcontrols/controls/calendar/src/main.cpp | 54 ++ .../controls/calendar/src/sqleventmodel.cpp | 103 +++ .../controls/calendar/src/sqleventmodel.h | 62 ++ .../quickcontrols/controls/calendar/src/src.pri | 9 + examples/quickcontrols/controls/controls.pro | 20 + .../filesystembrowser/filesystembrowser.pro | 10 + .../controls/filesystembrowser/main.cpp | 152 +++++ .../controls/filesystembrowser/main.qml | 129 ++++ .../controls/filesystembrowser/qml.qrc | 5 + .../quickcontrols/controls/gallery/gallery.pro | 23 + .../quickcontrols/controls/gallery/gallery.qrc | 12 + examples/quickcontrols/controls/gallery/main.cpp | 58 ++ examples/quickcontrols/controls/gallery/main.qml | 162 +++++ .../controls/gallery/qml/+android/UI.js | 45 ++ .../quickcontrols/controls/gallery/qml/+ios/UI.js | 45 ++ .../quickcontrols/controls/gallery/qml/+osx/UI.js | 45 ++ .../controls/gallery/qml/ButtonPage.qml | 130 ++++ .../controls/gallery/qml/InputPage.qml | 116 ++++ .../controls/gallery/qml/ProgressPage.qml | 92 +++ examples/quickcontrols/controls/gallery/qml/UI.js | 45 ++ .../controls/shared/qtquickcontrolsapplication.h | 60 ++ examples/quickcontrols/controls/shared/shared.pri | 7 + .../controls/styles/images/bubble.png | Bin 0 -> 214 bytes .../controls/styles/images/button-pressed.png | Bin 0 -> 3094 bytes .../controls/styles/images/button.png | Bin 0 -> 3164 bytes .../controls/styles/images/progress-background.png | Bin 0 -> 456 bytes .../controls/styles/images/progress-fill.png | Bin 0 -> 507 bytes .../controls/styles/images/slider-handle.png | Bin 0 -> 3523 bytes .../quickcontrols/controls/styles/images/tab.png | Bin 0 -> 9877 bytes .../controls/styles/images/tab_selected.png | Bin 0 -> 10184 bytes .../controls/styles/images/textfield.png | Bin 0 -> 3023 bytes examples/quickcontrols/controls/styles/main.cpp | 53 ++ examples/quickcontrols/controls/styles/main.qml | 397 ++++++++++++ examples/quickcontrols/controls/styles/styles.pro | 13 + examples/quickcontrols/controls/styles/styles.qrc | 14 + examples/quickcontrols/controls/tableview/main.qml | 188 ++++++ .../quickcontrols/controls/tableview/src/main.cpp | 59 ++ .../tableview/src/sortfilterproxymodel.cpp | 189 ++++++ .../controls/tableview/src/sortfilterproxymodel.h | 111 ++++ .../quickcontrols/controls/tableview/src/src.pri | 8 + .../quickcontrols/controls/tableview/tableview.pro | 14 + .../quickcontrols/controls/tableview/tableview.qrc | 5 + .../quickcontrols/controls/texteditor/example.html | 79 +++ .../controls/texteditor/qml/ToolBarSeparator.qml | 61 ++ .../controls/texteditor/qml/images/editcopy.png | Bin 0 -> 1468 bytes .../controls/texteditor/qml/images/editcut.png | Bin 0 -> 1512 bytes .../controls/texteditor/qml/images/editpaste.png | Bin 0 -> 1906 bytes .../controls/texteditor/qml/images/editredo.png | Bin 0 -> 1752 bytes .../controls/texteditor/qml/images/editundo.png | Bin 0 -> 1746 bytes .../controls/texteditor/qml/images/exportpdf.png | Bin 0 -> 1215 bytes .../controls/texteditor/qml/images/filenew.png | Bin 0 -> 1172 bytes .../controls/texteditor/qml/images/fileopen.png | Bin 0 -> 2168 bytes .../controls/texteditor/qml/images/fileprint.png | Bin 0 -> 2087 bytes .../controls/texteditor/qml/images/filesave.png | Bin 0 -> 1206 bytes .../controls/texteditor/qml/images/qt-logo.png | Bin 0 -> 3531 bytes .../controls/texteditor/qml/images/textbold.png | Bin 0 -> 1611 bytes .../controls/texteditor/qml/images/textcenter.png | Bin 0 -> 1404 bytes .../controls/texteditor/qml/images/textitalic.png | Bin 0 -> 1164 bytes .../controls/texteditor/qml/images/textjustify.png | Bin 0 -> 1257 bytes .../controls/texteditor/qml/images/textleft.png | Bin 0 -> 1235 bytes .../controls/texteditor/qml/images/textright.png | Bin 0 -> 1406 bytes .../controls/texteditor/qml/images/textunder.png | Bin 0 -> 1183 bytes .../controls/texteditor/qml/images/zoomin.png | Bin 0 -> 1696 bytes .../controls/texteditor/qml/images/zoomout.png | Bin 0 -> 1662 bytes .../quickcontrols/controls/texteditor/qml/main.qml | 357 +++++++++++ .../controls/texteditor/resources.qrc | 27 + .../controls/texteditor/src/documenthandler.cpp | 335 ++++++++++ .../controls/texteditor/src/documenthandler.h | 171 +++++ .../quickcontrols/controls/texteditor/src/main.cpp | 53 ++ .../quickcontrols/controls/texteditor/src/src.pri | 9 + .../controls/texteditor/texteditor.pro | 16 + .../controls/touch/content/AndroidDelegate.qml | 88 +++ .../controls/touch/content/ButtonPage.qml | 172 +++++ .../controls/touch/content/ListPage.qml | 78 +++ .../controls/touch/content/ProgressBarPage.qml | 110 ++++ .../controls/touch/content/SliderPage.qml | 102 +++ .../controls/touch/content/TabBarPage.qml | 98 +++ .../controls/touch/content/TextInputPage.qml | 102 +++ .../quickcontrols/controls/touch/images/NOTICE.txt | 2 + .../controls/touch/images/button_default.png | Bin 0 -> 1406 bytes .../controls/touch/images/button_pressed.png | Bin 0 -> 1694 bytes .../controls/touch/images/navigation_next_item.png | Bin 0 -> 1341 bytes .../touch/images/navigation_previous_item.png | Bin 0 -> 1343 bytes .../controls/touch/images/tab_selected.png | Bin 0 -> 217 bytes .../controls/touch/images/tabs_standard.png | Bin 0 -> 1230 bytes .../controls/touch/images/textinput.png | Bin 0 -> 4132 bytes .../controls/touch/images/toolbar.png | Bin 0 -> 1643 bytes examples/quickcontrols/controls/touch/main.qml | 147 +++++ .../quickcontrols/controls/touch/resources.qrc | 20 + examples/quickcontrols/controls/touch/src/main.cpp | 51 ++ examples/quickcontrols/controls/touch/src/src.pri | 2 + examples/quickcontrols/controls/touch/touch.pro | 22 + .../quickcontrols/controls/touch/touch.qmlproject | 16 + .../quickcontrols/controls/uiforms/MainForm.ui.qml | 98 +++ examples/quickcontrols/controls/uiforms/main.cpp | 61 ++ examples/quickcontrols/controls/uiforms/main.qml | 131 ++++ .../controls/uiforms/qml/CustomerModel.qml | 144 +++++ .../quickcontrols/controls/uiforms/qml/History.qml | 76 +++ .../controls/uiforms/qml/HistoryForm.ui.qml | 80 +++ .../quickcontrols/controls/uiforms/qml/Notes.qml | 76 +++ .../controls/uiforms/qml/NotesForm.ui.qml | 85 +++ .../controls/uiforms/qml/Settings.qml | 96 +++ .../controls/uiforms/qml/SettingsForm.ui.qml | 259 ++++++++ .../quickcontrols/controls/uiforms/uiforms.pro | 24 + .../quickcontrols/controls/uiforms/uiforms.qrc | 13 + examples/quickcontrols/dialogs/dialogs.pro | 4 + .../dialogs/systemdialogs/ColorDialogs.qml | 144 +++++ .../dialogs/systemdialogs/CustomDialogs.qml | 339 ++++++++++ .../dialogs/systemdialogs/FileDialogs.qml | 186 ++++++ .../dialogs/systemdialogs/FontDialogs.qml | 153 +++++ .../dialogs/systemdialogs/MessageDialogs.qml | 326 ++++++++++ .../doc/images/systemdialogs-example.jpg | Bin 0 -> 47413 bytes .../systemdialogs/doc/src/systemdialogs.qdoc | 49 ++ .../quickcontrols/dialogs/systemdialogs/main.cpp | 59 ++ .../dialogs/systemdialogs/systemdialogs.pro | 19 + .../dialogs/systemdialogs/systemdialogs.qml | 75 +++ .../dialogs/systemdialogs/systemdialogs.qrc | 10 + .../quickcontrols/extras/dashboard/dashboard.pro | 21 + .../quickcontrols/extras/dashboard/dashboard.qrc | 13 + .../extras/dashboard/fonts/DejaVuSans.ttf | Bin 0 -> 720856 bytes .../quickcontrols/extras/dashboard/fonts/LICENSE | 99 +++ .../extras/dashboard/images/fuel-icon.png | Bin 0 -> 409 bytes .../extras/dashboard/images/temperature-icon.png | Bin 0 -> 3302 bytes examples/quickcontrols/extras/dashboard/main.cpp | 57 ++ .../extras/dashboard/qml/DashboardGaugeStyle.qml | 164 +++++ .../extras/dashboard/qml/IconGaugeStyle.qml | 124 ++++ .../extras/dashboard/qml/TachometerStyle.qml | 116 ++++ .../extras/dashboard/qml/TurnIndicator.qml | 104 +++ .../extras/dashboard/qml/ValueSource.qml | 320 ++++++++++ .../extras/dashboard/qml/dashboard.qml | 174 +++++ examples/quickcontrols/extras/extras.pro | 5 + examples/quickcontrols/extras/flat/Content.qml | 706 +++++++++++++++++++++ .../quickcontrols/extras/flat/SettingsIcon.qml | 118 ++++ examples/quickcontrols/extras/flat/flat.pro | 19 + examples/quickcontrols/extras/flat/flat.qrc | 16 + .../extras/flat/images/piemenu-bw-normal.png | Bin 0 -> 1716 bytes .../extras/flat/images/piemenu-bw-pressed.png | Bin 0 -> 1394 bytes .../extras/flat/images/piemenu-image-bw.jpg | Bin 0 -> 1065560 bytes .../extras/flat/images/piemenu-image-rgb.jpg | Bin 0 -> 1152261 bytes .../extras/flat/images/piemenu-image-sepia.jpg | Bin 0 -> 1513238 bytes .../extras/flat/images/piemenu-rgb-normal.png | Bin 0 -> 1665 bytes .../extras/flat/images/piemenu-rgb-pressed.png | Bin 0 -> 1571 bytes .../extras/flat/images/piemenu-sepia-normal.png | Bin 0 -> 1410 bytes .../extras/flat/images/piemenu-sepia-pressed.png | Bin 0 -> 1386 bytes examples/quickcontrols/extras/flat/main.cpp | 62 ++ examples/quickcontrols/extras/flat/main.qml | 479 ++++++++++++++ .../quickcontrols/extras/gallery/fonts/LICENSE.txt | 202 ++++++ .../extras/gallery/fonts/OpenSans-Regular.ttf | Bin 0 -> 217360 bytes examples/quickcontrols/extras/gallery/gallery.pro | 34 + examples/quickcontrols/extras/gallery/gallery.qrc | 36 ++ .../extras/gallery/images/background-light.png | Bin 0 -> 46832 bytes .../extras/gallery/images/background.png | Bin 0 -> 45497 bytes .../extras/gallery/images/center-light.png | Bin 0 -> 2113 bytes .../quickcontrols/extras/gallery/images/center.png | Bin 0 -> 2260 bytes .../extras/gallery/images/icon-back.png | Bin 0 -> 614 bytes .../extras/gallery/images/icon-go.png | Bin 0 -> 1435 bytes .../extras/gallery/images/icon-settings.png | Bin 0 -> 1786 bytes .../quickcontrols/extras/gallery/images/info.png | Bin 0 -> 709 bytes .../extras/gallery/images/needle-light.png | Bin 0 -> 2105 bytes .../quickcontrols/extras/gallery/images/needle.png | Bin 0 -> 4891 bytes .../extras/gallery/images/qt-logo.png | Bin 0 -> 5149 bytes .../extras/gallery/images/zoom_in.png | Bin 0 -> 829 bytes .../extras/gallery/images/zoom_out.png | Bin 0 -> 779 bytes examples/quickcontrols/extras/gallery/main.cpp | 51 ++ .../extras/gallery/qml/BlackButtonBackground.qml | 71 +++ .../extras/gallery/qml/BlackButtonStyle.qml | 97 +++ .../extras/gallery/qml/CircularGaugeDarkStyle.qml | 96 +++ .../gallery/qml/CircularGaugeDefaultStyle.qml | 46 ++ .../extras/gallery/qml/CircularGaugeLightStyle.qml | 97 +++ .../extras/gallery/qml/CircularGaugeView.qml | 230 +++++++ .../extras/gallery/qml/ControlLabel.qml | 49 ++ .../extras/gallery/qml/ControlView.qml | 188 ++++++ .../extras/gallery/qml/ControlViewToolbar.qml | 91 +++ .../extras/gallery/qml/CustomizerLabel.qml | 48 ++ .../extras/gallery/qml/CustomizerSlider.qml | 75 +++ .../extras/gallery/qml/CustomizerSwitch.qml | 46 ++ .../extras/gallery/qml/FlickableMoreIndicator.qml | 76 +++ .../extras/gallery/qml/PieMenuControlView.qml | 187 ++++++ .../extras/gallery/qml/PieMenuDarkStyle.qml | 46 ++ .../extras/gallery/qml/PieMenuDefaultStyle.qml | 44 ++ .../extras/gallery/qml/StylePicker.qml | 98 +++ .../quickcontrols/extras/gallery/qml/gallery.qml | 439 +++++++++++++ examples/quickcontrols/quickcontrols.pro | 5 + src/controls/doc/qtquickcontrols.qdocconf | 4 +- src/dialogs/doc/qtquickdialogs.qdocconf | 4 +- src/extras/doc/qtquickextras.qdocconf | 4 +- 393 files changed, 12637 insertions(+), 12596 deletions(-) delete mode 100644 examples/quick/controls/basiclayouts/basiclayouts.pro delete mode 100644 examples/quick/controls/basiclayouts/basiclayouts.qmlproject delete mode 100644 examples/quick/controls/basiclayouts/main.qml delete mode 100644 examples/quick/controls/basiclayouts/resources.qrc delete mode 100644 examples/quick/controls/basiclayouts/src/main.cpp delete mode 100644 examples/quick/controls/basiclayouts/src/src.pri delete mode 100644 examples/quick/controls/calendar/calendar.pro delete mode 100644 examples/quick/controls/calendar/images/eventindicator.png delete mode 100644 examples/quick/controls/calendar/qml/main.qml delete mode 100644 examples/quick/controls/calendar/resources.qrc delete mode 100644 examples/quick/controls/calendar/src/event.cpp delete mode 100644 examples/quick/controls/calendar/src/event.h delete mode 100644 examples/quick/controls/calendar/src/main.cpp delete mode 100644 examples/quick/controls/calendar/src/sqleventmodel.cpp delete mode 100644 examples/quick/controls/calendar/src/sqleventmodel.h delete mode 100644 examples/quick/controls/calendar/src/src.pri delete mode 100644 examples/quick/controls/controls.pro delete mode 100644 examples/quick/controls/filesystembrowser/filesystembrowser.pro delete mode 100644 examples/quick/controls/filesystembrowser/main.cpp delete mode 100644 examples/quick/controls/filesystembrowser/main.qml delete mode 100644 examples/quick/controls/filesystembrowser/qml.qrc delete mode 100644 examples/quick/controls/gallery/gallery.pro delete mode 100644 examples/quick/controls/gallery/gallery.qrc delete mode 100644 examples/quick/controls/gallery/main.cpp delete mode 100644 examples/quick/controls/gallery/main.qml delete mode 100644 examples/quick/controls/gallery/qml/+android/UI.js delete mode 100644 examples/quick/controls/gallery/qml/+ios/UI.js delete mode 100644 examples/quick/controls/gallery/qml/+osx/UI.js delete mode 100644 examples/quick/controls/gallery/qml/ButtonPage.qml delete mode 100644 examples/quick/controls/gallery/qml/InputPage.qml delete mode 100644 examples/quick/controls/gallery/qml/ProgressPage.qml delete mode 100644 examples/quick/controls/gallery/qml/UI.js delete mode 100644 examples/quick/controls/shared/qtquickcontrolsapplication.h delete mode 100644 examples/quick/controls/shared/shared.pri delete mode 100644 examples/quick/controls/styles/images/bubble.png delete mode 100644 examples/quick/controls/styles/images/button-pressed.png delete mode 100644 examples/quick/controls/styles/images/button.png delete mode 100644 examples/quick/controls/styles/images/progress-background.png delete mode 100644 examples/quick/controls/styles/images/progress-fill.png delete mode 100644 examples/quick/controls/styles/images/slider-handle.png delete mode 100644 examples/quick/controls/styles/images/tab.png delete mode 100644 examples/quick/controls/styles/images/tab_selected.png delete mode 100644 examples/quick/controls/styles/images/textfield.png delete mode 100644 examples/quick/controls/styles/main.cpp delete mode 100644 examples/quick/controls/styles/main.qml delete mode 100644 examples/quick/controls/styles/styles.pro delete mode 100644 examples/quick/controls/styles/styles.qrc delete mode 100644 examples/quick/controls/tableview/main.qml delete mode 100644 examples/quick/controls/tableview/src/main.cpp delete mode 100644 examples/quick/controls/tableview/src/sortfilterproxymodel.cpp delete mode 100644 examples/quick/controls/tableview/src/sortfilterproxymodel.h delete mode 100644 examples/quick/controls/tableview/src/src.pri delete mode 100644 examples/quick/controls/tableview/tableview.pro delete mode 100644 examples/quick/controls/tableview/tableview.qrc delete mode 100644 examples/quick/controls/texteditor/example.html delete mode 100644 examples/quick/controls/texteditor/qml/ToolBarSeparator.qml delete mode 100644 examples/quick/controls/texteditor/qml/images/editcopy.png delete mode 100644 examples/quick/controls/texteditor/qml/images/editcut.png delete mode 100644 examples/quick/controls/texteditor/qml/images/editpaste.png delete mode 100644 examples/quick/controls/texteditor/qml/images/editredo.png delete mode 100644 examples/quick/controls/texteditor/qml/images/editundo.png delete mode 100644 examples/quick/controls/texteditor/qml/images/exportpdf.png delete mode 100644 examples/quick/controls/texteditor/qml/images/filenew.png delete mode 100644 examples/quick/controls/texteditor/qml/images/fileopen.png delete mode 100644 examples/quick/controls/texteditor/qml/images/fileprint.png delete mode 100644 examples/quick/controls/texteditor/qml/images/filesave.png delete mode 100644 examples/quick/controls/texteditor/qml/images/qt-logo.png delete mode 100644 examples/quick/controls/texteditor/qml/images/textbold.png delete mode 100644 examples/quick/controls/texteditor/qml/images/textcenter.png delete mode 100644 examples/quick/controls/texteditor/qml/images/textitalic.png delete mode 100644 examples/quick/controls/texteditor/qml/images/textjustify.png delete mode 100644 examples/quick/controls/texteditor/qml/images/textleft.png delete mode 100644 examples/quick/controls/texteditor/qml/images/textright.png delete mode 100644 examples/quick/controls/texteditor/qml/images/textunder.png delete mode 100644 examples/quick/controls/texteditor/qml/images/zoomin.png delete mode 100644 examples/quick/controls/texteditor/qml/images/zoomout.png delete mode 100644 examples/quick/controls/texteditor/qml/main.qml delete mode 100644 examples/quick/controls/texteditor/resources.qrc delete mode 100644 examples/quick/controls/texteditor/src/documenthandler.cpp delete mode 100644 examples/quick/controls/texteditor/src/documenthandler.h delete mode 100644 examples/quick/controls/texteditor/src/main.cpp delete mode 100644 examples/quick/controls/texteditor/src/src.pri delete mode 100644 examples/quick/controls/texteditor/texteditor.pro delete mode 100644 examples/quick/controls/touch/content/AndroidDelegate.qml delete mode 100644 examples/quick/controls/touch/content/ButtonPage.qml delete mode 100644 examples/quick/controls/touch/content/ListPage.qml delete mode 100644 examples/quick/controls/touch/content/ProgressBarPage.qml delete mode 100644 examples/quick/controls/touch/content/SliderPage.qml delete mode 100644 examples/quick/controls/touch/content/TabBarPage.qml delete mode 100644 examples/quick/controls/touch/content/TextInputPage.qml delete mode 100644 examples/quick/controls/touch/images/NOTICE.txt delete mode 100644 examples/quick/controls/touch/images/button_default.png delete mode 100644 examples/quick/controls/touch/images/button_pressed.png delete mode 100644 examples/quick/controls/touch/images/navigation_next_item.png delete mode 100644 examples/quick/controls/touch/images/navigation_previous_item.png delete mode 100644 examples/quick/controls/touch/images/tab_selected.png delete mode 100644 examples/quick/controls/touch/images/tabs_standard.png delete mode 100644 examples/quick/controls/touch/images/textinput.png delete mode 100644 examples/quick/controls/touch/images/toolbar.png delete mode 100644 examples/quick/controls/touch/main.qml delete mode 100644 examples/quick/controls/touch/resources.qrc delete mode 100644 examples/quick/controls/touch/src/main.cpp delete mode 100644 examples/quick/controls/touch/src/src.pri delete mode 100644 examples/quick/controls/touch/touch.pro delete mode 100644 examples/quick/controls/touch/touch.qmlproject delete mode 100644 examples/quick/controls/uiforms/MainForm.ui.qml delete mode 100644 examples/quick/controls/uiforms/main.cpp delete mode 100644 examples/quick/controls/uiforms/main.qml delete mode 100644 examples/quick/controls/uiforms/qml/CustomerModel.qml delete mode 100644 examples/quick/controls/uiforms/qml/History.qml delete mode 100644 examples/quick/controls/uiforms/qml/HistoryForm.ui.qml delete mode 100644 examples/quick/controls/uiforms/qml/Notes.qml delete mode 100644 examples/quick/controls/uiforms/qml/NotesForm.ui.qml delete mode 100644 examples/quick/controls/uiforms/qml/Settings.qml delete mode 100644 examples/quick/controls/uiforms/qml/SettingsForm.ui.qml delete mode 100644 examples/quick/controls/uiforms/uiforms.pro delete mode 100644 examples/quick/controls/uiforms/uiforms.qrc delete mode 100644 examples/quick/dialogs/dialogs.pro delete mode 100644 examples/quick/dialogs/systemdialogs/ColorDialogs.qml delete mode 100644 examples/quick/dialogs/systemdialogs/CustomDialogs.qml delete mode 100644 examples/quick/dialogs/systemdialogs/FileDialogs.qml delete mode 100644 examples/quick/dialogs/systemdialogs/FontDialogs.qml delete mode 100644 examples/quick/dialogs/systemdialogs/MessageDialogs.qml delete mode 100644 examples/quick/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg delete mode 100644 examples/quick/dialogs/systemdialogs/doc/src/systemdialogs.qdoc delete mode 100644 examples/quick/dialogs/systemdialogs/main.cpp delete mode 100644 examples/quick/dialogs/systemdialogs/systemdialogs.pro delete mode 100644 examples/quick/dialogs/systemdialogs/systemdialogs.qml delete mode 100644 examples/quick/dialogs/systemdialogs/systemdialogs.qrc delete mode 100644 examples/quick/extras/dashboard/dashboard.pro delete mode 100644 examples/quick/extras/dashboard/dashboard.qrc delete mode 100644 examples/quick/extras/dashboard/fonts/DejaVuSans.ttf delete mode 100644 examples/quick/extras/dashboard/fonts/LICENSE delete mode 100644 examples/quick/extras/dashboard/images/fuel-icon.png delete mode 100644 examples/quick/extras/dashboard/images/temperature-icon.png delete mode 100644 examples/quick/extras/dashboard/main.cpp delete mode 100644 examples/quick/extras/dashboard/qml/DashboardGaugeStyle.qml delete mode 100644 examples/quick/extras/dashboard/qml/IconGaugeStyle.qml delete mode 100644 examples/quick/extras/dashboard/qml/TachometerStyle.qml delete mode 100644 examples/quick/extras/dashboard/qml/TurnIndicator.qml delete mode 100644 examples/quick/extras/dashboard/qml/ValueSource.qml delete mode 100644 examples/quick/extras/dashboard/qml/dashboard.qml delete mode 100644 examples/quick/extras/extras.pro delete mode 100644 examples/quick/extras/flat/Content.qml delete mode 100644 examples/quick/extras/flat/SettingsIcon.qml delete mode 100644 examples/quick/extras/flat/flat.pro delete mode 100644 examples/quick/extras/flat/flat.qrc delete mode 100644 examples/quick/extras/flat/images/piemenu-bw-normal.png delete mode 100644 examples/quick/extras/flat/images/piemenu-bw-pressed.png delete mode 100644 examples/quick/extras/flat/images/piemenu-image-bw.jpg delete mode 100644 examples/quick/extras/flat/images/piemenu-image-rgb.jpg delete mode 100644 examples/quick/extras/flat/images/piemenu-image-sepia.jpg delete mode 100644 examples/quick/extras/flat/images/piemenu-rgb-normal.png delete mode 100644 examples/quick/extras/flat/images/piemenu-rgb-pressed.png delete mode 100644 examples/quick/extras/flat/images/piemenu-sepia-normal.png delete mode 100644 examples/quick/extras/flat/images/piemenu-sepia-pressed.png delete mode 100644 examples/quick/extras/flat/main.cpp delete mode 100644 examples/quick/extras/flat/main.qml delete mode 100644 examples/quick/extras/gallery/fonts/LICENSE.txt delete mode 100644 examples/quick/extras/gallery/fonts/OpenSans-Regular.ttf delete mode 100644 examples/quick/extras/gallery/gallery.pro delete mode 100644 examples/quick/extras/gallery/gallery.qrc delete mode 100644 examples/quick/extras/gallery/images/background-light.png delete mode 100644 examples/quick/extras/gallery/images/background.png delete mode 100644 examples/quick/extras/gallery/images/center-light.png delete mode 100644 examples/quick/extras/gallery/images/center.png delete mode 100644 examples/quick/extras/gallery/images/icon-back.png delete mode 100644 examples/quick/extras/gallery/images/icon-go.png delete mode 100644 examples/quick/extras/gallery/images/icon-settings.png delete mode 100644 examples/quick/extras/gallery/images/info.png delete mode 100644 examples/quick/extras/gallery/images/needle-light.png delete mode 100644 examples/quick/extras/gallery/images/needle.png delete mode 100644 examples/quick/extras/gallery/images/qt-logo.png delete mode 100644 examples/quick/extras/gallery/images/zoom_in.png delete mode 100644 examples/quick/extras/gallery/images/zoom_out.png delete mode 100644 examples/quick/extras/gallery/main.cpp delete mode 100644 examples/quick/extras/gallery/qml/BlackButtonBackground.qml delete mode 100644 examples/quick/extras/gallery/qml/BlackButtonStyle.qml delete mode 100644 examples/quick/extras/gallery/qml/CircularGaugeDarkStyle.qml delete mode 100644 examples/quick/extras/gallery/qml/CircularGaugeDefaultStyle.qml delete mode 100644 examples/quick/extras/gallery/qml/CircularGaugeLightStyle.qml delete mode 100644 examples/quick/extras/gallery/qml/CircularGaugeView.qml delete mode 100644 examples/quick/extras/gallery/qml/ControlLabel.qml delete mode 100644 examples/quick/extras/gallery/qml/ControlView.qml delete mode 100644 examples/quick/extras/gallery/qml/ControlViewToolbar.qml delete mode 100644 examples/quick/extras/gallery/qml/CustomizerLabel.qml delete mode 100644 examples/quick/extras/gallery/qml/CustomizerSlider.qml delete mode 100644 examples/quick/extras/gallery/qml/CustomizerSwitch.qml delete mode 100644 examples/quick/extras/gallery/qml/FlickableMoreIndicator.qml delete mode 100644 examples/quick/extras/gallery/qml/PieMenuControlView.qml delete mode 100644 examples/quick/extras/gallery/qml/PieMenuDarkStyle.qml delete mode 100644 examples/quick/extras/gallery/qml/PieMenuDefaultStyle.qml delete mode 100644 examples/quick/extras/gallery/qml/StylePicker.qml delete mode 100644 examples/quick/extras/gallery/qml/gallery.qml create mode 100644 examples/quickcontrols/controls/basiclayouts/basiclayouts.pro create mode 100644 examples/quickcontrols/controls/basiclayouts/basiclayouts.qmlproject create mode 100644 examples/quickcontrols/controls/basiclayouts/main.qml create mode 100644 examples/quickcontrols/controls/basiclayouts/resources.qrc create mode 100644 examples/quickcontrols/controls/basiclayouts/src/main.cpp create mode 100644 examples/quickcontrols/controls/basiclayouts/src/src.pri create mode 100644 examples/quickcontrols/controls/calendar/calendar.pro create mode 100644 examples/quickcontrols/controls/calendar/images/eventindicator.png create mode 100644 examples/quickcontrols/controls/calendar/qml/main.qml create mode 100644 examples/quickcontrols/controls/calendar/resources.qrc create mode 100644 examples/quickcontrols/controls/calendar/src/event.cpp create mode 100644 examples/quickcontrols/controls/calendar/src/event.h create mode 100644 examples/quickcontrols/controls/calendar/src/main.cpp create mode 100644 examples/quickcontrols/controls/calendar/src/sqleventmodel.cpp create mode 100644 examples/quickcontrols/controls/calendar/src/sqleventmodel.h create mode 100644 examples/quickcontrols/controls/calendar/src/src.pri create mode 100644 examples/quickcontrols/controls/controls.pro create mode 100644 examples/quickcontrols/controls/filesystembrowser/filesystembrowser.pro create mode 100644 examples/quickcontrols/controls/filesystembrowser/main.cpp create mode 100644 examples/quickcontrols/controls/filesystembrowser/main.qml create mode 100644 examples/quickcontrols/controls/filesystembrowser/qml.qrc create mode 100644 examples/quickcontrols/controls/gallery/gallery.pro create mode 100644 examples/quickcontrols/controls/gallery/gallery.qrc create mode 100644 examples/quickcontrols/controls/gallery/main.cpp create mode 100644 examples/quickcontrols/controls/gallery/main.qml create mode 100644 examples/quickcontrols/controls/gallery/qml/+android/UI.js create mode 100644 examples/quickcontrols/controls/gallery/qml/+ios/UI.js create mode 100644 examples/quickcontrols/controls/gallery/qml/+osx/UI.js create mode 100644 examples/quickcontrols/controls/gallery/qml/ButtonPage.qml create mode 100644 examples/quickcontrols/controls/gallery/qml/InputPage.qml create mode 100644 examples/quickcontrols/controls/gallery/qml/ProgressPage.qml create mode 100644 examples/quickcontrols/controls/gallery/qml/UI.js create mode 100644 examples/quickcontrols/controls/shared/qtquickcontrolsapplication.h create mode 100644 examples/quickcontrols/controls/shared/shared.pri create mode 100644 examples/quickcontrols/controls/styles/images/bubble.png create mode 100644 examples/quickcontrols/controls/styles/images/button-pressed.png create mode 100644 examples/quickcontrols/controls/styles/images/button.png create mode 100644 examples/quickcontrols/controls/styles/images/progress-background.png create mode 100644 examples/quickcontrols/controls/styles/images/progress-fill.png create mode 100644 examples/quickcontrols/controls/styles/images/slider-handle.png create mode 100644 examples/quickcontrols/controls/styles/images/tab.png create mode 100644 examples/quickcontrols/controls/styles/images/tab_selected.png create mode 100644 examples/quickcontrols/controls/styles/images/textfield.png create mode 100644 examples/quickcontrols/controls/styles/main.cpp create mode 100644 examples/quickcontrols/controls/styles/main.qml create mode 100644 examples/quickcontrols/controls/styles/styles.pro create mode 100644 examples/quickcontrols/controls/styles/styles.qrc create mode 100644 examples/quickcontrols/controls/tableview/main.qml create mode 100644 examples/quickcontrols/controls/tableview/src/main.cpp create mode 100644 examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.cpp create mode 100644 examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.h create mode 100644 examples/quickcontrols/controls/tableview/src/src.pri create mode 100644 examples/quickcontrols/controls/tableview/tableview.pro create mode 100644 examples/quickcontrols/controls/tableview/tableview.qrc create mode 100644 examples/quickcontrols/controls/texteditor/example.html create mode 100644 examples/quickcontrols/controls/texteditor/qml/ToolBarSeparator.qml create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/editcopy.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/editcut.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/editpaste.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/editredo.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/editundo.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/exportpdf.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/filenew.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/fileopen.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/fileprint.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/filesave.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/qt-logo.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/textbold.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/textcenter.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/textitalic.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/textjustify.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/textleft.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/textright.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/textunder.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/zoomin.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/images/zoomout.png create mode 100644 examples/quickcontrols/controls/texteditor/qml/main.qml create mode 100644 examples/quickcontrols/controls/texteditor/resources.qrc create mode 100644 examples/quickcontrols/controls/texteditor/src/documenthandler.cpp create mode 100644 examples/quickcontrols/controls/texteditor/src/documenthandler.h create mode 100644 examples/quickcontrols/controls/texteditor/src/main.cpp create mode 100644 examples/quickcontrols/controls/texteditor/src/src.pri create mode 100644 examples/quickcontrols/controls/texteditor/texteditor.pro create mode 100644 examples/quickcontrols/controls/touch/content/AndroidDelegate.qml create mode 100644 examples/quickcontrols/controls/touch/content/ButtonPage.qml create mode 100644 examples/quickcontrols/controls/touch/content/ListPage.qml create mode 100644 examples/quickcontrols/controls/touch/content/ProgressBarPage.qml create mode 100644 examples/quickcontrols/controls/touch/content/SliderPage.qml create mode 100644 examples/quickcontrols/controls/touch/content/TabBarPage.qml create mode 100644 examples/quickcontrols/controls/touch/content/TextInputPage.qml create mode 100644 examples/quickcontrols/controls/touch/images/NOTICE.txt create mode 100644 examples/quickcontrols/controls/touch/images/button_default.png create mode 100644 examples/quickcontrols/controls/touch/images/button_pressed.png create mode 100644 examples/quickcontrols/controls/touch/images/navigation_next_item.png create mode 100644 examples/quickcontrols/controls/touch/images/navigation_previous_item.png create mode 100644 examples/quickcontrols/controls/touch/images/tab_selected.png create mode 100644 examples/quickcontrols/controls/touch/images/tabs_standard.png create mode 100644 examples/quickcontrols/controls/touch/images/textinput.png create mode 100644 examples/quickcontrols/controls/touch/images/toolbar.png create mode 100644 examples/quickcontrols/controls/touch/main.qml create mode 100644 examples/quickcontrols/controls/touch/resources.qrc create mode 100644 examples/quickcontrols/controls/touch/src/main.cpp create mode 100644 examples/quickcontrols/controls/touch/src/src.pri create mode 100644 examples/quickcontrols/controls/touch/touch.pro create mode 100644 examples/quickcontrols/controls/touch/touch.qmlproject create mode 100644 examples/quickcontrols/controls/uiforms/MainForm.ui.qml create mode 100644 examples/quickcontrols/controls/uiforms/main.cpp create mode 100644 examples/quickcontrols/controls/uiforms/main.qml create mode 100644 examples/quickcontrols/controls/uiforms/qml/CustomerModel.qml create mode 100644 examples/quickcontrols/controls/uiforms/qml/History.qml create mode 100644 examples/quickcontrols/controls/uiforms/qml/HistoryForm.ui.qml create mode 100644 examples/quickcontrols/controls/uiforms/qml/Notes.qml create mode 100644 examples/quickcontrols/controls/uiforms/qml/NotesForm.ui.qml create mode 100644 examples/quickcontrols/controls/uiforms/qml/Settings.qml create mode 100644 examples/quickcontrols/controls/uiforms/qml/SettingsForm.ui.qml create mode 100644 examples/quickcontrols/controls/uiforms/uiforms.pro create mode 100644 examples/quickcontrols/controls/uiforms/uiforms.qrc create mode 100644 examples/quickcontrols/dialogs/dialogs.pro create mode 100644 examples/quickcontrols/dialogs/systemdialogs/ColorDialogs.qml create mode 100644 examples/quickcontrols/dialogs/systemdialogs/CustomDialogs.qml create mode 100644 examples/quickcontrols/dialogs/systemdialogs/FileDialogs.qml create mode 100644 examples/quickcontrols/dialogs/systemdialogs/FontDialogs.qml create mode 100644 examples/quickcontrols/dialogs/systemdialogs/MessageDialogs.qml create mode 100644 examples/quickcontrols/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg create mode 100644 examples/quickcontrols/dialogs/systemdialogs/doc/src/systemdialogs.qdoc create mode 100644 examples/quickcontrols/dialogs/systemdialogs/main.cpp create mode 100644 examples/quickcontrols/dialogs/systemdialogs/systemdialogs.pro create mode 100644 examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qml create mode 100644 examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qrc create mode 100644 examples/quickcontrols/extras/dashboard/dashboard.pro create mode 100644 examples/quickcontrols/extras/dashboard/dashboard.qrc create mode 100644 examples/quickcontrols/extras/dashboard/fonts/DejaVuSans.ttf create mode 100644 examples/quickcontrols/extras/dashboard/fonts/LICENSE create mode 100644 examples/quickcontrols/extras/dashboard/images/fuel-icon.png create mode 100644 examples/quickcontrols/extras/dashboard/images/temperature-icon.png create mode 100644 examples/quickcontrols/extras/dashboard/main.cpp create mode 100644 examples/quickcontrols/extras/dashboard/qml/DashboardGaugeStyle.qml create mode 100644 examples/quickcontrols/extras/dashboard/qml/IconGaugeStyle.qml create mode 100644 examples/quickcontrols/extras/dashboard/qml/TachometerStyle.qml create mode 100644 examples/quickcontrols/extras/dashboard/qml/TurnIndicator.qml create mode 100644 examples/quickcontrols/extras/dashboard/qml/ValueSource.qml create mode 100644 examples/quickcontrols/extras/dashboard/qml/dashboard.qml create mode 100644 examples/quickcontrols/extras/extras.pro create mode 100644 examples/quickcontrols/extras/flat/Content.qml create mode 100644 examples/quickcontrols/extras/flat/SettingsIcon.qml create mode 100644 examples/quickcontrols/extras/flat/flat.pro create mode 100644 examples/quickcontrols/extras/flat/flat.qrc create mode 100644 examples/quickcontrols/extras/flat/images/piemenu-bw-normal.png create mode 100644 examples/quickcontrols/extras/flat/images/piemenu-bw-pressed.png create mode 100644 examples/quickcontrols/extras/flat/images/piemenu-image-bw.jpg create mode 100644 examples/quickcontrols/extras/flat/images/piemenu-image-rgb.jpg create mode 100644 examples/quickcontrols/extras/flat/images/piemenu-image-sepia.jpg create mode 100644 examples/quickcontrols/extras/flat/images/piemenu-rgb-normal.png create mode 100644 examples/quickcontrols/extras/flat/images/piemenu-rgb-pressed.png create mode 100644 examples/quickcontrols/extras/flat/images/piemenu-sepia-normal.png create mode 100644 examples/quickcontrols/extras/flat/images/piemenu-sepia-pressed.png create mode 100644 examples/quickcontrols/extras/flat/main.cpp create mode 100644 examples/quickcontrols/extras/flat/main.qml create mode 100644 examples/quickcontrols/extras/gallery/fonts/LICENSE.txt create mode 100644 examples/quickcontrols/extras/gallery/fonts/OpenSans-Regular.ttf create mode 100644 examples/quickcontrols/extras/gallery/gallery.pro create mode 100644 examples/quickcontrols/extras/gallery/gallery.qrc create mode 100644 examples/quickcontrols/extras/gallery/images/background-light.png create mode 100644 examples/quickcontrols/extras/gallery/images/background.png create mode 100644 examples/quickcontrols/extras/gallery/images/center-light.png create mode 100644 examples/quickcontrols/extras/gallery/images/center.png create mode 100644 examples/quickcontrols/extras/gallery/images/icon-back.png create mode 100644 examples/quickcontrols/extras/gallery/images/icon-go.png create mode 100644 examples/quickcontrols/extras/gallery/images/icon-settings.png create mode 100644 examples/quickcontrols/extras/gallery/images/info.png create mode 100644 examples/quickcontrols/extras/gallery/images/needle-light.png create mode 100644 examples/quickcontrols/extras/gallery/images/needle.png create mode 100644 examples/quickcontrols/extras/gallery/images/qt-logo.png create mode 100644 examples/quickcontrols/extras/gallery/images/zoom_in.png create mode 100644 examples/quickcontrols/extras/gallery/images/zoom_out.png create mode 100644 examples/quickcontrols/extras/gallery/main.cpp create mode 100644 examples/quickcontrols/extras/gallery/qml/BlackButtonBackground.qml create mode 100644 examples/quickcontrols/extras/gallery/qml/BlackButtonStyle.qml create mode 100644 examples/quickcontrols/extras/gallery/qml/CircularGaugeDarkStyle.qml create mode 100644 examples/quickcontrols/extras/gallery/qml/CircularGaugeDefaultStyle.qml create mode 100644 examples/quickcontrols/extras/gallery/qml/CircularGaugeLightStyle.qml create mode 100644 examples/quickcontrols/extras/gallery/qml/CircularGaugeView.qml create mode 100644 examples/quickcontrols/extras/gallery/qml/ControlLabel.qml create mode 100644 examples/quickcontrols/extras/gallery/qml/ControlView.qml create mode 100644 examples/quickcontrols/extras/gallery/qml/ControlViewToolbar.qml create mode 100644 examples/quickcontrols/extras/gallery/qml/CustomizerLabel.qml create mode 100644 examples/quickcontrols/extras/gallery/qml/CustomizerSlider.qml create mode 100644 examples/quickcontrols/extras/gallery/qml/CustomizerSwitch.qml create mode 100644 examples/quickcontrols/extras/gallery/qml/FlickableMoreIndicator.qml create mode 100644 examples/quickcontrols/extras/gallery/qml/PieMenuControlView.qml create mode 100644 examples/quickcontrols/extras/gallery/qml/PieMenuDarkStyle.qml create mode 100644 examples/quickcontrols/extras/gallery/qml/PieMenuDefaultStyle.qml create mode 100644 examples/quickcontrols/extras/gallery/qml/StylePicker.qml create mode 100644 examples/quickcontrols/extras/gallery/qml/gallery.qml create mode 100644 examples/quickcontrols/quickcontrols.pro diff --git a/examples/examples.pro b/examples/examples.pro index c80af37f0..a561399ae 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -1,5 +1,2 @@ TEMPLATE = subdirs - -SUBDIRS += quick/controls -SUBDIRS += quick/dialogs -SUBDIRS += quick/extras +SUBDIRS = quickcontrols diff --git a/examples/quick/controls/basiclayouts/basiclayouts.pro b/examples/quick/controls/basiclayouts/basiclayouts.pro deleted file mode 100644 index 54e609920..000000000 --- a/examples/quick/controls/basiclayouts/basiclayouts.pro +++ /dev/null @@ -1,12 +0,0 @@ -QT += qml quick -TARGET = basiclayouts -!no_desktop: QT += widgets - -include(src/src.pri) -include(../shared/shared.pri) - -OTHER_FILES += \ - main.qml - -RESOURCES += \ - resources.qrc diff --git a/examples/quick/controls/basiclayouts/basiclayouts.qmlproject b/examples/quick/controls/basiclayouts/basiclayouts.qmlproject deleted file mode 100644 index e5a8bf02c..000000000 --- a/examples/quick/controls/basiclayouts/basiclayouts.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "main.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/quick/controls/basiclayouts/main.qml b/examples/quick/controls/basiclayouts/main.qml deleted file mode 100644 index b6694b454..000000000 --- a/examples/quick/controls/basiclayouts/main.qml +++ /dev/null @@ -1,135 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.2 -import QtQuick.Layouts 1.3 - -ApplicationWindow { - visible: true - title: "Basic layouts" - property int margin: 11 - width: mainLayout.implicitWidth + 2 * margin - height: mainLayout.implicitHeight + 2 * margin - minimumWidth: mainLayout.Layout.minimumWidth + 2 * margin - minimumHeight: mainLayout.Layout.minimumHeight + 2 * margin - - ColumnLayout { - id: mainLayout - anchors.fill: parent - anchors.margins: margin - GroupBox { - id: rowBox - title: "Row layout" - Layout.fillWidth: true - - RowLayout { - id: rowLayout - anchors.fill: parent - TextField { - placeholderText: "This wants to grow horizontally" - Layout.fillWidth: true - } - Button { - text: "Button" - } - } - } - - GroupBox { - id: gridBox - title: "Grid layout" - Layout.fillWidth: true - - GridLayout { - id: gridLayout - rows: 3 - flow: GridLayout.TopToBottom - anchors.fill: parent - - Label { text: "Line 1" } - Label { text: "Line 2" } - Label { text: "Line 3" } - - TextField { } - TextField { } - TextField { } - - TextArea { - text: "This widget spans over three rows in the GridLayout.\n" - + "All items in the GridLayout are implicitly positioned from top to bottom." - Layout.rowSpan: 3 - Layout.fillHeight: true - Layout.fillWidth: true - } - } - } - TextArea { - id: t3 - text: "This fills the whole cell" - Layout.minimumHeight: 30 - Layout.fillHeight: true - Layout.fillWidth: true - } - GroupBox { - id: stackBox - title: "Stack layout" - implicitWidth: 200 - implicitHeight: 60 - Layout.fillWidth: true - Layout.fillHeight: true - StackLayout { - id: stackLayout - anchors.fill: parent - - function advance() { currentIndex = (currentIndex + 1) % count } - - Repeater { - id: stackRepeater - model: 5 - Rectangle { - color: Qt.hsla((0.5 + index)/stackRepeater.count, 0.3, 0.7, 1) - Button { anchors.centerIn: parent; text: "Page " + (index + 1); onClicked: { stackLayout.advance() } } - } - } - } - } - } -} diff --git a/examples/quick/controls/basiclayouts/resources.qrc b/examples/quick/controls/basiclayouts/resources.qrc deleted file mode 100644 index 3b111a907..000000000 --- a/examples/quick/controls/basiclayouts/resources.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - main.qml - - diff --git a/examples/quick/controls/basiclayouts/src/main.cpp b/examples/quick/controls/basiclayouts/src/main.cpp deleted file mode 100644 index e66387f7b..000000000 --- a/examples/quick/controls/basiclayouts/src/main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 "qtquickcontrolsapplication.h" -#include - -int main(int argc, char *argv[]) -{ - QtQuickControlsApplication app(argc, argv); - QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); - if (engine.rootObjects().isEmpty()) - return -1; - return app.exec(); -} diff --git a/examples/quick/controls/basiclayouts/src/src.pri b/examples/quick/controls/basiclayouts/src/src.pri deleted file mode 100644 index 66d903eac..000000000 --- a/examples/quick/controls/basiclayouts/src/src.pri +++ /dev/null @@ -1,2 +0,0 @@ -SOURCES += \ - $$PWD/main.cpp diff --git a/examples/quick/controls/calendar/calendar.pro b/examples/quick/controls/calendar/calendar.pro deleted file mode 100644 index e5bee1e97..000000000 --- a/examples/quick/controls/calendar/calendar.pro +++ /dev/null @@ -1,11 +0,0 @@ -QT += qml quick sql -TARGET = calendar - -!contains(sql-drivers, sqlite): QTPLUGIN += qsqlite - -include(src/src.pri) -include(../shared/shared.pri) - -OTHER_FILES += qml/main.qml - -RESOURCES += resources.qrc diff --git a/examples/quick/controls/calendar/images/eventindicator.png b/examples/quick/controls/calendar/images/eventindicator.png deleted file mode 100644 index 1edffd02d..000000000 Binary files a/examples/quick/controls/calendar/images/eventindicator.png and /dev/null differ diff --git a/examples/quick/controls/calendar/qml/main.qml b/examples/quick/controls/calendar/qml/main.qml deleted file mode 100644 index 46215e28d..000000000 --- a/examples/quick/controls/calendar/qml/main.qml +++ /dev/null @@ -1,216 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.1 -import org.qtproject.examples.calendar 1.0 - -ApplicationWindow { - visible: true - width: 640 - height: 400 - minimumWidth: 400 - minimumHeight: 300 - color: "#f4f4f4" - - title: "Calendar Example" - - SystemPalette { - id: systemPalette - } - - SqlEventModel { - id: eventModel - } - - Flow { - id: row - anchors.fill: parent - anchors.margins: 20 - spacing: 10 - layoutDirection: Qt.RightToLeft - - Calendar { - id: calendar - width: (parent.width > parent.height ? parent.width * 0.6 - parent.spacing : parent.width) - height: (parent.height > parent.width ? parent.height * 0.6 - parent.spacing : parent.height) - frameVisible: true - weekNumbersVisible: true - selectedDate: new Date(2014, 0, 1) - focus: true - - style: CalendarStyle { - dayDelegate: Item { - readonly property color sameMonthDateTextColor: "#444" - readonly property color selectedDateColor: Qt.platform.os === "osx" ? "#3778d0" : systemPalette.highlight - readonly property color selectedDateTextColor: "white" - readonly property color differentMonthDateTextColor: "#bbb" - readonly property color invalidDatecolor: "#dddddd" - - Rectangle { - anchors.fill: parent - border.color: "transparent" - color: styleData.date !== undefined && styleData.selected ? selectedDateColor : "transparent" - anchors.margins: styleData.selected ? -1 : 0 - } - - Image { - visible: eventModel.eventsForDate(styleData.date).length > 0 - anchors.top: parent.top - anchors.left: parent.left - anchors.margins: -1 - width: 12 - height: width - source: "qrc:/images/eventindicator.png" - } - - Label { - id: dayDelegateText - text: styleData.date.getDate() - anchors.centerIn: parent - color: { - var color = invalidDatecolor; - if (styleData.valid) { - // Date is within the valid range. - color = styleData.visibleMonth ? sameMonthDateTextColor : differentMonthDateTextColor; - if (styleData.selected) { - color = selectedDateTextColor; - } - } - color; - } - } - } - } - } - - Component { - id: eventListHeader - - Row { - id: eventDateRow - width: parent.width - height: eventDayLabel.height - spacing: 10 - - Label { - id: eventDayLabel - text: calendar.selectedDate.getDate() - font.pointSize: 35 - } - - Column { - height: eventDayLabel.height - - Label { - readonly property var options: { weekday: "long" } - text: Qt.locale().standaloneDayName(calendar.selectedDate.getDay(), Locale.LongFormat) - font.pointSize: 18 - } - Label { - text: Qt.locale().standaloneMonthName(calendar.selectedDate.getMonth()) - + calendar.selectedDate.toLocaleDateString(Qt.locale(), " yyyy") - font.pointSize: 12 - } - } - } - } - - Rectangle { - width: (parent.width > parent.height ? parent.width * 0.4 - parent.spacing : parent.width) - height: (parent.height > parent.width ? parent.height * 0.4 - parent.spacing : parent.height) - border.color: Qt.darker(color, 1.2) - - ListView { - id: eventsListView - spacing: 4 - clip: true - header: eventListHeader - anchors.fill: parent - anchors.margins: 10 - model: eventModel.eventsForDate(calendar.selectedDate) - - delegate: Rectangle { - width: eventsListView.width - height: eventItemColumn.height - anchors.horizontalCenter: parent.horizontalCenter - - Image { - anchors.top: parent.top - anchors.topMargin: 4 - width: 12 - height: width - source: "qrc:/images/eventindicator.png" - } - - Rectangle { - width: parent.width - height: 1 - color: "#eee" - } - - Column { - id: eventItemColumn - anchors.left: parent.left - anchors.leftMargin: 20 - anchors.right: parent.right - height: timeLabel.height + nameLabel.height + 8 - - Label { - id: nameLabel - width: parent.width - wrapMode: Text.Wrap - text: modelData.name - } - Label { - id: timeLabel - width: parent.width - wrapMode: Text.Wrap - text: modelData.startDate.toLocaleTimeString(calendar.locale, Locale.ShortFormat) - color: "#aaa" - } - } - } - } - } - } -} diff --git a/examples/quick/controls/calendar/resources.qrc b/examples/quick/controls/calendar/resources.qrc deleted file mode 100644 index 9da283ba3..000000000 --- a/examples/quick/controls/calendar/resources.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - qml/main.qml - images/eventindicator.png - - diff --git a/examples/quick/controls/calendar/src/event.cpp b/examples/quick/controls/calendar/src/event.cpp deleted file mode 100644 index e4c7dd787..000000000 --- a/examples/quick/controls/calendar/src/event.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 "event.h" - -Event::Event(QObject *parent) : - QObject(parent) -{ -} - -QString Event::name() const -{ - return mName; -} - -void Event::setName(const QString &name) -{ - if (name != mName) { - mName = name; - emit nameChanged(mName); - } -} - -QDateTime Event::startDate() const -{ - return mStartDate; -} - -void Event::setStartDate(const QDateTime &startDate) -{ - if (startDate != mStartDate) { - mStartDate = startDate; - emit startDateChanged(mStartDate); - } -} - -QDateTime Event::endDate() const -{ - return mEndDate; -} - -void Event::setEndDate(const QDateTime &endDate) -{ - if (endDate != mEndDate) { - mEndDate = endDate; - emit endDateChanged(mEndDate); - } -} diff --git a/examples/quick/controls/calendar/src/event.h b/examples/quick/controls/calendar/src/event.h deleted file mode 100644 index bfa11ad72..000000000 --- a/examples/quick/controls/calendar/src/event.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 EVENT_H -#define EVENT_H - -#include -#include -#include - -class Event : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(QDateTime startDate READ startDate WRITE setStartDate NOTIFY startDateChanged) - Q_PROPERTY(QDateTime endDate READ endDate WRITE setEndDate NOTIFY endDateChanged) -public: - explicit Event(QObject *parent = 0); - - QString name() const; - void setName(const QString &name); - - QDateTime startDate() const; - void setStartDate(const QDateTime &startDate); - - QDateTime endDate() const; - void setEndDate(const QDateTime &endDate); -signals: - void nameChanged(const QString &name); - void startDateChanged(const QDateTime &startDate); - void endDateChanged(const QDateTime &endDate); -private: - QString mName; - QDateTime mStartDate; - QDateTime mEndDate; -}; - -#endif diff --git a/examples/quick/controls/calendar/src/main.cpp b/examples/quick/controls/calendar/src/main.cpp deleted file mode 100644 index bab7e4b26..000000000 --- a/examples/quick/controls/calendar/src/main.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 "qtquickcontrolsapplication.h" -#include "sqleventmodel.h" - -int main(int argc, char *argv[]) -{ - QtQuickControlsApplication app(argc, argv); - qmlRegisterType("org.qtproject.examples.calendar", 1, 0, "SqlEventModel"); - QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml")); - if (engine.rootObjects().isEmpty()) - return -1; - return app.exec(); -} diff --git a/examples/quick/controls/calendar/src/sqleventmodel.cpp b/examples/quick/controls/calendar/src/sqleventmodel.cpp deleted file mode 100644 index 92e558ef3..000000000 --- a/examples/quick/controls/calendar/src/sqleventmodel.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 "sqleventmodel.h" - -#include -#include -#include -#include - -SqlEventModel::SqlEventModel() -{ - createConnection(); -} - -QList SqlEventModel::eventsForDate(const QDate &date) -{ - const QString queryStr = QString::fromLatin1("SELECT * FROM Event WHERE '%1' >= startDate AND '%1' <= endDate").arg(date.toString("yyyy-MM-dd")); - QSqlQuery query(queryStr); - if (!query.exec()) - qFatal("Query failed"); - - QList events; - while (query.next()) { - Event *event = new Event(this); - event->setName(query.value("name").toString()); - - QDateTime startDate; - startDate.setDate(query.value("startDate").toDate()); - startDate.setTime(QTime(0, 0).addSecs(query.value("startTime").toInt())); - event->setStartDate(startDate); - - QDateTime endDate; - endDate.setDate(query.value("endDate").toDate()); - endDate.setTime(QTime(0, 0).addSecs(query.value("endTime").toInt())); - event->setEndDate(endDate); - - events.append(event); - } - - return events; -} - -/* - Defines a helper function to open a connection to an - in-memory SQLITE database and to create a test table. -*/ -void SqlEventModel::createConnection() -{ - QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); - db.setDatabaseName(":memory:"); - if (!db.open()) { - qFatal("Cannot open database"); - return; - } - - QSqlQuery query; - // We store the time as seconds because it's easier to query. - query.exec("create table Event (name TEXT, startDate DATE, startTime INT, endDate DATE, endTime INT)"); - query.exec("insert into Event values('Grocery shopping', '2014-01-01', 36000, '2014-01-01', 39600)"); - query.exec("insert into Event values('Ice skating', '2014-01-01', 57600, '2014-01-01', 61200)"); - query.exec("insert into Event values('Doctor''s appointment', '2014-01-15', 57600, '2014-01-15', 63000)"); - query.exec("insert into Event values('Conference', '2014-01-24', 32400, '2014-01-28', 61200)"); - - return; -} diff --git a/examples/quick/controls/calendar/src/sqleventmodel.h b/examples/quick/controls/calendar/src/sqleventmodel.h deleted file mode 100644 index e7a35c011..000000000 --- a/examples/quick/controls/calendar/src/sqleventmodel.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 SQLEVENTMODEL_H -#define SQLEVENTMODEL_H - -#include -#include - -#include "event.h" - -class SqlEventModel : public QObject -{ - Q_OBJECT - -public: - SqlEventModel(); - - Q_INVOKABLE QList eventsForDate(const QDate &date); - -private: - static void createConnection(); -}; - -#endif diff --git a/examples/quick/controls/calendar/src/src.pri b/examples/quick/controls/calendar/src/src.pri deleted file mode 100644 index 50b2ea620..000000000 --- a/examples/quick/controls/calendar/src/src.pri +++ /dev/null @@ -1,9 +0,0 @@ -SOURCES += \ - $$PWD/event.cpp \ - $$PWD/main.cpp \ - $$PWD/sqleventmodel.cpp - - -HEADERS += \ - $$PWD/event.h \ - $$PWD/sqleventmodel.h diff --git a/examples/quick/controls/controls.pro b/examples/quick/controls/controls.pro deleted file mode 100644 index 52ab8c459..000000000 --- a/examples/quick/controls/controls.pro +++ /dev/null @@ -1,17 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += \ - gallery \ - tableview \ - touch \ - basiclayouts \ - styles \ - uiforms - -qtHaveModule(widgets) { - SUBDIRS += texteditor filesystembrowser -} - -qtHaveModule(sql) { - SUBDIRS += calendar -} diff --git a/examples/quick/controls/filesystembrowser/filesystembrowser.pro b/examples/quick/controls/filesystembrowser/filesystembrowser.pro deleted file mode 100644 index bf77d958f..000000000 --- a/examples/quick/controls/filesystembrowser/filesystembrowser.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = app -TARGET = filesystembrowser -QT += qml quick widgets - -SOURCES += main.cpp - -RESOURCES += qml.qrc diff --git a/examples/quick/controls/filesystembrowser/main.cpp b/examples/quick/controls/filesystembrowser/main.cpp deleted file mode 100644 index e9c63c208..000000000 --- a/examples/quick/controls/filesystembrowser/main.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 -#include -#include -#include -#include -#include - -static inline QString permissionString(const QFileInfo &fi) -{ - const QFile::Permissions permissions = fi.permissions(); - QString result = QLatin1String("----------"); - if (fi.isSymLink()) - result[0] = QLatin1Char('l'); - else if (fi.isDir()) - result[0] = QLatin1Char('d'); - if (permissions & QFileDevice::ReadUser) - result[1] = QLatin1Char('r'); - if (permissions & QFileDevice::WriteUser) - result[2] = QLatin1Char('w'); - if (permissions & QFileDevice::ExeUser) - result[3] = QLatin1Char('x'); - if (permissions & QFileDevice::ReadGroup) - result[4] = QLatin1Char('r'); - if (permissions & QFileDevice::WriteGroup) - result[5] = QLatin1Char('w'); - if (permissions & QFileDevice::ExeGroup) - result[6] = QLatin1Char('x'); - if (permissions & QFileDevice::ReadOther) - result[7] = QLatin1Char('r'); - if (permissions & QFileDevice::WriteOther) - result[8] = QLatin1Char('w'); - if (permissions & QFileDevice::ExeOther) - result[9] = QLatin1Char('x'); - return result; -} - -static inline QString sizeString(const QFileInfo &fi) -{ - if (!fi.isFile()) - return QString(); - const qint64 size = fi.size(); - if (size > 1024 * 1024 * 10) - return QString::number(size / (1024 * 1024)) + QLatin1Char('M'); - if (size > 1024 * 10) - return QString::number(size / 1024) + QLatin1Char('K'); - return QString::number(size); -} - -class DisplayFileSystemModel : public QFileSystemModel { - Q_OBJECT -public: - explicit DisplayFileSystemModel(QObject *parent = Q_NULLPTR) - : QFileSystemModel(parent) {} - - enum Roles { - SizeRole = Qt::UserRole + 4, - DisplayableFilePermissionsRole = Qt::UserRole + 5, - LastModifiedRole = Qt::UserRole + 6, - UrlStringRole = Qt::UserRole + 7 - }; - Q_ENUM(Roles) - - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE - { - if (index.isValid() && role >= SizeRole) { - switch (role) { - case SizeRole: - return QVariant(sizeString(fileInfo(index))); - case DisplayableFilePermissionsRole: - return QVariant(permissionString(fileInfo(index))); - case LastModifiedRole: - return QVariant(fileInfo(index).lastModified().toString(Qt::SystemLocaleShortDate)); - case UrlStringRole: - return QVariant(QUrl::fromLocalFile(filePath(index)).toString()); - default: - break; - } - } - return QFileSystemModel::data(index, role); - } - - QHash roleNames() const Q_DECL_OVERRIDE - { - QHash result = QFileSystemModel::roleNames(); - result.insert(SizeRole, QByteArrayLiteral("size")); - result.insert(DisplayableFilePermissionsRole, QByteArrayLiteral("displayableFilePermissions")); - result.insert(LastModifiedRole, QByteArrayLiteral("lastModified")); - return result; - } -}; - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QQmlApplicationEngine engine; - qmlRegisterUncreatableType("io.qt.examples.quick.controls.filesystembrowser", 1, 0, - "FileSystemModel", "Cannot create a FileSystemModel instance."); - QFileSystemModel *fsm = new DisplayFileSystemModel(&engine); - fsm->setRootPath(QDir::homePath()); - fsm->setResolveSymlinks(true); - engine.rootContext()->setContextProperty("fileSystemModel", fsm); - engine.rootContext()->setContextProperty("rootPathIndex", fsm->index(fsm->rootPath())); - engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); - if (engine.rootObjects().isEmpty()) - return -1; - - return app.exec(); -} - -#include "main.moc" diff --git a/examples/quick/controls/filesystembrowser/main.qml b/examples/quick/controls/filesystembrowser/main.qml deleted file mode 100644 index 6e79ca618..000000000 --- a/examples/quick/controls/filesystembrowser/main.qml +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.5 -import QtQml.Models 2.2 -import io.qt.examples.quick.controls.filesystembrowser 1.0 - -ApplicationWindow { - visible: true - width: 640 - height: 480 - title: qsTr("File System") - - menuBar: MenuBar { - Menu { - title: qsTr("File") - MenuItem { - text: qsTr("Exit") - onTriggered: Qt.quit(); - } - } - } - - Row { - id: row - anchors.top: parent.top - anchors.topMargin: 12 - anchors.horizontalCenter: parent.horizontalCenter - - ExclusiveGroup { - id: eg - } - - Repeater { - model: [ "None", "Single", "Extended", "Multi", "Contig."] - Button { - text: modelData - exclusiveGroup: eg - checkable: true - checked: index === 1 - onClicked: view.selectionMode = index - } - } - } - - ItemSelectionModel { - id: sel - model: fileSystemModel - } - - TreeView { - id: view - anchors.fill: parent - anchors.margins: 2 * 12 + row.height - model: fileSystemModel - rootIndex: rootPathIndex - selection: sel - - TableViewColumn { - title: "Name" - role: "fileName" - resizable: true - } - - TableViewColumn { - title: "Size" - role: "size" - resizable: true - horizontalAlignment : Text.AlignRight - width: 70 - } - - TableViewColumn { - title: "Permissions" - role: "displayableFilePermissions" - resizable: true - width: 100 - } - - TableViewColumn { - title: "Date Modified" - role: "lastModified" - resizable: true - } - - onActivated : { - var url = fileSystemModel.data(index, FileSystemModel.UrlStringRole) - Qt.openUrlExternally(url) - } - } -} diff --git a/examples/quick/controls/filesystembrowser/qml.qrc b/examples/quick/controls/filesystembrowser/qml.qrc deleted file mode 100644 index 5f6483ac3..000000000 --- a/examples/quick/controls/filesystembrowser/qml.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - main.qml - - diff --git a/examples/quick/controls/gallery/gallery.pro b/examples/quick/controls/gallery/gallery.pro deleted file mode 100644 index f13f42135..000000000 --- a/examples/quick/controls/gallery/gallery.pro +++ /dev/null @@ -1,20 +0,0 @@ -TEMPLATE = app -TARGET = gallery - -SOURCES += \ - main.cpp - -RESOURCES += \ - gallery.qrc - -OTHER_FILES += \ - main.qml \ - qml/ButtonPage.qml \ - qml/InputPage.qml \ - qml/ProgressPage.qml \ - qml/UI.js \ - qml/+android/UI.js \ - qml/+ios/UI.js \ - qml/+osx/UI.js - -include(../shared/shared.pri) diff --git a/examples/quick/controls/gallery/gallery.qrc b/examples/quick/controls/gallery/gallery.qrc deleted file mode 100644 index 873c8b5ca..000000000 --- a/examples/quick/controls/gallery/gallery.qrc +++ /dev/null @@ -1,12 +0,0 @@ - - - main.qml - qml/ButtonPage.qml - qml/InputPage.qml - qml/ProgressPage.qml - qml/UI.js - qml/+android/UI.js - qml/+ios/UI.js - qml/+osx/UI.js - - diff --git a/examples/quick/controls/gallery/main.cpp b/examples/quick/controls/gallery/main.cpp deleted file mode 100644 index ac3f447d3..000000000 --- a/examples/quick/controls/gallery/main.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 "qtquickcontrolsapplication.h" -#include -#include - -int main(int argc, char *argv[]) -{ - QtQuickControlsApplication app(argc, argv); - if (QCoreApplication::arguments().contains(QLatin1String("--coreprofile"))) { - QSurfaceFormat fmt; - fmt.setVersion(4, 4); - fmt.setProfile(QSurfaceFormat::CoreProfile); - QSurfaceFormat::setDefaultFormat(fmt); - } - QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); - if (engine.rootObjects().isEmpty()) - return -1; - return app.exec(); -} diff --git a/examples/quick/controls/gallery/main.qml b/examples/quick/controls/gallery/main.qml deleted file mode 100644 index ab3d8d32a..000000000 --- a/examples/quick/controls/gallery/main.qml +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.1 -import QtQuick.Controls 1.2 -import "qml/UI.js" as UI -import "qml" - -ApplicationWindow { - visible: true - title: "Qt Quick Controls Gallery" - - width: 640 - height: 480 - - MessageDialog { - id: aboutDialog - icon: StandardIcon.Information - title: "About" - text: "Qt Quick Controls Gallery" - informativeText: "This example demonstrates most of the available Qt Quick Controls." - } - - Action { - id: copyAction - text: "&Copy" - shortcut: StandardKey.Copy - iconName: "edit-copy" - enabled: (!!activeFocusItem && !!activeFocusItem["copy"]) - onTriggered: activeFocusItem.copy() - } - - Action { - id: cutAction - text: "Cu&t" - shortcut: StandardKey.Cut - iconName: "edit-cut" - enabled: (!!activeFocusItem && !!activeFocusItem["cut"]) - onTriggered: activeFocusItem.cut() - } - - Action { - id: pasteAction - text: "&Paste" - shortcut: StandardKey.Paste - iconName: "edit-paste" - enabled: (!!activeFocusItem && !!activeFocusItem["paste"]) - onTriggered: activeFocusItem.paste() - } - - toolBar: ToolBar { - RowLayout { - anchors.fill: parent - anchors.margins: spacing - Label { - text: UI.label - } - Item { Layout.fillWidth: true } - CheckBox { - id: enabler - text: "Enabled" - checked: true - } - } - } - - menuBar: MenuBar { - Menu { - title: "&File" - MenuItem { - text: "E&xit" - shortcut: StandardKey.Quit - onTriggered: Qt.quit() - } - } - Menu { - title: "&Edit" - visible: tabView.currentIndex == 2 - MenuItem { action: cutAction } - MenuItem { action: copyAction } - MenuItem { action: pasteAction } - } - Menu { - title: "&Help" - MenuItem { - text: "About..." - onTriggered: aboutDialog.open() - } - } - } - - TabView { - id: tabView - - anchors.fill: parent - anchors.margins: UI.margin - tabPosition: UI.tabPosition - - Layout.minimumWidth: 360 - Layout.minimumHeight: 360 - Layout.preferredWidth: 480 - Layout.preferredHeight: 640 - - Tab { - title: "Buttons" - ButtonPage { - enabled: enabler.checked - } - } - Tab { - title: "Progress" - ProgressPage { - enabled: enabler.checked - } - } - Tab { - title: "Input" - InputPage { - enabled: enabler.checked - } - } - } -} diff --git a/examples/quick/controls/gallery/qml/+android/UI.js b/examples/quick/controls/gallery/qml/+android/UI.js deleted file mode 100644 index 417b4581e..000000000 --- a/examples/quick/controls/gallery/qml/+android/UI.js +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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$ -** -****************************************************************************/ - -.pragma library - -var margin = 0 -var tabPosition = Qt.BottomEdge -var label = "Gallery" diff --git a/examples/quick/controls/gallery/qml/+ios/UI.js b/examples/quick/controls/gallery/qml/+ios/UI.js deleted file mode 100644 index 417b4581e..000000000 --- a/examples/quick/controls/gallery/qml/+ios/UI.js +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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$ -** -****************************************************************************/ - -.pragma library - -var margin = 0 -var tabPosition = Qt.BottomEdge -var label = "Gallery" diff --git a/examples/quick/controls/gallery/qml/+osx/UI.js b/examples/quick/controls/gallery/qml/+osx/UI.js deleted file mode 100644 index ee439953c..000000000 --- a/examples/quick/controls/gallery/qml/+osx/UI.js +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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$ -** -****************************************************************************/ - -.pragma library - -var margin = 12 -var tabPosition = Qt.TopEdge -var label = "" diff --git a/examples/quick/controls/gallery/qml/ButtonPage.qml b/examples/quick/controls/gallery/qml/ButtonPage.qml deleted file mode 100644 index b6db20de4..000000000 --- a/examples/quick/controls/gallery/qml/ButtonPage.qml +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.2 - -ScrollView { - id: page - implicitWidth: 640 - implicitHeight: 200 - - horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff - - Item { - id: content - - width: Math.max(page.viewport.width, grid.implicitWidth + 2 * grid.rowSpacing) - height: Math.max(page.viewport.height, grid.implicitHeight + 2 * grid.columnSpacing) - - GridLayout { - id: grid - - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.leftMargin: grid.rowSpacing - anchors.rightMargin: grid.rowSpacing - anchors.topMargin: grid.columnSpacing - - columns: page.width < page.height ? 1 : 2 - - GroupBox { - title: "Button" - Layout.fillWidth: true - Layout.columnSpan: grid.columns - RowLayout { - anchors.fill: parent - Button { text: "OK"; isDefault: true } - Button { text: "Cancel" } - Item { Layout.fillWidth: true } - Button { - text: "Attach" - menu: Menu { - MenuItem { text: "Image" } - MenuItem { text: "Document" } - } - } - } - } - - GroupBox { - title: "CheckBox" - Layout.fillWidth: true - ColumnLayout { - anchors.fill: parent - CheckBox { text: "E-mail"; checked: true } - CheckBox { text: "Calendar"; checked: true } - CheckBox { text: "Contacts" } - } - } - - GroupBox { - title: "RadioButton" - Layout.fillWidth: true - ColumnLayout { - anchors.fill: parent - ExclusiveGroup { id: radioGroup } - RadioButton { text: "Portrait"; exclusiveGroup: radioGroup } - RadioButton { text: "Landscape"; exclusiveGroup: radioGroup } - RadioButton { text: "Automatic"; exclusiveGroup: radioGroup; checked: true } - } - } - - GroupBox { - title: "Switch" - Layout.fillWidth: true - Layout.columnSpan: grid.columns - ColumnLayout { - anchors.fill: parent - RowLayout { - Label { text: "Wi-Fi"; Layout.fillWidth: true } - Switch { checked: true } - } - RowLayout { - Label { text: "Bluetooth"; Layout.fillWidth: true } - Switch { checked: false } - } - } - } - } - } -} diff --git a/examples/quick/controls/gallery/qml/InputPage.qml b/examples/quick/controls/gallery/qml/InputPage.qml deleted file mode 100644 index 660429671..000000000 --- a/examples/quick/controls/gallery/qml/InputPage.qml +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.2 - -ScrollView { - id: page - implicitWidth: 640 - implicitHeight: 400 - - horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff - - Item { - id: content - - width: Math.max(page.viewport.width, column.implicitWidth + 2 * column.spacing) - height: Math.max(page.viewport.height, column.implicitHeight + 2 * column.spacing) - - ColumnLayout { - id: column - - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: column.spacing - - GroupBox { - title: "TextField" - Layout.fillWidth: true - ColumnLayout { - anchors.fill: parent - TextField { placeholderText: "..."; Layout.fillWidth: true; z: 1 } - TextField { placeholderText: "Password"; echoMode: TextInput.Password; Layout.fillWidth: true } - } - } - - GroupBox { - title: "ComboBox" - Layout.fillWidth: true - ColumnLayout { - anchors.fill: parent - ComboBox { - model: Qt.fontFamilies() - Layout.fillWidth: true - } - ComboBox { - editable: true - model: ListModel { - id: listModel - ListElement { text: "Apple" } - ListElement { text: "Banana" } - ListElement { text: "Coconut" } - ListElement { text: "Orange" } - } - onAccepted: { - if (find(currentText) === -1) { - listModel.append({text: editText}) - currentIndex = find(editText) - } - } - Layout.fillWidth: true - } - } - } - - GroupBox { - title: "SpinBox" - Layout.fillWidth: true - ColumnLayout { - anchors.fill: parent - SpinBox { value: 99; Layout.fillWidth: true; z: 1 } - SpinBox { decimals: 2; Layout.fillWidth: true } - } - } - } - } -} diff --git a/examples/quick/controls/gallery/qml/ProgressPage.qml b/examples/quick/controls/gallery/qml/ProgressPage.qml deleted file mode 100644 index 416e936ae..000000000 --- a/examples/quick/controls/gallery/qml/ProgressPage.qml +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.2 - -ScrollView { - id: page - implicitWidth: 640 - implicitHeight: 400 - - horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff - - Item { - id: content - - width: Math.max(page.viewport.width, column.implicitWidth + 2 * column.spacing) - height: Math.max(page.viewport.height, column.implicitHeight + 2 * column.spacing) - - ColumnLayout { - id: column - - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: column.spacing - - GroupBox { - title: "ProgressBar" - Layout.fillWidth: true - ColumnLayout { - anchors.fill: parent - ProgressBar { indeterminate: true; Layout.fillWidth: true } - ProgressBar { value: slider.value; Layout.fillWidth: true } - } - } - - GroupBox { - title: "Slider" - Layout.fillWidth: true - ColumnLayout { - anchors.fill: parent - Slider { id: slider; value: 0.5; Layout.fillWidth: true } - } - } - - GroupBox { - title: "BusyIndicator" - Layout.fillWidth: true - BusyIndicator { running: true } - } - } - } -} diff --git a/examples/quick/controls/gallery/qml/UI.js b/examples/quick/controls/gallery/qml/UI.js deleted file mode 100644 index 819c34eec..000000000 --- a/examples/quick/controls/gallery/qml/UI.js +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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$ -** -****************************************************************************/ - -.pragma library - -var margin = 2 -var tabPosition = Qt.TopEdge -var label = "" diff --git a/examples/quick/controls/shared/qtquickcontrolsapplication.h b/examples/quick/controls/shared/qtquickcontrolsapplication.h deleted file mode 100644 index 5f22b483f..000000000 --- a/examples/quick/controls/shared/qtquickcontrolsapplication.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 QTQUICKCONTROLSAPPLICATION_H -#define QTQUICKCONTROLSAPPLICATION_H - -#ifdef QT_WIDGETS_LIB -#include -#else -#include -#endif - -QT_BEGIN_NAMESPACE - -#ifdef QT_WIDGETS_LIB -#define QtQuickControlsApplication QApplication -#else -#define QtQuickControlsApplication QGuiApplication -#endif - -QT_END_NAMESPACE - -#endif // QTQUICKCONTROLSAPPLICATION_H diff --git a/examples/quick/controls/shared/shared.pri b/examples/quick/controls/shared/shared.pri deleted file mode 100644 index 1d9e0592f..000000000 --- a/examples/quick/controls/shared/shared.pri +++ /dev/null @@ -1,7 +0,0 @@ -QT += quick -!no_desktop: QT += widgets - -INCLUDEPATH += $$PWD - -SOURCES += \ - $$PWD/qtquickcontrolsapplication.h diff --git a/examples/quick/controls/styles/images/bubble.png b/examples/quick/controls/styles/images/bubble.png deleted file mode 100644 index 62aa1efe5..000000000 Binary files a/examples/quick/controls/styles/images/bubble.png and /dev/null differ diff --git a/examples/quick/controls/styles/images/button-pressed.png b/examples/quick/controls/styles/images/button-pressed.png deleted file mode 100644 index d64cdaa78..000000000 Binary files a/examples/quick/controls/styles/images/button-pressed.png and /dev/null differ diff --git a/examples/quick/controls/styles/images/button.png b/examples/quick/controls/styles/images/button.png deleted file mode 100644 index 8ab41cc80..000000000 Binary files a/examples/quick/controls/styles/images/button.png and /dev/null differ diff --git a/examples/quick/controls/styles/images/progress-background.png b/examples/quick/controls/styles/images/progress-background.png deleted file mode 100644 index 55a069dfc..000000000 Binary files a/examples/quick/controls/styles/images/progress-background.png and /dev/null differ diff --git a/examples/quick/controls/styles/images/progress-fill.png b/examples/quick/controls/styles/images/progress-fill.png deleted file mode 100644 index b588c9586..000000000 Binary files a/examples/quick/controls/styles/images/progress-fill.png and /dev/null differ diff --git a/examples/quick/controls/styles/images/slider-handle.png b/examples/quick/controls/styles/images/slider-handle.png deleted file mode 100644 index ac4d4a0d9..000000000 Binary files a/examples/quick/controls/styles/images/slider-handle.png and /dev/null differ diff --git a/examples/quick/controls/styles/images/tab.png b/examples/quick/controls/styles/images/tab.png deleted file mode 100644 index 74fefab78..000000000 Binary files a/examples/quick/controls/styles/images/tab.png and /dev/null differ diff --git a/examples/quick/controls/styles/images/tab_selected.png b/examples/quick/controls/styles/images/tab_selected.png deleted file mode 100644 index 665400ccf..000000000 Binary files a/examples/quick/controls/styles/images/tab_selected.png and /dev/null differ diff --git a/examples/quick/controls/styles/images/textfield.png b/examples/quick/controls/styles/images/textfield.png deleted file mode 100644 index 1d4a38ab3..000000000 Binary files a/examples/quick/controls/styles/images/textfield.png and /dev/null differ diff --git a/examples/quick/controls/styles/main.cpp b/examples/quick/controls/styles/main.cpp deleted file mode 100644 index 55c592e6e..000000000 --- a/examples/quick/controls/styles/main.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - if (engine.rootObjects().isEmpty()) - return -1; - return app.exec(); -} diff --git a/examples/quick/controls/styles/main.qml b/examples/quick/controls/styles/main.qml deleted file mode 100644 index b2eefb862..000000000 --- a/examples/quick/controls/styles/main.qml +++ /dev/null @@ -1,397 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Window 2.2 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.2 -import QtQuick.Particles 2.0 - -Window { - id: window - width: 640 - height: 480 - visible: true - title: qsTr("Styles Example") - - property int columnFactor: 5 - - GridLayout { - rowSpacing: 12 - columnSpacing: 30 - anchors.top: parent.top - anchors.horizontalCenter: parent.horizontalCenter - anchors.margins: 30 - - Button { - text: "Button" - implicitWidth: window.width / columnFactor - } - Button { - text: "Button" - style: ButtonStyle { - background: BorderImage { - source: control.pressed ? "images/button-pressed.png" : "images/button.png" - border.left: 4 ; border.right: 4 ; border.top: 4 ; border.bottom: 4 - } - } - implicitWidth: window.width / columnFactor - } - Button { - text: "Button" - style: buttonStyle - implicitWidth: window.width / columnFactor - } - - TextField { - Layout.row: 1 - implicitWidth: window.width / columnFactor - } - TextField { - style: TextFieldStyle { - background: BorderImage { - source: "images/textfield.png" - border.left: 4 ; border.right: 4 ; border.top: 4 ; border.bottom: 4 - } - } - implicitWidth: window.width / columnFactor - } - TextField { - style: textFieldStyle - implicitWidth: window.width / columnFactor - } - - Slider { - id: slider1 - Layout.row: 2 - value: 0.5 - implicitWidth: window.width / columnFactor - } - Slider { - id: slider2 - value: 0.5 - implicitWidth: window.width / columnFactor - style: SliderStyle { - groove: BorderImage { - height: 6 - border.top: 1 - border.bottom: 1 - source: "images/progress-background.png" - border.left: 6 - border.right: 6 - BorderImage { - anchors.verticalCenter: parent.verticalCenter - source: "images/progress-fill.png" - border.left: 5 ; border.top: 1 - border.right: 5 ; border.bottom: 1 - width: styleData.handlePosition - height: parent.height - } - } - handle: Item { - width: 13 - height: 13 - Image { - anchors.centerIn: parent - source: "images/slider-handle.png" - } - } - } - } - Slider { - id: slider3 - value: 0.5 - implicitWidth: window.width / columnFactor - style: sliderStyle - } - - ProgressBar { - Layout.row: 3 - value: slider1.value - implicitWidth: window.width / columnFactor - } - ProgressBar { - value: slider2.value - implicitWidth: window.width / columnFactor - style: progressBarStyle - } - ProgressBar { - value: slider3.value - implicitWidth: window.width / columnFactor - style: progressBarStyle2 - } - - CheckBox { - text: "CheckBox" - Layout.row: 4 - implicitWidth: window.width / columnFactor - } - - RadioButton { - text: "RadioButton" - implicitWidth: window.width / columnFactor - } - - ComboBox { - model: ["Paris", "Oslo", "New York"] - implicitWidth: window.width / columnFactor - } - - TabView { - Layout.row: 5 - Layout.columnSpan: 3 - Layout.fillWidth: true - implicitHeight: 30 - Tab { title: "One" ; Item {} } - Tab { title: "Two" ; Item {} } - Tab { title: "Three" ; Item {} } - Tab { title: "Four" ; Item {} } - } - - TabView { - Layout.row: 6 - Layout.columnSpan: 3 - Layout.fillWidth: true - implicitHeight: 30 - Tab { title: "One" ; Item {}} - Tab { title: "Two" ; Item {}} - Tab { title: "Three" ; Item {}} - Tab { title: "Four" ; Item {}} - style: tabViewStyle - } - } - - // Style delegates: - - Component { - id: buttonStyle - ButtonStyle { - - background: Rectangle { - implicitHeight: 22 - implicitWidth: window.width / columnFactor - color: control.pressed ? "darkGray" : control.activeFocus ? "#cdd" : "#ccc" - antialiasing: true - border.color: "gray" - radius: height/2 - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: "transparent" - antialiasing: true - visible: !control.pressed - border.color: "#aaffffff" - radius: height/2 - } - } - } - } - - Component { - id: textFieldStyle - TextFieldStyle { - background: Rectangle { - implicitWidth: window.width / columnFactor - color: "#f0f0f0" - antialiasing: true - border.color: "gray" - radius: height/2 - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: "transparent" - antialiasing: true - border.color: "#aaffffff" - radius: height/2 - } - } - } - } - - Component { - id: sliderStyle - SliderStyle { - handle: Rectangle { - width: 18 - height: 18 - color: control.pressed ? "darkGray" : "lightGray" - border.color: "gray" - antialiasing: true - radius: height/2 - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: "transparent" - antialiasing: true - border.color: "#eee" - radius: height/2 - } - } - - groove: Rectangle { - height: 8 - implicitWidth: window.width / columnFactor - implicitHeight: 22 - - antialiasing: true - color: "#ccc" - border.color: "#777" - radius: height/2 - Rectangle { - anchors.fill: parent - anchors.margins: 1 - color: "transparent" - antialiasing: true - border.color: "#66ffffff" - radius: height/2 - } - } - } - } - - Component { - id: progressBarStyle - ProgressBarStyle { - background: BorderImage { - source: "images/progress-background.png" - border.left: 2 ; border.right: 2 ; border.top: 2 ; border.bottom: 2 - } - progress: Item { - clip: true - BorderImage { - anchors.fill: parent - anchors.rightMargin: (control.value < control.maximumValue) ? -4 : 0 - source: "images/progress-fill.png" - border.left: 10 ; border.right: 10 - Rectangle { - width: 1 - color: "#a70" - opacity: 0.8 - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.bottomMargin: 1 - anchors.right: parent.right - visible: control.value < control.maximumValue - anchors.rightMargin: -parent.anchors.rightMargin - } - } - ParticleSystem { id: bubbles; running: visible } - ImageParticle { - id: fireball - system: bubbles - source: "images/bubble.png" - opacity: 0.7 - } - Emitter { - system: bubbles - anchors.bottom: parent.bottom - anchors.margins: 4 - anchors.bottomMargin: -4 - anchors.left: parent.left - anchors.right: parent.right - size: 4 - sizeVariation: 4 - acceleration: PointDirection { y: -6; xVariation: 3 } - emitRate: 6 * control.value - lifeSpan: 3000 - } - } - } - } - - Component { - id: progressBarStyle2 - ProgressBarStyle { - background: Rectangle { - implicitWidth: window.width / columnFactor - implicitHeight: 24 - color: "#f0f0f0" - border.color: "gray" - } - progress: Rectangle { - color: "#ccc" - border.color: "gray" - Rectangle { - color: "transparent" - border.color: "#44ffffff" - anchors.fill: parent - anchors.margins: 1 - } - } - } - } - - Component { - id: tabViewStyle - TabViewStyle { - tabOverlap: 16 - frameOverlap: 4 - tabsMovable: true - - frame: Rectangle { - gradient: Gradient { - GradientStop { color: "#e5e5e5" ; position: 0 } - GradientStop { color: "#e0e0e0" ; position: 1 } - } - border.color: "#898989" - Rectangle { anchors.fill: parent ; anchors.margins: 1 ; border.color: "white" ; color: "transparent" } - } - tab: Item { - property int totalOverlap: tabOverlap * (control.count - 1) - implicitWidth: Math.min ((styleData.availableWidth + totalOverlap)/control.count - 4, image.sourceSize.width) - implicitHeight: image.sourceSize.height - BorderImage { - id: image - anchors.fill: parent - source: styleData.selected ? "images/tab_selected.png" : "images/tab.png" - border.left: 30 - smooth: false - border.right: 30 - } - Text { - text: styleData.title - anchors.centerIn: parent - } - } - leftCorner: Item { implicitWidth: 12 } - } - } -} diff --git a/examples/quick/controls/styles/styles.pro b/examples/quick/controls/styles/styles.pro deleted file mode 100644 index 03648f4cc..000000000 --- a/examples/quick/controls/styles/styles.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE = app -TARGET = styles -QT += qml quick - -SOURCES += \ - main.cpp -RESOURCES += \ - styles.qrc -OTHER_FILES += \ - main.qml diff --git a/examples/quick/controls/styles/styles.qrc b/examples/quick/controls/styles/styles.qrc deleted file mode 100644 index d2300c6fa..000000000 --- a/examples/quick/controls/styles/styles.qrc +++ /dev/null @@ -1,14 +0,0 @@ - - - main.qml - images/bubble.png - images/button.png - images/button-pressed.png - images/progress-background.png - images/progress-fill.png - images/slider-handle.png - images/tab.png - images/tab_selected.png - images/textfield.png - - diff --git a/examples/quick/controls/tableview/main.qml b/examples/quick/controls/tableview/main.qml deleted file mode 100644 index 1d99f4b93..000000000 --- a/examples/quick/controls/tableview/main.qml +++ /dev/null @@ -1,188 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.2 -import org.qtproject.example 1.0 - -ApplicationWindow { - id: window - visible: true - title: "Table View Example" - - toolBar: ToolBar { - TextField { - id: searchBox - - placeholderText: "Search..." - inputMethodHints: Qt.ImhNoPredictiveText - - width: window.width / 5 * 2 - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - } - } - - TableView { - id: tableView - - frameVisible: false - sortIndicatorVisible: true - - anchors.fill: parent - - Layout.minimumWidth: 400 - Layout.minimumHeight: 240 - Layout.preferredWidth: 600 - Layout.preferredHeight: 400 - - TableViewColumn { - id: titleColumn - title: "Title" - role: "title" - movable: false - resizable: false - width: tableView.viewport.width - authorColumn.width - } - - TableViewColumn { - id: authorColumn - title: "Author" - role: "author" - movable: false - resizable: false - width: tableView.viewport.width / 3 - } - - model: SortFilterProxyModel { - id: proxyModel - source: sourceModel.count > 0 ? sourceModel : null - - sortOrder: tableView.sortIndicatorOrder - sortCaseSensitivity: Qt.CaseInsensitive - sortRole: sourceModel.count > 0 ? tableView.getColumn(tableView.sortIndicatorColumn).role : "" - - filterString: "*" + searchBox.text + "*" - filterSyntax: SortFilterProxyModel.Wildcard - filterCaseSensitivity: Qt.CaseInsensitive - } - - ListModel { - id: sourceModel - ListElement { - title: "Moby-Dick" - author: "Herman Melville" - } - ListElement { - title: "The Adventures of Tom Sawyer" - author: "Mark Twain" - } - ListElement { - title: "Cat’s Cradle" - author: "Kurt Vonnegut" - } - ListElement { - title: "Farenheit 451" - author: "Ray Bradbury" - } - ListElement { - title: "It" - author: "Stephen King" - } - ListElement { - title: "On the Road" - author: "Jack Kerouac" - } - ListElement { - title: "Of Mice and Men" - author: "John Steinbeck" - } - ListElement { - title: "Do Androids Dream of Electric Sheep?" - author: "Philip K. Dick" - } - ListElement { - title: "Uncle Tom’s Cabin" - author: "Harriet Beecher Stowe" - } - ListElement { - title: "The Call of the Wild" - author: "Jack London" - } - ListElement { - title: "The Old Man and the Sea" - author: "Ernest Hemingway" - } - ListElement { - title: "A Streetcar Named Desire" - author: "Tennessee Williams" - } - ListElement { - title: "Catch-22" - author: "Joseph Heller" - } - ListElement { - title: "One Flew Over the Cuckoo’s Nest" - author: "Ken Kesey" - } - ListElement { - title: "The Murders in the Rue Morgue" - author: "Edgar Allan Poe" - } - ListElement { - title: "Breakfast at Tiffany’s" - author: "Truman Capote" - } - ListElement { - title: "Death of a Salesman" - author: "Arthur Miller" - } - ListElement { - title: "Post Office" - author: "Charles Bukowski" - } - ListElement { - title: "Herbert West—Reanimator" - author: "H. P. Lovecraft" - } - } - } -} diff --git a/examples/quick/controls/tableview/src/main.cpp b/examples/quick/controls/tableview/src/main.cpp deleted file mode 100644 index dbba7f38c..000000000 --- a/examples/quick/controls/tableview/src/main.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 "qtquickcontrolsapplication.h" -#include "sortfilterproxymodel.h" -#include -#include -#include - -int main(int argc, char *argv[]) -{ - QtQuickControlsApplication app(argc, argv); - if (QCoreApplication::arguments().contains(QLatin1String("--coreprofile"))) { - QSurfaceFormat fmt; - fmt.setVersion(4, 4); - fmt.setProfile(QSurfaceFormat::CoreProfile); - QSurfaceFormat::setDefaultFormat(fmt); - } - qmlRegisterType("org.qtproject.example", 1, 0, "SortFilterProxyModel"); - QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); - return app.exec(); -} diff --git a/examples/quick/controls/tableview/src/sortfilterproxymodel.cpp b/examples/quick/controls/tableview/src/sortfilterproxymodel.cpp deleted file mode 100644 index f362d5d3d..000000000 --- a/examples/quick/controls/tableview/src/sortfilterproxymodel.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 "sortfilterproxymodel.h" -#include -#include - -SortFilterProxyModel::SortFilterProxyModel(QObject *parent) : QSortFilterProxyModel(parent), m_complete(false) -{ - connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SIGNAL(countChanged())); - connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(countChanged())); -} - -int SortFilterProxyModel::count() const -{ - return rowCount(); -} - -QObject *SortFilterProxyModel::source() const -{ - return sourceModel(); -} - -void SortFilterProxyModel::setSource(QObject *source) -{ - setSourceModel(qobject_cast(source)); -} - -QByteArray SortFilterProxyModel::sortRole() const -{ - return m_sortRole; -} - -void SortFilterProxyModel::setSortRole(const QByteArray &role) -{ - if (m_sortRole != role) { - m_sortRole = role; - if (m_complete) - QSortFilterProxyModel::setSortRole(roleKey(role)); - } -} - -void SortFilterProxyModel::setSortOrder(Qt::SortOrder order) -{ - QSortFilterProxyModel::sort(0, order); -} - -QByteArray SortFilterProxyModel::filterRole() const -{ - return m_filterRole; -} - -void SortFilterProxyModel::setFilterRole(const QByteArray &role) -{ - if (m_filterRole != role) { - m_filterRole = role; - if (m_complete) - QSortFilterProxyModel::setFilterRole(roleKey(role)); - } -} - -QString SortFilterProxyModel::filterString() const -{ - return filterRegExp().pattern(); -} - -void SortFilterProxyModel::setFilterString(const QString &filter) -{ - setFilterRegExp(QRegExp(filter, filterCaseSensitivity(), static_cast(filterSyntax()))); -} - -SortFilterProxyModel::FilterSyntax SortFilterProxyModel::filterSyntax() const -{ - return static_cast(filterRegExp().patternSyntax()); -} - -void SortFilterProxyModel::setFilterSyntax(SortFilterProxyModel::FilterSyntax syntax) -{ - setFilterRegExp(QRegExp(filterString(), filterCaseSensitivity(), static_cast(syntax))); -} - -QJSValue SortFilterProxyModel::get(int idx) const -{ - QJSEngine *engine = qmlEngine(this); - QJSValue value = engine->newObject(); - if (idx >= 0 && idx < count()) { - QHash roles = roleNames(); - QHashIterator it(roles); - while (it.hasNext()) { - it.next(); - value.setProperty(QString::fromUtf8(it.value()), data(index(idx, 0), it.key()).toString()); - } - } - return value; -} - -void SortFilterProxyModel::classBegin() -{ -} - -void SortFilterProxyModel::componentComplete() -{ - m_complete = true; - if (!m_sortRole.isEmpty()) - QSortFilterProxyModel::setSortRole(roleKey(m_sortRole)); - if (!m_filterRole.isEmpty()) - QSortFilterProxyModel::setFilterRole(roleKey(m_filterRole)); -} - -int SortFilterProxyModel::roleKey(const QByteArray &role) const -{ - QHash roles = roleNames(); - QHashIterator it(roles); - while (it.hasNext()) { - it.next(); - if (it.value() == role) - return it.key(); - } - return -1; -} - -QHash SortFilterProxyModel::roleNames() const -{ - if (QAbstractItemModel *source = sourceModel()) - return source->roleNames(); - return QHash(); -} - -bool SortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const -{ - QRegExp rx = filterRegExp(); - if (rx.isEmpty()) - return true; - QAbstractItemModel *model = sourceModel(); - if (filterRole().isEmpty()) { - QHash roles = roleNames(); - QHashIterator it(roles); - while (it.hasNext()) { - it.next(); - QModelIndex sourceIndex = model->index(sourceRow, 0, sourceParent); - QString key = model->data(sourceIndex, it.key()).toString(); - if (key.contains(rx)) - return true; - } - return false; - } - QModelIndex sourceIndex = model->index(sourceRow, 0, sourceParent); - if (!sourceIndex.isValid()) - return true; - QString key = model->data(sourceIndex, roleKey(filterRole())).toString(); - return key.contains(rx); -} diff --git a/examples/quick/controls/tableview/src/sortfilterproxymodel.h b/examples/quick/controls/tableview/src/sortfilterproxymodel.h deleted file mode 100644 index c4460b0f1..000000000 --- a/examples/quick/controls/tableview/src/sortfilterproxymodel.h +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 SORTFILTERPROXYMODEL_H -#define SORTFILTERPROXYMODEL_H - -#include -#include -#include - -class SortFilterProxyModel : public QSortFilterProxyModel, public QQmlParserStatus -{ - Q_OBJECT - Q_INTERFACES(QQmlParserStatus) - - Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(QObject *source READ source WRITE setSource) - - Q_PROPERTY(QByteArray sortRole READ sortRole WRITE setSortRole) - Q_PROPERTY(Qt::SortOrder sortOrder READ sortOrder WRITE setSortOrder) - - Q_PROPERTY(QByteArray filterRole READ filterRole WRITE setFilterRole) - Q_PROPERTY(QString filterString READ filterString WRITE setFilterString) - Q_PROPERTY(FilterSyntax filterSyntax READ filterSyntax WRITE setFilterSyntax) - - Q_ENUMS(FilterSyntax) - -public: - explicit SortFilterProxyModel(QObject *parent = 0); - - QObject *source() const; - void setSource(QObject *source); - - QByteArray sortRole() const; - void setSortRole(const QByteArray &role); - - void setSortOrder(Qt::SortOrder order); - - QByteArray filterRole() const; - void setFilterRole(const QByteArray &role); - - QString filterString() const; - void setFilterString(const QString &filter); - - enum FilterSyntax { - RegExp, - Wildcard, - FixedString - }; - - FilterSyntax filterSyntax() const; - void setFilterSyntax(FilterSyntax syntax); - - int count() const; - Q_INVOKABLE QJSValue get(int index) const; - - void classBegin(); - void componentComplete(); - -signals: - void countChanged(); - -protected: - int roleKey(const QByteArray &role) const; - QHash roleNames() const; - bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; - -private: - bool m_complete; - QByteArray m_sortRole; - QByteArray m_filterRole; -}; - -#endif // SORTFILTERPROXYMODEL_H diff --git a/examples/quick/controls/tableview/src/src.pri b/examples/quick/controls/tableview/src/src.pri deleted file mode 100644 index 491f851c9..000000000 --- a/examples/quick/controls/tableview/src/src.pri +++ /dev/null @@ -1,8 +0,0 @@ -INCLUDEPATH += $$PWD - -HEADERS += \ - $$PWD/sortfilterproxymodel.h - -SOURCES += \ - $$PWD/main.cpp \ - $$PWD/sortfilterproxymodel.cpp diff --git a/examples/quick/controls/tableview/tableview.pro b/examples/quick/controls/tableview/tableview.pro deleted file mode 100644 index c0ed1a2f9..000000000 --- a/examples/quick/controls/tableview/tableview.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app -TARGET = tableview - -RESOURCES += \ - tableview.qrc - -OTHER_FILES += \ - main.qml - -include(src/src.pri) -include(../shared/shared.pri) diff --git a/examples/quick/controls/tableview/tableview.qrc b/examples/quick/controls/tableview/tableview.qrc deleted file mode 100644 index 3b111a907..000000000 --- a/examples/quick/controls/tableview/tableview.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - main.qml - - diff --git a/examples/quick/controls/texteditor/example.html b/examples/quick/controls/texteditor/example.html deleted file mode 100644 index 52bb507a1..000000000 --- a/examples/quick/controls/texteditor/example.html +++ /dev/null @@ -1,79 +0,0 @@ -TextArea Example -

TextArea

-

The TextArea control is an advanced editor that supports formatted rich text. It can be used to display HTML and other rich document formats. Internally, TextArea uses the QQuickTextDocument class to describe both the high-level structure of each document and the low-level formatting of paragraphs.

-

If you are viewing this document in the Text Editor example, you can edit this document to explore Qt's rich text editing features. We have included some comments in each of the following sections to encourage you to experiment.

-

Font and Paragraph Styles

-

TextArea supports bold, italic, and underlined font styles, and can display multicolored - text. Font families such as Helvetica and - Courier can also be used directly. If you place the cursor in a region of styled text, the corresponding controls in the tool bar will change to reflect the current style, font size and color.

-

Paragraphs can be formatted so that the text is left-aligned, right-aligned, centered, or fully justified.

-

Try changing the alignment of some text and resize the editor to see how the text layout changes.

-

Lists

-

Different kinds of lists can be included in rich text documents. Standard bullet lists can be nested, using different symbols for each level of the list:

-
  • Disc symbols are typically used for top-level list items.
-
  • Circle symbols can be used to distinguish between items in lower-level lists.
-
  • Square symbols provide a reasonable alternative to discs and circles.
-

Ordered lists can be used for tables of contents. Different characters can be used to enumerate items, and one can use both Roman and Arabic numerals in the same list structure:

-
  1. Introduction
  2. -
  3. Qt Tools
-
  1. Qt Assistant
  2. -
  3. Qt Designer
  4. -
    1. Form Editor
    2. -
    3. Component Architecture
    -
  5. Qt Linguist
-

-

The list will automatically be renumbered if you add or remove items. Try adding new sections to the above list or removing existing item to see the numbers change.

-

-

Images

-

Inline images are treated like ordinary ranges of characters in the text editor, so they flow with the surrounding text. Images can also be selected in the same way as text, making it easy to cut, copy, and paste them.

-

Try to select this image by clicking and dragging over it with the mouse, or use the text cursor to select it by holding down Shift and using the arrow keys. You can then cut or copy it, and paste it into different parts of this document.

-

Tables

-

TextArea can arrange and format tables, supporting features such as row and column spans, text formatting within cells, and size constraints for columns.

-

-

- - - - - - - - - - - - - - - - - - - - - - -
-

-

Development Tools

-

Programming Techniques

-

Graphical User Interfaces

-

9:00 - 11:00

-

Introduction to Qt

-

11:00 - 13:00

-

Using qmake

-

Object-oriented Programming

-

Layouts in Qt

-

13:00 - 15:00

-

Qt Designer Tutorial

-

Extreme Programming

-

Writing Custom Styles

-

15:00 - 17:00

-

Qt Linguist and Internationalization

-

-

Try adding text to the cells in the table and experiment with the alignment of the paragraphs.

-

Undo and Redo

-

Full support for undo and redo operations is built into TextArea and the underlying rich text framework. Operations on a document can be packaged together to make editing easier for the user.

-

Try making changes to this document and press Ctrl+Z to undo them. You can always recover the original contents of the document.

diff --git a/examples/quick/controls/texteditor/qml/ToolBarSeparator.qml b/examples/quick/controls/texteditor/qml/ToolBarSeparator.qml deleted file mode 100644 index a225e2eaa..000000000 --- a/examples/quick/controls/texteditor/qml/ToolBarSeparator.qml +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 - -Item { - width: 8 - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.margins: 6 - Rectangle { - width: 1 - height: parent.height - anchors.horizontalCenter: parent.horizontalCenter - color: "#22000000" - } - Rectangle { - width: 1 - height: parent.height - anchors.horizontalCenterOffset: 1 - anchors.horizontalCenter: parent.horizontalCenter - color: "#33ffffff" - } -} diff --git a/examples/quick/controls/texteditor/qml/images/editcopy.png b/examples/quick/controls/texteditor/qml/images/editcopy.png deleted file mode 100644 index f55136446..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/editcopy.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/editcut.png b/examples/quick/controls/texteditor/qml/images/editcut.png deleted file mode 100644 index a784fd570..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/editcut.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/editpaste.png b/examples/quick/controls/texteditor/qml/images/editpaste.png deleted file mode 100644 index 64c0b2d6a..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/editpaste.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/editredo.png b/examples/quick/controls/texteditor/qml/images/editredo.png deleted file mode 100644 index 8875bf246..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/editredo.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/editundo.png b/examples/quick/controls/texteditor/qml/images/editundo.png deleted file mode 100644 index a3bd5e0bf..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/editundo.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/exportpdf.png b/examples/quick/controls/texteditor/qml/images/exportpdf.png deleted file mode 100644 index ebb44e6b8..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/exportpdf.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/filenew.png b/examples/quick/controls/texteditor/qml/images/filenew.png deleted file mode 100644 index d3882c7b3..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/filenew.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/fileopen.png b/examples/quick/controls/texteditor/qml/images/fileopen.png deleted file mode 100644 index fc06c5ec6..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/fileopen.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/fileprint.png b/examples/quick/controls/texteditor/qml/images/fileprint.png deleted file mode 100644 index 10ca56c82..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/fileprint.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/filesave.png b/examples/quick/controls/texteditor/qml/images/filesave.png deleted file mode 100644 index b41ecf531..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/filesave.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/qt-logo.png b/examples/quick/controls/texteditor/qml/images/qt-logo.png deleted file mode 100644 index be1bb1060..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/qt-logo.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/textbold.png b/examples/quick/controls/texteditor/qml/images/textbold.png deleted file mode 100644 index 38400bd1f..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/textbold.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/textcenter.png b/examples/quick/controls/texteditor/qml/images/textcenter.png deleted file mode 100644 index 2ef5b2ee6..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/textcenter.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/textitalic.png b/examples/quick/controls/texteditor/qml/images/textitalic.png deleted file mode 100644 index 0170ee26a..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/textitalic.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/textjustify.png b/examples/quick/controls/texteditor/qml/images/textjustify.png deleted file mode 100644 index 39cd6c1a9..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/textjustify.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/textleft.png b/examples/quick/controls/texteditor/qml/images/textleft.png deleted file mode 100644 index 83a66d553..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/textleft.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/textright.png b/examples/quick/controls/texteditor/qml/images/textright.png deleted file mode 100644 index e7c04645c..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/textright.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/textunder.png b/examples/quick/controls/texteditor/qml/images/textunder.png deleted file mode 100644 index 968bac5e9..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/textunder.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/zoomin.png b/examples/quick/controls/texteditor/qml/images/zoomin.png deleted file mode 100644 index d46f5aff0..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/zoomin.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/images/zoomout.png b/examples/quick/controls/texteditor/qml/images/zoomout.png deleted file mode 100644 index 46326566d..000000000 Binary files a/examples/quick/controls/texteditor/qml/images/zoomout.png and /dev/null differ diff --git a/examples/quick/controls/texteditor/qml/main.qml b/examples/quick/controls/texteditor/qml/main.qml deleted file mode 100644 index 42f5e7f94..000000000 --- a/examples/quick/controls/texteditor/qml/main.qml +++ /dev/null @@ -1,357 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.2 -import QtQuick.Layouts 1.0 -import QtQuick.Dialogs 1.1 -import QtQuick.Window 2.1 -import org.qtproject.example 1.0 - -ApplicationWindow { - visible: true - width: 640 - height: 480 - minimumWidth: 400 - minimumHeight: 300 - - title: document.documentTitle + " - Text Editor Example" - - MessageDialog { - id: aboutBox - title: "About Text" - text: "This is a basic text editor \nwritten with Qt Quick Controls" - icon: StandardIcon.Information - } - - Action { - id: cutAction - text: "Cut" - shortcut: "ctrl+x" - iconSource: "images/editcut.png" - iconName: "edit-cut" - onTriggered: textArea.cut() - } - - Action { - id: copyAction - text: "Copy" - shortcut: "Ctrl+C" - iconSource: "images/editcopy.png" - iconName: "edit-copy" - onTriggered: textArea.copy() - } - - Action { - id: pasteAction - text: "Paste" - shortcut: "ctrl+v" - iconSource: "qrc:images/editpaste.png" - iconName: "edit-paste" - onTriggered: textArea.paste() - } - - Action { - id: alignLeftAction - text: "&Left" - iconSource: "images/textleft.png" - iconName: "format-justify-left" - shortcut: "ctrl+l" - onTriggered: document.alignment = Qt.AlignLeft - checkable: true - checked: document.alignment == Qt.AlignLeft - } - Action { - id: alignCenterAction - text: "C&enter" - iconSource: "images/textcenter.png" - iconName: "format-justify-center" - onTriggered: document.alignment = Qt.AlignHCenter - checkable: true - checked: document.alignment == Qt.AlignHCenter - } - Action { - id: alignRightAction - text: "&Right" - iconSource: "images/textright.png" - iconName: "format-justify-right" - onTriggered: document.alignment = Qt.AlignRight - checkable: true - checked: document.alignment == Qt.AlignRight - } - Action { - id: alignJustifyAction - text: "&Justify" - iconSource: "images/textjustify.png" - iconName: "format-justify-fill" - onTriggered: document.alignment = Qt.AlignJustify - checkable: true - checked: document.alignment == Qt.AlignJustify - } - - Action { - id: boldAction - text: "&Bold" - iconSource: "images/textbold.png" - iconName: "format-text-bold" - onTriggered: document.bold = !document.bold - checkable: true - checked: document.bold - } - - Action { - id: italicAction - text: "&Italic" - iconSource: "images/textitalic.png" - iconName: "format-text-italic" - onTriggered: document.italic = !document.italic - checkable: true - checked: document.italic - } - Action { - id: underlineAction - text: "&Underline" - iconSource: "images/textunder.png" - iconName: "format-text-underline" - onTriggered: document.underline = !document.underline - checkable: true - checked: document.underline - } - - FileDialog { - id: fileDialog - nameFilters: ["Text files (*.txt)", "HTML files (*.html, *.htm)"] - onAccepted: { - if (fileDialog.selectExisting) - document.fileUrl = fileUrl - else - document.saveAs(fileUrl, selectedNameFilter) - } - } - - ColorDialog { - id: colorDialog - color: "black" - } - - Action { - id: fileOpenAction - iconSource: "images/fileopen.png" - iconName: "document-open" - text: "Open" - onTriggered: { - fileDialog.selectExisting = true - fileDialog.open() - } - } - - Action { - id: fileSaveAsAction - iconSource: "images/filesave.png" - iconName: "document-save" - text: "Save As…" - onTriggered: { - fileDialog.selectExisting = false - fileDialog.open() - } - } - - menuBar: MenuBar { - Menu { - title: "&File" - MenuItem { action: fileOpenAction } - MenuItem { action: fileSaveAsAction } - MenuItem { text: "Quit"; onTriggered: Qt.quit() } - } - Menu { - title: "&Edit" - MenuItem { action: copyAction } - MenuItem { action: cutAction } - MenuItem { action: pasteAction } - } - Menu { - title: "F&ormat" - MenuItem { action: boldAction } - MenuItem { action: italicAction } - MenuItem { action: underlineAction } - MenuSeparator {} - MenuItem { action: alignLeftAction } - MenuItem { action: alignCenterAction } - MenuItem { action: alignRightAction } - MenuItem { action: alignJustifyAction } - MenuSeparator {} - MenuItem { - text: "&Color ..." - onTriggered: { - colorDialog.color = document.textColor - colorDialog.open() - } - } - } - Menu { - title: "&Help" - MenuItem { text: "About..." ; onTriggered: aboutBox.open() } - } - } - - toolBar: ToolBar { - id: mainToolBar - width: parent.width - RowLayout { - anchors.fill: parent - spacing: 0 - ToolButton { action: fileOpenAction } - - ToolBarSeparator {} - - ToolButton { action: copyAction } - ToolButton { action: cutAction } - ToolButton { action: pasteAction } - - ToolBarSeparator {} - - ToolButton { action: boldAction } - ToolButton { action: italicAction } - ToolButton { action: underlineAction } - - ToolBarSeparator {} - - ToolButton { action: alignLeftAction } - ToolButton { action: alignCenterAction } - ToolButton { action: alignRightAction } - ToolButton { action: alignJustifyAction } - - ToolBarSeparator {} - - ToolButton { - id: colorButton - property var color : document.textColor - Rectangle { - id: colorRect - anchors.fill: parent - anchors.margins: 8 - color: Qt.darker(document.textColor, colorButton.pressed ? 1.4 : 1) - border.width: 1 - border.color: Qt.darker(colorRect.color, 2) - } - onClicked: { - colorDialog.color = document.textColor - colorDialog.open() - } - } - Item { Layout.fillWidth: true } - } - } - - ToolBar { - id: secondaryToolBar - width: parent.width - - RowLayout { - anchors.fill: parent - ComboBox { - id: fontFamilyComboBox - implicitWidth: 150 - model: Qt.fontFamilies() - property bool special : false - onActivated: { - if (special == false || index != 0) { - document.fontFamily = textAt(index) - } - } - } - SpinBox { - id: fontSizeSpinBox - activeFocusOnPress: false - implicitWidth: 50 - value: 0 - property bool valueGuard: true - onValueChanged: if (valueGuard) document.fontSize = value - } - Item { Layout.fillWidth: true } - } - } - - TextArea { - Accessible.name: "document" - id: textArea - frameVisible: false - width: parent.width - anchors.top: secondaryToolBar.bottom - anchors.bottom: parent.bottom - baseUrl: "qrc:/" - text: document.text - textFormat: Qt.RichText - Component.onCompleted: forceActiveFocus() - } - - MessageDialog { - id: errorDialog - } - - DocumentHandler { - id: document - target: textArea - cursorPosition: textArea.cursorPosition - selectionStart: textArea.selectionStart - selectionEnd: textArea.selectionEnd - textColor: colorDialog.color - Component.onCompleted: document.fileUrl = "qrc:/example.html" - onFontSizeChanged: { - fontSizeSpinBox.valueGuard = false - fontSizeSpinBox.value = document.fontSize - fontSizeSpinBox.valueGuard = true - } - onFontFamilyChanged: { - var index = Qt.fontFamilies().indexOf(document.fontFamily) - if (index == -1) { - fontFamilyComboBox.currentIndex = 0 - fontFamilyComboBox.special = true - } else { - fontFamilyComboBox.currentIndex = index - fontFamilyComboBox.special = false - } - } - onError: { - errorDialog.text = message - errorDialog.visible = true - } - } -} diff --git a/examples/quick/controls/texteditor/resources.qrc b/examples/quick/controls/texteditor/resources.qrc deleted file mode 100644 index 27c7b9215..000000000 --- a/examples/quick/controls/texteditor/resources.qrc +++ /dev/null @@ -1,27 +0,0 @@ - - - qml/main.qml - qml/ToolBarSeparator.qml - qml/images/editcopy.png - qml/images/editcut.png - qml/images/editpaste.png - qml/images/editredo.png - qml/images/editundo.png - qml/images/exportpdf.png - qml/images/filenew.png - qml/images/fileopen.png - qml/images/fileprint.png - qml/images/filesave.png - qml/images/textbold.png - qml/images/textcenter.png - qml/images/textitalic.png - qml/images/textjustify.png - qml/images/textleft.png - qml/images/textright.png - qml/images/textunder.png - qml/images/zoomin.png - qml/images/zoomout.png - example.html - qml/images/qt-logo.png - - diff --git a/examples/quick/controls/texteditor/src/documenthandler.cpp b/examples/quick/controls/texteditor/src/documenthandler.cpp deleted file mode 100644 index 2e03f7471..000000000 --- a/examples/quick/controls/texteditor/src/documenthandler.cpp +++ /dev/null @@ -1,335 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 "documenthandler.h" - -#include -#include -#include -#include - -DocumentHandler::DocumentHandler() - : m_target(0) - , m_doc(0) - , m_cursorPosition(-1) - , m_selectionStart(0) - , m_selectionEnd(0) -{ -} - -void DocumentHandler::setTarget(QQuickItem *target) -{ - m_doc = 0; - m_target = target; - if (!m_target) - return; - - QVariant doc = m_target->property("textDocument"); - if (doc.canConvert()) { - QQuickTextDocument *qqdoc = doc.value(); - if (qqdoc) - m_doc = qqdoc->textDocument(); - } - emit targetChanged(); -} - -void DocumentHandler::setFileUrl(const QUrl &arg) -{ - if (m_fileUrl != arg) { - m_fileUrl = arg; - QString fileName = QQmlFile::urlToLocalFileOrQrc(arg); - if (QFile::exists(fileName)) { - QFile file(fileName); - if (file.open(QFile::ReadOnly)) { - QByteArray data = file.readAll(); - QTextCodec *codec = QTextCodec::codecForHtml(data); - setText(codec->toUnicode(data)); - if (m_doc) - m_doc->setModified(false); - if (fileName.isEmpty()) - m_documentTitle = QStringLiteral("untitled.txt"); - else - m_documentTitle = QFileInfo(fileName).fileName(); - - emit textChanged(); - emit documentTitleChanged(); - - reset(); - } - } - emit fileUrlChanged(); - } -} - -QString DocumentHandler::documentTitle() const -{ - return m_documentTitle; -} - -void DocumentHandler::setDocumentTitle(QString arg) -{ - if (m_documentTitle != arg) { - m_documentTitle = arg; - emit documentTitleChanged(); - } -} - -void DocumentHandler::setText(const QString &arg) -{ - if (m_text != arg) { - m_text = arg; - emit textChanged(); - } -} - -void DocumentHandler::saveAs(const QUrl &arg, const QString &fileType) -{ - bool isHtml = fileType.contains(QLatin1String("htm")); - QLatin1String ext(isHtml ? ".html" : ".txt"); - QString localPath = arg.toLocalFile(); - if (!localPath.endsWith(ext)) - localPath += ext; - QFile f(localPath); - if (!f.open(QFile::WriteOnly | QFile::Truncate | (isHtml ? QFile::NotOpen : QFile::Text))) { - emit error(tr("Cannot save: ") + f.errorString()); - return; - } - f.write((isHtml ? m_doc->toHtml() : m_doc->toPlainText()).toLocal8Bit()); - f.close(); - setFileUrl(QUrl::fromLocalFile(localPath)); -} - -QUrl DocumentHandler::fileUrl() const -{ - return m_fileUrl; -} - -QString DocumentHandler::text() const -{ - return m_text; -} - -void DocumentHandler::setCursorPosition(int position) -{ - if (position == m_cursorPosition) - return; - - m_cursorPosition = position; - - reset(); -} - -void DocumentHandler::reset() -{ - emit fontFamilyChanged(); - emit alignmentChanged(); - emit boldChanged(); - emit italicChanged(); - emit underlineChanged(); - emit fontSizeChanged(); - emit textColorChanged(); -} - -QTextCursor DocumentHandler::textCursor() const -{ - QTextCursor cursor = QTextCursor(m_doc); - if (m_selectionStart != m_selectionEnd) { - cursor.setPosition(m_selectionStart); - cursor.setPosition(m_selectionEnd, QTextCursor::KeepAnchor); - } else { - cursor.setPosition(m_cursorPosition); - } - return cursor; -} - -void DocumentHandler::mergeFormatOnWordOrSelection(const QTextCharFormat &format) -{ - QTextCursor cursor = textCursor(); - if (!cursor.hasSelection()) - cursor.select(QTextCursor::WordUnderCursor); - cursor.mergeCharFormat(format); -} - -void DocumentHandler::setSelectionStart(int position) -{ - m_selectionStart = position; -} - -void DocumentHandler::setSelectionEnd(int position) -{ - m_selectionEnd = position; -} - -void DocumentHandler::setAlignment(Qt::Alignment a) -{ - QTextBlockFormat fmt; - fmt.setAlignment((Qt::Alignment) a); - QTextCursor cursor = QTextCursor(m_doc); - cursor.setPosition(m_selectionStart, QTextCursor::MoveAnchor); - cursor.setPosition(m_selectionEnd, QTextCursor::KeepAnchor); - cursor.mergeBlockFormat(fmt); - emit alignmentChanged(); -} - -Qt::Alignment DocumentHandler::alignment() const -{ - QTextCursor cursor = textCursor(); - if (cursor.isNull()) - return Qt::AlignLeft; - return textCursor().blockFormat().alignment(); -} - -bool DocumentHandler::bold() const -{ - QTextCursor cursor = textCursor(); - if (cursor.isNull()) - return false; - return textCursor().charFormat().fontWeight() == QFont::Bold; -} - -bool DocumentHandler::italic() const -{ - QTextCursor cursor = textCursor(); - if (cursor.isNull()) - return false; - return textCursor().charFormat().fontItalic(); -} - -bool DocumentHandler::underline() const -{ - QTextCursor cursor = textCursor(); - if (cursor.isNull()) - return false; - return textCursor().charFormat().fontUnderline(); -} - -void DocumentHandler::setBold(bool arg) -{ - QTextCharFormat fmt; - fmt.setFontWeight(arg ? QFont::Bold : QFont::Normal); - mergeFormatOnWordOrSelection(fmt); - emit boldChanged(); -} - -void DocumentHandler::setItalic(bool arg) -{ - QTextCharFormat fmt; - fmt.setFontItalic(arg); - mergeFormatOnWordOrSelection(fmt); - emit italicChanged(); -} - -void DocumentHandler::setUnderline(bool arg) -{ - QTextCharFormat fmt; - fmt.setFontUnderline(arg); - mergeFormatOnWordOrSelection(fmt); - emit underlineChanged(); -} - -int DocumentHandler::fontSize() const -{ - QTextCursor cursor = textCursor(); - if (cursor.isNull()) - return 0; - QTextCharFormat format = cursor.charFormat(); - return format.font().pointSize(); -} - -void DocumentHandler::setFontSize(int arg) -{ - QTextCursor cursor = textCursor(); - if (cursor.isNull()) - return; - QTextCharFormat format; - format.setFontPointSize(arg); - mergeFormatOnWordOrSelection(format); - emit fontSizeChanged(); -} - -QColor DocumentHandler::textColor() const -{ - QTextCursor cursor = textCursor(); - if (cursor.isNull()) - return QColor(Qt::black); - QTextCharFormat format = cursor.charFormat(); - return format.foreground().color(); -} - -void DocumentHandler::setTextColor(const QColor &c) -{ - QTextCursor cursor = textCursor(); - if (cursor.isNull()) - return; - QTextCharFormat format; - format.setForeground(QBrush(c)); - mergeFormatOnWordOrSelection(format); - emit textColorChanged(); -} - -QString DocumentHandler::fontFamily() const -{ - QTextCursor cursor = textCursor(); - if (cursor.isNull()) - return QString(); - QTextCharFormat format = cursor.charFormat(); - return format.font().family(); -} - -void DocumentHandler::setFontFamily(const QString &arg) -{ - QTextCursor cursor = textCursor(); - if (cursor.isNull()) - return; - QTextCharFormat format; - format.setFontFamily(arg); - mergeFormatOnWordOrSelection(format); - emit fontFamilyChanged(); -} - -QStringList DocumentHandler::defaultFontSizes() const -{ - // uhm... this is quite ugly - QStringList sizes; - QFontDatabase db; - foreach (int size, db.standardSizes()) - sizes.append(QString::number(size)); - return sizes; -} diff --git a/examples/quick/controls/texteditor/src/documenthandler.h b/examples/quick/controls/texteditor/src/documenthandler.h deleted file mode 100644 index f2bd4eead..000000000 --- a/examples/quick/controls/texteditor/src/documenthandler.h +++ /dev/null @@ -1,171 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 DOCUMENTHANDLER_H -#define DOCUMENTHANDLER_H - -#include - -#include -#include - -#include - -QT_BEGIN_NAMESPACE -class QTextDocument; -QT_END_NAMESPACE - -class DocumentHandler : public QObject -{ - Q_OBJECT - - Q_ENUMS(HAlignment) - - Q_PROPERTY(QQuickItem *target READ target WRITE setTarget NOTIFY targetChanged) - Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged) - Q_PROPERTY(int selectionStart READ selectionStart WRITE setSelectionStart NOTIFY selectionStartChanged) - Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged) - - Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor NOTIFY textColorChanged) - Q_PROPERTY(QString fontFamily READ fontFamily WRITE setFontFamily NOTIFY fontFamilyChanged) - Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged) - - Q_PROPERTY(bool bold READ bold WRITE setBold NOTIFY boldChanged) - Q_PROPERTY(bool italic READ italic WRITE setItalic NOTIFY italicChanged) - Q_PROPERTY(bool underline READ underline WRITE setUnderline NOTIFY underlineChanged) - - Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged) - - Q_PROPERTY(QStringList defaultFontSizes READ defaultFontSizes NOTIFY defaultFontSizesChanged) - - Q_PROPERTY(QUrl fileUrl READ fileUrl WRITE setFileUrl NOTIFY fileUrlChanged) - Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) - Q_PROPERTY(QString documentTitle READ documentTitle WRITE setDocumentTitle NOTIFY documentTitleChanged) - -public: - DocumentHandler(); - - QQuickItem *target() { return m_target; } - - void setTarget(QQuickItem *target); - - void setCursorPosition(int position); - void setSelectionStart(int position); - void setSelectionEnd(int position); - - int cursorPosition() const { return m_cursorPosition; } - int selectionStart() const { return m_selectionStart; } - int selectionEnd() const { return m_selectionEnd; } - - QString fontFamily() const; - - QColor textColor() const; - - Qt::Alignment alignment() const; - void setAlignment(Qt::Alignment a); - - bool bold() const; - bool italic() const; - bool underline() const; - int fontSize() const; - - QStringList defaultFontSizes() const; - QUrl fileUrl() const; - QString text() const; - - QString documentTitle() const; - -public Q_SLOTS: - void setBold(bool arg); - void setItalic(bool arg); - void setUnderline(bool arg); - void setFontSize(int arg); - void setTextColor(const QColor &arg); - void setFontFamily(const QString &arg); - - void setFileUrl(const QUrl &arg); - void setText(const QString &arg); - void saveAs(const QUrl &arg, const QString &fileType); - - void setDocumentTitle(QString arg); - -Q_SIGNALS: - void targetChanged(); - void cursorPositionChanged(); - void selectionStartChanged(); - void selectionEndChanged(); - - void fontFamilyChanged(); - void textColorChanged(); - void alignmentChanged(); - - void boldChanged(); - void italicChanged(); - void underlineChanged(); - - void fontSizeChanged(); - void defaultFontSizesChanged(); - - void fileUrlChanged(); - - void textChanged(); - void documentTitleChanged(); - void error(QString message); - -private: - void reset(); - QTextCursor textCursor() const; - void mergeFormatOnWordOrSelection(const QTextCharFormat &format); - - QQuickItem *m_target; - QTextDocument *m_doc; - - int m_cursorPosition; - int m_selectionStart; - int m_selectionEnd; - - QFont m_font; - int m_fontSize; - QUrl m_fileUrl; - QString m_text; - QString m_documentTitle; -}; - -#endif diff --git a/examples/quick/controls/texteditor/src/main.cpp b/examples/quick/controls/texteditor/src/main.cpp deleted file mode 100644 index 1ef76e3a0..000000000 --- a/examples/quick/controls/texteditor/src/main.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 "qtquickcontrolsapplication.h" -#include "documenthandler.h" -#include - -int main(int argc, char *argv[]) -{ - QtQuickControlsApplication app(argc, argv); - qmlRegisterType("org.qtproject.example", 1, 0, "DocumentHandler"); - QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml")); - if (engine.rootObjects().isEmpty()) - return -1; - return app.exec(); -} diff --git a/examples/quick/controls/texteditor/src/src.pri b/examples/quick/controls/texteditor/src/src.pri deleted file mode 100644 index 2b89cd629..000000000 --- a/examples/quick/controls/texteditor/src/src.pri +++ /dev/null @@ -1,9 +0,0 @@ -SOURCES += \ - $$PWD/documenthandler.cpp \ - $$PWD/main.cpp - - -HEADERS += \ - $$PWD/documenthandler.h - - diff --git a/examples/quick/controls/texteditor/texteditor.pro b/examples/quick/controls/texteditor/texteditor.pro deleted file mode 100644 index ec9d8d863..000000000 --- a/examples/quick/controls/texteditor/texteditor.pro +++ /dev/null @@ -1,13 +0,0 @@ -QT += qml quick -TARGET = texteditor -!no_desktop: QT += widgets - -include(src/src.pri) -include(../shared/shared.pri) - -OTHER_FILES += \ - qml/main.qml \ - qml/ToolBarSeparator.qml - -RESOURCES += \ - resources.qrc diff --git a/examples/quick/controls/touch/content/AndroidDelegate.qml b/examples/quick/controls/touch/content/AndroidDelegate.qml deleted file mode 100644 index 07f288337..000000000 --- a/examples/quick/controls/touch/content/AndroidDelegate.qml +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 - -Item { - id: root - width: parent.width - height: 88 - - property alias text: textitem.text - signal clicked - - Rectangle { - anchors.fill: parent - color: "#11ffffff" - visible: mouse.pressed - } - - Text { - id: textitem - color: "white" - font.pixelSize: 32 - text: modelData - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 30 - } - - Rectangle { - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: 15 - height: 1 - color: "#424246" - } - - Image { - anchors.right: parent.right - anchors.rightMargin: 20 - anchors.verticalCenter: parent.verticalCenter - source: "../images/navigation_next_item.png" - } - - MouseArea { - id: mouse - anchors.fill: parent - onClicked: root.clicked() - - } -} diff --git a/examples/quick/controls/touch/content/ButtonPage.qml b/examples/quick/controls/touch/content/ButtonPage.qml deleted file mode 100644 index 3888e30d5..000000000 --- a/examples/quick/controls/touch/content/ButtonPage.qml +++ /dev/null @@ -1,172 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.1 - -Item { - width: parent.width - height: parent.height - - property real progress: 0 - SequentialAnimation on progress { - loops: Animation.Infinite - running: true - NumberAnimation { - from: 0 - to: 1 - duration: 3000 - } - NumberAnimation { - from: 1 - to: 0 - duration: 3000 - } - } - - Column { - spacing: 40 - anchors.centerIn: parent - - Button { - text: "Press me" - style: touchStyle - } - - Button { - style: touchStyle - text: "Press me too" - } - - Button { - anchors.margins: 20 - style: touchStyle - text: "Don't press me" - onClicked: if (stackView) stackView.pop() - } - - Row { - spacing: 20 - Switch { - style: switchStyle - } - Switch { - style: switchStyle - } - } - - } - - Component { - id: touchStyle - ButtonStyle { - panel: Item { - implicitHeight: 50 - implicitWidth: 320 - BorderImage { - anchors.fill: parent - antialiasing: true - border.bottom: 8 - border.top: 8 - border.left: 8 - border.right: 8 - anchors.margins: control.pressed ? -4 : 0 - source: control.pressed ? "../images/button_pressed.png" : "../images/button_default.png" - Text { - text: control.text - anchors.centerIn: parent - color: "white" - font.pixelSize: 23 - renderType: Text.NativeRendering - } - } - } - } - } - - Component { - id: switchStyle - SwitchStyle { - - groove: Rectangle { - implicitHeight: 50 - implicitWidth: 152 - Rectangle { - anchors.top: parent.top - anchors.left: parent.left - anchors.bottom: parent.bottom - width: parent.width/2 - 2 - height: 20 - anchors.margins: 2 - color: control.checked ? "#468bb7" : "#222" - Behavior on color {ColorAnimation {}} - Text { - font.pixelSize: 23 - color: "white" - anchors.centerIn: parent - text: "ON" - } - } - Item { - width: parent.width/2 - height: parent.height - anchors.right: parent.right - Text { - font.pixelSize: 23 - color: "white" - anchors.centerIn: parent - text: "OFF" - } - } - color: "#222" - border.color: "#444" - border.width: 2 - } - handle: Rectangle { - width: parent.parent.width/2 - height: control.height - color: "#444" - border.color: "#555" - border.width: 2 - } - } - } -} diff --git a/examples/quick/controls/touch/content/ListPage.qml b/examples/quick/controls/touch/content/ListPage.qml deleted file mode 100644 index f12b0c12b..000000000 --- a/examples/quick/controls/touch/content/ListPage.qml +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.1 - -ScrollView { - width: parent.width - height: parent.height - - flickableItem.interactive: true - - ListView { - anchors.fill: parent - model: 100 - delegate: AndroidDelegate { - text: "Item #" + modelData - } - } - - style: ScrollViewStyle { - transientScrollBars: true - handle: Item { - implicitWidth: 14 - implicitHeight: 26 - Rectangle { - color: "#424246" - anchors.fill: parent - anchors.topMargin: 6 - anchors.leftMargin: 4 - anchors.rightMargin: 4 - anchors.bottomMargin: 6 - } - } - scrollBarBackground: Item { - implicitWidth: 14 - implicitHeight: 26 - } - } -} diff --git a/examples/quick/controls/touch/content/ProgressBarPage.qml b/examples/quick/controls/touch/content/ProgressBarPage.qml deleted file mode 100644 index 5190b4bba..000000000 --- a/examples/quick/controls/touch/content/ProgressBarPage.qml +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.1 - -Item { - width: parent.width - height: parent.height - - property real progress: 0 - SequentialAnimation on progress { - loops: Animation.Infinite - running: true - NumberAnimation { - from: 0 - to: 1 - duration: 3000 - } - NumberAnimation { - from: 1 - to: 0 - duration: 3000 - } - } - - Column { - spacing: 40 - anchors.centerIn: parent - - ProgressBar { - anchors.margins: 20 - style: touchStyle - width: 400 - value: progress - } - - ProgressBar { - anchors.margins: 20 - style: touchStyle - width: 400 - value: 1 - progress - } - - ProgressBar { - anchors.margins: 20 - style: touchStyle - value: 1 - width: 400 - } - - } - - Component { - id: touchStyle - ProgressBarStyle { - panel: Rectangle { - implicitHeight: 15 - implicitWidth: 400 - color: "#444" - opacity: 0.8 - Rectangle { - antialiasing: true - radius: 1 - color: "#468bb7" - height: parent.height - width: parent.width * control.value / control.maximumValue - } - } - } - } -} diff --git a/examples/quick/controls/touch/content/SliderPage.qml b/examples/quick/controls/touch/content/SliderPage.qml deleted file mode 100644 index 4f4e2ee82..000000000 --- a/examples/quick/controls/touch/content/SliderPage.qml +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.1 - -Item { - width: parent.width - height: parent.height - - Column { - spacing: 12 - anchors.centerIn: parent - - Slider { - anchors.margins: 20 - style: touchStyle - value: 0 - } - Slider { - anchors.margins: 20 - style: touchStyle - value: 0.5 - } - Slider { - anchors.margins: 20 - style: touchStyle - value: 1.0 - } - - } - - Component { - id: touchStyle - SliderStyle { - handle: Rectangle { - width: 30 - height: 30 - radius: height - antialiasing: true - color: Qt.lighter("#468bb7", 1.2) - } - - groove: Item { - implicitHeight: 50 - implicitWidth: 400 - Rectangle { - height: 8 - width: parent.width - anchors.verticalCenter: parent.verticalCenter - color: "#444" - opacity: 0.8 - Rectangle { - antialiasing: true - radius: 1 - color: "#468bb7" - height: parent.height - width: parent.width * control.value / control.maximumValue - } - } - } - } - } -} diff --git a/examples/quick/controls/touch/content/TabBarPage.qml b/examples/quick/controls/touch/content/TabBarPage.qml deleted file mode 100644 index a27bb2069..000000000 --- a/examples/quick/controls/touch/content/TabBarPage.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.1 - -Item { - width: parent.width - height: parent.height - - TabView { - anchors.fill: parent - style: touchStyle - Tab { - title: "Buttons" - ButtonPage{ visible: true } - } - Tab { - title: "Sliders" - SliderPage{ visible: true } - } - Tab { - title: "Progress" - ProgressBarPage{ visible: true } - } - } - - Component { - id: touchStyle - TabViewStyle { - tabsAlignment: Qt.AlignVCenter - tabOverlap: 0 - frame: Item { } - tab: Item { - implicitWidth: control.width/control.count - implicitHeight: 50 - BorderImage { - anchors.fill: parent - border.bottom: 8 - border.top: 8 - source: styleData.selected ? "../images/tab_selected.png":"../images/tabs_standard.png" - Text { - anchors.centerIn: parent - color: "white" - text: styleData.title.toUpperCase() - font.pixelSize: 16 - } - Rectangle { - visible: index > 0 - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.margins: 10 - width:1 - color: "#3a3a3a" - } - } - } - } - } -} diff --git a/examples/quick/controls/touch/content/TextInputPage.qml b/examples/quick/controls/touch/content/TextInputPage.qml deleted file mode 100644 index 3c4dc4ade..000000000 --- a/examples/quick/controls/touch/content/TextInputPage.qml +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.1 - -Item { - width: parent.width - height: parent.height - - property real progress: 0 - SequentialAnimation on progress { - loops: Animation.Infinite - running: true - NumberAnimation { - from: 0 - to: 1 - duration: 3000 - } - NumberAnimation { - from: 1 - to: 0 - duration: 3000 - } - } - - Column { - spacing: 40 - anchors.centerIn: parent - - TextField { - anchors.margins: 20 - text: "Text input" - style: touchStyle - } - - TextField { - anchors.margins: 20 - text: "Readonly Text input" - style: touchStyle - readOnly: true - } - } - Component { - id: touchStyle - - TextFieldStyle { - textColor: "white" - font.pixelSize: 28 - background: Item { - implicitHeight: 50 - implicitWidth: 320 - BorderImage { - source: "../images/textinput.png" - border.left: 8 - border.right: 8 - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - } - } - } - } -} diff --git a/examples/quick/controls/touch/images/NOTICE.txt b/examples/quick/controls/touch/images/NOTICE.txt deleted file mode 100644 index 93a9afc8c..000000000 --- a/examples/quick/controls/touch/images/NOTICE.txt +++ /dev/null @@ -1,2 +0,0 @@ -Notice some of these images are derived from Google applications resources. They were provided under the following license: -You may use the materials in this directory without restriction to develop your apps and to use in your apps. diff --git a/examples/quick/controls/touch/images/button_default.png b/examples/quick/controls/touch/images/button_default.png deleted file mode 100644 index 6d6cfd9ad..000000000 Binary files a/examples/quick/controls/touch/images/button_default.png and /dev/null differ diff --git a/examples/quick/controls/touch/images/button_pressed.png b/examples/quick/controls/touch/images/button_pressed.png deleted file mode 100644 index ab78b6ea3..000000000 Binary files a/examples/quick/controls/touch/images/button_pressed.png and /dev/null differ diff --git a/examples/quick/controls/touch/images/navigation_next_item.png b/examples/quick/controls/touch/images/navigation_next_item.png deleted file mode 100644 index 6665c9d85..000000000 Binary files a/examples/quick/controls/touch/images/navigation_next_item.png and /dev/null differ diff --git a/examples/quick/controls/touch/images/navigation_previous_item.png b/examples/quick/controls/touch/images/navigation_previous_item.png deleted file mode 100644 index f8be01197..000000000 Binary files a/examples/quick/controls/touch/images/navigation_previous_item.png and /dev/null differ diff --git a/examples/quick/controls/touch/images/tab_selected.png b/examples/quick/controls/touch/images/tab_selected.png deleted file mode 100644 index 2345f7a8e..000000000 Binary files a/examples/quick/controls/touch/images/tab_selected.png and /dev/null differ diff --git a/examples/quick/controls/touch/images/tabs_standard.png b/examples/quick/controls/touch/images/tabs_standard.png deleted file mode 100644 index 7140ab7b7..000000000 Binary files a/examples/quick/controls/touch/images/tabs_standard.png and /dev/null differ diff --git a/examples/quick/controls/touch/images/textinput.png b/examples/quick/controls/touch/images/textinput.png deleted file mode 100644 index b0256db2c..000000000 Binary files a/examples/quick/controls/touch/images/textinput.png and /dev/null differ diff --git a/examples/quick/controls/touch/images/toolbar.png b/examples/quick/controls/touch/images/toolbar.png deleted file mode 100644 index e9eba4c74..000000000 Binary files a/examples/quick/controls/touch/images/toolbar.png and /dev/null differ diff --git a/examples/quick/controls/touch/main.qml b/examples/quick/controls/touch/main.qml deleted file mode 100644 index 5138fa0ca..000000000 --- a/examples/quick/controls/touch/main.qml +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.2 -import "content" - -ApplicationWindow { - visible: true - width: 800 - height: 1280 - - Rectangle { - color: "#212126" - anchors.fill: parent - } - - toolBar: BorderImage { - border.bottom: 8 - source: "images/toolbar.png" - width: parent.width - height: 100 - - Rectangle { - id: backButton - width: opacity ? 60 : 0 - anchors.left: parent.left - anchors.leftMargin: 20 - opacity: stackView.depth > 1 ? 1 : 0 - anchors.verticalCenter: parent.verticalCenter - antialiasing: true - height: 60 - radius: 4 - color: backmouse.pressed ? "#222" : "transparent" - Behavior on opacity { NumberAnimation{} } - Image { - anchors.verticalCenter: parent.verticalCenter - source: "images/navigation_previous_item.png" - } - MouseArea { - id: backmouse - anchors.fill: parent - anchors.margins: -10 - onClicked: stackView.pop() - } - } - - Text { - font.pixelSize: 42 - Behavior on x { NumberAnimation{ easing.type: Easing.OutCubic} } - x: backButton.x + backButton.width + 20 - anchors.verticalCenter: parent.verticalCenter - color: "white" - text: "Widget Gallery" - } - } - - ListModel { - id: pageModel - ListElement { - title: "Buttons" - page: "content/ButtonPage.qml" - } - ListElement { - title: "Sliders" - page: "content/SliderPage.qml" - } - ListElement { - title: "ProgressBar" - page: "content/ProgressBarPage.qml" - } - ListElement { - title: "Tabs" - page: "content/TabBarPage.qml" - } - ListElement { - title: "TextInput" - page: "content/TextInputPage.qml" - } - ListElement { - title: "List" - page: "content/ListPage.qml" - } - } - - StackView { - id: stackView - anchors.fill: parent - // Implements back key navigation - focus: true - Keys.onReleased: if (event.key === Qt.Key_Back && stackView.depth > 1) { - stackView.pop(); - event.accepted = true; - } - - initialItem: Item { - width: parent.width - height: parent.height - ListView { - model: pageModel - anchors.fill: parent - delegate: AndroidDelegate { - text: title - onClicked: stackView.push(Qt.resolvedUrl(page)) - } - } - } - } - -} diff --git a/examples/quick/controls/touch/resources.qrc b/examples/quick/controls/touch/resources.qrc deleted file mode 100644 index e64a063f1..000000000 --- a/examples/quick/controls/touch/resources.qrc +++ /dev/null @@ -1,20 +0,0 @@ - - - main.qml - content/AndroidDelegate.qml - content/ButtonPage.qml - content/ListPage.qml - content/ProgressBarPage.qml - content/SliderPage.qml - content/TabBarPage.qml - content/TextInputPage.qml - images/button_default.png - images/button_pressed.png - images/navigation_next_item.png - images/navigation_previous_item.png - images/tab_selected.png - images/tabs_standard.png - images/textinput.png - images/toolbar.png - - diff --git a/examples/quick/controls/touch/src/main.cpp b/examples/quick/controls/touch/src/main.cpp deleted file mode 100644 index e66387f7b..000000000 --- a/examples/quick/controls/touch/src/main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 "qtquickcontrolsapplication.h" -#include - -int main(int argc, char *argv[]) -{ - QtQuickControlsApplication app(argc, argv); - QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); - if (engine.rootObjects().isEmpty()) - return -1; - return app.exec(); -} diff --git a/examples/quick/controls/touch/src/src.pri b/examples/quick/controls/touch/src/src.pri deleted file mode 100644 index 66d903eac..000000000 --- a/examples/quick/controls/touch/src/src.pri +++ /dev/null @@ -1,2 +0,0 @@ -SOURCES += \ - $$PWD/main.cpp diff --git a/examples/quick/controls/touch/touch.pro b/examples/quick/controls/touch/touch.pro deleted file mode 100644 index 63902f81b..000000000 --- a/examples/quick/controls/touch/touch.pro +++ /dev/null @@ -1,19 +0,0 @@ -QT += qml quick -TARGET = touch -!no_desktop: QT += widgets - -include(src/src.pri) -include(../shared/shared.pri) - -OTHER_FILES += \ - main.qml \ - content/AndroidDelegate.qml \ - content/ButtonPage.qml \ - content/ListPage.qml \ - content/ProgressBarPage.qml \ - content/SliderPage.qml \ - content/TabBarPage.qml \ - content/TextInputPage.qml - -RESOURCES += \ - resources.qrc diff --git a/examples/quick/controls/touch/touch.qmlproject b/examples/quick/controls/touch/touch.qmlproject deleted file mode 100644 index e5a8bf02c..000000000 --- a/examples/quick/controls/touch/touch.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "main.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/quick/controls/uiforms/MainForm.ui.qml b/examples/quick/controls/uiforms/MainForm.ui.qml deleted file mode 100644 index 4649209f4..000000000 --- a/examples/quick/controls/uiforms/MainForm.ui.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.1 -import QtQuick.Controls 1.2 - -Item { - width: 800 - height: 480 - property alias tableView: tableView - - SplitView { - id: splitView - anchors.fill: parent - - TableView { - id: tableView - - property int columnWidth: width / 3 - Layout.minimumWidth: splitView.width / 3 - - TableViewColumn { - role: "customerId" - title: qsTr("Customer Id") - width: tableView.columnWidth - } - - TableViewColumn { - role: "firstName" - title: qsTr("First Name") - width: tableView.columnWidth - } - TableViewColumn { - role: "lastName" - title: qsTr("Last Name") - width: tableView.columnWidth - } - } - - TabView { - id: tabView - - Layout.minimumWidth: 480 - - Tab { - title: qsTr("Customer Settings") - source: "qml/Settings.qml" - } - Tab { - title: qsTr("Customer Notes") - source: "qml/Notes.qml" - } - Tab { - title: qsTr("Customer History") - source: "qml/History.qml" - } - } - } -} diff --git a/examples/quick/controls/uiforms/main.cpp b/examples/quick/controls/uiforms/main.cpp deleted file mode 100644 index 6a15842a9..000000000 --- a/examples/quick/controls/uiforms/main.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 "qtquickcontrolsapplication.h" -#include -#include - -int main(int argc, char *argv[]) -{ - QtQuickControlsApplication app(argc, argv); - if (QCoreApplication::arguments().contains(QLatin1String("--coreprofile"))) { - QSurfaceFormat fmt; - fmt.setVersion(4, 4); - fmt.setProfile(QSurfaceFormat::CoreProfile); - QSurfaceFormat::setDefaultFormat(fmt); - } - - qmlRegisterSingletonType(QUrl(QStringLiteral("qrc:/qml/CustomerModel.qml")), "io.qt.example", 1, 0, "CustomerModel"); - - QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); - if (engine.rootObjects().isEmpty()) - return -1; - return app.exec(); -} diff --git a/examples/quick/controls/uiforms/main.qml b/examples/quick/controls/uiforms/main.qml deleted file mode 100644 index da2580225..000000000 --- a/examples/quick/controls/uiforms/main.qml +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.1 -import QtQuick.Controls 1.2 -import io.qt.example 1.0 -import "qml" - -ApplicationWindow { - visible: true - title: "Qt Quick UI Forms" - - MessageDialog { - id: aboutDialog - icon: StandardIcon.Information - title: qsTr("About") - text: "Qt Quick UI Forms" - informativeText: qsTr("This example demonstrates how to separate the implementation of an application from the UI using ui.qml files.") - } - - Action { - id: copyAction - text: qsTr("&Copy") - shortcut: StandardKey.Copy - iconName: "edit-copy" - enabled: (!!activeFocusItem && !!activeFocusItem["copy"]) - onTriggered: activeFocusItem.copy() - } - - Action { - id: cutAction - text: qsTr("Cu&t") - shortcut: StandardKey.Cut - iconName: "edit-cut" - enabled: (!!activeFocusItem && !!activeFocusItem["cut"]) - onTriggered: activeFocusItem.cut() - } - - Action { - id: pasteAction - text: qsTr("&Paste") - shortcut: StandardKey.Paste - iconName: "edit-paste" - enabled: (!!activeFocusItem && !!activeFocusItem["paste"]) - onTriggered: activeFocusItem.paste() - } - - menuBar: MenuBar { - Menu { - title: qsTr("&File") - MenuItem { - text: qsTr("E&xit") - shortcut: StandardKey.Quit - onTriggered: Qt.quit() - } - } - Menu { - title: qsTr("&Edit") - MenuItem { - action: cutAction - } - MenuItem { - action: copyAction - } - MenuItem { - action: pasteAction - } - } - Menu { - title: qsTr("&Help") - MenuItem { - text: qsTr("About...") - onTriggered: aboutDialog.open() - } - } - } - - MainForm { - id: mainForm - - anchors.fill: parent - - Layout.minimumWidth: 800 - Layout.minimumHeight: 480 - Layout.preferredWidth: 768 - Layout.preferredHeight: 480 - - tableView.model: CustomerModel - - Component.onCompleted: CustomerModel.selection = tableView.selection - } -} diff --git a/examples/quick/controls/uiforms/qml/CustomerModel.qml b/examples/quick/controls/uiforms/qml/CustomerModel.qml deleted file mode 100644 index 70a9695dd..000000000 --- a/examples/quick/controls/uiforms/qml/CustomerModel.qml +++ /dev/null @@ -1,144 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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$ -** -****************************************************************************/ - -pragma Singleton - -import QtQuick 2.0 - -ListModel { - property QtObject selection - ListElement { - customerId: "15881123" - firstName: "Julia" - title: "Ms." - lastName: "Jefferson" - email: "Julia@example.com" - address: "Spandia Avenue, Suite 610" - city: "Toronto" - zipCode: "92334" - phoneNumber: "0803-033330" - notes: "Very demanding customer." - history: "21.4.2014|Order|coffee~23.4.2014|Order|poster~29.4.2014|Invoice|poster 40$~05.5.2014|Overdue Notice|poster 40$" - } - - ListElement { - customerId: "29993496" - firstName: "Tim" - lastName: "Northington" - title: "Mr." - email: "Northington@example.com" - address: "North Fifth Street 55" - city: "San Jose" - zipCode: "95112" - phoneNumber: "09000-3330" - notes: "Very good customer." - history: "18.4.2014|Order|orange juice~23.4.2014|Order|chair~24.4.2014|Complaint|Chair is broken." - } - - ListElement { - customerId: "37713567" - firstName: "Daniel" - lastName: "Krumm" - title: "Mr." - email: "Krumm@example.com" - address: "Waterfront 14" - city: "Berlin" - zipCode: "12334" - phoneNumber: "0708093330" - notes: "This customer has a lot of Complaintts." - history: "15.4.2014|Order|table~25.4.2014|Return|table~28.4.2014|Complaint|Table had wrong color." - } - - ListElement { - customerId: "45817387" - firstName: "Sandra" - lastName: "Booth" - title: "Ms." - email: "Sandrab@example.com" - address: "Folsom Street 23" - city: "San Francisco" - zipCode: "94103" - phoneNumber: "0103436370" - notes: "This customer is not paying." - history: "22.4.2014|Order|coffee~23.4.2014|Order|smartphone~29.4.2014|Invoice|smartphone 200$~05.5.2014|Overdue Notice|smartphone 200$" - } - - ListElement { - customerId: "588902396" - firstName: "Lora" - lastName: "Beckner" - title: "Ms." - email: "LoraB@example.com" - address: " W Wilson Apt 3" - city: "Los Angeles" - zipCode: "90086" - phoneNumber: "0903436360" - notes: "This customer usually pays late." - history: "17.4.2014|Order|soft drink~23.4.2014|Order|computer~29.4.2014|Invoice|computer 1200$~07.5.2014|Overdue Notice|computer 1200$" - } - - ListElement { - customerId: "67873693" - firstName: "Daniel" - lastName: "Krumm" - title: "Mr." - email: "Krumm@example.com" - address: "Waterfront 14" - city: "Berlin" - zipCode: "12334" - phoneNumber: "0303033330" - notes: "This customer has a lot of Complaints." - history: "23.4.2014|Order|jacket~25.4.2014|Return|jacket~28.4.2014|Complaint|Jacket had wrong color." - } - - ListElement { - customerId: "78885693" - firstName: "Vanessa" - lastName: "Newbury" - title: "Ms." - email: "VanessaN@example.com" - address: "Madison Ave. 277" - city: "New York" - zipCode: "10016" - phoneNumber: "0503053530" - notes: "Deliveries sometime do not arrive on time." - history: "19.4.2014|Order|coffee~23.4.2014|Order|bicycle~29.4.2014|Invoice|bicycle 500$~06.5.2014|Overdue Notice|bicycle 500$" - } -} diff --git a/examples/quick/controls/uiforms/qml/History.qml b/examples/quick/controls/uiforms/qml/History.qml deleted file mode 100644 index 336d717ff..000000000 --- a/examples/quick/controls/uiforms/qml/History.qml +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.2 -import io.qt.example 1.0 - -HistoryForm { - id: form - - function readData() { - CustomerModel.selection.forEach(function (rowIndex) { - - var history = CustomerModel.get(rowIndex).history - var entries = history.split("~") - - form.tableView.model.clear() - - var index - for (index = 0; index < entries.length; index++) { - var entry = entries[index] - var data = entry.split("|") - form.tableView.model.append({ - date: data[0], - type: data[1], - text: data[2] - }) - } - }) - } - - Connections { - target: CustomerModel.selection - onSelectionChanged: form.readData() - } - - Component.onCompleted: readData() -} diff --git a/examples/quick/controls/uiforms/qml/HistoryForm.ui.qml b/examples/quick/controls/uiforms/qml/HistoryForm.ui.qml deleted file mode 100644 index 9445b12fb..000000000 --- a/examples/quick/controls/uiforms/qml/HistoryForm.ui.qml +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.2 - -Item { - id: content - - width: 640 - height: 480 - property alias tableView: tableView - - TableView { - id: tableView - - property int columnWidth: width / 3 - - anchors.fill: parent - - TableViewColumn { - role: "date" - title: qsTr("Date") - width: tableView.columnWidth - } - - TableViewColumn { - role: "type" - title: qsTr("Type") - width: tableView.columnWidth - } - - TableViewColumn { - role: "text" - title: qsTr("Description") - width: tableView.columnWidth - } - - model: ListModel { - } - } -} diff --git a/examples/quick/controls/uiforms/qml/Notes.qml b/examples/quick/controls/uiforms/qml/Notes.qml deleted file mode 100644 index af506af31..000000000 --- a/examples/quick/controls/uiforms/qml/Notes.qml +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.2 -import io.qt.example 1.0 - -NotesForm { - id: form - - function readData() { - CustomerModel.selection.forEach(function (rowIndex) { - form.textArea.text = CustomerModel.get(rowIndex).notes - }) - - save.enabled = true - cancel.enabled = true - form.textArea.enabled = true - } - - function writeData() { - CustomerModel.selection.forEach(function (rowIndex) { - var data = CustomerModel.get(rowIndex) - data.notes = form.textArea.text - CustomerModel.set(rowIndex, data) - }) - } - - cancel.onClicked: readData() - save.onClicked: writeData() - - Connections { - target: CustomerModel.selection - onSelectionChanged: form.readData() - } - - Component.onCompleted: readData() -} diff --git a/examples/quick/controls/uiforms/qml/NotesForm.ui.qml b/examples/quick/controls/uiforms/qml/NotesForm.ui.qml deleted file mode 100644 index 9552afcd0..000000000 --- a/examples/quick/controls/uiforms/qml/NotesForm.ui.qml +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.2 - -Item { - id: content - - property alias cancel: cancel - property alias save: save - property alias textArea: textArea - - width: 640 - height: 480 - - ColumnLayout { - anchors.rightMargin: 12 - anchors.leftMargin: 12 - anchors.bottomMargin: 12 - anchors.topMargin: 12 - anchors.fill: parent - - TextArea { - id: textArea - x: 8 - y: 8 - width: 624 - height: 320 - Layout.fillHeight: true - Layout.fillWidth: true - } - RowLayout { - Layout.alignment: Qt.AlignTop | Qt.AlignRight - Button { - id: save - text: qsTr("Save") - enabled: false - } - Button { - id: cancel - text: qsTr("Cancel") - enabled: false - } - } - } -} diff --git a/examples/quick/controls/uiforms/qml/Settings.qml b/examples/quick/controls/uiforms/qml/Settings.qml deleted file mode 100644 index 658c62d3c..000000000 --- a/examples/quick/controls/uiforms/qml/Settings.qml +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.2 -import QtQuick.Dialogs 1.2 -import io.qt.example 1.0 - -SettingsForm { - id: form - anchors.fill: parent - - function readData() { - CustomerModel.selection.forEach(function (rowIndex) { - form.firstName.text = CustomerModel.get(rowIndex).firstName - form.lastName.text = CustomerModel.get(rowIndex).lastName - form.customerId.text = CustomerModel.get(rowIndex).customerId - form.email.text = CustomerModel.get(rowIndex).email - form.address.text = CustomerModel.get(rowIndex).address - form.phoneNumber.text = CustomerModel.get(rowIndex).phoneNumber - form.zipCode.text = CustomerModel.get(rowIndex).zipCode - form.city.text = CustomerModel.get(rowIndex).city - form.title.currentIndex = form.title.find(CustomerModel.get(rowIndex).title) - }) - - save.enabled = true - cancel.enabled = true - gridLayout.enabled = true - } - - function writeData() { - CustomerModel.selection.forEach(function (rowIndex) { - var notes = CustomerModel.get(rowIndex).notes - CustomerModel.set(rowIndex, { - firstName: form.firstName.text, - lastName: form.lastName.text, - customerId: form.customerId.text, - email: form.firstName.email, - address: form.lastName.address, - phoneNumber: form.customerId.phoneNumber, - zipCode: form.customerId.zipCode, - city: form.customerId.city, - title: form.title.currentText, - notes: notes - }) - }) - } - - cancel.onClicked: readData() - save.onClicked: writeData() - - Connections { - target: CustomerModel.selection - onSelectionChanged: form.readData() - } - - Component.onCompleted: readData() -} diff --git a/examples/quick/controls/uiforms/qml/SettingsForm.ui.qml b/examples/quick/controls/uiforms/qml/SettingsForm.ui.qml deleted file mode 100644 index 5cafe0e7a..000000000 --- a/examples/quick/controls/uiforms/qml/SettingsForm.ui.qml +++ /dev/null @@ -1,259 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.2 - -Item { - id: content - - width: 480 - height: 480 - - property alias address: address - property alias gridLayout: gridLayout - property alias cancel: cancel - property alias save: save - - property alias title: title - property alias zipCode: zipCode - property alias city: city - property alias phoneNumber: phoneNumber - property alias customerId: customerId - property alias email: email - property alias lastName: lastName - property alias firstName: firstName - - GridLayout { - id: gridLayout - - anchors.right: parent.right - anchors.left: parent.left - anchors.top: parent.top - anchors.rightMargin: 12 - anchors.leftMargin: 12 - anchors.topMargin: 12 - columnSpacing: 8 - rowSpacing: 8 - rows: 8 - columns: 7 - enabled: false - - Label { - id: label1 - text: qsTr("Title") - Layout.columnSpan: 2 - } - - Label { - id: label2 - text: qsTr("First Name") - Layout.columnSpan: 2 - } - - Item { - id: spacer10 - Layout.preferredHeight: 14 - Layout.preferredWidth: 14 - } - - Label { - id: label3 - text: qsTr("Last Name") - } - - Item { - id: spacer15 - Layout.preferredHeight: 14 - Layout.preferredWidth: 14 - } - - ComboBox { - id: title - Layout.columnSpan: 2 - Layout.fillWidth: true - model: ["Mr.", "Ms."] - } - - TextField { - id: firstName - Layout.minimumWidth: 140 - Layout.fillWidth: true - Layout.columnSpan: 3 - placeholderText: qsTr("first name") - } - - TextField { - id: lastName - Layout.minimumWidth: 140 - Layout.fillWidth: true - Layout.columnSpan: 2 - placeholderText: qsTr("last name") - } - - Label { - id: label4 - text: qsTr("Phone Number") - Layout.columnSpan: 5 - } - - Label { - id: label5 - text: qsTr("Email") - Layout.preferredHeight: 13 - Layout.preferredWidth: 24 - } - - Item { - id: spacer16 - Layout.preferredHeight: 14 - Layout.preferredWidth: 14 - } - - TextField { - id: phoneNumber - Layout.fillWidth: true - Layout.columnSpan: 5 - placeholderText: qsTr("phone number") - } - - TextField { - id: email - Layout.fillWidth: true - Layout.columnSpan: 2 - placeholderText: qsTr("email") - } - - Label { - id: label6 - text: qsTr("Address") - } - - Item { - id: spacer3 - Layout.columnSpan: 6 - Layout.preferredHeight: 14 - Layout.preferredWidth: 14 - } - - TextField { - id: address - Layout.fillWidth: true - Layout.columnSpan: 7 - placeholderText: qsTr("address") - } - - Label { - id: label7 - text: qsTr("City") - } - - Item { - id: spacer4 - Layout.columnSpan: 4 - Layout.preferredHeight: 14 - Layout.preferredWidth: 14 - } - - Label { - id: label8 - text: qsTr("Zip Code") - } - - Item { - id: spacer18 - Layout.preferredHeight: 14 - Layout.preferredWidth: 14 - } - - TextField { - id: city - Layout.fillWidth: true - Layout.columnSpan: 5 - placeholderText: qsTr("city") - } - - TextField { - id: zipCode - Layout.fillWidth: true - Layout.columnSpan: 2 - placeholderText: qsTr("zip code") - } - - Label { - id: label9 - text: qsTr("Customer Id") - } - - Item { - id: spacer19 - Layout.columnSpan: 6 - Layout.preferredHeight: 14 - Layout.preferredWidth: 14 - } - - TextField { - id: customerId - Layout.columnSpan: 7 - Layout.fillWidth: true - placeholderText: qsTr("id") - } - } - - RowLayout { - anchors.topMargin: 12 - anchors.right: parent.right - anchors.rightMargin: 12 - anchors.top: gridLayout.bottom - - Button { - id: save - text: qsTr("Save") - enabled: false - } - - Button { - id: cancel - text: qsTr("Cancel") - enabled: false - } - } -} diff --git a/examples/quick/controls/uiforms/uiforms.pro b/examples/quick/controls/uiforms/uiforms.pro deleted file mode 100644 index 08b3d0c4a..000000000 --- a/examples/quick/controls/uiforms/uiforms.pro +++ /dev/null @@ -1,21 +0,0 @@ -TEMPLATE = app -TARGET = uiforms - -SOURCES += \ - main.cpp - -RESOURCES += \ - uiforms.qrc - -OTHER_FILES += \ - main.qml \ - MainForm.ui.qml \ - qml/Settings.qml \ - qml/History.qml \ - qml/Notes.qml \ - qml/SettingsForm.ui.qml \ - qml/HistoryForm.ui.qml \ - qml/NotesForm.ui.qml \ - qml/CustomerModel.qml - -include(../shared/shared.pri) diff --git a/examples/quick/controls/uiforms/uiforms.qrc b/examples/quick/controls/uiforms/uiforms.qrc deleted file mode 100644 index 447bb039d..000000000 --- a/examples/quick/controls/uiforms/uiforms.qrc +++ /dev/null @@ -1,13 +0,0 @@ - - - main.qml - MainForm.ui.qml - qml/Settings.qml - qml/History.qml - qml/Notes.qml - qml/SettingsForm.ui.qml - qml/HistoryForm.ui.qml - qml/NotesForm.ui.qml - qml/CustomerModel.qml - - diff --git a/examples/quick/dialogs/dialogs.pro b/examples/quick/dialogs/dialogs.pro deleted file mode 100644 index 538e75686..000000000 --- a/examples/quick/dialogs/dialogs.pro +++ /dev/null @@ -1,4 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS = \ - systemdialogs diff --git a/examples/quick/dialogs/systemdialogs/ColorDialogs.qml b/examples/quick/dialogs/systemdialogs/ColorDialogs.qml deleted file mode 100644 index 90cbccf44..000000000 --- a/examples/quick/dialogs/systemdialogs/ColorDialogs.qml +++ /dev/null @@ -1,144 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.2 -import QtQuick.Dialogs 1.1 - -Item { - width: 320 - height: 240 - SystemPalette { id: palette } - clip: true - - //! [colordialog] - ColorDialog { - id: colorDialog - visible: colorDialogVisible.checked - modality: colorDialogModal.checked ? Qt.WindowModal : Qt.NonModal - title: "Choose a color" - color: "green" - showAlphaChannel: colorDialogAlpha.checked - onAccepted: { console.log("Accepted: " + color) } - onRejected: { console.log("Rejected") } - } - //! [colordialog] - - Column { - anchors.fill: parent - anchors.margins: 12 - spacing: 8 - Label { - font.bold: true - text: "Color dialog properties:" - } - CheckBox { - id: colorDialogModal - text: "Modal" - checked: true - Binding on checked { value: colorDialog.modality != Qt.NonModal } - } - CheckBox { - id: colorDialogAlpha - text: "Show alpha channel" - Binding on checked { value: colorDialog.showAlphaChannel } - } - CheckBox { - id: colorDialogVisible - text: "Visible" - Binding on checked { value: colorDialog.visible } - } - Row { - id: colorRow - spacing: parent.spacing - height: colorLabel.implicitHeight * 2.0 - Rectangle { - color: colorDialog.color - height: parent.height - width: height * 2 - border.color: "black" - MouseArea { - anchors.fill: parent - onClicked: colorDialog.open() - } - } - Label { - id: colorLabel - text: "current color: " + colorDialog.color - anchors.verticalCenter: parent.verticalCenter - } - } - } - - Rectangle { - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - } - height: buttonRow.height * 1.2 - color: Qt.darker(palette.window, 1.1) - border.color: Qt.darker(palette.window, 1.3) - Row { - id: buttonRow - spacing: 6 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 12 - height: implicitHeight - width: parent.width - Button { - text: "Open" - anchors.verticalCenter: parent.verticalCenter - onClicked: colorDialog.open() - } - Button { - text: "Close" - anchors.verticalCenter: parent.verticalCenter - onClicked: colorDialog.close() - } - Button { - text: "set to green" - anchors.verticalCenter: parent.verticalCenter - onClicked: colorDialog.color = "green" - } - } - } -} diff --git a/examples/quick/dialogs/systemdialogs/CustomDialogs.qml b/examples/quick/dialogs/systemdialogs/CustomDialogs.qml deleted file mode 100644 index c1022fbba..000000000 --- a/examples/quick/dialogs/systemdialogs/CustomDialogs.qml +++ /dev/null @@ -1,339 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.3 -import QtQuick.Controls 1.2 -import QtQuick.Dialogs 1.2 -import QtQuick.Layouts 1.1 -import QtQuick.Window 2.0 - -Item { - id: root - width: 580 - height: 400 - SystemPalette { id: palette } - clip: true - - //! [dialog] - Dialog { - id: helloDialog - modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal - title: customizeTitle.checked ? windowTitleField.text : "Hello" - onButtonClicked: console.log("clicked button " + clickedButton) - onAccepted: lastChosen.text = "Accepted " + - (clickedButton == StandardButton.Ok ? "(OK)" : (clickedButton == StandardButton.Retry ? "(Retry)" : "(Ignore)")) - onRejected: lastChosen.text = "Rejected " + - (clickedButton == StandardButton.Close ? "(Close)" : (clickedButton == StandardButton.Abort ? "(Abort)" : "(Cancel)")) - onHelp: lastChosen.text = "Yelped for help!" - onYes: lastChosen.text = (clickedButton == StandardButton.Yes ? "Yeessss!!" : "Yes, now and always") - onNo: lastChosen.text = (clickedButton == StandardButton.No ? "Oh No." : "No, no, a thousand times no!") - onApply: lastChosen.text = "Apply" - onReset: lastChosen.text = "Reset" - - Label { - text: "Hello world!" - } - } - //! [dialog] - - Dialog { - id: spinboxDialog - modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal - title: customizeTitle.checked ? windowTitleField.text : "Spinbox" - onHelp: { - lastChosen.text = "No help available, sorry. Please answer the question." - visible = true - } - onButtonClicked: { - if (clickedButton === StandardButton.Ok && answer.value == 11.0) - lastChosen.text = "You are correct!" - else - lastChosen.text = "Having failed to give the correct answer, you shall not pass!" - } - - ColumnLayout { - id: column - width: parent ? parent.width : 100 - Label { - text: "What is the average airspeed velocity of an unladen European swallow?" - Layout.columnSpan: 2 - Layout.fillWidth: true - wrapMode: Text.WordWrap - } - RowLayout { - Layout.alignment: Qt.AlignHCenter - SpinBox { - id: answer - onEditingFinished: spinboxDialog.click(StandardButton.Ok) - } - Label { - text: "m/s" - Layout.alignment: Qt.AlignBaseline | Qt.AlignLeft - } - } - } - } - - Dialog { - id: dateDialog - modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal - title: customizeTitle.checked ? windowTitleField.text : "Choose a date" - onButtonClicked: console.log("clicked button " + clickedButton) - onAccepted: { - if (clickedButton == StandardButton.Ok) - lastChosen.text = "Accepted " + calendar.selectedDate.toLocaleDateString() - else - lastChosen.text = (clickedButton == StandardButton.Retry ? "(Retry)" : "(Ignore)") - } - onRejected: lastChosen.text = "Rejected" - - Calendar { - id: calendar - width: parent ? parent.width : implicitWidth - onDoubleClicked: dateDialog.click(StandardButton.Ok) - } - } - - Dialog { - id: filledDialog - modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal - title: customizeTitle.checked ? windowTitleField.text : "Customized content" - onRejected: lastChosen.text = "Rejected" - onAccepted: lastChosen.text = "Accepted " + - (clickedButton === StandardButton.Retry ? "(Retry)" : "(OK)") - onButtonClicked: if (clickedButton === StandardButton.Retry) lastChosen.text = "Retry" - contentItem: Rectangle { - color: "lightskyblue" - implicitWidth: 400 - implicitHeight: 100 - Label { - text: "Hello blue sky!" - color: "navy" - anchors.centerIn: parent - } - Keys.onPressed: if (event.key === Qt.Key_R && (event.modifiers & Qt.ControlModifier)) filledDialog.click(StandardButton.Retry) - Keys.onEnterPressed: filledDialog.accept() - Keys.onEscapePressed: filledDialog.reject() - Keys.onBackPressed: filledDialog.reject() // especially necessary on Android - } - } - - ColumnLayout { - anchors.fill: parent - anchors.margins: 12 - spacing: 8 - Label { - font.bold: true - text: "Message dialog properties:" - } - CheckBox { - id: dialogModal - text: "Modal" - Binding on checked { value: helloDialog.modality != Qt.NonModal } - } - RowLayout { - CheckBox { - id: customizeTitle - text: "Window Title" - Layout.alignment: Qt.AlignBaseline - checked: true - } - TextField { - id: windowTitleField - Layout.alignment: Qt.AlignBaseline - Layout.fillWidth: true - text: "Custom Dialog" - } - } - Label { - text: "Buttons:" - } - Flow { - spacing: 8 - Layout.fillWidth: true - property bool updating: false - function updateButtons(button, checked) { - if (updating) return - updating = true - var buttons = 0 - for (var i = 0; i < children.length; ++i) - if (children[i].checked) - buttons |= children[i].button - if (!buttons) - buttons = StandardButton.Ok - helloDialog.standardButtons = buttons - spinboxDialog.standardButtons = buttons - dateDialog.standardButtons = buttons - updating = false - } - - CheckBox { - text: "Help" - property int button: StandardButton.Help - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "Abort" - property int button: StandardButton.Abort - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "Close" - property int button: StandardButton.Close - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "Cancel" - property int button: StandardButton.Cancel - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "NoToAll" - property int button: StandardButton.NoToAll - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "No" - property int button: StandardButton.No - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "YesToAll" - property int button: StandardButton.YesToAll - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "Yes" - property int button: StandardButton.Yes - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "Ignore" - property int button: StandardButton.Ignore - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "Retry" - property int button: StandardButton.Retry - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "Apply" - property int button: StandardButton.Apply - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "Reset" - property int button: StandardButton.Reset - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "Restore Defaults" - property int button: StandardButton.RestoreDefaults - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "OK" - checked: true - property int button: StandardButton.Ok - onCheckedChanged: parent.updateButtons(button, checked) - } - - Component.onCompleted: updateButtons() - } - Label { - id: lastChosen - } - Item { Layout.fillHeight: true } - } - - Rectangle { - id: bottomBar - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - } - height: buttonRow.height * 1.2 - color: Qt.darker(palette.window, 1.1) - border.color: Qt.darker(palette.window, 1.3) - Row { - id: buttonRow - spacing: 6 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 12 - width: parent.width - Button { - text: "Hello World" - anchors.verticalCenter: parent.verticalCenter - onClicked: helloDialog.open() - } - Button { - text: "Input" - anchors.verticalCenter: parent.verticalCenter - onClicked: spinboxDialog.open() - } - Button { - text: "Date" - anchors.verticalCenter: parent.verticalCenter - onClicked: dateDialog.open() - } - Button { - text: "No buttons or margins" - anchors.verticalCenter: parent.verticalCenter - onClicked: filledDialog.open() - } - } - } -} diff --git a/examples/quick/dialogs/systemdialogs/FileDialogs.qml b/examples/quick/dialogs/systemdialogs/FileDialogs.qml deleted file mode 100644 index 57e474ce2..000000000 --- a/examples/quick/dialogs/systemdialogs/FileDialogs.qml +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.2 -import QtQuick.Dialogs 1.1 -import QtQuick.Layouts 1.1 -import QtQuick.Window 2.0 - -Item { - width: 580 - height: 400 - SystemPalette { id: palette } - clip: true - - //! [filedialog] - FileDialog { - id: fileDialog - visible: fileDialogVisible.checked - modality: fileDialogModal.checked ? Qt.WindowModal : Qt.NonModal - title: fileDialogSelectFolder.checked ? "Choose a folder" : - (fileDialogSelectMultiple.checked ? "Choose some files" : "Choose a file") - selectExisting: fileDialogSelectExisting.checked - selectMultiple: fileDialogSelectMultiple.checked - selectFolder: fileDialogSelectFolder.checked - nameFilters: [ "Image files (*.png *.jpg)", "All files (*)" ] - selectedNameFilter: "All files (*)" - sidebarVisible: fileDialogSidebarVisible.checked - onAccepted: { - console.log("Accepted: " + fileUrls) - if (fileDialogOpenFiles.checked) - for (var i = 0; i < fileUrls.length; ++i) - Qt.openUrlExternally(fileUrls[i]) - } - onRejected: { console.log("Rejected") } - } - //! [filedialog] - - ScrollView { - id: scrollView - anchors { - left: parent.left - right: parent.right - top: parent.top - bottom: bottomBar.top - leftMargin: 12 - } - ColumnLayout { - spacing: 8 - Item { Layout.preferredHeight: 4 } // padding - Label { - font.bold: true - text: "File dialog properties:" - } - CheckBox { - id: fileDialogModal - text: "Modal" - checked: true - Binding on checked { value: fileDialog.modality != Qt.NonModal } - } - CheckBox { - id: fileDialogSelectFolder - text: "Select Folder" - Binding on checked { value: fileDialog.selectFolder } - } - CheckBox { - id: fileDialogSelectExisting - text: "Select Existing Files" - checked: true - Binding on checked { value: fileDialog.selectExisting } - } - CheckBox { - id: fileDialogSelectMultiple - text: "Select Multiple Files" - Binding on checked { value: fileDialog.selectMultiple } - } - CheckBox { - id: fileDialogOpenFiles - text: "Open Files After Accepting" - } - CheckBox { - id: fileDialogSidebarVisible - text: "Show Sidebar" - checked: fileDialog.sidebarVisible - Binding on checked { value: fileDialog.sidebarVisible } - } - CheckBox { - id: fileDialogVisible - text: "Visible" - Binding on checked { value: fileDialog.visible } - } - Label { - text: "current view folder: " + fileDialog.folder - } - Label { - text: "name filters: {" + fileDialog.nameFilters + "}" - } - Label { - text: "current filter:" + fileDialog.selectedNameFilter - } - Label { - text: "chosen files: " + fileDialog.fileUrls - } - Label { - text: "chosen single path: " + fileDialog.fileUrl - } - } - } - - Rectangle { - id: bottomBar - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - } - height: buttonRow.height * 1.2 - color: Qt.darker(palette.window, 1.1) - border.color: Qt.darker(palette.window, 1.3) - Row { - id: buttonRow - spacing: 6 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 12 - height: implicitHeight - width: parent.width - Button { - text: "Open" - anchors.verticalCenter: parent.verticalCenter - onClicked: fileDialog.open() - } - Button { - text: "Pictures" - tooltip: "go to my Pictures directory" - anchors.verticalCenter: parent.verticalCenter - enabled: fileDialog.shortcuts.hasOwnProperty("pictures") - onClicked: fileDialog.folder = fileDialog.shortcuts.pictures - } - Button { - text: "Home" - tooltip: "go to my home directory" - anchors.verticalCenter: parent.verticalCenter - enabled: fileDialog.shortcuts.hasOwnProperty("home") - onClicked: fileDialog.folder = fileDialog.shortcuts.home - } - } - } -} diff --git a/examples/quick/dialogs/systemdialogs/FontDialogs.qml b/examples/quick/dialogs/systemdialogs/FontDialogs.qml deleted file mode 100644 index 60881dd92..000000000 --- a/examples/quick/dialogs/systemdialogs/FontDialogs.qml +++ /dev/null @@ -1,153 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.2 -import QtQuick.Dialogs 1.1 - -Item { - width: 320 - height: 360 - SystemPalette { id: palette } - clip: true - - FontDialog { - id: fontDialog - visible: fontDialogVisible.checked - modality: fontDialogModal.checked ? Qt.WindowModal : Qt.NonModal - scalableFonts: fontDialogScalableFonts.checked - nonScalableFonts: fontDialogNonScalableFonts.checked - monospacedFonts: fontDialogMonospacedFonts.checked - proportionalFonts: fontDialogProportionalFonts.checked - title: "Choose a font" - font: Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal }) - currentFont: Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal }) - onCurrentFontChanged: { console.log("CurrentFontChanged: " + currentFont) } - onAccepted: { console.log("Accepted: " + font) } - onRejected: { console.log("Rejected") } - } - - Column { - id: optionsColumn - anchors.fill: parent - anchors.margins: 12 - spacing: 8 - Label { - font.bold: true - text: "Font dialog properties:" - } - CheckBox { - id: fontDialogModal - text: "Modal" - checked: true - Binding on checked { value: fontDialog.modality != Qt.NonModal } - } - CheckBox { - id: fontDialogScalableFonts - text: "Scalable fonts" - Binding on checked { value: fontDialog.scalableFonts } - } - CheckBox { - id: fontDialogNonScalableFonts - text: "Non scalable fonts" - Binding on checked { value: fontDialog.nonScalableFonts } - } - CheckBox { - id: fontDialogMonospacedFonts - text: "Monospaced fonts" - Binding on checked { value: fontDialog.monospacedFonts } - } - CheckBox { - id: fontDialogProportionalFonts - text: "Proportional fonts" - Binding on checked { value: fontDialog.proportionalFonts } - } - CheckBox { - id: fontDialogVisible - text: "Visible" - Binding on checked { value: fontDialog.visible } - } - Label { - text: "Current font:" - } - Label { - id: fontLabel - text: "" + fontDialog.font.family + " - " + fontDialog.font.pointSize + "" - MouseArea { - anchors.fill: parent - onClicked: fontDialog.open() - } - } - } - - Rectangle { - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - } - height: buttonRow.height * 1.2 - color: Qt.darker(palette.window, 1.1) - border.color: Qt.darker(palette.window, 1.3) - Row { - id: buttonRow - spacing: 6 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 12 - width: parent.width - Button { - text: "Open" - anchors.verticalCenter: parent.verticalCenter - onClicked: fontDialog.open() - } - Button { - text: "Close" - anchors.verticalCenter: parent.verticalCenter - onClicked: fontDialog.close() - } - Button { - text: "set to default" - anchors.verticalCenter: parent.verticalCenter - onClicked: fontDialog.font = Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal }) - } - } - } -} diff --git a/examples/quick/dialogs/systemdialogs/MessageDialogs.qml b/examples/quick/dialogs/systemdialogs/MessageDialogs.qml deleted file mode 100644 index 2f9205b7a..000000000 --- a/examples/quick/dialogs/systemdialogs/MessageDialogs.qml +++ /dev/null @@ -1,326 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.2 -import QtQuick.Dialogs 1.1 -import QtQuick.Layouts 1.1 -import QtQuick.Window 2.0 - -Item { - id: root - width: 580 - height: 400 - SystemPalette { id: palette } - clip: true - - //! [messagedialog] - MessageDialog { - id: messageDialog - visible: messageDialogVisible.checked - modality: messageDialogModal.checked ? Qt.WindowModal : Qt.NonModal - title: windowTitleField.text - text: customizeText.checked ? textField.text : "" - informativeText: customizeInformativeText.checked ? informativeTextField.text : "" - detailedText: customizeDetailedText.checked ? detailedTextField.text : "" - onButtonClicked: console.log("clicked button " + clickedButton) - onAccepted: lastChosen.text = "Accepted " + - (clickedButton == StandardButton.Ok ? "(OK)" : (clickedButton == StandardButton.Retry ? "(Retry)" : "(Ignore)")) - onRejected: lastChosen.text = "Rejected " + - (clickedButton == StandardButton.Close ? "(Close)" : (clickedButton == StandardButton.Abort ? "(Abort)" : "(Cancel)")) - onHelp: lastChosen.text = "Yelped for help!" - onYes: lastChosen.text = (clickedButton == StandardButton.Yes ? "Yeessss!!" : "Yes, now and always") - onNo: lastChosen.text = (clickedButton == StandardButton.No ? "Oh No." : "No, no, a thousand times no!") - onApply: lastChosen.text = "Apply" - onReset: lastChosen.text = "Reset" - } - //! [messagedialog] - - ScrollView { - id: scrollView - anchors { - left: parent.left - right: parent.right - top: parent.top - bottom: bottomBar.top - leftMargin: 12 - } - ColumnLayout { - spacing: 8 - Item { Layout.preferredHeight: 4 } // padding - Label { - font.bold: true - text: "Message dialog properties:" - } - CheckBox { - id: messageDialogModal - text: "Modal" - checked: true - Binding on checked { value: messageDialog.modality != Qt.NonModal } - } - RowLayout { - CheckBox { - id: customizeTitle - text: "Window Title" - Layout.alignment: Qt.AlignBaseline - checked: true - } - TextField { - id: windowTitleField - Layout.alignment: Qt.AlignBaseline - Layout.fillWidth: true - text: "Alert" - } - } - Label { text: "Icon:" } - Flow { - spacing: 8 - Layout.fillWidth: true - property bool updating: false - function updateIcon(icon, checked) { - if (updating) return - updating = true - messageDialog.icon = (checked ? icon : StandardIcon.NoIcon) - for (var i = 0; i < children.length; ++i) - if (children[i].icon !== icon) - children[i].checked = false - updating = false - } - - CheckBox { - id: iconInformation - text: "Information" - property int icon: StandardIcon.Information - onCheckedChanged: parent.updateIcon(icon, checked) - } - - CheckBox { - id: iconWarning - text: "Warning" - checked: true - property int icon: StandardIcon.Warning - onCheckedChanged: parent.updateIcon(icon, checked) - Component.onCompleted: parent.updateIcon(icon, true) - } - - CheckBox { - id: iconCritical - text: "Critical" - property int icon: StandardIcon.Critical - onCheckedChanged: parent.updateIcon(icon, checked) - } - - CheckBox { - id: iconQuestion - text: "Question" - property int icon: StandardIcon.Question - onCheckedChanged: parent.updateIcon(icon, checked) - } - } - - RowLayout { - CheckBox { - id: customizeText - text: "Primary Text" - Layout.alignment: Qt.AlignBaseline - checked: true - } - TextField { - id: textField - Layout.alignment: Qt.AlignBaseline - Layout.fillWidth: true - text: "Attention Please" - } - } - RowLayout { - CheckBox { - id: customizeInformativeText - text: "Informative Text" - Layout.alignment: Qt.AlignBaseline - checked: true - } - TextField { - id: informativeTextField - Layout.alignment: Qt.AlignBaseline - Layout.fillWidth: true - text: "Be alert!" - } - } - Label { text: "Buttons:" } - Flow { - spacing: 8 - Layout.fillWidth: true - Layout.preferredWidth: root.width - 30 - property bool updating: false - function updateButtons(button, checked) { - if (updating) return - updating = true - var buttons = 0 - for (var i = 0; i < children.length; ++i) - if (children[i].checked) - buttons |= children[i].button - if (!buttons) - buttons = StandardButton.Ok - messageDialog.standardButtons = buttons - updating = false - } - - CheckBox { - text: "Help" - property int button: StandardButton.Help - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "Abort" - property int button: StandardButton.Abort - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "Close" - property int button: StandardButton.Close - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "Cancel" - property int button: StandardButton.Cancel - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "NoToAll" - property int button: StandardButton.NoToAll - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "No" - property int button: StandardButton.No - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "YesToAll" - property int button: StandardButton.YesToAll - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "Yes" - property int button: StandardButton.Yes - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "Ignore" - property int button: StandardButton.Ignore - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "Retry" - property int button: StandardButton.Retry - onCheckedChanged: parent.updateButtons(button, checked) - } - - CheckBox { - text: "OK" - checked: true - property int button: StandardButton.Ok - onCheckedChanged: parent.updateButtons(button, checked) - } - } - RowLayout { - CheckBox { - id: customizeDetailedText - text: "Detailed Text" - Layout.alignment: Qt.AlignBaseline - checked: true - } - TextField { - id: detailedTextField - Layout.alignment: Qt.AlignBaseline - Layout.fillWidth: true - text: "The world needs more lerts." - } - } - CheckBox { - id: messageDialogVisible - text: "Visible" - Binding on checked { value: messageDialog.visible } - } - Label { - id: lastChosen - } - } - } - - Rectangle { - id: bottomBar - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - } - height: buttonRow.height * 1.2 - color: Qt.darker(palette.window, 1.1) - border.color: Qt.darker(palette.window, 1.3) - Row { - id: buttonRow - spacing: 6 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 12 - width: parent.width - Button { - text: "Open" - anchors.verticalCenter: parent.verticalCenter - onClicked: messageDialog.open() - } - Button { - text: "Close" - anchors.verticalCenter: parent.verticalCenter - onClicked: messageDialog.close() - } - } - } -} diff --git a/examples/quick/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg b/examples/quick/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg deleted file mode 100644 index 4517a3930..000000000 Binary files a/examples/quick/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg and /dev/null differ diff --git a/examples/quick/dialogs/systemdialogs/doc/src/systemdialogs.qdoc b/examples/quick/dialogs/systemdialogs/doc/src/systemdialogs.qdoc deleted file mode 100644 index b9f05de71..000000000 --- a/examples/quick/dialogs/systemdialogs/doc/src/systemdialogs.qdoc +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title Qt Quick System Dialog Examples - \example systemdialogs - \brief This example demonstrates the system dialog types in QML - \image systemdialogs-example.jpg - \ingroup qtquickdialog_examples - - This example demonstrates the system dialogs in the \l{Qt Quick Dialogs} - module. The appearance and behavior is platform-dependent. - - A \l FileDialog is used to choose a single file, multiple files or a - single directory, depending on how it is configured. - \snippet systemdialogs/FileDialogs.qml filedialog - - A \l ColorDialog is used to choose a color, with or without alpha (transparency) - depending on how it is configured. - \snippet systemdialogs/ColorDialogs.qml colordialog - - The example can be built as a standalone executable, but each - type of dialog is demonstrated in a separate QML file which can - also be run separately with qmlscene. -*/ diff --git a/examples/quick/dialogs/systemdialogs/main.cpp b/examples/quick/dialogs/systemdialogs/main.cpp deleted file mode 100644 index 5f65ce040..000000000 --- a/examples/quick/dialogs/systemdialogs/main.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 "qtquickcontrolsapplication.h" -#include -#include -#include - -int main(int argc, char *argv[]) -{ - QtQuickControlsApplication app(argc, argv); - if (QCoreApplication::arguments().contains(QLatin1String("--coreprofile"))) { - QSurfaceFormat fmt; - fmt.setVersion(4, 4); - fmt.setProfile(QSurfaceFormat::CoreProfile); - QSurfaceFormat::setDefaultFormat(fmt); - } - QQmlApplicationEngine engine(QUrl("qrc:/dialogs/systemdialogs/systemdialogs.qml")); - if (engine.rootObjects().isEmpty()) - return -1; - return app.exec(); -} diff --git a/examples/quick/dialogs/systemdialogs/systemdialogs.pro b/examples/quick/dialogs/systemdialogs/systemdialogs.pro deleted file mode 100644 index 128bb1b5c..000000000 --- a/examples/quick/dialogs/systemdialogs/systemdialogs.pro +++ /dev/null @@ -1,19 +0,0 @@ -QT += qml quick -!no_desktop: QT += widgets - -QT += quick qml -SOURCES += main.cpp -include(../../controls/shared/shared.pri) - -OTHER_FILES += \ - systemdialogs.qml \ - FileDialogs.qml \ - ColorDialogs.qml \ - FontDialogs.qml \ - MessageDialogs.qml \ - CustomDialogs.qml - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs/systemdialogs -INSTALLS += target - -RESOURCES += systemdialogs.qrc diff --git a/examples/quick/dialogs/systemdialogs/systemdialogs.qml b/examples/quick/dialogs/systemdialogs/systemdialogs.qml deleted file mode 100644 index f1b215c74..000000000 --- a/examples/quick/dialogs/systemdialogs/systemdialogs.qml +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.2 - -ApplicationWindow { - visible: true - title: "System Dialogs Gallery" - width: 580 - height: 480 - - TabView { - anchors.fill: parent - anchors.margins: 8 - Tab { - id: controlPage - title: "File" - FileDialogs { } - } - Tab { - title: "Color" - ColorDialogs { } - } - Tab { - title: "Font" - FontDialogs { anchors.fill: parent } - } - Tab { - title: "Message" - MessageDialogs { anchors.fill:parent } - } - Tab { - title: "Custom" - CustomDialogs { anchors.fill:parent } - } - } -} diff --git a/examples/quick/dialogs/systemdialogs/systemdialogs.qrc b/examples/quick/dialogs/systemdialogs/systemdialogs.qrc deleted file mode 100644 index afd81bfee..000000000 --- a/examples/quick/dialogs/systemdialogs/systemdialogs.qrc +++ /dev/null @@ -1,10 +0,0 @@ - - - systemdialogs.qml - FileDialogs.qml - ColorDialogs.qml - FontDialogs.qml - MessageDialogs.qml - CustomDialogs.qml - - diff --git a/examples/quick/extras/dashboard/dashboard.pro b/examples/quick/extras/dashboard/dashboard.pro deleted file mode 100644 index c549250ec..000000000 --- a/examples/quick/extras/dashboard/dashboard.pro +++ /dev/null @@ -1,18 +0,0 @@ -TEMPLATE = app -TARGET = dashboard -INCLUDEPATH += . -QT += quick - -SOURCES += \ - main.cpp - -RESOURCES += \ - dashboard.qrc - -OTHER_FILES += \ - qml/dashboard.qml \ - qml/DashboardGaugeStyle.qml \ - qml/IconGaugeStyle.qml \ - qml/TachometerStyle.qml \ - qml/TurnIndicator.qml \ - qml/ValueSource.qml diff --git a/examples/quick/extras/dashboard/dashboard.qrc b/examples/quick/extras/dashboard/dashboard.qrc deleted file mode 100644 index 605e1678b..000000000 --- a/examples/quick/extras/dashboard/dashboard.qrc +++ /dev/null @@ -1,13 +0,0 @@ - - - fonts/DejaVuSans.ttf - images/fuel-icon.png - images/temperature-icon.png - qml/dashboard.qml - qml/DashboardGaugeStyle.qml - qml/IconGaugeStyle.qml - qml/TachometerStyle.qml - qml/TurnIndicator.qml - qml/ValueSource.qml - - diff --git a/examples/quick/extras/dashboard/fonts/DejaVuSans.ttf b/examples/quick/extras/dashboard/fonts/DejaVuSans.ttf deleted file mode 100644 index 19ed0b468..000000000 Binary files a/examples/quick/extras/dashboard/fonts/DejaVuSans.ttf and /dev/null differ diff --git a/examples/quick/extras/dashboard/fonts/LICENSE b/examples/quick/extras/dashboard/fonts/LICENSE deleted file mode 100644 index 254e2cc42..000000000 --- a/examples/quick/extras/dashboard/fonts/LICENSE +++ /dev/null @@ -1,99 +0,0 @@ -Fonts are (c) Bitstream (see below). DejaVu changes are in public domain. -Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below) - -Bitstream Vera Fonts Copyright ------------------------------- - -Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is -a trademark of Bitstream, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of the fonts accompanying this license ("Fonts") and associated -documentation files (the "Font Software"), to reproduce and distribute the -Font Software, including without limitation the rights to use, copy, merge, -publish, distribute, and/or sell copies of the Font Software, and to permit -persons to whom the Font Software is furnished to do so, subject to the -following conditions: - -The above copyright and trademark notices and this permission notice shall -be included in all copies of one or more of the Font Software typefaces. - -The Font Software may be modified, altered, or added to, and in particular -the designs of glyphs or characters in the Fonts may be modified and -additional glyphs or characters may be added to the Fonts, only if the fonts -are renamed to names not containing either the words "Bitstream" or the word -"Vera". - -This License becomes null and void to the extent applicable to Fonts or Font -Software that has been modified and is distributed under the "Bitstream -Vera" names. - -The Font Software may be sold as part of a larger software package but no -copy of one or more of the Font Software typefaces may be sold by itself. - -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, -TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME -FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING -ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE -FONT SOFTWARE. - -Except as contained in this notice, the names of Gnome, the Gnome -Foundation, and Bitstream Inc., shall not be used in advertising or -otherwise to promote the sale, use or other dealings in this Font Software -without prior written authorization from the Gnome Foundation or Bitstream -Inc., respectively. For further information, contact: fonts at gnome dot -org. - -Arev Fonts Copyright ------------------------------- - -Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of the fonts accompanying this license ("Fonts") and -associated documentation files (the "Font Software"), to reproduce -and distribute the modifications to the Bitstream Vera Font Software, -including without limitation the rights to use, copy, merge, publish, -distribute, and/or sell copies of the Font Software, and to permit -persons to whom the Font Software is furnished to do so, subject to -the following conditions: - -The above copyright and trademark notices and this permission notice -shall be included in all copies of one or more of the Font Software -typefaces. - -The Font Software may be modified, altered, or added to, and in -particular the designs of glyphs or characters in the Fonts may be -modified and additional glyphs or characters may be added to the -Fonts, only if the fonts are renamed to names not containing either -the words "Tavmjong Bah" or the word "Arev". - -This License becomes null and void to the extent applicable to Fonts -or Font Software that has been modified and is distributed under the -"Tavmjong Bah Arev" names. - -The Font Software may be sold as part of a larger software package but -no copy of one or more of the Font Software typefaces may be sold by -itself. - -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL -TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM -OTHER DEALINGS IN THE FONT SOFTWARE. - -Except as contained in this notice, the name of Tavmjong Bah shall not -be used in advertising or otherwise to promote the sale, use or other -dealings in this Font Software without prior written authorization -from Tavmjong Bah. For further information, contact: tavmjong @ free -. fr. - -$Id: LICENSE 2133 2007-11-28 02:46:28Z lechimp $ diff --git a/examples/quick/extras/dashboard/images/fuel-icon.png b/examples/quick/extras/dashboard/images/fuel-icon.png deleted file mode 100644 index 70da758c2..000000000 Binary files a/examples/quick/extras/dashboard/images/fuel-icon.png and /dev/null differ diff --git a/examples/quick/extras/dashboard/images/temperature-icon.png b/examples/quick/extras/dashboard/images/temperature-icon.png deleted file mode 100644 index 5a4334e01..000000000 Binary files a/examples/quick/extras/dashboard/images/temperature-icon.png and /dev/null differ diff --git a/examples/quick/extras/dashboard/main.cpp b/examples/quick/extras/dashboard/main.cpp deleted file mode 100644 index 74ea07720..000000000 --- a/examples/quick/extras/dashboard/main.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 -#include -#include - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - QFontDatabase::addApplicationFont(":/fonts/DejaVuSans.ttf"); - app.setFont(QFont("DejaVu Sans")); - - QQmlApplicationEngine engine(QUrl("qrc:/qml/dashboard.qml")); - if (engine.rootObjects().isEmpty()) - return -1; - return app.exec(); -} diff --git a/examples/quick/extras/dashboard/qml/DashboardGaugeStyle.qml b/examples/quick/extras/dashboard/qml/DashboardGaugeStyle.qml deleted file mode 100644 index 598fce563..000000000 --- a/examples/quick/extras/dashboard/qml/DashboardGaugeStyle.qml +++ /dev/null @@ -1,164 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls.Styles 1.4 - -CircularGaugeStyle { - tickmarkInset: toPixels(0.04) - minorTickmarkInset: tickmarkInset - labelStepSize: 20 - labelInset: toPixels(0.23) - - property real xCenter: outerRadius - property real yCenter: outerRadius - property real needleLength: outerRadius - tickmarkInset * 1.25 - property real needleTipWidth: toPixels(0.02) - property real needleBaseWidth: toPixels(0.06) - property bool halfGauge: false - - function toPixels(percentage) { - return percentage * outerRadius; - } - - function degToRad(degrees) { - return degrees * (Math.PI / 180); - } - - function radToDeg(radians) { - return radians * (180 / Math.PI); - } - - function paintBackground(ctx) { - if (halfGauge) { - ctx.beginPath(); - ctx.rect(0, 0, ctx.canvas.width, ctx.canvas.height / 2); - ctx.clip(); - } - - ctx.beginPath(); - ctx.fillStyle = "black"; - ctx.ellipse(0, 0, ctx.canvas.width, ctx.canvas.height); - ctx.fill(); - - ctx.beginPath(); - ctx.lineWidth = tickmarkInset; - ctx.strokeStyle = "black"; - ctx.arc(xCenter, yCenter, outerRadius - ctx.lineWidth / 2, outerRadius - ctx.lineWidth / 2, 0, Math.PI * 2); - ctx.stroke(); - - ctx.beginPath(); - ctx.lineWidth = tickmarkInset / 2; - ctx.strokeStyle = "#222"; - ctx.arc(xCenter, yCenter, outerRadius - ctx.lineWidth / 2, outerRadius - ctx.lineWidth / 2, 0, Math.PI * 2); - ctx.stroke(); - - ctx.beginPath(); - var gradient = ctx.createRadialGradient(xCenter, yCenter, outerRadius * 0.8, xCenter, yCenter, outerRadius); - gradient.addColorStop(0, Qt.rgba(1, 1, 1, 0)); - gradient.addColorStop(0.7, Qt.rgba(1, 1, 1, 0.13)); - gradient.addColorStop(1, Qt.rgba(1, 1, 1, 1)); - ctx.fillStyle = gradient; - ctx.arc(xCenter, yCenter, outerRadius - tickmarkInset, outerRadius - tickmarkInset, 0, Math.PI * 2); - ctx.fill(); - } - - background: Canvas { - onPaint: { - var ctx = getContext("2d"); - ctx.reset(); - paintBackground(ctx); - } - - Text { - id: speedText - font.pixelSize: toPixels(0.3) - text: kphInt - color: "white" - horizontalAlignment: Text.AlignRight - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.verticalCenter - anchors.topMargin: toPixels(0.1) - - readonly property int kphInt: control.value - } - Text { - text: "km/h" - color: "white" - font.pixelSize: toPixels(0.09) - anchors.top: speedText.bottom - anchors.horizontalCenter: parent.horizontalCenter - } - } - - needle: Canvas { - implicitWidth: needleBaseWidth - implicitHeight: needleLength - - property real xCenter: width / 2 - property real yCenter: height / 2 - - onPaint: { - var ctx = getContext("2d"); - ctx.reset(); - - ctx.beginPath(); - ctx.moveTo(xCenter, height); - ctx.lineTo(xCenter - needleBaseWidth / 2, height - needleBaseWidth / 2); - ctx.lineTo(xCenter - needleTipWidth / 2, 0); - ctx.lineTo(xCenter, yCenter - needleLength); - ctx.lineTo(xCenter, 0); - ctx.closePath(); - ctx.fillStyle = Qt.rgba(0.66, 0, 0, 0.66); - ctx.fill(); - - ctx.beginPath(); - ctx.moveTo(xCenter, height) - ctx.lineTo(width, height - needleBaseWidth / 2); - ctx.lineTo(xCenter + needleTipWidth / 2, 0); - ctx.lineTo(xCenter, 0); - ctx.closePath(); - ctx.fillStyle = Qt.lighter(Qt.rgba(0.66, 0, 0, 0.66)); - ctx.fill(); - } - } - - foreground: null -} diff --git a/examples/quick/extras/dashboard/qml/IconGaugeStyle.qml b/examples/quick/extras/dashboard/qml/IconGaugeStyle.qml deleted file mode 100644 index 0c3d93204..000000000 --- a/examples/quick/extras/dashboard/qml/IconGaugeStyle.qml +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls.Styles 1.4 -import QtQuick.Extras 1.4 - -DashboardGaugeStyle { - id: fuelGaugeStyle - minimumValueAngle: -60 - maximumValueAngle: 60 - tickmarkStepSize: 1 - labelStepSize: 1 - labelInset: toPixels(-0.25) - minorTickmarkCount: 3 - - needleLength: toPixels(0.85) - needleBaseWidth: toPixels(0.08) - needleTipWidth: toPixels(0.03) - - halfGauge: true - - property string icon: "" - property color minWarningColor: "transparent" - property color maxWarningColor: "transparent" - readonly property real minWarningStartAngle: minimumValueAngle - 90 - readonly property real maxWarningStartAngle: maximumValueAngle - 90 - - tickmark: Rectangle { - implicitWidth: toPixels(0.06) - antialiasing: true - implicitHeight: toPixels(0.2) - color: "#c8c8c8" - } - - minorTickmark: Rectangle { - implicitWidth: toPixels(0.03) - antialiasing: true - implicitHeight: toPixels(0.15) - color: "#c8c8c8" - } - - background: Item { - Canvas { - anchors.fill: parent - onPaint: { - var ctx = getContext("2d"); - ctx.reset(); - - paintBackground(ctx); - - if (minWarningColor != "transparent") { - ctx.beginPath(); - ctx.lineWidth = fuelGaugeStyle.toPixels(0.08); - ctx.strokeStyle = minWarningColor; - ctx.arc(outerRadius, outerRadius, - // Start the line in from the decorations, and account for the width of the line itself. - outerRadius - tickmarkInset - ctx.lineWidth / 2, - degToRad(minWarningStartAngle), - degToRad(minWarningStartAngle + angleRange / (minorTickmarkCount + 1)), false); - ctx.stroke(); - } - if (maxWarningColor != "transparent") { - ctx.beginPath(); - ctx.lineWidth = fuelGaugeStyle.toPixels(0.08); - ctx.strokeStyle = maxWarningColor; - ctx.arc(outerRadius, outerRadius, - // Start the line in from the decorations, and account for the width of the line itself. - outerRadius - tickmarkInset - ctx.lineWidth / 2, - degToRad(maxWarningStartAngle - angleRange / (minorTickmarkCount + 1)), - degToRad(maxWarningStartAngle), false); - ctx.stroke(); - } - } - } - - Image { - source: icon - anchors.bottom: parent.verticalCenter - anchors.bottomMargin: toPixels(0.3) - anchors.horizontalCenter: parent.horizontalCenter - width: toPixels(0.3) - height: width - fillMode: Image.PreserveAspectFit - } - } -} diff --git a/examples/quick/extras/dashboard/qml/TachometerStyle.qml b/examples/quick/extras/dashboard/qml/TachometerStyle.qml deleted file mode 100644 index a0f7b6b9a..000000000 --- a/examples/quick/extras/dashboard/qml/TachometerStyle.qml +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls.Styles 1.4 -import QtQuick.Extras 1.4 - -DashboardGaugeStyle { - id: tachometerStyle - tickmarkStepSize: 1 - labelStepSize: 1 - needleLength: toPixels(0.85) - needleBaseWidth: toPixels(0.08) - needleTipWidth: toPixels(0.03) - - tickmark: Rectangle { - implicitWidth: toPixels(0.03) - antialiasing: true - implicitHeight: toPixels(0.08) - color: styleData.index === 7 || styleData.index === 8 ? Qt.rgba(0.5, 0, 0, 1) : "#c8c8c8" - } - - minorTickmark: null - - tickmarkLabel: Text { - font.pixelSize: Math.max(6, toPixels(0.12)) - text: styleData.value - color: styleData.index === 7 || styleData.index === 8 ? Qt.rgba(0.5, 0, 0, 1) : "#c8c8c8" - antialiasing: true - } - - background: Canvas { - onPaint: { - var ctx = getContext("2d"); - ctx.reset(); - paintBackground(ctx); - - ctx.beginPath(); - ctx.lineWidth = tachometerStyle.toPixels(0.08); - ctx.strokeStyle = Qt.rgba(0.5, 0, 0, 1); - var warningCircumference = maximumValueAngle - minimumValueAngle * 0.1; - var startAngle = maximumValueAngle - 90; - ctx.arc(outerRadius, outerRadius, - // Start the line in from the decorations, and account for the width of the line itself. - outerRadius - tickmarkInset - ctx.lineWidth / 2, - degToRad(startAngle - angleRange / 8 + angleRange * 0.015), - degToRad(startAngle - angleRange * 0.015), false); - ctx.stroke(); - } - - Text { - id: rpmText - font.pixelSize: tachometerStyle.toPixels(0.3) - text: rpmInt - color: "white" - horizontalAlignment: Text.AlignRight - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.verticalCenter - anchors.topMargin: 20 - - readonly property int rpmInt: valueSource.rpm - } - Text { - text: "x1000" - color: "white" - font.pixelSize: tachometerStyle.toPixels(0.1) - anchors.top: parent.top - anchors.topMargin: parent.height / 4 - anchors.horizontalCenter: parent.horizontalCenter - } - Text { - text: "RPM" - color: "white" - font.pixelSize: tachometerStyle.toPixels(0.1) - anchors.top: rpmText.bottom - anchors.horizontalCenter: parent.horizontalCenter - } - } -} diff --git a/examples/quick/extras/dashboard/qml/TurnIndicator.qml b/examples/quick/extras/dashboard/qml/TurnIndicator.qml deleted file mode 100644 index cf9c41db3..000000000 --- a/examples/quick/extras/dashboard/qml/TurnIndicator.qml +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 - -Item { - // This enum is actually keyboard-related, but it serves its purpose - // as an indication of direction for us. - property int direction: Qt.LeftArrow - property bool on: false - - property bool flashing: false - - scale: direction === Qt.LeftArrow ? 1 : -1 - - Timer { - id: flashTimer - interval: 500 - running: on - repeat: true - onTriggered: flashing = !flashing - } - - function paintOutlinePath(ctx) { - ctx.beginPath(); - ctx.moveTo(0, height * 0.5); - ctx.lineTo(0.6 * width, 0); - ctx.lineTo(0.6 * width, height * 0.28); - ctx.lineTo(width, height * 0.28); - ctx.lineTo(width, height * 0.72); - ctx.lineTo(0.6 * width, height * 0.72); - ctx.lineTo(0.6 * width, height); - ctx.lineTo(0, height * 0.5); - } - - Canvas { - id: backgroundCanvas - anchors.fill: parent - - onPaint: { - var ctx = getContext("2d"); - ctx.reset(); - - paintOutlinePath(ctx); - - ctx.lineWidth = 1; - ctx.strokeStyle = "black"; - ctx.stroke(); - } - } - - Canvas { - id: foregroundCanvas - anchors.fill: parent - visible: on && flashing - - onPaint: { - var ctx = getContext("2d"); - ctx.reset(); - - paintOutlinePath(ctx); - - ctx.fillStyle = "green"; - ctx.fill(); - } - } -} diff --git a/examples/quick/extras/dashboard/qml/ValueSource.qml b/examples/quick/extras/dashboard/qml/ValueSource.qml deleted file mode 100644 index 39d35966a..000000000 --- a/examples/quick/extras/dashboard/qml/ValueSource.qml +++ /dev/null @@ -1,320 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 - -Item { - id: valueSource - property real kph: 0 - property real rpm: 1 - property real fuel: 0.85 - property string gear: { - var g; - if (kph == 0) { - return "P"; - } - if (kph < 30) { - return "1"; - } - if (kph < 50) { - return "2"; - } - if (kph < 80) { - return "3"; - } - if (kph < 120) { - return "4"; - } - if (kph < 160) { - return "5"; - } - } - property int turnSignal: gear == "P" && !start ? randomDirection() : -1 - property real temperature: 0.6 - property bool start: true - - function randomDirection() { - return Math.random() > 0.5 ? Qt.LeftArrow : Qt.RightArrow; - } - - SequentialAnimation { - running: true - loops: 1 - - // We want a small pause at the beginning, but we only want it to happen once. - PauseAnimation { - duration: 1000 - } - - PropertyAction { - target: valueSource - property: "start" - value: false - } - - SequentialAnimation { - loops: Animation.Infinite - - ParallelAnimation { - NumberAnimation { - target: valueSource - property: "kph" - easing.type: Easing.InOutSine - from: 0 - to: 30 - duration: 3000 - } - NumberAnimation { - target: valueSource - property: "rpm" - easing.type: Easing.InOutSine - from: 1 - to: 6.1 - duration: 3000 - } - } - ParallelAnimation { - // We changed gears so we lost a bit of speed. - NumberAnimation { - target: valueSource - property: "kph" - easing.type: Easing.InOutSine - from: 30 - to: 26 - duration: 600 - } - NumberAnimation { - target: valueSource - property: "rpm" - easing.type: Easing.InOutSine - from: 6 - to: 2.4 - duration: 600 - } - } - ParallelAnimation { - NumberAnimation { - target: valueSource - property: "kph" - easing.type: Easing.InOutSine - to: 60 - duration: 3000 - } - NumberAnimation { - target: valueSource - property: "rpm" - easing.type: Easing.InOutSine - to: 5.6 - duration: 3000 - } - } - ParallelAnimation { - // We changed gears so we lost a bit of speed. - NumberAnimation { - target: valueSource - property: "kph" - easing.type: Easing.InOutSine - to: 56 - duration: 600 - } - NumberAnimation { - target: valueSource - property: "rpm" - easing.type: Easing.InOutSine - to: 2.3 - duration: 600 - } - } - ParallelAnimation { - NumberAnimation { - target: valueSource - property: "kph" - easing.type: Easing.InOutSine - to: 100 - duration: 3000 - } - NumberAnimation { - target: valueSource - property: "rpm" - easing.type: Easing.InOutSine - to: 5.1 - duration: 3000 - } - } - ParallelAnimation { - // We changed gears so we lost a bit of speed. - NumberAnimation { - target: valueSource - property: "kph" - easing.type: Easing.InOutSine - to: 96 - duration: 600 - } - NumberAnimation { - target: valueSource - property: "rpm" - easing.type: Easing.InOutSine - to: 2.2 - duration: 600 - } - } - - ParallelAnimation { - NumberAnimation { - target: valueSource - property: "kph" - easing.type: Easing.InOutSine - to: 140 - duration: 3000 - } - NumberAnimation { - target: valueSource - property: "rpm" - easing.type: Easing.InOutSine - to: 6.2 - duration: 3000 - } - } - - // Start downshifting. - - // Fifth to fourth gear. - ParallelAnimation { - NumberAnimation { - target: valueSource - property: "kph" - easing.type: Easing.Linear - to: 100 - duration: 5000 - } - - NumberAnimation { - target: valueSource - property: "rpm" - easing.type: Easing.InOutSine - to: 3.1 - duration: 5000 - } - } - - // Fourth to third gear. - NumberAnimation { - target: valueSource - property: "rpm" - easing.type: Easing.InOutSine - to: 5.5 - duration: 600 - } - - ParallelAnimation { - NumberAnimation { - target: valueSource - property: "kph" - easing.type: Easing.InOutSine - to: 60 - duration: 5000 - } - NumberAnimation { - target: valueSource - property: "rpm" - easing.type: Easing.InOutSine - to: 2.6 - duration: 5000 - } - } - - // Third to second gear. - NumberAnimation { - target: valueSource - property: "rpm" - easing.type: Easing.InOutSine - to: 6.3 - duration: 600 - } - - ParallelAnimation { - NumberAnimation { - target: valueSource - property: "kph" - easing.type: Easing.InOutSine - to: 30 - duration: 5000 - } - NumberAnimation { - target: valueSource - property: "rpm" - easing.type: Easing.InOutSine - to: 2.6 - duration: 5000 - } - } - - NumberAnimation { - target: valueSource - property: "rpm" - easing.type: Easing.InOutSine - to: 6.5 - duration: 600 - } - - // Second to first gear. - ParallelAnimation { - NumberAnimation { - target: valueSource - property: "kph" - easing.type: Easing.InOutSine - to: 0 - duration: 5000 - } - NumberAnimation { - target: valueSource - property: "rpm" - easing.type: Easing.InOutSine - to: 1 - duration: 4500 - } - } - - PauseAnimation { - duration: 5000 - } - } - } -} diff --git a/examples/quick/extras/dashboard/qml/dashboard.qml b/examples/quick/extras/dashboard/qml/dashboard.qml deleted file mode 100644 index 756d96a50..000000000 --- a/examples/quick/extras/dashboard/qml/dashboard.qml +++ /dev/null @@ -1,174 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Window 2.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtQuick.Extras 1.4 - -Window { - id: root - visible: true - width: 1024 - height: 600 - - color: "#161616" - title: "Qt Quick Extras Demo" - - ValueSource { - id: valueSource - } - - // Dashboards are typically in a landscape orientation, so we need to ensure - // our height is never greater than our width. - Item { - id: container - width: root.width - height: Math.min(root.width, root.height) - anchors.centerIn: parent - - Row { - id: gaugeRow - spacing: container.width * 0.02 - anchors.centerIn: parent - - TurnIndicator { - id: leftIndicator - anchors.verticalCenter: parent.verticalCenter - width: height - height: container.height * 0.1 - gaugeRow.spacing - - direction: Qt.LeftArrow - on: valueSource.turnSignal == Qt.LeftArrow - } - - Item { - width: height - height: container.height * 0.25 - gaugeRow.spacing - anchors.verticalCenter: parent.verticalCenter - - CircularGauge { - id: fuelGauge - value: valueSource.fuel - maximumValue: 1 - y: parent.height / 2 - height / 2 - container.height * 0.01 - width: parent.width - height: parent.height * 0.7 - - style: IconGaugeStyle { - id: fuelGaugeStyle - - icon: "qrc:/images/fuel-icon.png" - minWarningColor: Qt.rgba(0.5, 0, 0, 1) - - tickmarkLabel: Text { - color: "white" - visible: styleData.value === 0 || styleData.value === 1 - font.pixelSize: fuelGaugeStyle.toPixels(0.225) - text: styleData.value === 0 ? "E" : (styleData.value === 1 ? "F" : "") - } - } - } - - CircularGauge { - value: valueSource.temperature - maximumValue: 1 - width: parent.width - height: parent.height * 0.7 - y: parent.height / 2 + container.height * 0.01 - - style: IconGaugeStyle { - id: tempGaugeStyle - - icon: "qrc:/images/temperature-icon.png" - maxWarningColor: Qt.rgba(0.5, 0, 0, 1) - - tickmarkLabel: Text { - color: "white" - visible: styleData.value === 0 || styleData.value === 1 - font.pixelSize: tempGaugeStyle.toPixels(0.225) - text: styleData.value === 0 ? "C" : (styleData.value === 1 ? "H" : "") - } - } - } - } - - CircularGauge { - id: speedometer - value: valueSource.kph - anchors.verticalCenter: parent.verticalCenter - maximumValue: 280 - // We set the width to the height, because the height will always be - // the more limited factor. Also, all circular controls letterbox - // their contents to ensure that they remain circular. However, we - // don't want to extra space on the left and right of our gauges, - // because they're laid out horizontally, and that would create - // large horizontal gaps between gauges on wide screens. - width: height - height: container.height * 0.5 - - style: DashboardGaugeStyle {} - } - - CircularGauge { - id: tachometer - width: height - height: container.height * 0.25 - gaugeRow.spacing - value: valueSource.rpm - maximumValue: 8 - anchors.verticalCenter: parent.verticalCenter - - style: TachometerStyle {} - } - - TurnIndicator { - id: rightIndicator - anchors.verticalCenter: parent.verticalCenter - width: height - height: container.height * 0.1 - gaugeRow.spacing - - direction: Qt.RightArrow - on: valueSource.turnSignal == Qt.RightArrow - } - - } - } -} diff --git a/examples/quick/extras/extras.pro b/examples/quick/extras/extras.pro deleted file mode 100644 index 7f7b72156..000000000 --- a/examples/quick/extras/extras.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += \ - gallery \ - dashboard \ - flat diff --git a/examples/quick/extras/flat/Content.qml b/examples/quick/extras/flat/Content.qml deleted file mode 100644 index 2969f7305..000000000 --- a/examples/quick/extras/flat/Content.qml +++ /dev/null @@ -1,706 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.4 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import QtQuick.Extras 1.4 -import QtQuick.XmlListModel 2.0 - -Item { - anchors.fill: parent - - Text { - id: text - visible: false - } - - FontMetrics { - id: fontMetrics - font.family: Flat.FlatStyle.fontFamily - } - - readonly property int layoutSpacing: Math.round(5 * Flat.FlatStyle.scaleFactor) - - property var componentModel: [ - { name: "Buttons", component: buttonsComponent }, - { name: "Calendar", component: calendarComponent }, - { name: "DelayButton", component: delayButtonComponent }, - { name: "Dial", component: dialComponent }, - { name: "Input", component: inputComponent }, - { name: "PieMenu", component: pieMenuComponent }, - { name: "Progress", component: progressComponent }, - { name: "TableView", component: tableViewComponent }, - { name: "TextArea", component: textAreaComponent }, - { name: "Tumbler", component: tumblerComponent } - ] - - Loader { - id: componentLoader - anchors.fill: parent - sourceComponent: componentModel[controlData.componentIndex].component - } - - property Component buttonsComponent: ScrollView { - id: scrollView - horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff - - Flickable { - anchors.fill: parent - contentWidth: viewport.width - contentHeight: buttoncolumn.implicitHeight + textMargins * 1.5 - ColumnLayout { - id: buttoncolumn - anchors.fill: parent - anchors.margins: textMargins - anchors.topMargin: textMargins / 2 - spacing: textMargins / 2 - enabled: !settingsData.allDisabled - - GroupBox { - title: "Button" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - GridLayout { - columns: Math.max(1, Math.floor(scrollView.width / button.implicitWidth - 0.5)) - Button { - id: button - text: "Normal" - } - Button { - text: "Default" - isDefault: true - } - Button { - text: "Checkable" - checkable: true - } - Button { - text: "Menu" - menu: Menu { - MenuItem { text: "Normal"; shortcut: "Ctrl+N" } - MenuSeparator { } - MenuItem { text: "Checkable 1"; checkable: true; checked: true } - MenuItem { text: "Checkable 2"; checkable: true; checked: true } - MenuSeparator { } - } - visible: Qt.application.supportsMultipleWindows - } - } - } - - GroupBox { - title: "RadioButton" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - ExclusiveGroup { id: radiobuttongroup } - ColumnLayout { - anchors.fill: parent - Repeater { - model: ["First", "Second", "Third"] - RadioButton { - text: modelData - checked: index === 0 - exclusiveGroup: radiobuttongroup - Layout.fillWidth: true - } - } - } - } - - GroupBox { - title: "CheckBox" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - ColumnLayout { - anchors.fill: parent - Repeater { - model: ["First", "Second", "Third"] - CheckBox { - text: modelData - checked: index === 0 - Layout.fillWidth: true - } - } - } - } - - GroupBox { - title: "Switch" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - ColumnLayout { - anchors.fill: parent - Repeater { - model: ["First", "Second", "Third"] - RowLayout { - spacing: layoutSpacing * 2 - Label { - text: modelData - font.family: Flat.FlatStyle.fontFamily - renderType: Text.QtRendering - Layout.preferredWidth: fontMetrics.advanceWidth("Second") - } - Switch { checked: index == 0 } - } - } - } - } - - GroupBox { - title: "ToggleButton" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - GridLayout { - columns: Math.max(1, !!children[0] ? Math.floor(scrollView.width / children[0].implicitWidth - 0.5) : children.length) - ToggleButton { - text: "Pump 1" - checked: true - } - ToggleButton { - text: "Pump 2" - checked: false - } - } - } - - GroupBox { - title: "StatusIndicator" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - GridLayout { - columns: Math.max(1, Math.floor(scrollView.width / recordButton.implicitWidth - 0.5)) - columnSpacing: layoutSpacing * 4 - - Button { - id: recordButton - text: "Record" - Layout.alignment: Qt.AlignTop - onClicked: recordStatusIndicator.active = !recordStatusIndicator.active - - StatusIndicator { - id: recordStatusIndicator - active: false - anchors.left: parent.left - anchors.leftMargin: Math.max(6, Math.round(text.implicitHeight * 0.4)) - anchors.verticalCenter: parent.verticalCenter - rotation: 90 - } - } - ColumnLayout { - Repeater { - model: 3 - delegate: RowLayout { - Layout.alignment: Qt.AlignCenter - StatusIndicator { - active: true - color: "#f09116" - } - Label { - text: "Camera " + (index + 1) - font.family: Flat.FlatStyle.fontFamily - renderType: Text.QtRendering - } - } - } - } - } - } - } - } - } - - property Component progressComponent: ScrollView { - id: scrollView - horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff - Flickable { - anchors.fill: parent - contentWidth: viewport.width - contentHeight: progresscolumn.implicitHeight + textMargins * 1.5 - ColumnLayout { - id: progresscolumn - anchors.fill: parent - anchors.leftMargin: textMargins - anchors.rightMargin: textMargins - anchors.bottomMargin: textMargins - anchors.topMargin: textMargins / 2 - spacing: textMargins / 2 - enabled: !settingsData.allDisabled - - GroupBox { - title: "BusyIndicator" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - BusyIndicator { - id: busyindicator - anchors.centerIn: parent - running: scrollView.visible - } - } - - GroupBox { - title: "ProgressBar" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - ColumnLayout { - anchors.fill: parent - ProgressBar { - value: slider.value - maximumValue: slider.maximumValue - Layout.fillWidth: true - } - ProgressBar { - indeterminate: true - value: slider.value - maximumValue: slider.maximumValue - Layout.fillWidth: true - } - } - } - - GroupBox { - title: "Slider" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - ColumnLayout { - anchors.fill: parent - Slider { - id: slider - // TODO: can't use maximumValue / 2 here, otherwise the gauges - // initially show up as empty; find out why. - value: 50 - // If we use the default value of 1 here, we run into QTBUG-42358, - // even though that report specifically uses 100 as an example... - maximumValue: 100 - Layout.fillWidth: true - } - } - } - - GroupBox { - title: "Gauge" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - Gauge { - id: gauge - value: slider.value * 1.4 - orientation: window.width < window.height ? Qt.Vertical : Qt.Horizontal - minimumValue: slider.minimumValue * 1.4 - maximumValue: slider.maximumValue * 1.4 - tickmarkStepSize: 20 - - anchors.centerIn: parent - } - } - - GroupBox { - title: "CircularGauge" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - Layout.minimumWidth: 0 - CircularGauge { - id: circularGauge - value: slider.value * 3.2 - minimumValue: slider.minimumValue * 3.2 - maximumValue: slider.maximumValue * 3.2 - - anchors.centerIn: parent - width: Math.min(implicitWidth, parent.width) - height: Math.min(implicitHeight, parent.height) - - style: Flat.CircularGaugeStyle { - tickmarkStepSize: 20 - labelStepSize: 40 - minorTickmarkCount: 2 - } - - Column { - anchors.centerIn: parent - - Label { - text: Math.floor(circularGauge.value) - anchors.horizontalCenter: parent.horizontalCenter - renderType: Text.QtRendering - font.pixelSize: unitLabel.font.pixelSize * 2 - font.family: Flat.FlatStyle.fontFamily - font.weight: Font.Light - } - Label { - id: unitLabel - text: "km/h" - renderType: Text.QtRendering - font.family: Flat.FlatStyle.fontFamily - anchors.horizontalCenter: parent.horizontalCenter - } - } - } - } - } - } - } - - property Component inputComponent: ScrollView { - id: scrollView - horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff - Flickable { - anchors.fill: parent - contentWidth: viewport.width - contentHeight: inputcolumn.implicitHeight + textMargins * 1.5 - ColumnLayout { - id: inputcolumn - anchors.fill: parent - anchors.margins: textMargins - spacing: textMargins / 2 - enabled: !settingsData.allDisabled - - GroupBox { - title: "TextField" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - ColumnLayout { - anchors.fill: parent - TextField { - z: 1 - placeholderText: "TextField" - Layout.fillWidth: true - } - TextField { - placeholderText: "Password" - echoMode: TextInput.Password // TODO: PasswordEchoOnEdit - Layout.fillWidth: true - } - } - } - - GroupBox { - title: "ComboBox" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - visible: Qt.application.supportsMultipleWindows - ColumnLayout { - anchors.fill: parent - ComboBox { - model: ["Option 1", "Option 2", "Option 3"] - Layout.fillWidth: true - } - ComboBox { - editable: true - model: ListModel { - id: combomodel - ListElement { text: "Option 1" } - ListElement { text: "Option 2" } - ListElement { text: "Option 3" } - } - onAccepted: { - if (find(currentText) === -1) { - combomodel.append({text: editText}) - currentIndex = find(editText) - } - } - Layout.fillWidth: true - } - } - } - - GroupBox { - title: "SpinBox" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - GridLayout { - anchors.fill: parent - columns: Math.max(1, Math.floor(scrollView.width / spinbox.implicitWidth - 0.5)) - SpinBox { - id: spinbox - Layout.fillWidth: true - } - SpinBox { - decimals: 1 - Layout.fillWidth: true - } - } - } - } - } - } - - Component { - id: tableViewComponent - TableView { - id: view - enabled: !settingsData.allDisabled - TableViewColumn { - role: "title" - title: "Title" - width: view.width / 2 - resizable: false - movable: false - } - TableViewColumn { - role: "author" - title: "Author" - width: view.width / 2 - resizable: false - movable: false - } - - frameVisible: false - backgroundVisible: true - alternatingRowColors: false - model: ListModel { - ListElement { - title: "Moby-Dick" - author: "Herman Melville" - } - ListElement { - title: "The Adventures of Tom Sawyer" - author: "Mark Twain" - } - ListElement { - title: "Cat’s Cradle" - author: "Kurt Vonnegut" - } - ListElement { - title: "Farenheit 451" - author: "Ray Bradbury" - } - ListElement { - title: "It" - author: "Stephen King" - } - ListElement { - title: "On the Road" - author: "Jack Kerouac" - } - ListElement { - title: "Of Mice and Men" - author: "John Steinbeck" - } - ListElement { - title: "Do Androids Dream of Electric Sheep?" - author: "Philip K. Dick" - } - ListElement { - title: "Uncle Tom’s Cabin" - author: "Harriet Beecher Stowe" - } - ListElement { - title: "The Call of the Wild" - author: "Jack London" - } - ListElement { - title: "The Old Man and the Sea" - author: "Ernest Hemingway" - } - ListElement { - title: "A Streetcar Named Desire" - author: "Tennessee Williams" - } - ListElement { - title: "Catch-22" - author: "Joseph Heller" - } - ListElement { - title: "One Flew Over the Cuckoo’s Nest" - author: "Ken Kesey" - } - ListElement { - title: "The Murders in the Rue Morgue" - author: "Edgar Allan Poe" - } - ListElement { - title: "Breakfast at Tiffany’s" - author: "Truman Capote" - } - ListElement { - title: "Death of a Salesman" - author: "Arthur Miller" - } - ListElement { - title: "Post Office" - author: "Charles Bukowski" - } - ListElement { - title: "Herbert West—Reanimator" - author: "H. P. Lovecraft" - } - } - } - } - Component { - id: calendarComponent - Item { - enabled: !settingsData.allDisabled - Calendar { - anchors.centerIn: parent - weekNumbersVisible: true - frameVisible: settingsData.frames - } - } - } - Component { - id: textAreaComponent - TextArea { - enabled: !settingsData.allDisabled - frameVisible: false - flickableItem.flickableDirection: Flickable.VerticalFlick - text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum quis justo a sem faucibus mattis nec vitae nisi. Fusce fringilla nulla a tellus vehicula sodales. Etiam volutpat suscipit erat vitae adipiscing. Sed vestibulum massa nisl, eget posuere urna porta ac. Morbi at nunc ligula. Cras et mauris aliquet ligula sodales suscipit eget imperdiet augue. Ut eget dui eu magna malesuada imperdiet. Donec imperdiet urna eu consequat ornare. Cras at metus tristique, ullamcorper nisl ut, faucibus mauris. Fusce in euismod arcu. Donec tristique rutrum porta. Praesent mattis ac tortor quis scelerisque. Integer luctus nulla ut lacinia tempus." - } - } - Component { - id: pieMenuComponent - Item { - enabled: !settingsData.allDisabled - - Column { - anchors.fill: parent - anchors.bottom: parent.bottom - anchors.bottomMargin: controlData.textMargins - spacing: Math.round(controlData.textMargins * 0.5) - - Image { - id: pieMenuImage - source: "qrc:/images/piemenu-image-rgb.jpg" - fillMode: Image.PreserveAspectFit - width: parent.width - height: Math.min((width / sourceSize.width) * sourceSize.height, (parent.height - parent.spacing) * 0.88) - } - Item { - width: parent.width - height: parent.height - pieMenuImage.height - parent.spacing - - Text { - id: instructionText - anchors.fill: parent - anchors.leftMargin: controlData.textMargins - anchors.rightMargin: controlData.textMargins - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - text: "Tap and hold to open menu" - font.family: Flat.FlatStyle.fontFamily - font.pixelSize: Math.round(20 * Flat.FlatStyle.scaleFactor) - fontSizeMode: Text.Fit - color: Flat.FlatStyle.lightFrameColor - } - } - } - MouseArea { - id: mouseArea - anchors.fill: parent - onPressAndHold: pieMenu.popup(mouse.x, mouse.y) - } - PieMenu { - id: pieMenu - triggerMode: TriggerMode.TriggerOnClick - - MenuItem { - iconSource: "qrc:/images/piemenu-rgb-" + (pieMenu.currentIndex === 0 ? "pressed" : "normal") + ".png" - onTriggered: pieMenuImage.source = "qrc:/images/piemenu-image-rgb.jpg" - } - MenuItem { - iconSource: "qrc:/images/piemenu-bw-" + (pieMenu.currentIndex === 1 ? "pressed" : "normal") + ".png" - onTriggered: pieMenuImage.source = "qrc:/images/piemenu-image-bw.jpg" - } - MenuItem { - iconSource: "qrc:/images/piemenu-sepia-" + (pieMenu.currentIndex === 2 ? "pressed" : "normal") + ".png" - onTriggered: pieMenuImage.source = "qrc:/images/piemenu-image-sepia.jpg" - } - } - } - } - Component { - id: delayButtonComponent - Item { - enabled: !settingsData.allDisabled - DelayButton { - text: progress < 1 ? "START" : "STOP" - anchors.centerIn: parent - } - } - } - Component { - id: dialComponent - Item { - enabled: !settingsData.allDisabled - Dial { - anchors.centerIn: parent - } - } - } - Component { - id: tumblerComponent - Item { - enabled: !settingsData.allDisabled - Tumbler { - anchors.centerIn: parent - TumblerColumn { - model: { - var hours = []; - for (var i = 1; i <= 24; ++i) - hours.push(i < 10 ? "0" + i : i); - hours; - } - } - TumblerColumn { - model: { - var minutes = []; - for (var i = 0; i < 60; ++i) - minutes.push(i < 10 ? "0" + i : i); - minutes; - } - } - } - } - } -} diff --git a/examples/quick/extras/flat/SettingsIcon.qml b/examples/quick/extras/flat/SettingsIcon.qml deleted file mode 100644 index e494e5370..000000000 --- a/examples/quick/extras/flat/SettingsIcon.qml +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.4 - -Canvas { - onPaint: { - var ctx = getContext("2d"); - ctx.reset(); - - ctx.scale(width, height); - - ctx.beginPath(); - ctx.moveTo(0.706,0.542); - ctx.bezierCurveTo(0.709,0.527,0.711,0.512,0.711,0.49700000000000005); - ctx.bezierCurveTo(0.711,0.4820000000000001,0.709,0.465,0.706,0.451); - ctx.lineTo(0.752,0.41600000000000004); - ctx.lineTo(0.759,0.41); - ctx.lineTo(0.756,0.4); - ctx.bezierCurveTo(0.756,0.399,0.749,0.382,0.737,0.36200000000000004); - ctx.bezierCurveTo(0.725,0.3420000000000001,0.714,0.328,0.714,0.327); - ctx.lineTo(0.708,0.319); - ctx.lineTo(0.698,0.324); - ctx.lineTo(0.645,0.346); - ctx.bezierCurveTo(0.623,0.32499999999999996,0.595,0.309,0.5650000000000001,0.3); - ctx.lineTo(0.558,0.243); - ctx.lineTo(0.557,0.23299999999999998); - ctx.lineTo(0.547,0.23099999999999998); - ctx.bezierCurveTo(0.546,0.23099999999999998,0.528,0.22799999999999998,0.505,0.22799999999999998); - ctx.bezierCurveTo(0.481,0.22799999999999998,0.463,0.23099999999999998,0.463,0.23099999999999998); - ctx.lineTo(0.453,0.23299999999999998); - ctx.lineTo(0.452,0.243); - ctx.lineTo(0.444,0.299); - ctx.bezierCurveTo(0.41400000000000003,0.308,0.387,0.324,0.364,0.345); - ctx.lineTo(0.312,0.323); - ctx.lineTo(0.302,0.319); - ctx.lineTo(0.296,0.327); - ctx.bezierCurveTo(0.296,0.327,0.284,0.342,0.27299999999999996,0.362); - ctx.bezierCurveTo(0.26,0.383,0.254,0.399,0.254,0.4); - ctx.lineTo(0.25,0.41); - ctx.lineTo(0.258,0.416); - ctx.lineTo(0.303,0.45099999999999996); - ctx.bezierCurveTo(0.3,0.465,0.299,0.48,0.299,0.497); - ctx.bezierCurveTo(0.299,0.513,0.3,0.528,0.304,0.543); - ctx.lineTo(0.259,0.577); - ctx.lineTo(0.25,0.584); - ctx.lineTo(0.254,0.593); - ctx.bezierCurveTo(0.254,0.594,0.261,0.61,0.273,0.63); - ctx.bezierCurveTo(0.28500000000000003,0.65,0.29500000000000004,0.664,0.29600000000000004,0.665); - ctx.lineTo(0.30200000000000005,0.673); - ctx.lineTo(0.31200000000000006,0.669); - ctx.lineTo(0.36500000000000005,0.647); - ctx.bezierCurveTo(0.38700000000000007,0.668,0.41400000000000003,0.684,0.44400000000000006,0.6930000000000001); - ctx.lineTo(0.45200000000000007,0.7510000000000001); - ctx.lineTo(0.45300000000000007,0.7620000000000001); - ctx.lineTo(0.4640000000000001,0.7630000000000001); - ctx.bezierCurveTo(0.4640000000000001,0.7630000000000001,0.4820000000000001,0.7640000000000001,0.5060000000000001,0.7640000000000001); - ctx.bezierCurveTo(0.5300000000000001,0.7640000000000001,0.5470000000000002,0.7620000000000001,0.5480000000000002,0.7620000000000001); - ctx.lineTo(0.5580000000000002,0.7610000000000001); - ctx.lineTo(0.5590000000000002,0.7510000000000001); - ctx.lineTo(0.5660000000000002,0.6940000000000001); - ctx.bezierCurveTo(0.5960000000000002,0.685,0.6230000000000002,0.669,0.6460000000000001,0.648); - ctx.lineTo(0.6990000000000002,0.67); - ctx.lineTo(0.7090000000000002,0.674); - ctx.lineTo(0.7150000000000002,0.665); - ctx.bezierCurveTo(0.7150000000000002,0.665,0.7260000000000002,0.65,0.7370000000000002,0.63); - ctx.bezierCurveTo(0.7490000000000002,0.61,0.7560000000000002,0.594,0.7560000000000002,0.593); - ctx.lineTo(0.7600000000000002,0.584); - ctx.lineTo(0.751,0.577); - ctx.lineTo(0.706,0.542); - ctx.closePath(); - ctx.moveTo(0.505,0.622); - ctx.bezierCurveTo(0.436,0.622,0.38,0.566,0.38,0.497); - ctx.bezierCurveTo(0.38,0.428,0.436,0.372,0.505,0.372); - ctx.bezierCurveTo(0.5740000000000001,0.372,0.63,0.428,0.63,0.497); - ctx.bezierCurveTo(0.63,0.565,0.574,0.622,0.505,0.622); - ctx.closePath(); - ctx.fillStyle = "#333333"; - ctx.fill(); - } -} diff --git a/examples/quick/extras/flat/flat.pro b/examples/quick/extras/flat/flat.pro deleted file mode 100644 index 387e7ca09..000000000 --- a/examples/quick/extras/flat/flat.pro +++ /dev/null @@ -1,16 +0,0 @@ -TEMPLATE = app -TARGET = flat -QT += quick - -SOURCES += \ - main.cpp - -RESOURCES += \ - flat.qrc - -OTHER_FILES += \ - main.qml - -DISTFILES += \ - Content.qml \ - SettingsIcon.qml diff --git a/examples/quick/extras/flat/flat.qrc b/examples/quick/extras/flat/flat.qrc deleted file mode 100644 index 5b06a55ce..000000000 --- a/examples/quick/extras/flat/flat.qrc +++ /dev/null @@ -1,16 +0,0 @@ - - - main.qml - images/piemenu-bw-normal.png - images/piemenu-bw-pressed.png - images/piemenu-rgb-normal.png - images/piemenu-rgb-pressed.png - images/piemenu-sepia-normal.png - images/piemenu-sepia-pressed.png - images/piemenu-image-bw.jpg - images/piemenu-image-rgb.jpg - images/piemenu-image-sepia.jpg - Content.qml - SettingsIcon.qml - - diff --git a/examples/quick/extras/flat/images/piemenu-bw-normal.png b/examples/quick/extras/flat/images/piemenu-bw-normal.png deleted file mode 100644 index ef57111fb..000000000 Binary files a/examples/quick/extras/flat/images/piemenu-bw-normal.png and /dev/null differ diff --git a/examples/quick/extras/flat/images/piemenu-bw-pressed.png b/examples/quick/extras/flat/images/piemenu-bw-pressed.png deleted file mode 100644 index b6bd1d20d..000000000 Binary files a/examples/quick/extras/flat/images/piemenu-bw-pressed.png and /dev/null differ diff --git a/examples/quick/extras/flat/images/piemenu-image-bw.jpg b/examples/quick/extras/flat/images/piemenu-image-bw.jpg deleted file mode 100644 index ce4d8ffda..000000000 Binary files a/examples/quick/extras/flat/images/piemenu-image-bw.jpg and /dev/null differ diff --git a/examples/quick/extras/flat/images/piemenu-image-rgb.jpg b/examples/quick/extras/flat/images/piemenu-image-rgb.jpg deleted file mode 100644 index 2d7d22056..000000000 Binary files a/examples/quick/extras/flat/images/piemenu-image-rgb.jpg and /dev/null differ diff --git a/examples/quick/extras/flat/images/piemenu-image-sepia.jpg b/examples/quick/extras/flat/images/piemenu-image-sepia.jpg deleted file mode 100644 index 3ef7b1f0f..000000000 Binary files a/examples/quick/extras/flat/images/piemenu-image-sepia.jpg and /dev/null differ diff --git a/examples/quick/extras/flat/images/piemenu-rgb-normal.png b/examples/quick/extras/flat/images/piemenu-rgb-normal.png deleted file mode 100644 index 2278f4a9e..000000000 Binary files a/examples/quick/extras/flat/images/piemenu-rgb-normal.png and /dev/null differ diff --git a/examples/quick/extras/flat/images/piemenu-rgb-pressed.png b/examples/quick/extras/flat/images/piemenu-rgb-pressed.png deleted file mode 100644 index f45846b17..000000000 Binary files a/examples/quick/extras/flat/images/piemenu-rgb-pressed.png and /dev/null differ diff --git a/examples/quick/extras/flat/images/piemenu-sepia-normal.png b/examples/quick/extras/flat/images/piemenu-sepia-normal.png deleted file mode 100644 index f1e9ffd26..000000000 Binary files a/examples/quick/extras/flat/images/piemenu-sepia-normal.png and /dev/null differ diff --git a/examples/quick/extras/flat/images/piemenu-sepia-pressed.png b/examples/quick/extras/flat/images/piemenu-sepia-pressed.png deleted file mode 100644 index 0f2b35171..000000000 Binary files a/examples/quick/extras/flat/images/piemenu-sepia-pressed.png and /dev/null differ diff --git a/examples/quick/extras/flat/main.cpp b/examples/quick/extras/flat/main.cpp deleted file mode 100644 index 57f48cda2..000000000 --- a/examples/quick/extras/flat/main.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 -#include -#include - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - if (qgetenv("QT_QUICK_CONTROLS_STYLE").isEmpty()) { -#ifdef QT_STATIC - // Need a full path to find the style when built statically - qputenv("QT_QUICK_CONTROLS_STYLE", ":/ExtrasImports/QtQuick/Controls/Styles/Flat"); -#else - qputenv("QT_QUICK_CONTROLS_STYLE", "Flat"); -#endif - } - QQmlApplicationEngine engine; - engine.load(QUrl("qrc:/main.qml")); - if (engine.rootObjects().isEmpty()) - return -1; - return app.exec(); -} diff --git a/examples/quick/extras/flat/main.qml b/examples/quick/extras/flat/main.qml deleted file mode 100644 index aec94c368..000000000 --- a/examples/quick/extras/flat/main.qml +++ /dev/null @@ -1,479 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.4 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import QtQuick.Extras 1.4 -import QtQuick.Extras.Private 1.0 - -ApplicationWindow { - id: window - width: 480 - height: 860 - title: "Flat Example" - visible: true - - readonly property bool contentLoaded: contentLoader.item - readonly property alias anchorItem: controlsMenu - property int currentMenu: -1 - readonly property int textMargins: Math.round(32 * Flat.FlatStyle.scaleFactor) - readonly property int menuMargins: Math.round(13 * Flat.FlatStyle.scaleFactor) - readonly property int menuWidth: Math.min(window.width, window.height) * 0.75 - - onCurrentMenuChanged: { - xBehavior.enabled = true; - anchorCurrentMenu(); - } - - onMenuWidthChanged: anchorCurrentMenu() - - function anchorCurrentMenu() { - switch (currentMenu) { - case -1: - anchorItem.x = -menuWidth; - break; - case 0: - anchorItem.x = 0; - break; - case 1: - anchorItem.x = -menuWidth * 2; - break; - } - } - - Item { - id: container - anchors.fill: parent - - Item { - id: loadingScreen - anchors.fill: parent - visible: !contentLoaded - - Timer { - running: true - interval: 100 - // TODO: Find a way to know when the loading screen has been rendered instead - // of using an abritrary amount of time. - onTriggered: contentLoader.sourceComponent = Qt.createComponent("Content.qml") - } - - Column { - anchors.centerIn: parent - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - - BusyIndicator { - anchors.horizontalCenter: parent.horizontalCenter - } - - Label { - text: "Loading Light Flat UI..." - width: Math.min(loadingScreen.width, loadingScreen.height) * 0.8 - height: font.pixelSize - anchors.horizontalCenter: parent.horizontalCenter - renderType: Text.QtRendering - font.pixelSize: Math.round(26 * Flat.FlatStyle.scaleFactor) - horizontalAlignment: Text.AlignHCenter - fontSizeMode: Text.Fit - font.family: Flat.FlatStyle.fontFamily - font.weight: Font.Light - } - } - } - - Rectangle { - id: controlsMenu - x: container.x - width - z: contentContainer.z + 1 - width: menuWidth - height: parent.height - - // Don't let the menus become visible when resizing the window - Binding { - target: controlsMenu - property: "x" - value: container.x - controlsMenu.width - when: !xBehavior.enabled && !xNumberAnimation.running && currentMenu == -1 - } - - Behavior on x { - id: xBehavior - enabled: false - NumberAnimation { - id: xNumberAnimation - easing.type: Easing.OutExpo - duration: 500 - onRunningChanged: xBehavior.enabled = false - } - } - - Rectangle { - id: controlsTitleBar - width: parent.width - height: toolBar.height - color: Flat.FlatStyle.defaultTextColor - - Label { - text: "Controls" - font.family: Flat.FlatStyle.fontFamily - font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor) - renderType: Text.QtRendering - color: "white" - anchors.left: parent.left - anchors.leftMargin: menuMargins - anchors.verticalCenter: parent.verticalCenter - } - } - - ListView { - id: controlView - width: parent.width - anchors.top: controlsTitleBar.bottom - anchors.bottom: parent.bottom - clip: true - currentIndex: 0 - model: contentLoaded ? contentLoader.item.componentModel : null - delegate: MouseArea { - id: delegateItem - width: parent.width - height: 64 * Flat.FlatStyle.scaleFactor - onClicked: { - if (controlView.currentIndex != index) - controlView.currentIndex = index; - - currentMenu = -1; - } - - Rectangle { - width: parent.width - height: Flat.FlatStyle.onePixel - anchors.bottom: parent.bottom - color: Flat.FlatStyle.lightFrameColor - } - - Label { - text: delegateItem.ListView.view.model[index].name - font.pixelSize: Math.round(15 * Flat.FlatStyle.scaleFactor) - font.family: Flat.FlatStyle.fontFamily - renderType: Text.QtRendering - color: delegateItem.ListView.isCurrentItem ? Flat.FlatStyle.styleColor : Flat.FlatStyle.defaultTextColor - anchors.left: parent.left - anchors.leftMargin: menuMargins - anchors.verticalCenter: parent.verticalCenter - } - } - - Rectangle { - width: parent.height - height: 8 * Flat.FlatStyle.scaleFactor - rotation: 90 - anchors.left: parent.right - transformOrigin: Item.TopLeft - - gradient: Gradient { - GradientStop { - color: Qt.rgba(0, 0, 0, 0.15) - position: 0 - } - GradientStop { - color: Qt.rgba(0, 0, 0, 0.05) - position: 0.5 - } - GradientStop { - color: Qt.rgba(0, 0, 0, 0) - position: 1 - } - } - } - } - } - - Item { - id: contentContainer - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: controlsMenu.right - width: parent.width - - ToolBar { - id: toolBar - visible: !loadingScreen.visible - width: parent.width - height: 54 * Flat.FlatStyle.scaleFactor - z: contentLoader.z + 1 - style: Flat.ToolBarStyle { - padding.left: 0 - padding.right: 0 - } - - RowLayout { - anchors.fill: parent - - MouseArea { - id: controlsButton - Layout.preferredWidth: toolBar.height + textMargins - Layout.preferredHeight: toolBar.height - onClicked: currentMenu = currentMenu == 0 ? -1 : 0 - - Column { - id: controlsIcon - anchors.left: parent.left - anchors.leftMargin: textMargins - anchors.verticalCenter: parent.verticalCenter - spacing: Math.round(2 * Flat.FlatStyle.scaleFactor) - - Repeater { - model: 3 - - Rectangle { - width: Math.round(4 * Flat.FlatStyle.scaleFactor) - height: width - radius: width / 2 - color: Flat.FlatStyle.defaultTextColor - } - } - } - } - - Text { - text: "Light Flat UI Demo" - font.family: Flat.FlatStyle.fontFamily - font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor) - horizontalAlignment: Text.AlignHCenter - color: "#666666" - Layout.fillWidth: true - } - - MouseArea { - id: settingsButton - Layout.preferredWidth: controlsButton.Layout.preferredWidth - Layout.preferredHeight: controlsButton.Layout.preferredHeight - onClicked: currentMenu = currentMenu == 1 ? -1 : 1 - - SettingsIcon { - width: Math.round(32 * Flat.FlatStyle.scaleFactor) - height: Math.round(32 * Flat.FlatStyle.scaleFactor) - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: textMargins - Math.round(8 * Flat.FlatStyle.scaleFactor) - } - } - } - } - - Loader { - id: contentLoader - anchors.left: parent.left - anchors.right: parent.right - anchors.top: toolBar.bottom - anchors.bottom: parent.bottom - - property QtObject settingsData: QtObject { - readonly property bool checks: disableSingleItemsAction.checked - readonly property bool frames: !greyBackgroundAction.checked - readonly property bool allDisabled: disableAllAction.checked - } - property QtObject controlData: QtObject { - readonly property int componentIndex: controlView.currentIndex - readonly property int textMargins: window.textMargins - } - - MouseArea { - enabled: currentMenu != -1 - // We would be able to just set this to true here, if it weren't for QTBUG-43083. - hoverEnabled: enabled - anchors.fill: parent - preventStealing: true - onClicked: currentMenu = -1 - focus: enabled - z: 1000 - } - } - } - - Rectangle { - id: settingsMenu - z: contentContainer.z + 1 - width: menuWidth - height: parent.height - anchors.left: contentContainer.right - - Rectangle { - id: optionsTitleBar - width: parent.width - height: toolBar.height - color: Flat.FlatStyle.defaultTextColor - - Label { - text: "Options" - font.family: Flat.FlatStyle.fontFamily - font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor) - renderType: Text.QtRendering - color: "white" - anchors.left: parent.left - anchors.leftMargin: menuMargins - anchors.verticalCenter: parent.verticalCenter - } - } - - Action { - id: disableAllAction - checkable: true - checked: false - } - - Action { - id: disableSingleItemsAction - checkable: true - checked: false - } - - Action { - id: greyBackgroundAction - checkable: true - checked: false - } - - ListView { - id: optionsListView - width: parent.width - anchors.top: optionsTitleBar.bottom - anchors.bottom: parent.bottom - clip: true - interactive: delegateHeight * count > height - - readonly property int delegateHeight: 64 * Flat.FlatStyle.scaleFactor - - model: [ - { name: "Disable all", action: disableAllAction }, - { name: "Disable single items", action: disableSingleItemsAction }, - { name: "Grey background", action: greyBackgroundAction }, - { name: "Exit", action: null } - ] - delegate: Rectangle { - id: optionDelegateItem - width: parent.width - height: optionsListView.delegateHeight - - Rectangle { - width: parent.width - height: Flat.FlatStyle.onePixel - anchors.bottom: parent.bottom - color: Flat.FlatStyle.lightFrameColor - } - - Loader { - sourceComponent: optionText !== "Exit" - ? optionsListView.checkBoxComponent : optionsListView.exitComponent - anchors.fill: parent - anchors.leftMargin: menuMargins - - property string optionText: optionsListView.model[index].name - property int optionIndex: index - } - } - - property Component checkBoxComponent: Item { - Label { - text: optionText - font.family: Flat.FlatStyle.fontFamily - font.pixelSize: Math.round(15 * Flat.FlatStyle.scaleFactor) - fontSizeMode: Text.Fit - renderType: Text.QtRendering - verticalAlignment: Text.AlignVCenter - color: Flat.FlatStyle.defaultTextColor - height: parent.height - anchors.left: parent.left - anchors.right: checkBox.left - anchors.rightMargin: Flat.FlatStyle.twoPixels - } - - CheckBox { - id: checkBox - checked: optionsListView.model[optionIndex].action.checked - anchors.right: parent.right - anchors.rightMargin: menuMargins - anchors.verticalCenter: parent.verticalCenter - onCheckedChanged: optionsListView.model[optionIndex].action.checked = checkBox.checked - } - } - - property Component exitComponent: MouseArea { - anchors.fill: parent - onClicked: Qt.quit() - - Label { - text: optionText - font.family: Flat.FlatStyle.fontFamily - font.pixelSize: Math.round(15 * Flat.FlatStyle.scaleFactor) - renderType: Text.QtRendering - color: Flat.FlatStyle.defaultTextColor - anchors.verticalCenter: parent.verticalCenter - } - } - - Rectangle { - width: parent.height - height: 8 * Flat.FlatStyle.scaleFactor - rotation: -90 - anchors.right: parent.left - transformOrigin: Item.TopRight - - gradient: Gradient { - GradientStop { - color: Qt.rgba(0, 0, 0, 0.15) - position: 0 - } - GradientStop { - color: Qt.rgba(0, 0, 0, 0.05) - position: 0.5 - } - GradientStop { - color: Qt.rgba(0, 0, 0, 0) - position: 1 - } - } - } - } - } - } -} diff --git a/examples/quick/extras/gallery/fonts/LICENSE.txt b/examples/quick/extras/gallery/fonts/LICENSE.txt deleted file mode 100644 index d64569567..000000000 --- a/examples/quick/extras/gallery/fonts/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/examples/quick/extras/gallery/fonts/OpenSans-Regular.ttf b/examples/quick/extras/gallery/fonts/OpenSans-Regular.ttf deleted file mode 100644 index db433349b..000000000 Binary files a/examples/quick/extras/gallery/fonts/OpenSans-Regular.ttf and /dev/null differ diff --git a/examples/quick/extras/gallery/gallery.pro b/examples/quick/extras/gallery/gallery.pro deleted file mode 100644 index 3c50a7c23..000000000 --- a/examples/quick/extras/gallery/gallery.pro +++ /dev/null @@ -1,31 +0,0 @@ -TEMPLATE = app -TARGET = gallery -INCLUDEPATH += . -QT += quick - -SOURCES += \ - main.cpp - -RESOURCES += \ - gallery.qrc - -OTHER_FILES += \ - qml/BlackButtonBackground.qml \ - qml/BlackButtonStyle.qml \ - qml/CircularGaugeDarkStyle.qml \ - qml/CircularGaugeDefaultStyle.qml \ - qml/CircularGaugeLightStyle.qml \ - qml/CircularGaugeView.qml \ - qml/ControlLabel.qml \ - qml/ControlView.qml \ - qml/ControlViewToolBar.qml \ - qml/CustomizerSwitch.qml \ - qml/CustomizerLabel.qml \ - qml/CustomizerSlider.qml \ - qml/FlickableMoreIndicator.qml \ - qml/gallery.qml \ - qml/PieMenuControlView.qml \ - qml/PieMenuDefaultStyle.qml \ - qml/PieMenuDarkStyle.qml \ - qml/StylePicker.qml \ - gallery.qrc diff --git a/examples/quick/extras/gallery/gallery.qrc b/examples/quick/extras/gallery/gallery.qrc deleted file mode 100644 index 97beb6b1b..000000000 --- a/examples/quick/extras/gallery/gallery.qrc +++ /dev/null @@ -1,36 +0,0 @@ - - - fonts/OpenSans-Regular.ttf - images/background-light.png - images/background.png - images/center-light.png - images/center.png - images/icon-go.png - images/icon-settings.png - images/info.png - images/needle-light.png - images/needle.png - images/qt-logo.png - images/zoom_in.png - images/zoom_out.png - qml/BlackButtonBackground.qml - qml/BlackButtonStyle.qml - qml/CircularGaugeDarkStyle.qml - qml/CircularGaugeDefaultStyle.qml - qml/CircularGaugeLightStyle.qml - qml/CircularGaugeView.qml - qml/ControlView.qml - qml/ControlViewToolbar.qml - qml/CustomizerSwitch.qml - qml/CustomizerLabel.qml - qml/CustomizerSlider.qml - qml/FlickableMoreIndicator.qml - qml/gallery.qml - qml/PieMenuControlView.qml - qml/StylePicker.qml - qml/PieMenuDarkStyle.qml - qml/PieMenuDefaultStyle.qml - qml/ControlLabel.qml - images/icon-back.png - - diff --git a/examples/quick/extras/gallery/images/background-light.png b/examples/quick/extras/gallery/images/background-light.png deleted file mode 100644 index 2f7698452..000000000 Binary files a/examples/quick/extras/gallery/images/background-light.png and /dev/null differ diff --git a/examples/quick/extras/gallery/images/background.png b/examples/quick/extras/gallery/images/background.png deleted file mode 100644 index a3f4302bc..000000000 Binary files a/examples/quick/extras/gallery/images/background.png and /dev/null differ diff --git a/examples/quick/extras/gallery/images/center-light.png b/examples/quick/extras/gallery/images/center-light.png deleted file mode 100644 index 75add20ce..000000000 Binary files a/examples/quick/extras/gallery/images/center-light.png and /dev/null differ diff --git a/examples/quick/extras/gallery/images/center.png b/examples/quick/extras/gallery/images/center.png deleted file mode 100644 index fd3696404..000000000 Binary files a/examples/quick/extras/gallery/images/center.png and /dev/null differ diff --git a/examples/quick/extras/gallery/images/icon-back.png b/examples/quick/extras/gallery/images/icon-back.png deleted file mode 100644 index 0b037ff69..000000000 Binary files a/examples/quick/extras/gallery/images/icon-back.png and /dev/null differ diff --git a/examples/quick/extras/gallery/images/icon-go.png b/examples/quick/extras/gallery/images/icon-go.png deleted file mode 100644 index bcb2a822a..000000000 Binary files a/examples/quick/extras/gallery/images/icon-go.png and /dev/null differ diff --git a/examples/quick/extras/gallery/images/icon-settings.png b/examples/quick/extras/gallery/images/icon-settings.png deleted file mode 100644 index 7763ba20e..000000000 Binary files a/examples/quick/extras/gallery/images/icon-settings.png and /dev/null differ diff --git a/examples/quick/extras/gallery/images/info.png b/examples/quick/extras/gallery/images/info.png deleted file mode 100644 index 5c7a9df3c..000000000 Binary files a/examples/quick/extras/gallery/images/info.png and /dev/null differ diff --git a/examples/quick/extras/gallery/images/needle-light.png b/examples/quick/extras/gallery/images/needle-light.png deleted file mode 100644 index d486d9e53..000000000 Binary files a/examples/quick/extras/gallery/images/needle-light.png and /dev/null differ diff --git a/examples/quick/extras/gallery/images/needle.png b/examples/quick/extras/gallery/images/needle.png deleted file mode 100644 index 6b10c604a..000000000 Binary files a/examples/quick/extras/gallery/images/needle.png and /dev/null differ diff --git a/examples/quick/extras/gallery/images/qt-logo.png b/examples/quick/extras/gallery/images/qt-logo.png deleted file mode 100644 index 14ddf2a02..000000000 Binary files a/examples/quick/extras/gallery/images/qt-logo.png and /dev/null differ diff --git a/examples/quick/extras/gallery/images/zoom_in.png b/examples/quick/extras/gallery/images/zoom_in.png deleted file mode 100644 index 412821064..000000000 Binary files a/examples/quick/extras/gallery/images/zoom_in.png and /dev/null differ diff --git a/examples/quick/extras/gallery/images/zoom_out.png b/examples/quick/extras/gallery/images/zoom_out.png deleted file mode 100644 index 772d6ac17..000000000 Binary files a/examples/quick/extras/gallery/images/zoom_out.png and /dev/null differ diff --git a/examples/quick/extras/gallery/main.cpp b/examples/quick/extras/gallery/main.cpp deleted file mode 100644 index 1d5d23139..000000000 --- a/examples/quick/extras/gallery/main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - QQmlApplicationEngine engine(QUrl("qrc:/qml/gallery.qml")); - if (engine.rootObjects().isEmpty()) - return -1; - return app.exec(); -} diff --git a/examples/quick/extras/gallery/qml/BlackButtonBackground.qml b/examples/quick/extras/gallery/qml/BlackButtonBackground.qml deleted file mode 100644 index 94852f38c..000000000 --- a/examples/quick/extras/gallery/qml/BlackButtonBackground.qml +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 - -Rectangle { - property bool pressed: false - - gradient: Gradient { - GradientStop { - color: pressed ? "#222" : "#333" - position: 0 - } - GradientStop { - color: "#222" - position: 1 - } - } - Rectangle { - height: 1 - width: parent.width - anchors.top: parent.top - color: "#444" - visible: !pressed - } - Rectangle { - height: 1 - width: parent.width - anchors.bottom: parent.bottom - color: "#000" - } -} diff --git a/examples/quick/extras/gallery/qml/BlackButtonStyle.qml b/examples/quick/extras/gallery/qml/BlackButtonStyle.qml deleted file mode 100644 index e3e60d88b..000000000 --- a/examples/quick/extras/gallery/qml/BlackButtonStyle.qml +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 - -ButtonStyle { - property color fontColor - - property url rightAlignedIconSource - - background: BlackButtonBackground { - pressed: control.pressed - } - label: Item { - implicitWidth: row.implicitWidth - implicitHeight: row.implicitHeight - baselineOffset: row.y + text.y + text.baselineOffset - - Row { - id: row - anchors.left: control.text.length === 0 ? undefined : parent.left - anchors.leftMargin: control.text.length === 0 ? 0 : textSingleton.implicitHeight - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: control.text.length === 0 ? parent.horizontalCenter : undefined - - Image { - source: control.iconSource - width: Math.min(sourceSize.width, height) - height: text.implicitHeight - fillMode: Image.PreserveAspectFit - } - Text { - id: text - text: control.text - color: fontColor - font.pixelSize: control.height * 0.25 - font.family: openSans.name - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - anchors.verticalCenter: parent.verticalCenter - } - } - - Loader { - active: rightAlignedIconSource.toString().length !== 0 - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: textSingleton.implicitHeight - - sourceComponent: Image { - width: Math.min(sourceSize.width, height) - height: text.implicitHeight - fillMode: Image.PreserveAspectFit - source: rightAlignedIconSource - } - } - } -} diff --git a/examples/quick/extras/gallery/qml/CircularGaugeDarkStyle.qml b/examples/quick/extras/gallery/qml/CircularGaugeDarkStyle.qml deleted file mode 100644 index 9993a97a6..000000000 --- a/examples/quick/extras/gallery/qml/CircularGaugeDarkStyle.qml +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls.Styles 1.4 - -CircularGaugeStyle { - id: root - tickmarkStepSize: 10 - minorTickmarkCount: 1 - labelStepSize: 20 - tickmarkInset: outerRadius * 0.06 - minorTickmarkInset: tickmarkInset - labelInset: outerRadius * 0.23 - - background: Image { - source: "qrc:/images/background.png" - } - - needle: Image { - id: needleImage - transformOrigin: Item.Bottom - source: "qrc:/images/needle.png" - scale: { - var distanceFromLabelToRadius = labelInset / 2; - var idealHeight = outerRadius - distanceFromLabelToRadius; - var originalImageHeight = needleImage.sourceSize.height; - idealHeight / originalImageHeight; - } - } - - foreground: Item { - Image { - anchors.centerIn: parent - source: "qrc:/images/center.png" - scale: (outerRadius * 0.25) / sourceSize.height - } - } - - tickmark: Rectangle { - implicitWidth: outerRadius * 0.02 - antialiasing: true - implicitHeight: outerRadius * 0.05 - color: "#888" - } - - minorTickmark: Rectangle { - implicitWidth: outerRadius * 0.01 - antialiasing: true - implicitHeight: outerRadius * 0.02 - color: "#444" - } - - tickmarkLabel: Text { - font.pixelSize: Math.max(6, outerRadius * 0.1) - text: styleData.value - color: "white" - } -} diff --git a/examples/quick/extras/gallery/qml/CircularGaugeDefaultStyle.qml b/examples/quick/extras/gallery/qml/CircularGaugeDefaultStyle.qml deleted file mode 100644 index b7f1b2412..000000000 --- a/examples/quick/extras/gallery/qml/CircularGaugeDefaultStyle.qml +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls.Styles 1.4 - -CircularGaugeStyle { - labelStepSize: 20 -} diff --git a/examples/quick/extras/gallery/qml/CircularGaugeLightStyle.qml b/examples/quick/extras/gallery/qml/CircularGaugeLightStyle.qml deleted file mode 100644 index 8e1f34ea7..000000000 --- a/examples/quick/extras/gallery/qml/CircularGaugeLightStyle.qml +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls.Styles 1.4 - -CircularGaugeStyle { - id: root - tickmarkStepSize: 10 - minorTickmarkCount: 2 - labelStepSize: 40 - tickmarkInset: outerRadius * 0.06 - minorTickmarkInset: tickmarkInset - labelInset: outerRadius * 0.23 - - background: Image { - source: "qrc:/images/background-light.png" - } - - needle: Image { - id: needleImage - source: "qrc:/images/needle-light.png" - transformOrigin: Item.Bottom - scale: { - var distanceFromLabelToRadius = labelInset / 2; - var idealHeight = outerRadius - distanceFromLabelToRadius; - var originalImageHeight = needleImage.sourceSize.height; - idealHeight / originalImageHeight; - } - } - - foreground: Item { - Image { - anchors.centerIn: parent - source: "qrc:/images/center-light.png" - scale: (outerRadius * 0.25) / sourceSize.height - } - } - - tickmark: Rectangle { - implicitWidth: outerRadius * 0.01 - antialiasing: true - implicitHeight: outerRadius * 0.04 - color: "#999" - } - - minorTickmark: Rectangle { - implicitWidth: outerRadius * 0.01 - antialiasing: true - implicitHeight: outerRadius * 0.02 - color: "#bbb" - } - - tickmarkLabel: Text { - font.family: "Helvetica neue" - font.pixelSize: Math.max(6, outerRadius * 0.1) - text: styleData.value - color: "#333" - } -} diff --git a/examples/quick/extras/gallery/qml/CircularGaugeView.qml b/examples/quick/extras/gallery/qml/CircularGaugeView.qml deleted file mode 100644 index cd03ebbe5..000000000 --- a/examples/quick/extras/gallery/qml/CircularGaugeView.qml +++ /dev/null @@ -1,230 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.1 -import QtQuick.Extras 1.4 - -ControlView { - id: controlView - darkBackground: customizerItem.currentStyleDark - - property color fontColor: darkBackground ? "white" : "black" - - property bool accelerating: false - - Keys.onSpacePressed: accelerating = true - Keys.onReleased: { - if (event.key === Qt.Key_Space) { - accelerating = false; - event.accepted = true; - } - } - - Button { - id: accelerate - text: "Accelerate" - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: parent.bottom - height: root.height * 0.125 - - onPressedChanged: accelerating = pressed - - style: BlackButtonStyle { - background: BlackButtonBackground { - pressed: control.pressed - } - label: Text { - text: control.text - color: "white" - font.pixelSize: Math.max(textSingleton.font.pixelSize, root.toPixels(0.04)) - font.family: openSans.name - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - } - - control: CircularGauge { - id: gauge - minimumValue: customizerItem.minimumValue - maximumValue: customizerItem.maximumValue - width: controlBounds.width - height: controlBounds.height - - value: accelerating ? maximumValue : 0 - style: styleMap[customizerItem.currentStylePath] - - // This stops the styles being recreated when a new one is chosen. - property var styleMap: { - var styles = {}; - for (var i = 0; i < customizerItem.allStylePaths.length; ++i) { - var path = customizerItem.allStylePaths[i]; - styles[path] = Qt.createComponent(path, gauge); - } - styles; - } - - // Called to update the style after the user has edited a property. - Connections { - target: customizerItem - onMinimumValueAngleChanged: __style.minimumValueAngle = customizerItem.minimumValueAngle - onMaximumValueAngleChanged: __style.maximumValueAngle = customizerItem.maximumValueAngle - onLabelStepSizeChanged: __style.tickmarkStepSize = __style.labelStepSize = customizerItem.labelStepSize - } - - Behavior on value { - NumberAnimation { - easing.type: Easing.OutCubic - duration: 6000 - } - } - } - - customizer: Column { - readonly property var allStylePaths: { - var paths = []; - for (var i = 0; i < stylePicker.model.count; ++i) { - paths.push(stylePicker.model.get(i).path); - } - paths; - } - property alias currentStylePath: stylePicker.currentStylePath - property alias currentStyleDark: stylePicker.currentStyleDark - property alias minimumValue: minimumValueSlider.value - property alias maximumValue: maximumValueSlider.value - property alias minimumValueAngle: minimumAngleSlider.value - property alias maximumValueAngle: maximumAngleSlider.value - property alias labelStepSize: labelStepSizeSlider.value - - id: circularGaugeColumn - spacing: customizerPropertySpacing - - readonly property bool isDefaultStyle: stylePicker.model.get(stylePicker.currentIndex).name === "Default" - - Item { - id: stylePickerBottomSpacing - width: parent.width - height: stylePicker.height + textSingleton.implicitHeight - - StylePicker { - id: stylePicker - currentIndex: 1 - - model: ListModel { - ListElement { - name: "Default" - path: "CircularGaugeDefaultStyle.qml" - dark: true - } - ListElement { - name: "Dark" - path: "CircularGaugeDarkStyle.qml" - dark: true - } - ListElement { - name: "Light" - path: "CircularGaugeLightStyle.qml" - dark: false - } - } - } - } - - CustomizerLabel { - text: "Minimum angle" - } - - CustomizerSlider { - id: minimumAngleSlider - minimumValue: -180 - value: -145 - maximumValue: 180 - width: parent.width - } - - CustomizerLabel { - text: "Maximum angle" - } - - CustomizerSlider { - id: maximumAngleSlider - minimumValue: -180 - value: 145 - maximumValue: 180 - } - - CustomizerLabel { - text: "Minimum value" - } - - CustomizerSlider { - id: minimumValueSlider - minimumValue: 0 - value: 0 - maximumValue: 360 - stepSize: 1 - } - - CustomizerLabel { - text: "Maximum value" - } - - CustomizerSlider { - id: maximumValueSlider - minimumValue: 0 - value: 240 - maximumValue: 300 - stepSize: 1 - } - - CustomizerLabel { - text: "Label step size" - } - - CustomizerSlider { - id: labelStepSizeSlider - minimumValue: 10 - value: 20 - maximumValue: 100 - stepSize: 20 - } - } -} diff --git a/examples/quick/extras/gallery/qml/ControlLabel.qml b/examples/quick/extras/gallery/qml/ControlLabel.qml deleted file mode 100644 index 6fdcec110..000000000 --- a/examples/quick/extras/gallery/qml/ControlLabel.qml +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Extras 1.4 - -Text { - font.pixelSize: Math.max(textSingleton.font.pixelSize, Math.min(32, root.toPixels(0.045))) - color: "#4e4e4e" - styleColor: "#ffffff" - style: Text.Raised -} diff --git a/examples/quick/extras/gallery/qml/ControlView.qml b/examples/quick/extras/gallery/qml/ControlView.qml deleted file mode 100644 index 565ab9d90..000000000 --- a/examples/quick/extras/gallery/qml/ControlView.qml +++ /dev/null @@ -1,188 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.1 - -Rectangle { - id: view - color: darkBackground ? "transparent" : lightBackgroundColor - - Keys.onReleased: { - if (event.key === Qt.Key_Back) { - stackView.pop(); - event.accepted = true; - } - } - - property bool darkBackground: true - - property Component control - property Component customizer - - property alias controlItem: controlLoader.item - property alias customizerItem: customizerLoader.item - - property bool isCustomizerVisible: false - - property real margin: root.toPixels(0.05) - - property rect controlBounds: Qt.rect(largestControlItem.x + controlBoundsItem.x, - largestControlItem.y + controlBoundsItem.y, controlBoundsItem.width, controlBoundsItem.height) - - Item { - id: largestControlItem - x: margin - y: margin - width: isCustomizerVisible ? widthWhenCustomizing : widthWhenNotCustomizing - height: isCustomizerVisible ? heightWhenCustomizing : heightWhenNotCustomizing - - readonly property real widthWhenCustomizing: (!isScreenPortrait ? parent.width / 2 : parent.width) - margin * 2 - readonly property real heightWhenCustomizing: (isScreenPortrait ? parent.height / 2 : parent.height - toolbar.height) - margin * 2 - readonly property real widthWhenNotCustomizing: parent.width - margin * 2 - readonly property real heightWhenNotCustomizing: parent.height - toolbar.height - margin * 2 - - Item { - id: controlBoundsItem - x: parent.width / 2 - controlBoundsItem.width / 2 - y: customizer && customizerItem.visible ? 0 : (isScreenPortrait ? (parent.height / 2) - (controlBoundsItem.height / 2) : 0) - width: Math.min(parent.widthWhenCustomizing, parent.widthWhenNotCustomizing) - height: Math.min(parent.heightWhenCustomizing, parent.heightWhenNotCustomizing) - - Behavior on x { - id: controlXBehavior - enabled: false - NumberAnimation {} - } - - Behavior on y { - id: controlYBehavior - enabled: false - NumberAnimation {} - } - - Loader { - id: controlLoader - sourceComponent: control - anchors.centerIn: parent - - property alias view: view - } - } - } - - Flickable { - id: flickable - // Hide the customizer on the right of the screen if it's not visible. - x: (isScreenPortrait ? 0 : (isCustomizerVisible ? largestControlItem.x + largestControlItem.width + margin : view.width)) + margin - y: (isScreenPortrait ? largestControlItem.y + largestControlItem.height : 0) + margin - width: largestControlItem.width - height: parent.height - y - toolbar.height - margin - anchors.leftMargin: margin - anchors.rightMargin: margin - visible: customizerLoader.opacity > 0 - - flickableDirection: Flickable.VerticalFlick - - clip: true - contentWidth: width - contentHeight: customizerLoader.height - - Behavior on x { - id: flickableXBehavior - enabled: false - NumberAnimation {} - } - - Behavior on y { - id: flickableYBehavior - enabled: false - NumberAnimation {} - } - - Loader { - id: customizerLoader - sourceComponent: customizer - opacity: 0 - width: flickable.width - - property alias view: view - - Behavior on opacity { - NumberAnimation { - duration: 300 - } - } - } - } - - ControlViewToolbar { - id: toolbar - - onCustomizeClicked: { - controlXBehavior.enabled = !isScreenPortrait; - controlYBehavior.enabled = isScreenPortrait; - - isCustomizerVisible = !isCustomizerVisible; - - if (isScreenPortrait) { - flickableXBehavior.enabled = false; - flickableYBehavior.enabled = true; - } else { - flickableXBehavior.enabled = true; - flickableYBehavior.enabled = false; - } - - customizerLoader.opacity = isCustomizerVisible ? 1 : 0; - } - } - - FlickableMoreIndicator { - flickable: flickable - atTop: true - gradientColor: view.darkBackground ? darkBackgroundColor : lightBackgroundColor - } - - FlickableMoreIndicator { - flickable: flickable - atTop: false - gradientColor: view.darkBackground ? darkBackgroundColor : lightBackgroundColor - } -} diff --git a/examples/quick/extras/gallery/qml/ControlViewToolbar.qml b/examples/quick/extras/gallery/qml/ControlViewToolbar.qml deleted file mode 100644 index 60a7e3f8c..000000000 --- a/examples/quick/extras/gallery/qml/ControlViewToolbar.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.1 - -BlackButtonBackground { - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - height: root.height * 0.125 - - signal customizeClicked - - gradient: Gradient { - GradientStop { - color: "#333" - position: 0 - } - GradientStop { - color: "#222" - position: 1 - } - } - - Button { - id: back - width: parent.height - height: parent.height - anchors.left: parent.left - anchors.bottom: parent.bottom - iconSource: "qrc:/images/icon-back.png" - onClicked: stackView.pop() - - style: BlackButtonStyle { - } - - } - - Button { - id: customize - width: parent.height - height: parent.height - anchors.right: parent.right - anchors.bottom: parent.bottom - iconSource: "qrc:/images/icon-settings.png" - visible: customizer - - style: BlackButtonStyle { - } - - onClicked: customizeClicked() - } -} diff --git a/examples/quick/extras/gallery/qml/CustomizerLabel.qml b/examples/quick/extras/gallery/qml/CustomizerLabel.qml deleted file mode 100644 index 0e9f4592a..000000000 --- a/examples/quick/extras/gallery/qml/CustomizerLabel.qml +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 - -Text { - color: darkBackground ? root.darkFontColor : root.lightFontColor - font.pixelSize: root.toPixels(0.04) - font.family: openSans.name - anchors.horizontalCenter: parent.horizontalCenter -} diff --git a/examples/quick/extras/gallery/qml/CustomizerSlider.qml b/examples/quick/extras/gallery/qml/CustomizerSlider.qml deleted file mode 100644 index 6a004e864..000000000 --- a/examples/quick/extras/gallery/qml/CustomizerSlider.qml +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.1 -import QtQuick.Controls 1.1 -import QtQuick.Controls.Styles 1.1 - -Slider { - id: slider - width: parent.width - height: root.toPixels(0.1) - - style: SliderStyle { - handle: Rectangle { - height: root.toPixels(0.06) - width: height - radius: width/2 - color: "#fff" - } - - groove: Rectangle { - implicitHeight: root.toPixels(0.015) - implicitWidth: 100 - radius: height/2 - border.color: "#333" - color: "#222" - Rectangle { - height: parent.height - width: styleData.handlePosition - implicitHeight: 6 - implicitWidth: 100 - radius: height/2 - color: "#555" - } - } - - } -} diff --git a/examples/quick/extras/gallery/qml/CustomizerSwitch.qml b/examples/quick/extras/gallery/qml/CustomizerSwitch.qml deleted file mode 100644 index a64a7f8a0..000000000 --- a/examples/quick/extras/gallery/qml/CustomizerSwitch.qml +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.1 - -Switch { - anchors.horizontalCenter: parent.horizontalCenter -} diff --git a/examples/quick/extras/gallery/qml/FlickableMoreIndicator.qml b/examples/quick/extras/gallery/qml/FlickableMoreIndicator.qml deleted file mode 100644 index 1fb18c01c..000000000 --- a/examples/quick/extras/gallery/qml/FlickableMoreIndicator.qml +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 - -Rectangle { - anchors.top: atTop ? flickable.top : undefined - anchors.bottom: atTop ? undefined : flickable.bottom - anchors.left: isScreenPortrait ? parent.left : parent.horizontalCenter - anchors.right: parent.right - height: 30 - visible: flickable.visible - opacity: atTop - ? (flickable.contentY > showDistance ? 1 : 0) - : (flickable.contentY < flickable.contentHeight - showDistance ? 1 : 0) - scale: atTop ? 1 : -1 - - readonly property real showDistance: 0 - property Flickable flickable - property color gradientColor - /*! \c true if this indicator is at the top of the item */ - property bool atTop - - Behavior on opacity { - NumberAnimation { - } - } - - gradient: Gradient { - GradientStop { - position: 0.0 - color: gradientColor - } - GradientStop { - position: 1.0 - color: "transparent" - } - } -} diff --git a/examples/quick/extras/gallery/qml/PieMenuControlView.qml b/examples/quick/extras/gallery/qml/PieMenuControlView.qml deleted file mode 100644 index bbaa8637a..000000000 --- a/examples/quick/extras/gallery/qml/PieMenuControlView.qml +++ /dev/null @@ -1,187 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtGraphicalEffects 1.0 -import QtQuick.Controls 1.1 -import QtQuick.Extras 1.4 - -Rectangle { - id: view - color: customizerItem.currentStyleDark ? "#111" : "#555" - - Behavior on color { - ColorAnimation {} - } - - Keys.onReleased: { - if (event.key === Qt.Key_Back) { - stackView.pop(); - event.accepted = true; - } - } - - property bool darkBackground: true - - property Component mouseArea - - property Component customizer: Item { - property alias currentStylePath: stylePicker.currentStylePath - property alias currentStyleDark: stylePicker.currentStyleDark - - StylePicker { - id: stylePicker - currentIndex: 0 - width: Math.round(Math.max(textSingleton.implicitHeight * 6 * 2, parent.width * 0.5)) - anchors.centerIn: parent - - model: ListModel { - ListElement { - name: "Default" - path: "PieMenuDefaultStyle.qml" - dark: false - } - ListElement { - name: "Dark" - path: "PieMenuDarkStyle.qml" - dark: true - } - } - } - } - - property alias controlItem: pieMenu - property alias customizerItem: customizerLoader.item - - Item { - id: controlBoundsItem - width: parent.width - height: parent.height - toolbar.height - visible: customizerLoader.opacity === 0 - - Image { - id: bgImage - anchors.centerIn: parent - height: 48 - Text { - id: bgLabel - anchors.top: parent.bottom - anchors.topMargin: 20 - anchors.horizontalCenter: parent.horizontalCenter - text: "Tap to open" - color: "#999" - font.pointSize: 20 - } - } - - MouseArea { - id: touchArea - anchors.fill: parent - onClicked: pieMenu.popup(touchArea.mouseX, touchArea.mouseY) - } - - PieMenu { - id: pieMenu - triggerMode: TriggerMode.TriggerOnClick - width: Math.min(controlBoundsItem.width, controlBoundsItem.height) * 0.5 - height: width - - style: Qt.createComponent(customizerItem.currentStylePath) - - MenuItem { - text: "Zoom In" - onTriggered: { - bgImage.source = iconSource - bgLabel.text = text + " selected" - } - iconSource: "qrc:/images/zoom_in.png" - } - MenuItem { - text: "Zoom Out" - onTriggered: { - bgImage.source = iconSource - bgLabel.text = text + " selected" - } - iconSource: "qrc:/images/zoom_out.png" - } - MenuItem { - text: "Info" - onTriggered: { - bgImage.source = iconSource - bgLabel.text = text + " selected" - } - iconSource: "qrc:/images/info.png" - } - } - } - Loader { - id: customizerLoader - sourceComponent: customizer - opacity: 0 - anchors.left: parent.left - anchors.right: parent.right - anchors.leftMargin: 30 - anchors.rightMargin: 30 - y: parent.height / 2 - height / 2 - toolbar.height - visible: customizerLoader.opacity > 0 - - property alias view: view - - Behavior on y { - NumberAnimation { - duration: 300 - } - } - - Behavior on opacity { - NumberAnimation { - duration: 300 - } - } - } - - ControlViewToolbar { - id: toolbar - - onCustomizeClicked: { - customizerLoader.opacity = customizerLoader.opacity == 0 ? 1 : 0; - } - } -} diff --git a/examples/quick/extras/gallery/qml/PieMenuDarkStyle.qml b/examples/quick/extras/gallery/qml/PieMenuDarkStyle.qml deleted file mode 100644 index 98e042981..000000000 --- a/examples/quick/extras/gallery/qml/PieMenuDarkStyle.qml +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.Controls.Styles 1.4 - -PieMenuStyle { - backgroundColor: "#222" - shadowColor: Qt.rgba(1, 1, 1, 0.26) -} diff --git a/examples/quick/extras/gallery/qml/PieMenuDefaultStyle.qml b/examples/quick/extras/gallery/qml/PieMenuDefaultStyle.qml deleted file mode 100644 index 02a189d6b..000000000 --- a/examples/quick/extras/gallery/qml/PieMenuDefaultStyle.qml +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.Controls.Styles 1.4 - -PieMenuStyle { -} diff --git a/examples/quick/extras/gallery/qml/StylePicker.qml b/examples/quick/extras/gallery/qml/StylePicker.qml deleted file mode 100644 index f1d2cad22..000000000 --- a/examples/quick/extras/gallery/qml/StylePicker.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtQuick.Extras 1.4 - -ListView { - id: stylePicker - width: parent.width - height: root.height * 0.06 - interactive: false - spacing: -1 - - orientation: ListView.Horizontal - - readonly property string currentStylePath: stylePicker.model.get(stylePicker.currentIndex).path - readonly property bool currentStyleDark: stylePicker.model.get(stylePicker.currentIndex).dark !== undefined - ? stylePicker.model.get(stylePicker.currentIndex).dark - : true - - ExclusiveGroup { - id: styleExclusiveGroup - } - - delegate: Button { - width: Math.round(stylePicker.width / stylePicker.model.count) - height: stylePicker.height - checkable: true - checked: index === ListView.view.currentIndex - exclusiveGroup: styleExclusiveGroup - - onCheckedChanged: { - if (checked) { - ListView.view.currentIndex = index; - } - } - - style: ButtonStyle { - background: Rectangle { - readonly property color checkedColor: currentStyleDark ? "#444" : "#777" - readonly property color uncheckedColor: currentStyleDark ? "#222" : "#bbb" - color: checked ? checkedColor : uncheckedColor - border.color: checkedColor - border.width: 1 - radius: 1 - } - - label: Text { - text: name - color: currentStyleDark ? "white" : (checked ? "white" : "black") - font.pixelSize: root.toPixels(0.04) - font.family: openSans.name - anchors.centerIn: parent - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - } -} diff --git a/examples/quick/extras/gallery/qml/gallery.qml b/examples/quick/extras/gallery/qml/gallery.qml deleted file mode 100644 index d6b46dc15..000000000 --- a/examples/quick/extras/gallery/qml/gallery.qml +++ /dev/null @@ -1,439 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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.2 -import QtGraphicalEffects 1.0 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtQuick.Dialogs 1.0 -import QtQuick.Extras 1.4 -import QtQuick.Layouts 1.0 -import QtQuick.Window 2.1 - -Window { - id: root - objectName: "window" - visible: true - width: 480 - height: 800 - - color: "#161616" - title: "Qt Quick Extras Demo" - - function toPixels(percentage) { - return percentage * Math.min(root.width, root.height); - } - - property bool isScreenPortrait: height > width - property color lightFontColor: "#222" - property color darkFontColor: "#e7e7e7" - readonly property color lightBackgroundColor: "#cccccc" - readonly property color darkBackgroundColor: "#161616" - property real customizerPropertySpacing: 10 - property real colorPickerRowSpacing: 8 - - Text { - id: textSingleton - } - - property Component circularGauge: CircularGaugeView {} - - property Component dial: ControlView { - darkBackground: false - - control: Column { - id: dialColumn - width: controlBounds.width - height: controlBounds.height - spacing - spacing: root.toPixels(0.05) - - ColumnLayout { - id: volumeColumn - width: parent.width - height: (dialColumn.height - dialColumn.spacing) / 2 - spacing: height * 0.025 - - Dial { - id: volumeDial - anchors.horizontalCenter: parent.horizontalCenter - Layout.fillWidth: true - Layout.fillHeight: true - - /*! - Determines whether the dial animates its rotation to the new value when - a single click or touch is received on the dial. - */ - property bool animate: customizerItem.animate - - Behavior on value { - enabled: volumeDial.animate && !volumeDial.pressed - NumberAnimation { - duration: 300 - easing.type: Easing.OutSine - } - } - } - - ControlLabel { - id: volumeText - text: "Volume" - anchors.horizontalCenter: parent.horizontalCenter - } - } - - ColumnLayout { - id: trebleColumn - width: parent.width - height: (dialColumn.height - dialColumn.spacing) / 2 - spacing: height * 0.025 - - Dial { - id: dial2 - anchors.horizontalCenter: parent.horizontalCenter - Layout.fillWidth: true - Layout.fillHeight: true - - stepSize: 1 - maximumValue: 10 - - style: DialStyle { - labelInset: outerRadius * 0 - } - } - - ControlLabel { - id: trebleText - text: "Treble" - anchors.horizontalCenter: parent.horizontalCenter - } - } - } - - customizer: Column { - spacing: customizerPropertySpacing - - property alias animate: animateCheckBox.checked - - CustomizerLabel { - text: "Animate" - } - - CustomizerSwitch { - id: animateCheckBox - } - } - } - - property Component delayButton: ControlView { - darkBackground: false - - control: DelayButton { - text: "Alarm" - anchors.centerIn: parent - } - } - - property Component gauge: ControlView { - id: gaugeView - control: Gauge { - id: gauge - width: orientation === Qt.Vertical ? implicitWidth : gaugeView.controlBounds.width - height: orientation === Qt.Vertical ? gaugeView.controlBounds.height : implicitHeight - anchors.centerIn: parent - - minimumValue: 0 - value: customizerItem.value - maximumValue: 100 - orientation: customizerItem.orientationFlag ? Qt.Vertical : Qt.Horizontal - tickmarkAlignment: orientation === Qt.Vertical - ? (customizerItem.alignFlag ? Qt.AlignLeft : Qt.AlignRight) - : (customizerItem.alignFlag ? Qt.AlignTop : Qt.AlignBottom) - } - - customizer: Column { - spacing: customizerPropertySpacing - - property alias value: valueSlider.value - property alias orientationFlag: orientationCheckBox.checked - property alias alignFlag: alignCheckBox.checked - - CustomizerLabel { - text: "Value" - } - - CustomizerSlider { - id: valueSlider - minimumValue: 0 - value: 50 - maximumValue: 100 - } - - CustomizerLabel { - text: "Vertical orientation" - } - - CustomizerSwitch { - id: orientationCheckBox - checked: true - } - - CustomizerLabel { - text: controlItem.orientation === Qt.Vertical ? "Left align" : "Top align" - } - - CustomizerSwitch { - id: alignCheckBox - checked: true - } - } - } - - property Component toggleButton: ControlView { - darkBackground: false - - control: ToggleButton { - text: checked ? "On" : "Off" - anchors.centerIn: parent - } - } - - property Component pieMenu: PieMenuControlView {} - - property Component statusIndicator: ControlView { - id: statusIndicatorView - darkBackground: false - - Timer { - id: recordingFlashTimer - running: true - repeat: true - interval: 1000 - } - - ColumnLayout { - id: indicatorLayout - width: statusIndicatorView.controlBounds.width * 0.25 - height: statusIndicatorView.controlBounds.height * 0.75 - anchors.centerIn: parent - - Repeater { - model: ListModel { - id: indicatorModel - ListElement { - name: "Power" - indicatorColor: "#35e02f" - } - ListElement { - name: "Recording" - indicatorColor: "red" - } - } - - ColumnLayout { - Layout.preferredWidth: indicatorLayout.width - spacing: 0 - - StatusIndicator { - id: indicator - color: indicatorColor - Layout.preferredWidth: statusIndicatorView.controlBounds.width * 0.07 - Layout.preferredHeight: Layout.preferredWidth - Layout.alignment: Qt.AlignHCenter - on: true - - Connections { - target: recordingFlashTimer - onTriggered: if (name == "Recording") indicator.active = !indicator.active - } - } - ControlLabel { - id: indicatorLabel - text: name - Layout.alignment: Qt.AlignHCenter - Layout.maximumWidth: parent.width - horizontalAlignment: Text.AlignHCenter - } - } - } - } - } - - property Component tumbler: ControlView { - id: tumblerView - darkBackground: false - - Tumbler { - id: tumbler - anchors.centerIn: parent - - // TODO: Use FontMetrics with 5.4 - Label { - id: characterMetrics - font.bold: true - font.pixelSize: textSingleton.font.pixelSize * 1.25 - font.family: openSans.name - visible: false - text: "M" - } - - readonly property real delegateTextMargins: characterMetrics.width * 1.5 - readonly property var days: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] - - TumblerColumn { - id: tumblerDayColumn - - function updateModel() { - var previousIndex = tumblerDayColumn.currentIndex; - var newDays = tumbler.days[monthColumn.currentIndex]; - - if (!model) { - var array = []; - for (var i = 0; i < newDays; ++i) { - array.push(i + 1); - } - model = array; - } else { - // If we've already got days in the model, just add or remove - // the minimum amount necessary to make spinning the month column fast. - var difference = model.length - newDays; - if (model.length > newDays) { - model.splice(model.length - 1, difference); - } else { - var lastDay = model[model.length - 1]; - for (i = lastDay; i < lastDay + difference; ++i) { - model.push(i + 1); - } - } - } - - tumbler.setCurrentIndexAt(0, Math.min(newDays - 1, previousIndex)); - } - } - TumblerColumn { - id: monthColumn - width: characterMetrics.width * 3 + tumbler.delegateTextMargins - model: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] - onCurrentIndexChanged: tumblerDayColumn.updateModel() - } - TumblerColumn { - width: characterMetrics.width * 4 + tumbler.delegateTextMargins - model: ListModel { - Component.onCompleted: { - for (var i = 2000; i < 2100; ++i) { - append({value: i.toString()}); - } - } - } - } - } - } - - - FontLoader { - id: openSans - source: "qrc:/fonts/OpenSans-Regular.ttf" - } - - property var componentMap: { - "CircularGauge": circularGauge, - "DelayButton": delayButton, - "Dial": dial, - "Gauge": gauge, - "PieMenu": pieMenu, - "StatusIndicator": statusIndicator, - "ToggleButton": toggleButton, - "Tumbler": tumbler - } - - StackView { - id: stackView - anchors.fill: parent - - initialItem: ListView { - model: ListModel { - ListElement { - title: "CircularGauge" - } - ListElement { - title: "DelayButton" - } - ListElement { - title: "Dial" - } - ListElement { - title: "Gauge" - } - ListElement { - title: "PieMenu" - } - ListElement { - title: "StatusIndicator" - } - ListElement { - title: "ToggleButton" - } - ListElement { - title: "Tumbler" - } - } - - delegate: Button { - width: stackView.width - height: root.height * 0.125 - text: title - - style: BlackButtonStyle { - fontColor: root.darkFontColor - rightAlignedIconSource: "qrc:/images/icon-go.png" - } - - onClicked: { - if (stackView.depth == 1) { - // Only push the control view if we haven't already pushed it... - stackView.push({item: componentMap[title]}); - stackView.currentItem.forceActiveFocus(); - } - } - } - } - } -} - - diff --git a/examples/quickcontrols/controls/basiclayouts/basiclayouts.pro b/examples/quickcontrols/controls/basiclayouts/basiclayouts.pro new file mode 100644 index 000000000..202a899fa --- /dev/null +++ b/examples/quickcontrols/controls/basiclayouts/basiclayouts.pro @@ -0,0 +1,15 @@ +QT += qml quick +TARGET = basiclayouts +!no_desktop: QT += widgets + +include(src/src.pri) +include(../shared/shared.pri) + +OTHER_FILES += \ + main.qml + +RESOURCES += \ + resources.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/controls/basiclayouts +INSTALLS += target diff --git a/examples/quickcontrols/controls/basiclayouts/basiclayouts.qmlproject b/examples/quickcontrols/controls/basiclayouts/basiclayouts.qmlproject new file mode 100644 index 000000000..e5a8bf02c --- /dev/null +++ b/examples/quickcontrols/controls/basiclayouts/basiclayouts.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "main.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/examples/quickcontrols/controls/basiclayouts/main.qml b/examples/quickcontrols/controls/basiclayouts/main.qml new file mode 100644 index 000000000..b6694b454 --- /dev/null +++ b/examples/quickcontrols/controls/basiclayouts/main.qml @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.2 +import QtQuick.Layouts 1.3 + +ApplicationWindow { + visible: true + title: "Basic layouts" + property int margin: 11 + width: mainLayout.implicitWidth + 2 * margin + height: mainLayout.implicitHeight + 2 * margin + minimumWidth: mainLayout.Layout.minimumWidth + 2 * margin + minimumHeight: mainLayout.Layout.minimumHeight + 2 * margin + + ColumnLayout { + id: mainLayout + anchors.fill: parent + anchors.margins: margin + GroupBox { + id: rowBox + title: "Row layout" + Layout.fillWidth: true + + RowLayout { + id: rowLayout + anchors.fill: parent + TextField { + placeholderText: "This wants to grow horizontally" + Layout.fillWidth: true + } + Button { + text: "Button" + } + } + } + + GroupBox { + id: gridBox + title: "Grid layout" + Layout.fillWidth: true + + GridLayout { + id: gridLayout + rows: 3 + flow: GridLayout.TopToBottom + anchors.fill: parent + + Label { text: "Line 1" } + Label { text: "Line 2" } + Label { text: "Line 3" } + + TextField { } + TextField { } + TextField { } + + TextArea { + text: "This widget spans over three rows in the GridLayout.\n" + + "All items in the GridLayout are implicitly positioned from top to bottom." + Layout.rowSpan: 3 + Layout.fillHeight: true + Layout.fillWidth: true + } + } + } + TextArea { + id: t3 + text: "This fills the whole cell" + Layout.minimumHeight: 30 + Layout.fillHeight: true + Layout.fillWidth: true + } + GroupBox { + id: stackBox + title: "Stack layout" + implicitWidth: 200 + implicitHeight: 60 + Layout.fillWidth: true + Layout.fillHeight: true + StackLayout { + id: stackLayout + anchors.fill: parent + + function advance() { currentIndex = (currentIndex + 1) % count } + + Repeater { + id: stackRepeater + model: 5 + Rectangle { + color: Qt.hsla((0.5 + index)/stackRepeater.count, 0.3, 0.7, 1) + Button { anchors.centerIn: parent; text: "Page " + (index + 1); onClicked: { stackLayout.advance() } } + } + } + } + } + } +} diff --git a/examples/quickcontrols/controls/basiclayouts/resources.qrc b/examples/quickcontrols/controls/basiclayouts/resources.qrc new file mode 100644 index 000000000..3b111a907 --- /dev/null +++ b/examples/quickcontrols/controls/basiclayouts/resources.qrc @@ -0,0 +1,5 @@ + + + main.qml + + diff --git a/examples/quickcontrols/controls/basiclayouts/src/main.cpp b/examples/quickcontrols/controls/basiclayouts/src/main.cpp new file mode 100644 index 000000000..e66387f7b --- /dev/null +++ b/examples/quickcontrols/controls/basiclayouts/src/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 "qtquickcontrolsapplication.h" +#include + +int main(int argc, char *argv[]) +{ + QtQuickControlsApplication app(argc, argv); + QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); + if (engine.rootObjects().isEmpty()) + return -1; + return app.exec(); +} diff --git a/examples/quickcontrols/controls/basiclayouts/src/src.pri b/examples/quickcontrols/controls/basiclayouts/src/src.pri new file mode 100644 index 000000000..66d903eac --- /dev/null +++ b/examples/quickcontrols/controls/basiclayouts/src/src.pri @@ -0,0 +1,2 @@ +SOURCES += \ + $$PWD/main.cpp diff --git a/examples/quickcontrols/controls/calendar/calendar.pro b/examples/quickcontrols/controls/calendar/calendar.pro new file mode 100644 index 000000000..67960e275 --- /dev/null +++ b/examples/quickcontrols/controls/calendar/calendar.pro @@ -0,0 +1,14 @@ +QT += qml quick sql +TARGET = calendar + +!contains(sql-drivers, sqlite): QTPLUGIN += qsqlite + +include(src/src.pri) +include(../shared/shared.pri) + +OTHER_FILES += qml/main.qml + +RESOURCES += resources.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/controls/calendar +INSTALLS += target diff --git a/examples/quickcontrols/controls/calendar/images/eventindicator.png b/examples/quickcontrols/controls/calendar/images/eventindicator.png new file mode 100644 index 000000000..1edffd02d Binary files /dev/null and b/examples/quickcontrols/controls/calendar/images/eventindicator.png differ diff --git a/examples/quickcontrols/controls/calendar/qml/main.qml b/examples/quickcontrols/controls/calendar/qml/main.qml new file mode 100644 index 000000000..46215e28d --- /dev/null +++ b/examples/quickcontrols/controls/calendar/qml/main.qml @@ -0,0 +1,216 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.1 +import org.qtproject.examples.calendar 1.0 + +ApplicationWindow { + visible: true + width: 640 + height: 400 + minimumWidth: 400 + minimumHeight: 300 + color: "#f4f4f4" + + title: "Calendar Example" + + SystemPalette { + id: systemPalette + } + + SqlEventModel { + id: eventModel + } + + Flow { + id: row + anchors.fill: parent + anchors.margins: 20 + spacing: 10 + layoutDirection: Qt.RightToLeft + + Calendar { + id: calendar + width: (parent.width > parent.height ? parent.width * 0.6 - parent.spacing : parent.width) + height: (parent.height > parent.width ? parent.height * 0.6 - parent.spacing : parent.height) + frameVisible: true + weekNumbersVisible: true + selectedDate: new Date(2014, 0, 1) + focus: true + + style: CalendarStyle { + dayDelegate: Item { + readonly property color sameMonthDateTextColor: "#444" + readonly property color selectedDateColor: Qt.platform.os === "osx" ? "#3778d0" : systemPalette.highlight + readonly property color selectedDateTextColor: "white" + readonly property color differentMonthDateTextColor: "#bbb" + readonly property color invalidDatecolor: "#dddddd" + + Rectangle { + anchors.fill: parent + border.color: "transparent" + color: styleData.date !== undefined && styleData.selected ? selectedDateColor : "transparent" + anchors.margins: styleData.selected ? -1 : 0 + } + + Image { + visible: eventModel.eventsForDate(styleData.date).length > 0 + anchors.top: parent.top + anchors.left: parent.left + anchors.margins: -1 + width: 12 + height: width + source: "qrc:/images/eventindicator.png" + } + + Label { + id: dayDelegateText + text: styleData.date.getDate() + anchors.centerIn: parent + color: { + var color = invalidDatecolor; + if (styleData.valid) { + // Date is within the valid range. + color = styleData.visibleMonth ? sameMonthDateTextColor : differentMonthDateTextColor; + if (styleData.selected) { + color = selectedDateTextColor; + } + } + color; + } + } + } + } + } + + Component { + id: eventListHeader + + Row { + id: eventDateRow + width: parent.width + height: eventDayLabel.height + spacing: 10 + + Label { + id: eventDayLabel + text: calendar.selectedDate.getDate() + font.pointSize: 35 + } + + Column { + height: eventDayLabel.height + + Label { + readonly property var options: { weekday: "long" } + text: Qt.locale().standaloneDayName(calendar.selectedDate.getDay(), Locale.LongFormat) + font.pointSize: 18 + } + Label { + text: Qt.locale().standaloneMonthName(calendar.selectedDate.getMonth()) + + calendar.selectedDate.toLocaleDateString(Qt.locale(), " yyyy") + font.pointSize: 12 + } + } + } + } + + Rectangle { + width: (parent.width > parent.height ? parent.width * 0.4 - parent.spacing : parent.width) + height: (parent.height > parent.width ? parent.height * 0.4 - parent.spacing : parent.height) + border.color: Qt.darker(color, 1.2) + + ListView { + id: eventsListView + spacing: 4 + clip: true + header: eventListHeader + anchors.fill: parent + anchors.margins: 10 + model: eventModel.eventsForDate(calendar.selectedDate) + + delegate: Rectangle { + width: eventsListView.width + height: eventItemColumn.height + anchors.horizontalCenter: parent.horizontalCenter + + Image { + anchors.top: parent.top + anchors.topMargin: 4 + width: 12 + height: width + source: "qrc:/images/eventindicator.png" + } + + Rectangle { + width: parent.width + height: 1 + color: "#eee" + } + + Column { + id: eventItemColumn + anchors.left: parent.left + anchors.leftMargin: 20 + anchors.right: parent.right + height: timeLabel.height + nameLabel.height + 8 + + Label { + id: nameLabel + width: parent.width + wrapMode: Text.Wrap + text: modelData.name + } + Label { + id: timeLabel + width: parent.width + wrapMode: Text.Wrap + text: modelData.startDate.toLocaleTimeString(calendar.locale, Locale.ShortFormat) + color: "#aaa" + } + } + } + } + } + } +} diff --git a/examples/quickcontrols/controls/calendar/resources.qrc b/examples/quickcontrols/controls/calendar/resources.qrc new file mode 100644 index 000000000..9da283ba3 --- /dev/null +++ b/examples/quickcontrols/controls/calendar/resources.qrc @@ -0,0 +1,6 @@ + + + qml/main.qml + images/eventindicator.png + + diff --git a/examples/quickcontrols/controls/calendar/src/event.cpp b/examples/quickcontrols/controls/calendar/src/event.cpp new file mode 100644 index 000000000..e4c7dd787 --- /dev/null +++ b/examples/quickcontrols/controls/calendar/src/event.cpp @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 "event.h" + +Event::Event(QObject *parent) : + QObject(parent) +{ +} + +QString Event::name() const +{ + return mName; +} + +void Event::setName(const QString &name) +{ + if (name != mName) { + mName = name; + emit nameChanged(mName); + } +} + +QDateTime Event::startDate() const +{ + return mStartDate; +} + +void Event::setStartDate(const QDateTime &startDate) +{ + if (startDate != mStartDate) { + mStartDate = startDate; + emit startDateChanged(mStartDate); + } +} + +QDateTime Event::endDate() const +{ + return mEndDate; +} + +void Event::setEndDate(const QDateTime &endDate) +{ + if (endDate != mEndDate) { + mEndDate = endDate; + emit endDateChanged(mEndDate); + } +} diff --git a/examples/quickcontrols/controls/calendar/src/event.h b/examples/quickcontrols/controls/calendar/src/event.h new file mode 100644 index 000000000..bfa11ad72 --- /dev/null +++ b/examples/quickcontrols/controls/calendar/src/event.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 EVENT_H +#define EVENT_H + +#include +#include +#include + +class Event : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + Q_PROPERTY(QDateTime startDate READ startDate WRITE setStartDate NOTIFY startDateChanged) + Q_PROPERTY(QDateTime endDate READ endDate WRITE setEndDate NOTIFY endDateChanged) +public: + explicit Event(QObject *parent = 0); + + QString name() const; + void setName(const QString &name); + + QDateTime startDate() const; + void setStartDate(const QDateTime &startDate); + + QDateTime endDate() const; + void setEndDate(const QDateTime &endDate); +signals: + void nameChanged(const QString &name); + void startDateChanged(const QDateTime &startDate); + void endDateChanged(const QDateTime &endDate); +private: + QString mName; + QDateTime mStartDate; + QDateTime mEndDate; +}; + +#endif diff --git a/examples/quickcontrols/controls/calendar/src/main.cpp b/examples/quickcontrols/controls/calendar/src/main.cpp new file mode 100644 index 000000000..bab7e4b26 --- /dev/null +++ b/examples/quickcontrols/controls/calendar/src/main.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 "qtquickcontrolsapplication.h" +#include "sqleventmodel.h" + +int main(int argc, char *argv[]) +{ + QtQuickControlsApplication app(argc, argv); + qmlRegisterType("org.qtproject.examples.calendar", 1, 0, "SqlEventModel"); + QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml")); + if (engine.rootObjects().isEmpty()) + return -1; + return app.exec(); +} diff --git a/examples/quickcontrols/controls/calendar/src/sqleventmodel.cpp b/examples/quickcontrols/controls/calendar/src/sqleventmodel.cpp new file mode 100644 index 000000000..92e558ef3 --- /dev/null +++ b/examples/quickcontrols/controls/calendar/src/sqleventmodel.cpp @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 "sqleventmodel.h" + +#include +#include +#include +#include + +SqlEventModel::SqlEventModel() +{ + createConnection(); +} + +QList SqlEventModel::eventsForDate(const QDate &date) +{ + const QString queryStr = QString::fromLatin1("SELECT * FROM Event WHERE '%1' >= startDate AND '%1' <= endDate").arg(date.toString("yyyy-MM-dd")); + QSqlQuery query(queryStr); + if (!query.exec()) + qFatal("Query failed"); + + QList events; + while (query.next()) { + Event *event = new Event(this); + event->setName(query.value("name").toString()); + + QDateTime startDate; + startDate.setDate(query.value("startDate").toDate()); + startDate.setTime(QTime(0, 0).addSecs(query.value("startTime").toInt())); + event->setStartDate(startDate); + + QDateTime endDate; + endDate.setDate(query.value("endDate").toDate()); + endDate.setTime(QTime(0, 0).addSecs(query.value("endTime").toInt())); + event->setEndDate(endDate); + + events.append(event); + } + + return events; +} + +/* + Defines a helper function to open a connection to an + in-memory SQLITE database and to create a test table. +*/ +void SqlEventModel::createConnection() +{ + QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); + db.setDatabaseName(":memory:"); + if (!db.open()) { + qFatal("Cannot open database"); + return; + } + + QSqlQuery query; + // We store the time as seconds because it's easier to query. + query.exec("create table Event (name TEXT, startDate DATE, startTime INT, endDate DATE, endTime INT)"); + query.exec("insert into Event values('Grocery shopping', '2014-01-01', 36000, '2014-01-01', 39600)"); + query.exec("insert into Event values('Ice skating', '2014-01-01', 57600, '2014-01-01', 61200)"); + query.exec("insert into Event values('Doctor''s appointment', '2014-01-15', 57600, '2014-01-15', 63000)"); + query.exec("insert into Event values('Conference', '2014-01-24', 32400, '2014-01-28', 61200)"); + + return; +} diff --git a/examples/quickcontrols/controls/calendar/src/sqleventmodel.h b/examples/quickcontrols/controls/calendar/src/sqleventmodel.h new file mode 100644 index 000000000..e7a35c011 --- /dev/null +++ b/examples/quickcontrols/controls/calendar/src/sqleventmodel.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 SQLEVENTMODEL_H +#define SQLEVENTMODEL_H + +#include +#include + +#include "event.h" + +class SqlEventModel : public QObject +{ + Q_OBJECT + +public: + SqlEventModel(); + + Q_INVOKABLE QList eventsForDate(const QDate &date); + +private: + static void createConnection(); +}; + +#endif diff --git a/examples/quickcontrols/controls/calendar/src/src.pri b/examples/quickcontrols/controls/calendar/src/src.pri new file mode 100644 index 000000000..50b2ea620 --- /dev/null +++ b/examples/quickcontrols/controls/calendar/src/src.pri @@ -0,0 +1,9 @@ +SOURCES += \ + $$PWD/event.cpp \ + $$PWD/main.cpp \ + $$PWD/sqleventmodel.cpp + + +HEADERS += \ + $$PWD/event.h \ + $$PWD/sqleventmodel.h diff --git a/examples/quickcontrols/controls/controls.pro b/examples/quickcontrols/controls/controls.pro new file mode 100644 index 000000000..02b0e094b --- /dev/null +++ b/examples/quickcontrols/controls/controls.pro @@ -0,0 +1,20 @@ +TEMPLATE = subdirs + +SUBDIRS += \ + gallery \ + tableview \ + touch \ + basiclayouts \ + styles \ + uiforms + +qtHaveModule(widgets) { + SUBDIRS += texteditor filesystembrowser +} + +qtHaveModule(sql) { + SUBDIRS += calendar +} + +EXAMPLE_FILES += \ + shared diff --git a/examples/quickcontrols/controls/filesystembrowser/filesystembrowser.pro b/examples/quickcontrols/controls/filesystembrowser/filesystembrowser.pro new file mode 100644 index 000000000..fc14584cd --- /dev/null +++ b/examples/quickcontrols/controls/filesystembrowser/filesystembrowser.pro @@ -0,0 +1,10 @@ +TEMPLATE = app +TARGET = filesystembrowser +QT += qml quick widgets + +SOURCES += main.cpp + +RESOURCES += qml.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/controls/filesystembrowser +INSTALLS += target diff --git a/examples/quickcontrols/controls/filesystembrowser/main.cpp b/examples/quickcontrols/controls/filesystembrowser/main.cpp new file mode 100644 index 000000000..e9c63c208 --- /dev/null +++ b/examples/quickcontrols/controls/filesystembrowser/main.cpp @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 +#include +#include +#include +#include +#include + +static inline QString permissionString(const QFileInfo &fi) +{ + const QFile::Permissions permissions = fi.permissions(); + QString result = QLatin1String("----------"); + if (fi.isSymLink()) + result[0] = QLatin1Char('l'); + else if (fi.isDir()) + result[0] = QLatin1Char('d'); + if (permissions & QFileDevice::ReadUser) + result[1] = QLatin1Char('r'); + if (permissions & QFileDevice::WriteUser) + result[2] = QLatin1Char('w'); + if (permissions & QFileDevice::ExeUser) + result[3] = QLatin1Char('x'); + if (permissions & QFileDevice::ReadGroup) + result[4] = QLatin1Char('r'); + if (permissions & QFileDevice::WriteGroup) + result[5] = QLatin1Char('w'); + if (permissions & QFileDevice::ExeGroup) + result[6] = QLatin1Char('x'); + if (permissions & QFileDevice::ReadOther) + result[7] = QLatin1Char('r'); + if (permissions & QFileDevice::WriteOther) + result[8] = QLatin1Char('w'); + if (permissions & QFileDevice::ExeOther) + result[9] = QLatin1Char('x'); + return result; +} + +static inline QString sizeString(const QFileInfo &fi) +{ + if (!fi.isFile()) + return QString(); + const qint64 size = fi.size(); + if (size > 1024 * 1024 * 10) + return QString::number(size / (1024 * 1024)) + QLatin1Char('M'); + if (size > 1024 * 10) + return QString::number(size / 1024) + QLatin1Char('K'); + return QString::number(size); +} + +class DisplayFileSystemModel : public QFileSystemModel { + Q_OBJECT +public: + explicit DisplayFileSystemModel(QObject *parent = Q_NULLPTR) + : QFileSystemModel(parent) {} + + enum Roles { + SizeRole = Qt::UserRole + 4, + DisplayableFilePermissionsRole = Qt::UserRole + 5, + LastModifiedRole = Qt::UserRole + 6, + UrlStringRole = Qt::UserRole + 7 + }; + Q_ENUM(Roles) + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE + { + if (index.isValid() && role >= SizeRole) { + switch (role) { + case SizeRole: + return QVariant(sizeString(fileInfo(index))); + case DisplayableFilePermissionsRole: + return QVariant(permissionString(fileInfo(index))); + case LastModifiedRole: + return QVariant(fileInfo(index).lastModified().toString(Qt::SystemLocaleShortDate)); + case UrlStringRole: + return QVariant(QUrl::fromLocalFile(filePath(index)).toString()); + default: + break; + } + } + return QFileSystemModel::data(index, role); + } + + QHash roleNames() const Q_DECL_OVERRIDE + { + QHash result = QFileSystemModel::roleNames(); + result.insert(SizeRole, QByteArrayLiteral("size")); + result.insert(DisplayableFilePermissionsRole, QByteArrayLiteral("displayableFilePermissions")); + result.insert(LastModifiedRole, QByteArrayLiteral("lastModified")); + return result; + } +}; + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QQmlApplicationEngine engine; + qmlRegisterUncreatableType("io.qt.examples.quick.controls.filesystembrowser", 1, 0, + "FileSystemModel", "Cannot create a FileSystemModel instance."); + QFileSystemModel *fsm = new DisplayFileSystemModel(&engine); + fsm->setRootPath(QDir::homePath()); + fsm->setResolveSymlinks(true); + engine.rootContext()->setContextProperty("fileSystemModel", fsm); + engine.rootContext()->setContextProperty("rootPathIndex", fsm->index(fsm->rootPath())); + engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); + if (engine.rootObjects().isEmpty()) + return -1; + + return app.exec(); +} + +#include "main.moc" diff --git a/examples/quickcontrols/controls/filesystembrowser/main.qml b/examples/quickcontrols/controls/filesystembrowser/main.qml new file mode 100644 index 000000000..6e79ca618 --- /dev/null +++ b/examples/quickcontrols/controls/filesystembrowser/main.qml @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.5 +import QtQml.Models 2.2 +import io.qt.examples.quick.controls.filesystembrowser 1.0 + +ApplicationWindow { + visible: true + width: 640 + height: 480 + title: qsTr("File System") + + menuBar: MenuBar { + Menu { + title: qsTr("File") + MenuItem { + text: qsTr("Exit") + onTriggered: Qt.quit(); + } + } + } + + Row { + id: row + anchors.top: parent.top + anchors.topMargin: 12 + anchors.horizontalCenter: parent.horizontalCenter + + ExclusiveGroup { + id: eg + } + + Repeater { + model: [ "None", "Single", "Extended", "Multi", "Contig."] + Button { + text: modelData + exclusiveGroup: eg + checkable: true + checked: index === 1 + onClicked: view.selectionMode = index + } + } + } + + ItemSelectionModel { + id: sel + model: fileSystemModel + } + + TreeView { + id: view + anchors.fill: parent + anchors.margins: 2 * 12 + row.height + model: fileSystemModel + rootIndex: rootPathIndex + selection: sel + + TableViewColumn { + title: "Name" + role: "fileName" + resizable: true + } + + TableViewColumn { + title: "Size" + role: "size" + resizable: true + horizontalAlignment : Text.AlignRight + width: 70 + } + + TableViewColumn { + title: "Permissions" + role: "displayableFilePermissions" + resizable: true + width: 100 + } + + TableViewColumn { + title: "Date Modified" + role: "lastModified" + resizable: true + } + + onActivated : { + var url = fileSystemModel.data(index, FileSystemModel.UrlStringRole) + Qt.openUrlExternally(url) + } + } +} diff --git a/examples/quickcontrols/controls/filesystembrowser/qml.qrc b/examples/quickcontrols/controls/filesystembrowser/qml.qrc new file mode 100644 index 000000000..5f6483ac3 --- /dev/null +++ b/examples/quickcontrols/controls/filesystembrowser/qml.qrc @@ -0,0 +1,5 @@ + + + main.qml + + diff --git a/examples/quickcontrols/controls/gallery/gallery.pro b/examples/quickcontrols/controls/gallery/gallery.pro new file mode 100644 index 000000000..5cba235da --- /dev/null +++ b/examples/quickcontrols/controls/gallery/gallery.pro @@ -0,0 +1,23 @@ +TEMPLATE = app +TARGET = gallery + +SOURCES += \ + main.cpp + +RESOURCES += \ + gallery.qrc + +OTHER_FILES += \ + main.qml \ + qml/ButtonPage.qml \ + qml/InputPage.qml \ + qml/ProgressPage.qml \ + qml/UI.js \ + qml/+android/UI.js \ + qml/+ios/UI.js \ + qml/+osx/UI.js + +include(../shared/shared.pri) + +target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/controls/gallery +INSTALLS += target diff --git a/examples/quickcontrols/controls/gallery/gallery.qrc b/examples/quickcontrols/controls/gallery/gallery.qrc new file mode 100644 index 000000000..873c8b5ca --- /dev/null +++ b/examples/quickcontrols/controls/gallery/gallery.qrc @@ -0,0 +1,12 @@ + + + main.qml + qml/ButtonPage.qml + qml/InputPage.qml + qml/ProgressPage.qml + qml/UI.js + qml/+android/UI.js + qml/+ios/UI.js + qml/+osx/UI.js + + diff --git a/examples/quickcontrols/controls/gallery/main.cpp b/examples/quickcontrols/controls/gallery/main.cpp new file mode 100644 index 000000000..ac3f447d3 --- /dev/null +++ b/examples/quickcontrols/controls/gallery/main.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 "qtquickcontrolsapplication.h" +#include +#include + +int main(int argc, char *argv[]) +{ + QtQuickControlsApplication app(argc, argv); + if (QCoreApplication::arguments().contains(QLatin1String("--coreprofile"))) { + QSurfaceFormat fmt; + fmt.setVersion(4, 4); + fmt.setProfile(QSurfaceFormat::CoreProfile); + QSurfaceFormat::setDefaultFormat(fmt); + } + QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); + if (engine.rootObjects().isEmpty()) + return -1; + return app.exec(); +} diff --git a/examples/quickcontrols/controls/gallery/main.qml b/examples/quickcontrols/controls/gallery/main.qml new file mode 100644 index 000000000..ab3d8d32a --- /dev/null +++ b/examples/quickcontrols/controls/gallery/main.qml @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Layouts 1.1 +import QtQuick.Dialogs 1.1 +import QtQuick.Controls 1.2 +import "qml/UI.js" as UI +import "qml" + +ApplicationWindow { + visible: true + title: "Qt Quick Controls Gallery" + + width: 640 + height: 480 + + MessageDialog { + id: aboutDialog + icon: StandardIcon.Information + title: "About" + text: "Qt Quick Controls Gallery" + informativeText: "This example demonstrates most of the available Qt Quick Controls." + } + + Action { + id: copyAction + text: "&Copy" + shortcut: StandardKey.Copy + iconName: "edit-copy" + enabled: (!!activeFocusItem && !!activeFocusItem["copy"]) + onTriggered: activeFocusItem.copy() + } + + Action { + id: cutAction + text: "Cu&t" + shortcut: StandardKey.Cut + iconName: "edit-cut" + enabled: (!!activeFocusItem && !!activeFocusItem["cut"]) + onTriggered: activeFocusItem.cut() + } + + Action { + id: pasteAction + text: "&Paste" + shortcut: StandardKey.Paste + iconName: "edit-paste" + enabled: (!!activeFocusItem && !!activeFocusItem["paste"]) + onTriggered: activeFocusItem.paste() + } + + toolBar: ToolBar { + RowLayout { + anchors.fill: parent + anchors.margins: spacing + Label { + text: UI.label + } + Item { Layout.fillWidth: true } + CheckBox { + id: enabler + text: "Enabled" + checked: true + } + } + } + + menuBar: MenuBar { + Menu { + title: "&File" + MenuItem { + text: "E&xit" + shortcut: StandardKey.Quit + onTriggered: Qt.quit() + } + } + Menu { + title: "&Edit" + visible: tabView.currentIndex == 2 + MenuItem { action: cutAction } + MenuItem { action: copyAction } + MenuItem { action: pasteAction } + } + Menu { + title: "&Help" + MenuItem { + text: "About..." + onTriggered: aboutDialog.open() + } + } + } + + TabView { + id: tabView + + anchors.fill: parent + anchors.margins: UI.margin + tabPosition: UI.tabPosition + + Layout.minimumWidth: 360 + Layout.minimumHeight: 360 + Layout.preferredWidth: 480 + Layout.preferredHeight: 640 + + Tab { + title: "Buttons" + ButtonPage { + enabled: enabler.checked + } + } + Tab { + title: "Progress" + ProgressPage { + enabled: enabler.checked + } + } + Tab { + title: "Input" + InputPage { + enabled: enabler.checked + } + } + } +} diff --git a/examples/quickcontrols/controls/gallery/qml/+android/UI.js b/examples/quickcontrols/controls/gallery/qml/+android/UI.js new file mode 100644 index 000000000..417b4581e --- /dev/null +++ b/examples/quickcontrols/controls/gallery/qml/+android/UI.js @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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$ +** +****************************************************************************/ + +.pragma library + +var margin = 0 +var tabPosition = Qt.BottomEdge +var label = "Gallery" diff --git a/examples/quickcontrols/controls/gallery/qml/+ios/UI.js b/examples/quickcontrols/controls/gallery/qml/+ios/UI.js new file mode 100644 index 000000000..417b4581e --- /dev/null +++ b/examples/quickcontrols/controls/gallery/qml/+ios/UI.js @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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$ +** +****************************************************************************/ + +.pragma library + +var margin = 0 +var tabPosition = Qt.BottomEdge +var label = "Gallery" diff --git a/examples/quickcontrols/controls/gallery/qml/+osx/UI.js b/examples/quickcontrols/controls/gallery/qml/+osx/UI.js new file mode 100644 index 000000000..ee439953c --- /dev/null +++ b/examples/quickcontrols/controls/gallery/qml/+osx/UI.js @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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$ +** +****************************************************************************/ + +.pragma library + +var margin = 12 +var tabPosition = Qt.TopEdge +var label = "" diff --git a/examples/quickcontrols/controls/gallery/qml/ButtonPage.qml b/examples/quickcontrols/controls/gallery/qml/ButtonPage.qml new file mode 100644 index 000000000..b6db20de4 --- /dev/null +++ b/examples/quickcontrols/controls/gallery/qml/ButtonPage.qml @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 + +ScrollView { + id: page + implicitWidth: 640 + implicitHeight: 200 + + horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff + + Item { + id: content + + width: Math.max(page.viewport.width, grid.implicitWidth + 2 * grid.rowSpacing) + height: Math.max(page.viewport.height, grid.implicitHeight + 2 * grid.columnSpacing) + + GridLayout { + id: grid + + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + anchors.leftMargin: grid.rowSpacing + anchors.rightMargin: grid.rowSpacing + anchors.topMargin: grid.columnSpacing + + columns: page.width < page.height ? 1 : 2 + + GroupBox { + title: "Button" + Layout.fillWidth: true + Layout.columnSpan: grid.columns + RowLayout { + anchors.fill: parent + Button { text: "OK"; isDefault: true } + Button { text: "Cancel" } + Item { Layout.fillWidth: true } + Button { + text: "Attach" + menu: Menu { + MenuItem { text: "Image" } + MenuItem { text: "Document" } + } + } + } + } + + GroupBox { + title: "CheckBox" + Layout.fillWidth: true + ColumnLayout { + anchors.fill: parent + CheckBox { text: "E-mail"; checked: true } + CheckBox { text: "Calendar"; checked: true } + CheckBox { text: "Contacts" } + } + } + + GroupBox { + title: "RadioButton" + Layout.fillWidth: true + ColumnLayout { + anchors.fill: parent + ExclusiveGroup { id: radioGroup } + RadioButton { text: "Portrait"; exclusiveGroup: radioGroup } + RadioButton { text: "Landscape"; exclusiveGroup: radioGroup } + RadioButton { text: "Automatic"; exclusiveGroup: radioGroup; checked: true } + } + } + + GroupBox { + title: "Switch" + Layout.fillWidth: true + Layout.columnSpan: grid.columns + ColumnLayout { + anchors.fill: parent + RowLayout { + Label { text: "Wi-Fi"; Layout.fillWidth: true } + Switch { checked: true } + } + RowLayout { + Label { text: "Bluetooth"; Layout.fillWidth: true } + Switch { checked: false } + } + } + } + } + } +} diff --git a/examples/quickcontrols/controls/gallery/qml/InputPage.qml b/examples/quickcontrols/controls/gallery/qml/InputPage.qml new file mode 100644 index 000000000..660429671 --- /dev/null +++ b/examples/quickcontrols/controls/gallery/qml/InputPage.qml @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 + +ScrollView { + id: page + implicitWidth: 640 + implicitHeight: 400 + + horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff + + Item { + id: content + + width: Math.max(page.viewport.width, column.implicitWidth + 2 * column.spacing) + height: Math.max(page.viewport.height, column.implicitHeight + 2 * column.spacing) + + ColumnLayout { + id: column + + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: column.spacing + + GroupBox { + title: "TextField" + Layout.fillWidth: true + ColumnLayout { + anchors.fill: parent + TextField { placeholderText: "..."; Layout.fillWidth: true; z: 1 } + TextField { placeholderText: "Password"; echoMode: TextInput.Password; Layout.fillWidth: true } + } + } + + GroupBox { + title: "ComboBox" + Layout.fillWidth: true + ColumnLayout { + anchors.fill: parent + ComboBox { + model: Qt.fontFamilies() + Layout.fillWidth: true + } + ComboBox { + editable: true + model: ListModel { + id: listModel + ListElement { text: "Apple" } + ListElement { text: "Banana" } + ListElement { text: "Coconut" } + ListElement { text: "Orange" } + } + onAccepted: { + if (find(currentText) === -1) { + listModel.append({text: editText}) + currentIndex = find(editText) + } + } + Layout.fillWidth: true + } + } + } + + GroupBox { + title: "SpinBox" + Layout.fillWidth: true + ColumnLayout { + anchors.fill: parent + SpinBox { value: 99; Layout.fillWidth: true; z: 1 } + SpinBox { decimals: 2; Layout.fillWidth: true } + } + } + } + } +} diff --git a/examples/quickcontrols/controls/gallery/qml/ProgressPage.qml b/examples/quickcontrols/controls/gallery/qml/ProgressPage.qml new file mode 100644 index 000000000..416e936ae --- /dev/null +++ b/examples/quickcontrols/controls/gallery/qml/ProgressPage.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 + +ScrollView { + id: page + implicitWidth: 640 + implicitHeight: 400 + + horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff + + Item { + id: content + + width: Math.max(page.viewport.width, column.implicitWidth + 2 * column.spacing) + height: Math.max(page.viewport.height, column.implicitHeight + 2 * column.spacing) + + ColumnLayout { + id: column + + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: column.spacing + + GroupBox { + title: "ProgressBar" + Layout.fillWidth: true + ColumnLayout { + anchors.fill: parent + ProgressBar { indeterminate: true; Layout.fillWidth: true } + ProgressBar { value: slider.value; Layout.fillWidth: true } + } + } + + GroupBox { + title: "Slider" + Layout.fillWidth: true + ColumnLayout { + anchors.fill: parent + Slider { id: slider; value: 0.5; Layout.fillWidth: true } + } + } + + GroupBox { + title: "BusyIndicator" + Layout.fillWidth: true + BusyIndicator { running: true } + } + } + } +} diff --git a/examples/quickcontrols/controls/gallery/qml/UI.js b/examples/quickcontrols/controls/gallery/qml/UI.js new file mode 100644 index 000000000..819c34eec --- /dev/null +++ b/examples/quickcontrols/controls/gallery/qml/UI.js @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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$ +** +****************************************************************************/ + +.pragma library + +var margin = 2 +var tabPosition = Qt.TopEdge +var label = "" diff --git a/examples/quickcontrols/controls/shared/qtquickcontrolsapplication.h b/examples/quickcontrols/controls/shared/qtquickcontrolsapplication.h new file mode 100644 index 000000000..5f22b483f --- /dev/null +++ b/examples/quickcontrols/controls/shared/qtquickcontrolsapplication.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 QTQUICKCONTROLSAPPLICATION_H +#define QTQUICKCONTROLSAPPLICATION_H + +#ifdef QT_WIDGETS_LIB +#include +#else +#include +#endif + +QT_BEGIN_NAMESPACE + +#ifdef QT_WIDGETS_LIB +#define QtQuickControlsApplication QApplication +#else +#define QtQuickControlsApplication QGuiApplication +#endif + +QT_END_NAMESPACE + +#endif // QTQUICKCONTROLSAPPLICATION_H diff --git a/examples/quickcontrols/controls/shared/shared.pri b/examples/quickcontrols/controls/shared/shared.pri new file mode 100644 index 000000000..1d9e0592f --- /dev/null +++ b/examples/quickcontrols/controls/shared/shared.pri @@ -0,0 +1,7 @@ +QT += quick +!no_desktop: QT += widgets + +INCLUDEPATH += $$PWD + +SOURCES += \ + $$PWD/qtquickcontrolsapplication.h diff --git a/examples/quickcontrols/controls/styles/images/bubble.png b/examples/quickcontrols/controls/styles/images/bubble.png new file mode 100644 index 000000000..62aa1efe5 Binary files /dev/null and b/examples/quickcontrols/controls/styles/images/bubble.png differ diff --git a/examples/quickcontrols/controls/styles/images/button-pressed.png b/examples/quickcontrols/controls/styles/images/button-pressed.png new file mode 100644 index 000000000..d64cdaa78 Binary files /dev/null and b/examples/quickcontrols/controls/styles/images/button-pressed.png differ diff --git a/examples/quickcontrols/controls/styles/images/button.png b/examples/quickcontrols/controls/styles/images/button.png new file mode 100644 index 000000000..8ab41cc80 Binary files /dev/null and b/examples/quickcontrols/controls/styles/images/button.png differ diff --git a/examples/quickcontrols/controls/styles/images/progress-background.png b/examples/quickcontrols/controls/styles/images/progress-background.png new file mode 100644 index 000000000..55a069dfc Binary files /dev/null and b/examples/quickcontrols/controls/styles/images/progress-background.png differ diff --git a/examples/quickcontrols/controls/styles/images/progress-fill.png b/examples/quickcontrols/controls/styles/images/progress-fill.png new file mode 100644 index 000000000..b588c9586 Binary files /dev/null and b/examples/quickcontrols/controls/styles/images/progress-fill.png differ diff --git a/examples/quickcontrols/controls/styles/images/slider-handle.png b/examples/quickcontrols/controls/styles/images/slider-handle.png new file mode 100644 index 000000000..ac4d4a0d9 Binary files /dev/null and b/examples/quickcontrols/controls/styles/images/slider-handle.png differ diff --git a/examples/quickcontrols/controls/styles/images/tab.png b/examples/quickcontrols/controls/styles/images/tab.png new file mode 100644 index 000000000..74fefab78 Binary files /dev/null and b/examples/quickcontrols/controls/styles/images/tab.png differ diff --git a/examples/quickcontrols/controls/styles/images/tab_selected.png b/examples/quickcontrols/controls/styles/images/tab_selected.png new file mode 100644 index 000000000..665400ccf Binary files /dev/null and b/examples/quickcontrols/controls/styles/images/tab_selected.png differ diff --git a/examples/quickcontrols/controls/styles/images/textfield.png b/examples/quickcontrols/controls/styles/images/textfield.png new file mode 100644 index 000000000..1d4a38ab3 Binary files /dev/null and b/examples/quickcontrols/controls/styles/images/textfield.png differ diff --git a/examples/quickcontrols/controls/styles/main.cpp b/examples/quickcontrols/controls/styles/main.cpp new file mode 100644 index 000000000..55c592e6e --- /dev/null +++ b/examples/quickcontrols/controls/styles/main.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + if (engine.rootObjects().isEmpty()) + return -1; + return app.exec(); +} diff --git a/examples/quickcontrols/controls/styles/main.qml b/examples/quickcontrols/controls/styles/main.qml new file mode 100644 index 000000000..b2eefb862 --- /dev/null +++ b/examples/quickcontrols/controls/styles/main.qml @@ -0,0 +1,397 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Window 2.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 +import QtQuick.Particles 2.0 + +Window { + id: window + width: 640 + height: 480 + visible: true + title: qsTr("Styles Example") + + property int columnFactor: 5 + + GridLayout { + rowSpacing: 12 + columnSpacing: 30 + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + anchors.margins: 30 + + Button { + text: "Button" + implicitWidth: window.width / columnFactor + } + Button { + text: "Button" + style: ButtonStyle { + background: BorderImage { + source: control.pressed ? "images/button-pressed.png" : "images/button.png" + border.left: 4 ; border.right: 4 ; border.top: 4 ; border.bottom: 4 + } + } + implicitWidth: window.width / columnFactor + } + Button { + text: "Button" + style: buttonStyle + implicitWidth: window.width / columnFactor + } + + TextField { + Layout.row: 1 + implicitWidth: window.width / columnFactor + } + TextField { + style: TextFieldStyle { + background: BorderImage { + source: "images/textfield.png" + border.left: 4 ; border.right: 4 ; border.top: 4 ; border.bottom: 4 + } + } + implicitWidth: window.width / columnFactor + } + TextField { + style: textFieldStyle + implicitWidth: window.width / columnFactor + } + + Slider { + id: slider1 + Layout.row: 2 + value: 0.5 + implicitWidth: window.width / columnFactor + } + Slider { + id: slider2 + value: 0.5 + implicitWidth: window.width / columnFactor + style: SliderStyle { + groove: BorderImage { + height: 6 + border.top: 1 + border.bottom: 1 + source: "images/progress-background.png" + border.left: 6 + border.right: 6 + BorderImage { + anchors.verticalCenter: parent.verticalCenter + source: "images/progress-fill.png" + border.left: 5 ; border.top: 1 + border.right: 5 ; border.bottom: 1 + width: styleData.handlePosition + height: parent.height + } + } + handle: Item { + width: 13 + height: 13 + Image { + anchors.centerIn: parent + source: "images/slider-handle.png" + } + } + } + } + Slider { + id: slider3 + value: 0.5 + implicitWidth: window.width / columnFactor + style: sliderStyle + } + + ProgressBar { + Layout.row: 3 + value: slider1.value + implicitWidth: window.width / columnFactor + } + ProgressBar { + value: slider2.value + implicitWidth: window.width / columnFactor + style: progressBarStyle + } + ProgressBar { + value: slider3.value + implicitWidth: window.width / columnFactor + style: progressBarStyle2 + } + + CheckBox { + text: "CheckBox" + Layout.row: 4 + implicitWidth: window.width / columnFactor + } + + RadioButton { + text: "RadioButton" + implicitWidth: window.width / columnFactor + } + + ComboBox { + model: ["Paris", "Oslo", "New York"] + implicitWidth: window.width / columnFactor + } + + TabView { + Layout.row: 5 + Layout.columnSpan: 3 + Layout.fillWidth: true + implicitHeight: 30 + Tab { title: "One" ; Item {} } + Tab { title: "Two" ; Item {} } + Tab { title: "Three" ; Item {} } + Tab { title: "Four" ; Item {} } + } + + TabView { + Layout.row: 6 + Layout.columnSpan: 3 + Layout.fillWidth: true + implicitHeight: 30 + Tab { title: "One" ; Item {}} + Tab { title: "Two" ; Item {}} + Tab { title: "Three" ; Item {}} + Tab { title: "Four" ; Item {}} + style: tabViewStyle + } + } + + // Style delegates: + + Component { + id: buttonStyle + ButtonStyle { + + background: Rectangle { + implicitHeight: 22 + implicitWidth: window.width / columnFactor + color: control.pressed ? "darkGray" : control.activeFocus ? "#cdd" : "#ccc" + antialiasing: true + border.color: "gray" + radius: height/2 + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + antialiasing: true + visible: !control.pressed + border.color: "#aaffffff" + radius: height/2 + } + } + } + } + + Component { + id: textFieldStyle + TextFieldStyle { + background: Rectangle { + implicitWidth: window.width / columnFactor + color: "#f0f0f0" + antialiasing: true + border.color: "gray" + radius: height/2 + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + antialiasing: true + border.color: "#aaffffff" + radius: height/2 + } + } + } + } + + Component { + id: sliderStyle + SliderStyle { + handle: Rectangle { + width: 18 + height: 18 + color: control.pressed ? "darkGray" : "lightGray" + border.color: "gray" + antialiasing: true + radius: height/2 + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + antialiasing: true + border.color: "#eee" + radius: height/2 + } + } + + groove: Rectangle { + height: 8 + implicitWidth: window.width / columnFactor + implicitHeight: 22 + + antialiasing: true + color: "#ccc" + border.color: "#777" + radius: height/2 + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + antialiasing: true + border.color: "#66ffffff" + radius: height/2 + } + } + } + } + + Component { + id: progressBarStyle + ProgressBarStyle { + background: BorderImage { + source: "images/progress-background.png" + border.left: 2 ; border.right: 2 ; border.top: 2 ; border.bottom: 2 + } + progress: Item { + clip: true + BorderImage { + anchors.fill: parent + anchors.rightMargin: (control.value < control.maximumValue) ? -4 : 0 + source: "images/progress-fill.png" + border.left: 10 ; border.right: 10 + Rectangle { + width: 1 + color: "#a70" + opacity: 0.8 + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.bottomMargin: 1 + anchors.right: parent.right + visible: control.value < control.maximumValue + anchors.rightMargin: -parent.anchors.rightMargin + } + } + ParticleSystem { id: bubbles; running: visible } + ImageParticle { + id: fireball + system: bubbles + source: "images/bubble.png" + opacity: 0.7 + } + Emitter { + system: bubbles + anchors.bottom: parent.bottom + anchors.margins: 4 + anchors.bottomMargin: -4 + anchors.left: parent.left + anchors.right: parent.right + size: 4 + sizeVariation: 4 + acceleration: PointDirection { y: -6; xVariation: 3 } + emitRate: 6 * control.value + lifeSpan: 3000 + } + } + } + } + + Component { + id: progressBarStyle2 + ProgressBarStyle { + background: Rectangle { + implicitWidth: window.width / columnFactor + implicitHeight: 24 + color: "#f0f0f0" + border.color: "gray" + } + progress: Rectangle { + color: "#ccc" + border.color: "gray" + Rectangle { + color: "transparent" + border.color: "#44ffffff" + anchors.fill: parent + anchors.margins: 1 + } + } + } + } + + Component { + id: tabViewStyle + TabViewStyle { + tabOverlap: 16 + frameOverlap: 4 + tabsMovable: true + + frame: Rectangle { + gradient: Gradient { + GradientStop { color: "#e5e5e5" ; position: 0 } + GradientStop { color: "#e0e0e0" ; position: 1 } + } + border.color: "#898989" + Rectangle { anchors.fill: parent ; anchors.margins: 1 ; border.color: "white" ; color: "transparent" } + } + tab: Item { + property int totalOverlap: tabOverlap * (control.count - 1) + implicitWidth: Math.min ((styleData.availableWidth + totalOverlap)/control.count - 4, image.sourceSize.width) + implicitHeight: image.sourceSize.height + BorderImage { + id: image + anchors.fill: parent + source: styleData.selected ? "images/tab_selected.png" : "images/tab.png" + border.left: 30 + smooth: false + border.right: 30 + } + Text { + text: styleData.title + anchors.centerIn: parent + } + } + leftCorner: Item { implicitWidth: 12 } + } + } +} diff --git a/examples/quickcontrols/controls/styles/styles.pro b/examples/quickcontrols/controls/styles/styles.pro new file mode 100644 index 000000000..b1b29951d --- /dev/null +++ b/examples/quickcontrols/controls/styles/styles.pro @@ -0,0 +1,13 @@ +TEMPLATE = app +TARGET = styles +QT += qml quick + +SOURCES += \ + main.cpp +RESOURCES += \ + styles.qrc +OTHER_FILES += \ + main.qml + +target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/controls/styles +INSTALLS += target diff --git a/examples/quickcontrols/controls/styles/styles.qrc b/examples/quickcontrols/controls/styles/styles.qrc new file mode 100644 index 000000000..d2300c6fa --- /dev/null +++ b/examples/quickcontrols/controls/styles/styles.qrc @@ -0,0 +1,14 @@ + + + main.qml + images/bubble.png + images/button.png + images/button-pressed.png + images/progress-background.png + images/progress-fill.png + images/slider-handle.png + images/tab.png + images/tab_selected.png + images/textfield.png + + diff --git a/examples/quickcontrols/controls/tableview/main.qml b/examples/quickcontrols/controls/tableview/main.qml new file mode 100644 index 000000000..1d99f4b93 --- /dev/null +++ b/examples/quickcontrols/controls/tableview/main.qml @@ -0,0 +1,188 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 +import org.qtproject.example 1.0 + +ApplicationWindow { + id: window + visible: true + title: "Table View Example" + + toolBar: ToolBar { + TextField { + id: searchBox + + placeholderText: "Search..." + inputMethodHints: Qt.ImhNoPredictiveText + + width: window.width / 5 * 2 + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + } + } + + TableView { + id: tableView + + frameVisible: false + sortIndicatorVisible: true + + anchors.fill: parent + + Layout.minimumWidth: 400 + Layout.minimumHeight: 240 + Layout.preferredWidth: 600 + Layout.preferredHeight: 400 + + TableViewColumn { + id: titleColumn + title: "Title" + role: "title" + movable: false + resizable: false + width: tableView.viewport.width - authorColumn.width + } + + TableViewColumn { + id: authorColumn + title: "Author" + role: "author" + movable: false + resizable: false + width: tableView.viewport.width / 3 + } + + model: SortFilterProxyModel { + id: proxyModel + source: sourceModel.count > 0 ? sourceModel : null + + sortOrder: tableView.sortIndicatorOrder + sortCaseSensitivity: Qt.CaseInsensitive + sortRole: sourceModel.count > 0 ? tableView.getColumn(tableView.sortIndicatorColumn).role : "" + + filterString: "*" + searchBox.text + "*" + filterSyntax: SortFilterProxyModel.Wildcard + filterCaseSensitivity: Qt.CaseInsensitive + } + + ListModel { + id: sourceModel + ListElement { + title: "Moby-Dick" + author: "Herman Melville" + } + ListElement { + title: "The Adventures of Tom Sawyer" + author: "Mark Twain" + } + ListElement { + title: "Cat’s Cradle" + author: "Kurt Vonnegut" + } + ListElement { + title: "Farenheit 451" + author: "Ray Bradbury" + } + ListElement { + title: "It" + author: "Stephen King" + } + ListElement { + title: "On the Road" + author: "Jack Kerouac" + } + ListElement { + title: "Of Mice and Men" + author: "John Steinbeck" + } + ListElement { + title: "Do Androids Dream of Electric Sheep?" + author: "Philip K. Dick" + } + ListElement { + title: "Uncle Tom’s Cabin" + author: "Harriet Beecher Stowe" + } + ListElement { + title: "The Call of the Wild" + author: "Jack London" + } + ListElement { + title: "The Old Man and the Sea" + author: "Ernest Hemingway" + } + ListElement { + title: "A Streetcar Named Desire" + author: "Tennessee Williams" + } + ListElement { + title: "Catch-22" + author: "Joseph Heller" + } + ListElement { + title: "One Flew Over the Cuckoo’s Nest" + author: "Ken Kesey" + } + ListElement { + title: "The Murders in the Rue Morgue" + author: "Edgar Allan Poe" + } + ListElement { + title: "Breakfast at Tiffany’s" + author: "Truman Capote" + } + ListElement { + title: "Death of a Salesman" + author: "Arthur Miller" + } + ListElement { + title: "Post Office" + author: "Charles Bukowski" + } + ListElement { + title: "Herbert West—Reanimator" + author: "H. P. Lovecraft" + } + } + } +} diff --git a/examples/quickcontrols/controls/tableview/src/main.cpp b/examples/quickcontrols/controls/tableview/src/main.cpp new file mode 100644 index 000000000..dbba7f38c --- /dev/null +++ b/examples/quickcontrols/controls/tableview/src/main.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 "qtquickcontrolsapplication.h" +#include "sortfilterproxymodel.h" +#include +#include +#include + +int main(int argc, char *argv[]) +{ + QtQuickControlsApplication app(argc, argv); + if (QCoreApplication::arguments().contains(QLatin1String("--coreprofile"))) { + QSurfaceFormat fmt; + fmt.setVersion(4, 4); + fmt.setProfile(QSurfaceFormat::CoreProfile); + QSurfaceFormat::setDefaultFormat(fmt); + } + qmlRegisterType("org.qtproject.example", 1, 0, "SortFilterProxyModel"); + QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); + return app.exec(); +} diff --git a/examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.cpp b/examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.cpp new file mode 100644 index 000000000..f362d5d3d --- /dev/null +++ b/examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.cpp @@ -0,0 +1,189 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 "sortfilterproxymodel.h" +#include +#include + +SortFilterProxyModel::SortFilterProxyModel(QObject *parent) : QSortFilterProxyModel(parent), m_complete(false) +{ + connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SIGNAL(countChanged())); + connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(countChanged())); +} + +int SortFilterProxyModel::count() const +{ + return rowCount(); +} + +QObject *SortFilterProxyModel::source() const +{ + return sourceModel(); +} + +void SortFilterProxyModel::setSource(QObject *source) +{ + setSourceModel(qobject_cast(source)); +} + +QByteArray SortFilterProxyModel::sortRole() const +{ + return m_sortRole; +} + +void SortFilterProxyModel::setSortRole(const QByteArray &role) +{ + if (m_sortRole != role) { + m_sortRole = role; + if (m_complete) + QSortFilterProxyModel::setSortRole(roleKey(role)); + } +} + +void SortFilterProxyModel::setSortOrder(Qt::SortOrder order) +{ + QSortFilterProxyModel::sort(0, order); +} + +QByteArray SortFilterProxyModel::filterRole() const +{ + return m_filterRole; +} + +void SortFilterProxyModel::setFilterRole(const QByteArray &role) +{ + if (m_filterRole != role) { + m_filterRole = role; + if (m_complete) + QSortFilterProxyModel::setFilterRole(roleKey(role)); + } +} + +QString SortFilterProxyModel::filterString() const +{ + return filterRegExp().pattern(); +} + +void SortFilterProxyModel::setFilterString(const QString &filter) +{ + setFilterRegExp(QRegExp(filter, filterCaseSensitivity(), static_cast(filterSyntax()))); +} + +SortFilterProxyModel::FilterSyntax SortFilterProxyModel::filterSyntax() const +{ + return static_cast(filterRegExp().patternSyntax()); +} + +void SortFilterProxyModel::setFilterSyntax(SortFilterProxyModel::FilterSyntax syntax) +{ + setFilterRegExp(QRegExp(filterString(), filterCaseSensitivity(), static_cast(syntax))); +} + +QJSValue SortFilterProxyModel::get(int idx) const +{ + QJSEngine *engine = qmlEngine(this); + QJSValue value = engine->newObject(); + if (idx >= 0 && idx < count()) { + QHash roles = roleNames(); + QHashIterator it(roles); + while (it.hasNext()) { + it.next(); + value.setProperty(QString::fromUtf8(it.value()), data(index(idx, 0), it.key()).toString()); + } + } + return value; +} + +void SortFilterProxyModel::classBegin() +{ +} + +void SortFilterProxyModel::componentComplete() +{ + m_complete = true; + if (!m_sortRole.isEmpty()) + QSortFilterProxyModel::setSortRole(roleKey(m_sortRole)); + if (!m_filterRole.isEmpty()) + QSortFilterProxyModel::setFilterRole(roleKey(m_filterRole)); +} + +int SortFilterProxyModel::roleKey(const QByteArray &role) const +{ + QHash roles = roleNames(); + QHashIterator it(roles); + while (it.hasNext()) { + it.next(); + if (it.value() == role) + return it.key(); + } + return -1; +} + +QHash SortFilterProxyModel::roleNames() const +{ + if (QAbstractItemModel *source = sourceModel()) + return source->roleNames(); + return QHash(); +} + +bool SortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const +{ + QRegExp rx = filterRegExp(); + if (rx.isEmpty()) + return true; + QAbstractItemModel *model = sourceModel(); + if (filterRole().isEmpty()) { + QHash roles = roleNames(); + QHashIterator it(roles); + while (it.hasNext()) { + it.next(); + QModelIndex sourceIndex = model->index(sourceRow, 0, sourceParent); + QString key = model->data(sourceIndex, it.key()).toString(); + if (key.contains(rx)) + return true; + } + return false; + } + QModelIndex sourceIndex = model->index(sourceRow, 0, sourceParent); + if (!sourceIndex.isValid()) + return true; + QString key = model->data(sourceIndex, roleKey(filterRole())).toString(); + return key.contains(rx); +} diff --git a/examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.h b/examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.h new file mode 100644 index 000000000..c4460b0f1 --- /dev/null +++ b/examples/quickcontrols/controls/tableview/src/sortfilterproxymodel.h @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 SORTFILTERPROXYMODEL_H +#define SORTFILTERPROXYMODEL_H + +#include +#include +#include + +class SortFilterProxyModel : public QSortFilterProxyModel, public QQmlParserStatus +{ + Q_OBJECT + Q_INTERFACES(QQmlParserStatus) + + Q_PROPERTY(int count READ count NOTIFY countChanged) + Q_PROPERTY(QObject *source READ source WRITE setSource) + + Q_PROPERTY(QByteArray sortRole READ sortRole WRITE setSortRole) + Q_PROPERTY(Qt::SortOrder sortOrder READ sortOrder WRITE setSortOrder) + + Q_PROPERTY(QByteArray filterRole READ filterRole WRITE setFilterRole) + Q_PROPERTY(QString filterString READ filterString WRITE setFilterString) + Q_PROPERTY(FilterSyntax filterSyntax READ filterSyntax WRITE setFilterSyntax) + + Q_ENUMS(FilterSyntax) + +public: + explicit SortFilterProxyModel(QObject *parent = 0); + + QObject *source() const; + void setSource(QObject *source); + + QByteArray sortRole() const; + void setSortRole(const QByteArray &role); + + void setSortOrder(Qt::SortOrder order); + + QByteArray filterRole() const; + void setFilterRole(const QByteArray &role); + + QString filterString() const; + void setFilterString(const QString &filter); + + enum FilterSyntax { + RegExp, + Wildcard, + FixedString + }; + + FilterSyntax filterSyntax() const; + void setFilterSyntax(FilterSyntax syntax); + + int count() const; + Q_INVOKABLE QJSValue get(int index) const; + + void classBegin(); + void componentComplete(); + +signals: + void countChanged(); + +protected: + int roleKey(const QByteArray &role) const; + QHash roleNames() const; + bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; + +private: + bool m_complete; + QByteArray m_sortRole; + QByteArray m_filterRole; +}; + +#endif // SORTFILTERPROXYMODEL_H diff --git a/examples/quickcontrols/controls/tableview/src/src.pri b/examples/quickcontrols/controls/tableview/src/src.pri new file mode 100644 index 000000000..491f851c9 --- /dev/null +++ b/examples/quickcontrols/controls/tableview/src/src.pri @@ -0,0 +1,8 @@ +INCLUDEPATH += $$PWD + +HEADERS += \ + $$PWD/sortfilterproxymodel.h + +SOURCES += \ + $$PWD/main.cpp \ + $$PWD/sortfilterproxymodel.cpp diff --git a/examples/quickcontrols/controls/tableview/tableview.pro b/examples/quickcontrols/controls/tableview/tableview.pro new file mode 100644 index 000000000..a956dc428 --- /dev/null +++ b/examples/quickcontrols/controls/tableview/tableview.pro @@ -0,0 +1,14 @@ +TEMPLATE = app +TARGET = tableview + +RESOURCES += \ + tableview.qrc + +OTHER_FILES += \ + main.qml + +include(src/src.pri) +include(../shared/shared.pri) + +target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/controls/tableview +INSTALLS += target diff --git a/examples/quickcontrols/controls/tableview/tableview.qrc b/examples/quickcontrols/controls/tableview/tableview.qrc new file mode 100644 index 000000000..3b111a907 --- /dev/null +++ b/examples/quickcontrols/controls/tableview/tableview.qrc @@ -0,0 +1,5 @@ + + + main.qml + + diff --git a/examples/quickcontrols/controls/texteditor/example.html b/examples/quickcontrols/controls/texteditor/example.html new file mode 100644 index 000000000..52bb507a1 --- /dev/null +++ b/examples/quickcontrols/controls/texteditor/example.html @@ -0,0 +1,79 @@ +TextArea Example +

TextArea

+

The TextArea control is an advanced editor that supports formatted rich text. It can be used to display HTML and other rich document formats. Internally, TextArea uses the QQuickTextDocument class to describe both the high-level structure of each document and the low-level formatting of paragraphs.

+

If you are viewing this document in the Text Editor example, you can edit this document to explore Qt's rich text editing features. We have included some comments in each of the following sections to encourage you to experiment.

+

Font and Paragraph Styles

+

TextArea supports bold, italic, and underlined font styles, and can display multicolored + text. Font families such as Helvetica and + Courier can also be used directly. If you place the cursor in a region of styled text, the corresponding controls in the tool bar will change to reflect the current style, font size and color.

+

Paragraphs can be formatted so that the text is left-aligned, right-aligned, centered, or fully justified.

+

Try changing the alignment of some text and resize the editor to see how the text layout changes.

+

Lists

+

Different kinds of lists can be included in rich text documents. Standard bullet lists can be nested, using different symbols for each level of the list:

+
  • Disc symbols are typically used for top-level list items.
+
  • Circle symbols can be used to distinguish between items in lower-level lists.
+
  • Square symbols provide a reasonable alternative to discs and circles.
+

Ordered lists can be used for tables of contents. Different characters can be used to enumerate items, and one can use both Roman and Arabic numerals in the same list structure:

+
  1. Introduction
  2. +
  3. Qt Tools
+
  1. Qt Assistant
  2. +
  3. Qt Designer
  4. +
    1. Form Editor
    2. +
    3. Component Architecture
    +
  5. Qt Linguist
+

+

The list will automatically be renumbered if you add or remove items. Try adding new sections to the above list or removing existing item to see the numbers change.

+

+

Images

+

Inline images are treated like ordinary ranges of characters in the text editor, so they flow with the surrounding text. Images can also be selected in the same way as text, making it easy to cut, copy, and paste them.

+

Try to select this image by clicking and dragging over it with the mouse, or use the text cursor to select it by holding down Shift and using the arrow keys. You can then cut or copy it, and paste it into different parts of this document.

+

Tables

+

TextArea can arrange and format tables, supporting features such as row and column spans, text formatting within cells, and size constraints for columns.

+

+

+ + + + + + + + + + + + + + + + + + + + + + +
+

+

Development Tools

+

Programming Techniques

+

Graphical User Interfaces

+

9:00 - 11:00

+

Introduction to Qt

+

11:00 - 13:00

+

Using qmake

+

Object-oriented Programming

+

Layouts in Qt

+

13:00 - 15:00

+

Qt Designer Tutorial

+

Extreme Programming

+

Writing Custom Styles

+

15:00 - 17:00

+

Qt Linguist and Internationalization

+

+

Try adding text to the cells in the table and experiment with the alignment of the paragraphs.

+

Undo and Redo

+

Full support for undo and redo operations is built into TextArea and the underlying rich text framework. Operations on a document can be packaged together to make editing easier for the user.

+

Try making changes to this document and press Ctrl+Z to undo them. You can always recover the original contents of the document.

diff --git a/examples/quickcontrols/controls/texteditor/qml/ToolBarSeparator.qml b/examples/quickcontrols/controls/texteditor/qml/ToolBarSeparator.qml new file mode 100644 index 000000000..a225e2eaa --- /dev/null +++ b/examples/quickcontrols/controls/texteditor/qml/ToolBarSeparator.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 + +Item { + width: 8 + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.margins: 6 + Rectangle { + width: 1 + height: parent.height + anchors.horizontalCenter: parent.horizontalCenter + color: "#22000000" + } + Rectangle { + width: 1 + height: parent.height + anchors.horizontalCenterOffset: 1 + anchors.horizontalCenter: parent.horizontalCenter + color: "#33ffffff" + } +} diff --git a/examples/quickcontrols/controls/texteditor/qml/images/editcopy.png b/examples/quickcontrols/controls/texteditor/qml/images/editcopy.png new file mode 100644 index 000000000..f55136446 Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/editcopy.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/editcut.png b/examples/quickcontrols/controls/texteditor/qml/images/editcut.png new file mode 100644 index 000000000..a784fd570 Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/editcut.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/editpaste.png b/examples/quickcontrols/controls/texteditor/qml/images/editpaste.png new file mode 100644 index 000000000..64c0b2d6a Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/editpaste.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/editredo.png b/examples/quickcontrols/controls/texteditor/qml/images/editredo.png new file mode 100644 index 000000000..8875bf246 Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/editredo.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/editundo.png b/examples/quickcontrols/controls/texteditor/qml/images/editundo.png new file mode 100644 index 000000000..a3bd5e0bf Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/editundo.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/exportpdf.png b/examples/quickcontrols/controls/texteditor/qml/images/exportpdf.png new file mode 100644 index 000000000..ebb44e6b8 Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/exportpdf.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/filenew.png b/examples/quickcontrols/controls/texteditor/qml/images/filenew.png new file mode 100644 index 000000000..d3882c7b3 Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/filenew.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/fileopen.png b/examples/quickcontrols/controls/texteditor/qml/images/fileopen.png new file mode 100644 index 000000000..fc06c5ec6 Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/fileopen.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/fileprint.png b/examples/quickcontrols/controls/texteditor/qml/images/fileprint.png new file mode 100644 index 000000000..10ca56c82 Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/fileprint.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/filesave.png b/examples/quickcontrols/controls/texteditor/qml/images/filesave.png new file mode 100644 index 000000000..b41ecf531 Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/filesave.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/qt-logo.png b/examples/quickcontrols/controls/texteditor/qml/images/qt-logo.png new file mode 100644 index 000000000..be1bb1060 Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/qt-logo.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/textbold.png b/examples/quickcontrols/controls/texteditor/qml/images/textbold.png new file mode 100644 index 000000000..38400bd1f Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/textbold.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/textcenter.png b/examples/quickcontrols/controls/texteditor/qml/images/textcenter.png new file mode 100644 index 000000000..2ef5b2ee6 Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/textcenter.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/textitalic.png b/examples/quickcontrols/controls/texteditor/qml/images/textitalic.png new file mode 100644 index 000000000..0170ee26a Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/textitalic.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/textjustify.png b/examples/quickcontrols/controls/texteditor/qml/images/textjustify.png new file mode 100644 index 000000000..39cd6c1a9 Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/textjustify.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/textleft.png b/examples/quickcontrols/controls/texteditor/qml/images/textleft.png new file mode 100644 index 000000000..83a66d553 Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/textleft.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/textright.png b/examples/quickcontrols/controls/texteditor/qml/images/textright.png new file mode 100644 index 000000000..e7c04645c Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/textright.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/textunder.png b/examples/quickcontrols/controls/texteditor/qml/images/textunder.png new file mode 100644 index 000000000..968bac5e9 Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/textunder.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/zoomin.png b/examples/quickcontrols/controls/texteditor/qml/images/zoomin.png new file mode 100644 index 000000000..d46f5aff0 Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/zoomin.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/images/zoomout.png b/examples/quickcontrols/controls/texteditor/qml/images/zoomout.png new file mode 100644 index 000000000..46326566d Binary files /dev/null and b/examples/quickcontrols/controls/texteditor/qml/images/zoomout.png differ diff --git a/examples/quickcontrols/controls/texteditor/qml/main.qml b/examples/quickcontrols/controls/texteditor/qml/main.qml new file mode 100644 index 000000000..42f5e7f94 --- /dev/null +++ b/examples/quickcontrols/controls/texteditor/qml/main.qml @@ -0,0 +1,357 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.2 +import QtQuick.Layouts 1.0 +import QtQuick.Dialogs 1.1 +import QtQuick.Window 2.1 +import org.qtproject.example 1.0 + +ApplicationWindow { + visible: true + width: 640 + height: 480 + minimumWidth: 400 + minimumHeight: 300 + + title: document.documentTitle + " - Text Editor Example" + + MessageDialog { + id: aboutBox + title: "About Text" + text: "This is a basic text editor \nwritten with Qt Quick Controls" + icon: StandardIcon.Information + } + + Action { + id: cutAction + text: "Cut" + shortcut: "ctrl+x" + iconSource: "images/editcut.png" + iconName: "edit-cut" + onTriggered: textArea.cut() + } + + Action { + id: copyAction + text: "Copy" + shortcut: "Ctrl+C" + iconSource: "images/editcopy.png" + iconName: "edit-copy" + onTriggered: textArea.copy() + } + + Action { + id: pasteAction + text: "Paste" + shortcut: "ctrl+v" + iconSource: "qrc:images/editpaste.png" + iconName: "edit-paste" + onTriggered: textArea.paste() + } + + Action { + id: alignLeftAction + text: "&Left" + iconSource: "images/textleft.png" + iconName: "format-justify-left" + shortcut: "ctrl+l" + onTriggered: document.alignment = Qt.AlignLeft + checkable: true + checked: document.alignment == Qt.AlignLeft + } + Action { + id: alignCenterAction + text: "C&enter" + iconSource: "images/textcenter.png" + iconName: "format-justify-center" + onTriggered: document.alignment = Qt.AlignHCenter + checkable: true + checked: document.alignment == Qt.AlignHCenter + } + Action { + id: alignRightAction + text: "&Right" + iconSource: "images/textright.png" + iconName: "format-justify-right" + onTriggered: document.alignment = Qt.AlignRight + checkable: true + checked: document.alignment == Qt.AlignRight + } + Action { + id: alignJustifyAction + text: "&Justify" + iconSource: "images/textjustify.png" + iconName: "format-justify-fill" + onTriggered: document.alignment = Qt.AlignJustify + checkable: true + checked: document.alignment == Qt.AlignJustify + } + + Action { + id: boldAction + text: "&Bold" + iconSource: "images/textbold.png" + iconName: "format-text-bold" + onTriggered: document.bold = !document.bold + checkable: true + checked: document.bold + } + + Action { + id: italicAction + text: "&Italic" + iconSource: "images/textitalic.png" + iconName: "format-text-italic" + onTriggered: document.italic = !document.italic + checkable: true + checked: document.italic + } + Action { + id: underlineAction + text: "&Underline" + iconSource: "images/textunder.png" + iconName: "format-text-underline" + onTriggered: document.underline = !document.underline + checkable: true + checked: document.underline + } + + FileDialog { + id: fileDialog + nameFilters: ["Text files (*.txt)", "HTML files (*.html, *.htm)"] + onAccepted: { + if (fileDialog.selectExisting) + document.fileUrl = fileUrl + else + document.saveAs(fileUrl, selectedNameFilter) + } + } + + ColorDialog { + id: colorDialog + color: "black" + } + + Action { + id: fileOpenAction + iconSource: "images/fileopen.png" + iconName: "document-open" + text: "Open" + onTriggered: { + fileDialog.selectExisting = true + fileDialog.open() + } + } + + Action { + id: fileSaveAsAction + iconSource: "images/filesave.png" + iconName: "document-save" + text: "Save As…" + onTriggered: { + fileDialog.selectExisting = false + fileDialog.open() + } + } + + menuBar: MenuBar { + Menu { + title: "&File" + MenuItem { action: fileOpenAction } + MenuItem { action: fileSaveAsAction } + MenuItem { text: "Quit"; onTriggered: Qt.quit() } + } + Menu { + title: "&Edit" + MenuItem { action: copyAction } + MenuItem { action: cutAction } + MenuItem { action: pasteAction } + } + Menu { + title: "F&ormat" + MenuItem { action: boldAction } + MenuItem { action: italicAction } + MenuItem { action: underlineAction } + MenuSeparator {} + MenuItem { action: alignLeftAction } + MenuItem { action: alignCenterAction } + MenuItem { action: alignRightAction } + MenuItem { action: alignJustifyAction } + MenuSeparator {} + MenuItem { + text: "&Color ..." + onTriggered: { + colorDialog.color = document.textColor + colorDialog.open() + } + } + } + Menu { + title: "&Help" + MenuItem { text: "About..." ; onTriggered: aboutBox.open() } + } + } + + toolBar: ToolBar { + id: mainToolBar + width: parent.width + RowLayout { + anchors.fill: parent + spacing: 0 + ToolButton { action: fileOpenAction } + + ToolBarSeparator {} + + ToolButton { action: copyAction } + ToolButton { action: cutAction } + ToolButton { action: pasteAction } + + ToolBarSeparator {} + + ToolButton { action: boldAction } + ToolButton { action: italicAction } + ToolButton { action: underlineAction } + + ToolBarSeparator {} + + ToolButton { action: alignLeftAction } + ToolButton { action: alignCenterAction } + ToolButton { action: alignRightAction } + ToolButton { action: alignJustifyAction } + + ToolBarSeparator {} + + ToolButton { + id: colorButton + property var color : document.textColor + Rectangle { + id: colorRect + anchors.fill: parent + anchors.margins: 8 + color: Qt.darker(document.textColor, colorButton.pressed ? 1.4 : 1) + border.width: 1 + border.color: Qt.darker(colorRect.color, 2) + } + onClicked: { + colorDialog.color = document.textColor + colorDialog.open() + } + } + Item { Layout.fillWidth: true } + } + } + + ToolBar { + id: secondaryToolBar + width: parent.width + + RowLayout { + anchors.fill: parent + ComboBox { + id: fontFamilyComboBox + implicitWidth: 150 + model: Qt.fontFamilies() + property bool special : false + onActivated: { + if (special == false || index != 0) { + document.fontFamily = textAt(index) + } + } + } + SpinBox { + id: fontSizeSpinBox + activeFocusOnPress: false + implicitWidth: 50 + value: 0 + property bool valueGuard: true + onValueChanged: if (valueGuard) document.fontSize = value + } + Item { Layout.fillWidth: true } + } + } + + TextArea { + Accessible.name: "document" + id: textArea + frameVisible: false + width: parent.width + anchors.top: secondaryToolBar.bottom + anchors.bottom: parent.bottom + baseUrl: "qrc:/" + text: document.text + textFormat: Qt.RichText + Component.onCompleted: forceActiveFocus() + } + + MessageDialog { + id: errorDialog + } + + DocumentHandler { + id: document + target: textArea + cursorPosition: textArea.cursorPosition + selectionStart: textArea.selectionStart + selectionEnd: textArea.selectionEnd + textColor: colorDialog.color + Component.onCompleted: document.fileUrl = "qrc:/example.html" + onFontSizeChanged: { + fontSizeSpinBox.valueGuard = false + fontSizeSpinBox.value = document.fontSize + fontSizeSpinBox.valueGuard = true + } + onFontFamilyChanged: { + var index = Qt.fontFamilies().indexOf(document.fontFamily) + if (index == -1) { + fontFamilyComboBox.currentIndex = 0 + fontFamilyComboBox.special = true + } else { + fontFamilyComboBox.currentIndex = index + fontFamilyComboBox.special = false + } + } + onError: { + errorDialog.text = message + errorDialog.visible = true + } + } +} diff --git a/examples/quickcontrols/controls/texteditor/resources.qrc b/examples/quickcontrols/controls/texteditor/resources.qrc new file mode 100644 index 000000000..27c7b9215 --- /dev/null +++ b/examples/quickcontrols/controls/texteditor/resources.qrc @@ -0,0 +1,27 @@ + + + qml/main.qml + qml/ToolBarSeparator.qml + qml/images/editcopy.png + qml/images/editcut.png + qml/images/editpaste.png + qml/images/editredo.png + qml/images/editundo.png + qml/images/exportpdf.png + qml/images/filenew.png + qml/images/fileopen.png + qml/images/fileprint.png + qml/images/filesave.png + qml/images/textbold.png + qml/images/textcenter.png + qml/images/textitalic.png + qml/images/textjustify.png + qml/images/textleft.png + qml/images/textright.png + qml/images/textunder.png + qml/images/zoomin.png + qml/images/zoomout.png + example.html + qml/images/qt-logo.png + + diff --git a/examples/quickcontrols/controls/texteditor/src/documenthandler.cpp b/examples/quickcontrols/controls/texteditor/src/documenthandler.cpp new file mode 100644 index 000000000..2e03f7471 --- /dev/null +++ b/examples/quickcontrols/controls/texteditor/src/documenthandler.cpp @@ -0,0 +1,335 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 "documenthandler.h" + +#include +#include +#include +#include + +DocumentHandler::DocumentHandler() + : m_target(0) + , m_doc(0) + , m_cursorPosition(-1) + , m_selectionStart(0) + , m_selectionEnd(0) +{ +} + +void DocumentHandler::setTarget(QQuickItem *target) +{ + m_doc = 0; + m_target = target; + if (!m_target) + return; + + QVariant doc = m_target->property("textDocument"); + if (doc.canConvert()) { + QQuickTextDocument *qqdoc = doc.value(); + if (qqdoc) + m_doc = qqdoc->textDocument(); + } + emit targetChanged(); +} + +void DocumentHandler::setFileUrl(const QUrl &arg) +{ + if (m_fileUrl != arg) { + m_fileUrl = arg; + QString fileName = QQmlFile::urlToLocalFileOrQrc(arg); + if (QFile::exists(fileName)) { + QFile file(fileName); + if (file.open(QFile::ReadOnly)) { + QByteArray data = file.readAll(); + QTextCodec *codec = QTextCodec::codecForHtml(data); + setText(codec->toUnicode(data)); + if (m_doc) + m_doc->setModified(false); + if (fileName.isEmpty()) + m_documentTitle = QStringLiteral("untitled.txt"); + else + m_documentTitle = QFileInfo(fileName).fileName(); + + emit textChanged(); + emit documentTitleChanged(); + + reset(); + } + } + emit fileUrlChanged(); + } +} + +QString DocumentHandler::documentTitle() const +{ + return m_documentTitle; +} + +void DocumentHandler::setDocumentTitle(QString arg) +{ + if (m_documentTitle != arg) { + m_documentTitle = arg; + emit documentTitleChanged(); + } +} + +void DocumentHandler::setText(const QString &arg) +{ + if (m_text != arg) { + m_text = arg; + emit textChanged(); + } +} + +void DocumentHandler::saveAs(const QUrl &arg, const QString &fileType) +{ + bool isHtml = fileType.contains(QLatin1String("htm")); + QLatin1String ext(isHtml ? ".html" : ".txt"); + QString localPath = arg.toLocalFile(); + if (!localPath.endsWith(ext)) + localPath += ext; + QFile f(localPath); + if (!f.open(QFile::WriteOnly | QFile::Truncate | (isHtml ? QFile::NotOpen : QFile::Text))) { + emit error(tr("Cannot save: ") + f.errorString()); + return; + } + f.write((isHtml ? m_doc->toHtml() : m_doc->toPlainText()).toLocal8Bit()); + f.close(); + setFileUrl(QUrl::fromLocalFile(localPath)); +} + +QUrl DocumentHandler::fileUrl() const +{ + return m_fileUrl; +} + +QString DocumentHandler::text() const +{ + return m_text; +} + +void DocumentHandler::setCursorPosition(int position) +{ + if (position == m_cursorPosition) + return; + + m_cursorPosition = position; + + reset(); +} + +void DocumentHandler::reset() +{ + emit fontFamilyChanged(); + emit alignmentChanged(); + emit boldChanged(); + emit italicChanged(); + emit underlineChanged(); + emit fontSizeChanged(); + emit textColorChanged(); +} + +QTextCursor DocumentHandler::textCursor() const +{ + QTextCursor cursor = QTextCursor(m_doc); + if (m_selectionStart != m_selectionEnd) { + cursor.setPosition(m_selectionStart); + cursor.setPosition(m_selectionEnd, QTextCursor::KeepAnchor); + } else { + cursor.setPosition(m_cursorPosition); + } + return cursor; +} + +void DocumentHandler::mergeFormatOnWordOrSelection(const QTextCharFormat &format) +{ + QTextCursor cursor = textCursor(); + if (!cursor.hasSelection()) + cursor.select(QTextCursor::WordUnderCursor); + cursor.mergeCharFormat(format); +} + +void DocumentHandler::setSelectionStart(int position) +{ + m_selectionStart = position; +} + +void DocumentHandler::setSelectionEnd(int position) +{ + m_selectionEnd = position; +} + +void DocumentHandler::setAlignment(Qt::Alignment a) +{ + QTextBlockFormat fmt; + fmt.setAlignment((Qt::Alignment) a); + QTextCursor cursor = QTextCursor(m_doc); + cursor.setPosition(m_selectionStart, QTextCursor::MoveAnchor); + cursor.setPosition(m_selectionEnd, QTextCursor::KeepAnchor); + cursor.mergeBlockFormat(fmt); + emit alignmentChanged(); +} + +Qt::Alignment DocumentHandler::alignment() const +{ + QTextCursor cursor = textCursor(); + if (cursor.isNull()) + return Qt::AlignLeft; + return textCursor().blockFormat().alignment(); +} + +bool DocumentHandler::bold() const +{ + QTextCursor cursor = textCursor(); + if (cursor.isNull()) + return false; + return textCursor().charFormat().fontWeight() == QFont::Bold; +} + +bool DocumentHandler::italic() const +{ + QTextCursor cursor = textCursor(); + if (cursor.isNull()) + return false; + return textCursor().charFormat().fontItalic(); +} + +bool DocumentHandler::underline() const +{ + QTextCursor cursor = textCursor(); + if (cursor.isNull()) + return false; + return textCursor().charFormat().fontUnderline(); +} + +void DocumentHandler::setBold(bool arg) +{ + QTextCharFormat fmt; + fmt.setFontWeight(arg ? QFont::Bold : QFont::Normal); + mergeFormatOnWordOrSelection(fmt); + emit boldChanged(); +} + +void DocumentHandler::setItalic(bool arg) +{ + QTextCharFormat fmt; + fmt.setFontItalic(arg); + mergeFormatOnWordOrSelection(fmt); + emit italicChanged(); +} + +void DocumentHandler::setUnderline(bool arg) +{ + QTextCharFormat fmt; + fmt.setFontUnderline(arg); + mergeFormatOnWordOrSelection(fmt); + emit underlineChanged(); +} + +int DocumentHandler::fontSize() const +{ + QTextCursor cursor = textCursor(); + if (cursor.isNull()) + return 0; + QTextCharFormat format = cursor.charFormat(); + return format.font().pointSize(); +} + +void DocumentHandler::setFontSize(int arg) +{ + QTextCursor cursor = textCursor(); + if (cursor.isNull()) + return; + QTextCharFormat format; + format.setFontPointSize(arg); + mergeFormatOnWordOrSelection(format); + emit fontSizeChanged(); +} + +QColor DocumentHandler::textColor() const +{ + QTextCursor cursor = textCursor(); + if (cursor.isNull()) + return QColor(Qt::black); + QTextCharFormat format = cursor.charFormat(); + return format.foreground().color(); +} + +void DocumentHandler::setTextColor(const QColor &c) +{ + QTextCursor cursor = textCursor(); + if (cursor.isNull()) + return; + QTextCharFormat format; + format.setForeground(QBrush(c)); + mergeFormatOnWordOrSelection(format); + emit textColorChanged(); +} + +QString DocumentHandler::fontFamily() const +{ + QTextCursor cursor = textCursor(); + if (cursor.isNull()) + return QString(); + QTextCharFormat format = cursor.charFormat(); + return format.font().family(); +} + +void DocumentHandler::setFontFamily(const QString &arg) +{ + QTextCursor cursor = textCursor(); + if (cursor.isNull()) + return; + QTextCharFormat format; + format.setFontFamily(arg); + mergeFormatOnWordOrSelection(format); + emit fontFamilyChanged(); +} + +QStringList DocumentHandler::defaultFontSizes() const +{ + // uhm... this is quite ugly + QStringList sizes; + QFontDatabase db; + foreach (int size, db.standardSizes()) + sizes.append(QString::number(size)); + return sizes; +} diff --git a/examples/quickcontrols/controls/texteditor/src/documenthandler.h b/examples/quickcontrols/controls/texteditor/src/documenthandler.h new file mode 100644 index 000000000..f2bd4eead --- /dev/null +++ b/examples/quickcontrols/controls/texteditor/src/documenthandler.h @@ -0,0 +1,171 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 DOCUMENTHANDLER_H +#define DOCUMENTHANDLER_H + +#include + +#include +#include + +#include + +QT_BEGIN_NAMESPACE +class QTextDocument; +QT_END_NAMESPACE + +class DocumentHandler : public QObject +{ + Q_OBJECT + + Q_ENUMS(HAlignment) + + Q_PROPERTY(QQuickItem *target READ target WRITE setTarget NOTIFY targetChanged) + Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged) + Q_PROPERTY(int selectionStart READ selectionStart WRITE setSelectionStart NOTIFY selectionStartChanged) + Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged) + + Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor NOTIFY textColorChanged) + Q_PROPERTY(QString fontFamily READ fontFamily WRITE setFontFamily NOTIFY fontFamilyChanged) + Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged) + + Q_PROPERTY(bool bold READ bold WRITE setBold NOTIFY boldChanged) + Q_PROPERTY(bool italic READ italic WRITE setItalic NOTIFY italicChanged) + Q_PROPERTY(bool underline READ underline WRITE setUnderline NOTIFY underlineChanged) + + Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged) + + Q_PROPERTY(QStringList defaultFontSizes READ defaultFontSizes NOTIFY defaultFontSizesChanged) + + Q_PROPERTY(QUrl fileUrl READ fileUrl WRITE setFileUrl NOTIFY fileUrlChanged) + Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) + Q_PROPERTY(QString documentTitle READ documentTitle WRITE setDocumentTitle NOTIFY documentTitleChanged) + +public: + DocumentHandler(); + + QQuickItem *target() { return m_target; } + + void setTarget(QQuickItem *target); + + void setCursorPosition(int position); + void setSelectionStart(int position); + void setSelectionEnd(int position); + + int cursorPosition() const { return m_cursorPosition; } + int selectionStart() const { return m_selectionStart; } + int selectionEnd() const { return m_selectionEnd; } + + QString fontFamily() const; + + QColor textColor() const; + + Qt::Alignment alignment() const; + void setAlignment(Qt::Alignment a); + + bool bold() const; + bool italic() const; + bool underline() const; + int fontSize() const; + + QStringList defaultFontSizes() const; + QUrl fileUrl() const; + QString text() const; + + QString documentTitle() const; + +public Q_SLOTS: + void setBold(bool arg); + void setItalic(bool arg); + void setUnderline(bool arg); + void setFontSize(int arg); + void setTextColor(const QColor &arg); + void setFontFamily(const QString &arg); + + void setFileUrl(const QUrl &arg); + void setText(const QString &arg); + void saveAs(const QUrl &arg, const QString &fileType); + + void setDocumentTitle(QString arg); + +Q_SIGNALS: + void targetChanged(); + void cursorPositionChanged(); + void selectionStartChanged(); + void selectionEndChanged(); + + void fontFamilyChanged(); + void textColorChanged(); + void alignmentChanged(); + + void boldChanged(); + void italicChanged(); + void underlineChanged(); + + void fontSizeChanged(); + void defaultFontSizesChanged(); + + void fileUrlChanged(); + + void textChanged(); + void documentTitleChanged(); + void error(QString message); + +private: + void reset(); + QTextCursor textCursor() const; + void mergeFormatOnWordOrSelection(const QTextCharFormat &format); + + QQuickItem *m_target; + QTextDocument *m_doc; + + int m_cursorPosition; + int m_selectionStart; + int m_selectionEnd; + + QFont m_font; + int m_fontSize; + QUrl m_fileUrl; + QString m_text; + QString m_documentTitle; +}; + +#endif diff --git a/examples/quickcontrols/controls/texteditor/src/main.cpp b/examples/quickcontrols/controls/texteditor/src/main.cpp new file mode 100644 index 000000000..1ef76e3a0 --- /dev/null +++ b/examples/quickcontrols/controls/texteditor/src/main.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 "qtquickcontrolsapplication.h" +#include "documenthandler.h" +#include + +int main(int argc, char *argv[]) +{ + QtQuickControlsApplication app(argc, argv); + qmlRegisterType("org.qtproject.example", 1, 0, "DocumentHandler"); + QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml")); + if (engine.rootObjects().isEmpty()) + return -1; + return app.exec(); +} diff --git a/examples/quickcontrols/controls/texteditor/src/src.pri b/examples/quickcontrols/controls/texteditor/src/src.pri new file mode 100644 index 000000000..2b89cd629 --- /dev/null +++ b/examples/quickcontrols/controls/texteditor/src/src.pri @@ -0,0 +1,9 @@ +SOURCES += \ + $$PWD/documenthandler.cpp \ + $$PWD/main.cpp + + +HEADERS += \ + $$PWD/documenthandler.h + + diff --git a/examples/quickcontrols/controls/texteditor/texteditor.pro b/examples/quickcontrols/controls/texteditor/texteditor.pro new file mode 100644 index 000000000..f52552555 --- /dev/null +++ b/examples/quickcontrols/controls/texteditor/texteditor.pro @@ -0,0 +1,16 @@ +QT += qml quick +TARGET = texteditor +!no_desktop: QT += widgets + +include(src/src.pri) +include(../shared/shared.pri) + +OTHER_FILES += \ + qml/main.qml \ + qml/ToolBarSeparator.qml + +RESOURCES += \ + resources.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/controls/texteditor +INSTALLS += target diff --git a/examples/quickcontrols/controls/touch/content/AndroidDelegate.qml b/examples/quickcontrols/controls/touch/content/AndroidDelegate.qml new file mode 100644 index 000000000..07f288337 --- /dev/null +++ b/examples/quickcontrols/controls/touch/content/AndroidDelegate.qml @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 + +Item { + id: root + width: parent.width + height: 88 + + property alias text: textitem.text + signal clicked + + Rectangle { + anchors.fill: parent + color: "#11ffffff" + visible: mouse.pressed + } + + Text { + id: textitem + color: "white" + font.pixelSize: 32 + text: modelData + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 30 + } + + Rectangle { + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: 15 + height: 1 + color: "#424246" + } + + Image { + anchors.right: parent.right + anchors.rightMargin: 20 + anchors.verticalCenter: parent.verticalCenter + source: "../images/navigation_next_item.png" + } + + MouseArea { + id: mouse + anchors.fill: parent + onClicked: root.clicked() + + } +} diff --git a/examples/quickcontrols/controls/touch/content/ButtonPage.qml b/examples/quickcontrols/controls/touch/content/ButtonPage.qml new file mode 100644 index 000000000..3888e30d5 --- /dev/null +++ b/examples/quickcontrols/controls/touch/content/ButtonPage.qml @@ -0,0 +1,172 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.1 + +Item { + width: parent.width + height: parent.height + + property real progress: 0 + SequentialAnimation on progress { + loops: Animation.Infinite + running: true + NumberAnimation { + from: 0 + to: 1 + duration: 3000 + } + NumberAnimation { + from: 1 + to: 0 + duration: 3000 + } + } + + Column { + spacing: 40 + anchors.centerIn: parent + + Button { + text: "Press me" + style: touchStyle + } + + Button { + style: touchStyle + text: "Press me too" + } + + Button { + anchors.margins: 20 + style: touchStyle + text: "Don't press me" + onClicked: if (stackView) stackView.pop() + } + + Row { + spacing: 20 + Switch { + style: switchStyle + } + Switch { + style: switchStyle + } + } + + } + + Component { + id: touchStyle + ButtonStyle { + panel: Item { + implicitHeight: 50 + implicitWidth: 320 + BorderImage { + anchors.fill: parent + antialiasing: true + border.bottom: 8 + border.top: 8 + border.left: 8 + border.right: 8 + anchors.margins: control.pressed ? -4 : 0 + source: control.pressed ? "../images/button_pressed.png" : "../images/button_default.png" + Text { + text: control.text + anchors.centerIn: parent + color: "white" + font.pixelSize: 23 + renderType: Text.NativeRendering + } + } + } + } + } + + Component { + id: switchStyle + SwitchStyle { + + groove: Rectangle { + implicitHeight: 50 + implicitWidth: 152 + Rectangle { + anchors.top: parent.top + anchors.left: parent.left + anchors.bottom: parent.bottom + width: parent.width/2 - 2 + height: 20 + anchors.margins: 2 + color: control.checked ? "#468bb7" : "#222" + Behavior on color {ColorAnimation {}} + Text { + font.pixelSize: 23 + color: "white" + anchors.centerIn: parent + text: "ON" + } + } + Item { + width: parent.width/2 + height: parent.height + anchors.right: parent.right + Text { + font.pixelSize: 23 + color: "white" + anchors.centerIn: parent + text: "OFF" + } + } + color: "#222" + border.color: "#444" + border.width: 2 + } + handle: Rectangle { + width: parent.parent.width/2 + height: control.height + color: "#444" + border.color: "#555" + border.width: 2 + } + } + } +} diff --git a/examples/quickcontrols/controls/touch/content/ListPage.qml b/examples/quickcontrols/controls/touch/content/ListPage.qml new file mode 100644 index 000000000..f12b0c12b --- /dev/null +++ b/examples/quickcontrols/controls/touch/content/ListPage.qml @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.1 + +ScrollView { + width: parent.width + height: parent.height + + flickableItem.interactive: true + + ListView { + anchors.fill: parent + model: 100 + delegate: AndroidDelegate { + text: "Item #" + modelData + } + } + + style: ScrollViewStyle { + transientScrollBars: true + handle: Item { + implicitWidth: 14 + implicitHeight: 26 + Rectangle { + color: "#424246" + anchors.fill: parent + anchors.topMargin: 6 + anchors.leftMargin: 4 + anchors.rightMargin: 4 + anchors.bottomMargin: 6 + } + } + scrollBarBackground: Item { + implicitWidth: 14 + implicitHeight: 26 + } + } +} diff --git a/examples/quickcontrols/controls/touch/content/ProgressBarPage.qml b/examples/quickcontrols/controls/touch/content/ProgressBarPage.qml new file mode 100644 index 000000000..5190b4bba --- /dev/null +++ b/examples/quickcontrols/controls/touch/content/ProgressBarPage.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.1 + +Item { + width: parent.width + height: parent.height + + property real progress: 0 + SequentialAnimation on progress { + loops: Animation.Infinite + running: true + NumberAnimation { + from: 0 + to: 1 + duration: 3000 + } + NumberAnimation { + from: 1 + to: 0 + duration: 3000 + } + } + + Column { + spacing: 40 + anchors.centerIn: parent + + ProgressBar { + anchors.margins: 20 + style: touchStyle + width: 400 + value: progress + } + + ProgressBar { + anchors.margins: 20 + style: touchStyle + width: 400 + value: 1 - progress + } + + ProgressBar { + anchors.margins: 20 + style: touchStyle + value: 1 + width: 400 + } + + } + + Component { + id: touchStyle + ProgressBarStyle { + panel: Rectangle { + implicitHeight: 15 + implicitWidth: 400 + color: "#444" + opacity: 0.8 + Rectangle { + antialiasing: true + radius: 1 + color: "#468bb7" + height: parent.height + width: parent.width * control.value / control.maximumValue + } + } + } + } +} diff --git a/examples/quickcontrols/controls/touch/content/SliderPage.qml b/examples/quickcontrols/controls/touch/content/SliderPage.qml new file mode 100644 index 000000000..4f4e2ee82 --- /dev/null +++ b/examples/quickcontrols/controls/touch/content/SliderPage.qml @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.1 + +Item { + width: parent.width + height: parent.height + + Column { + spacing: 12 + anchors.centerIn: parent + + Slider { + anchors.margins: 20 + style: touchStyle + value: 0 + } + Slider { + anchors.margins: 20 + style: touchStyle + value: 0.5 + } + Slider { + anchors.margins: 20 + style: touchStyle + value: 1.0 + } + + } + + Component { + id: touchStyle + SliderStyle { + handle: Rectangle { + width: 30 + height: 30 + radius: height + antialiasing: true + color: Qt.lighter("#468bb7", 1.2) + } + + groove: Item { + implicitHeight: 50 + implicitWidth: 400 + Rectangle { + height: 8 + width: parent.width + anchors.verticalCenter: parent.verticalCenter + color: "#444" + opacity: 0.8 + Rectangle { + antialiasing: true + radius: 1 + color: "#468bb7" + height: parent.height + width: parent.width * control.value / control.maximumValue + } + } + } + } + } +} diff --git a/examples/quickcontrols/controls/touch/content/TabBarPage.qml b/examples/quickcontrols/controls/touch/content/TabBarPage.qml new file mode 100644 index 000000000..a27bb2069 --- /dev/null +++ b/examples/quickcontrols/controls/touch/content/TabBarPage.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.1 + +Item { + width: parent.width + height: parent.height + + TabView { + anchors.fill: parent + style: touchStyle + Tab { + title: "Buttons" + ButtonPage{ visible: true } + } + Tab { + title: "Sliders" + SliderPage{ visible: true } + } + Tab { + title: "Progress" + ProgressBarPage{ visible: true } + } + } + + Component { + id: touchStyle + TabViewStyle { + tabsAlignment: Qt.AlignVCenter + tabOverlap: 0 + frame: Item { } + tab: Item { + implicitWidth: control.width/control.count + implicitHeight: 50 + BorderImage { + anchors.fill: parent + border.bottom: 8 + border.top: 8 + source: styleData.selected ? "../images/tab_selected.png":"../images/tabs_standard.png" + Text { + anchors.centerIn: parent + color: "white" + text: styleData.title.toUpperCase() + font.pixelSize: 16 + } + Rectangle { + visible: index > 0 + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.margins: 10 + width:1 + color: "#3a3a3a" + } + } + } + } + } +} diff --git a/examples/quickcontrols/controls/touch/content/TextInputPage.qml b/examples/quickcontrols/controls/touch/content/TextInputPage.qml new file mode 100644 index 000000000..3c4dc4ade --- /dev/null +++ b/examples/quickcontrols/controls/touch/content/TextInputPage.qml @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.1 + +Item { + width: parent.width + height: parent.height + + property real progress: 0 + SequentialAnimation on progress { + loops: Animation.Infinite + running: true + NumberAnimation { + from: 0 + to: 1 + duration: 3000 + } + NumberAnimation { + from: 1 + to: 0 + duration: 3000 + } + } + + Column { + spacing: 40 + anchors.centerIn: parent + + TextField { + anchors.margins: 20 + text: "Text input" + style: touchStyle + } + + TextField { + anchors.margins: 20 + text: "Readonly Text input" + style: touchStyle + readOnly: true + } + } + Component { + id: touchStyle + + TextFieldStyle { + textColor: "white" + font.pixelSize: 28 + background: Item { + implicitHeight: 50 + implicitWidth: 320 + BorderImage { + source: "../images/textinput.png" + border.left: 8 + border.right: 8 + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + } + } + } + } +} diff --git a/examples/quickcontrols/controls/touch/images/NOTICE.txt b/examples/quickcontrols/controls/touch/images/NOTICE.txt new file mode 100644 index 000000000..93a9afc8c --- /dev/null +++ b/examples/quickcontrols/controls/touch/images/NOTICE.txt @@ -0,0 +1,2 @@ +Notice some of these images are derived from Google applications resources. They were provided under the following license: +You may use the materials in this directory without restriction to develop your apps and to use in your apps. diff --git a/examples/quickcontrols/controls/touch/images/button_default.png b/examples/quickcontrols/controls/touch/images/button_default.png new file mode 100644 index 000000000..6d6cfd9ad Binary files /dev/null and b/examples/quickcontrols/controls/touch/images/button_default.png differ diff --git a/examples/quickcontrols/controls/touch/images/button_pressed.png b/examples/quickcontrols/controls/touch/images/button_pressed.png new file mode 100644 index 000000000..ab78b6ea3 Binary files /dev/null and b/examples/quickcontrols/controls/touch/images/button_pressed.png differ diff --git a/examples/quickcontrols/controls/touch/images/navigation_next_item.png b/examples/quickcontrols/controls/touch/images/navigation_next_item.png new file mode 100644 index 000000000..6665c9d85 Binary files /dev/null and b/examples/quickcontrols/controls/touch/images/navigation_next_item.png differ diff --git a/examples/quickcontrols/controls/touch/images/navigation_previous_item.png b/examples/quickcontrols/controls/touch/images/navigation_previous_item.png new file mode 100644 index 000000000..f8be01197 Binary files /dev/null and b/examples/quickcontrols/controls/touch/images/navigation_previous_item.png differ diff --git a/examples/quickcontrols/controls/touch/images/tab_selected.png b/examples/quickcontrols/controls/touch/images/tab_selected.png new file mode 100644 index 000000000..2345f7a8e Binary files /dev/null and b/examples/quickcontrols/controls/touch/images/tab_selected.png differ diff --git a/examples/quickcontrols/controls/touch/images/tabs_standard.png b/examples/quickcontrols/controls/touch/images/tabs_standard.png new file mode 100644 index 000000000..7140ab7b7 Binary files /dev/null and b/examples/quickcontrols/controls/touch/images/tabs_standard.png differ diff --git a/examples/quickcontrols/controls/touch/images/textinput.png b/examples/quickcontrols/controls/touch/images/textinput.png new file mode 100644 index 000000000..b0256db2c Binary files /dev/null and b/examples/quickcontrols/controls/touch/images/textinput.png differ diff --git a/examples/quickcontrols/controls/touch/images/toolbar.png b/examples/quickcontrols/controls/touch/images/toolbar.png new file mode 100644 index 000000000..e9eba4c74 Binary files /dev/null and b/examples/quickcontrols/controls/touch/images/toolbar.png differ diff --git a/examples/quickcontrols/controls/touch/main.qml b/examples/quickcontrols/controls/touch/main.qml new file mode 100644 index 000000000..5138fa0ca --- /dev/null +++ b/examples/quickcontrols/controls/touch/main.qml @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.2 +import "content" + +ApplicationWindow { + visible: true + width: 800 + height: 1280 + + Rectangle { + color: "#212126" + anchors.fill: parent + } + + toolBar: BorderImage { + border.bottom: 8 + source: "images/toolbar.png" + width: parent.width + height: 100 + + Rectangle { + id: backButton + width: opacity ? 60 : 0 + anchors.left: parent.left + anchors.leftMargin: 20 + opacity: stackView.depth > 1 ? 1 : 0 + anchors.verticalCenter: parent.verticalCenter + antialiasing: true + height: 60 + radius: 4 + color: backmouse.pressed ? "#222" : "transparent" + Behavior on opacity { NumberAnimation{} } + Image { + anchors.verticalCenter: parent.verticalCenter + source: "images/navigation_previous_item.png" + } + MouseArea { + id: backmouse + anchors.fill: parent + anchors.margins: -10 + onClicked: stackView.pop() + } + } + + Text { + font.pixelSize: 42 + Behavior on x { NumberAnimation{ easing.type: Easing.OutCubic} } + x: backButton.x + backButton.width + 20 + anchors.verticalCenter: parent.verticalCenter + color: "white" + text: "Widget Gallery" + } + } + + ListModel { + id: pageModel + ListElement { + title: "Buttons" + page: "content/ButtonPage.qml" + } + ListElement { + title: "Sliders" + page: "content/SliderPage.qml" + } + ListElement { + title: "ProgressBar" + page: "content/ProgressBarPage.qml" + } + ListElement { + title: "Tabs" + page: "content/TabBarPage.qml" + } + ListElement { + title: "TextInput" + page: "content/TextInputPage.qml" + } + ListElement { + title: "List" + page: "content/ListPage.qml" + } + } + + StackView { + id: stackView + anchors.fill: parent + // Implements back key navigation + focus: true + Keys.onReleased: if (event.key === Qt.Key_Back && stackView.depth > 1) { + stackView.pop(); + event.accepted = true; + } + + initialItem: Item { + width: parent.width + height: parent.height + ListView { + model: pageModel + anchors.fill: parent + delegate: AndroidDelegate { + text: title + onClicked: stackView.push(Qt.resolvedUrl(page)) + } + } + } + } + +} diff --git a/examples/quickcontrols/controls/touch/resources.qrc b/examples/quickcontrols/controls/touch/resources.qrc new file mode 100644 index 000000000..e64a063f1 --- /dev/null +++ b/examples/quickcontrols/controls/touch/resources.qrc @@ -0,0 +1,20 @@ + + + main.qml + content/AndroidDelegate.qml + content/ButtonPage.qml + content/ListPage.qml + content/ProgressBarPage.qml + content/SliderPage.qml + content/TabBarPage.qml + content/TextInputPage.qml + images/button_default.png + images/button_pressed.png + images/navigation_next_item.png + images/navigation_previous_item.png + images/tab_selected.png + images/tabs_standard.png + images/textinput.png + images/toolbar.png + + diff --git a/examples/quickcontrols/controls/touch/src/main.cpp b/examples/quickcontrols/controls/touch/src/main.cpp new file mode 100644 index 000000000..e66387f7b --- /dev/null +++ b/examples/quickcontrols/controls/touch/src/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 "qtquickcontrolsapplication.h" +#include + +int main(int argc, char *argv[]) +{ + QtQuickControlsApplication app(argc, argv); + QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); + if (engine.rootObjects().isEmpty()) + return -1; + return app.exec(); +} diff --git a/examples/quickcontrols/controls/touch/src/src.pri b/examples/quickcontrols/controls/touch/src/src.pri new file mode 100644 index 000000000..66d903eac --- /dev/null +++ b/examples/quickcontrols/controls/touch/src/src.pri @@ -0,0 +1,2 @@ +SOURCES += \ + $$PWD/main.cpp diff --git a/examples/quickcontrols/controls/touch/touch.pro b/examples/quickcontrols/controls/touch/touch.pro new file mode 100644 index 000000000..111c28459 --- /dev/null +++ b/examples/quickcontrols/controls/touch/touch.pro @@ -0,0 +1,22 @@ +QT += qml quick +TARGET = touch +!no_desktop: QT += widgets + +include(src/src.pri) +include(../shared/shared.pri) + +OTHER_FILES += \ + main.qml \ + content/AndroidDelegate.qml \ + content/ButtonPage.qml \ + content/ListPage.qml \ + content/ProgressBarPage.qml \ + content/SliderPage.qml \ + content/TabBarPage.qml \ + content/TextInputPage.qml + +RESOURCES += \ + resources.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/controls/touch +INSTALLS += target diff --git a/examples/quickcontrols/controls/touch/touch.qmlproject b/examples/quickcontrols/controls/touch/touch.qmlproject new file mode 100644 index 000000000..e5a8bf02c --- /dev/null +++ b/examples/quickcontrols/controls/touch/touch.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "main.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/examples/quickcontrols/controls/uiforms/MainForm.ui.qml b/examples/quickcontrols/controls/uiforms/MainForm.ui.qml new file mode 100644 index 000000000..4649209f4 --- /dev/null +++ b/examples/quickcontrols/controls/uiforms/MainForm.ui.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Layouts 1.1 +import QtQuick.Dialogs 1.1 +import QtQuick.Controls 1.2 + +Item { + width: 800 + height: 480 + property alias tableView: tableView + + SplitView { + id: splitView + anchors.fill: parent + + TableView { + id: tableView + + property int columnWidth: width / 3 + Layout.minimumWidth: splitView.width / 3 + + TableViewColumn { + role: "customerId" + title: qsTr("Customer Id") + width: tableView.columnWidth + } + + TableViewColumn { + role: "firstName" + title: qsTr("First Name") + width: tableView.columnWidth + } + TableViewColumn { + role: "lastName" + title: qsTr("Last Name") + width: tableView.columnWidth + } + } + + TabView { + id: tabView + + Layout.minimumWidth: 480 + + Tab { + title: qsTr("Customer Settings") + source: "qml/Settings.qml" + } + Tab { + title: qsTr("Customer Notes") + source: "qml/Notes.qml" + } + Tab { + title: qsTr("Customer History") + source: "qml/History.qml" + } + } + } +} diff --git a/examples/quickcontrols/controls/uiforms/main.cpp b/examples/quickcontrols/controls/uiforms/main.cpp new file mode 100644 index 000000000..6a15842a9 --- /dev/null +++ b/examples/quickcontrols/controls/uiforms/main.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 "qtquickcontrolsapplication.h" +#include +#include + +int main(int argc, char *argv[]) +{ + QtQuickControlsApplication app(argc, argv); + if (QCoreApplication::arguments().contains(QLatin1String("--coreprofile"))) { + QSurfaceFormat fmt; + fmt.setVersion(4, 4); + fmt.setProfile(QSurfaceFormat::CoreProfile); + QSurfaceFormat::setDefaultFormat(fmt); + } + + qmlRegisterSingletonType(QUrl(QStringLiteral("qrc:/qml/CustomerModel.qml")), "io.qt.example", 1, 0, "CustomerModel"); + + QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); + if (engine.rootObjects().isEmpty()) + return -1; + return app.exec(); +} diff --git a/examples/quickcontrols/controls/uiforms/main.qml b/examples/quickcontrols/controls/uiforms/main.qml new file mode 100644 index 000000000..da2580225 --- /dev/null +++ b/examples/quickcontrols/controls/uiforms/main.qml @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Layouts 1.1 +import QtQuick.Dialogs 1.1 +import QtQuick.Controls 1.2 +import io.qt.example 1.0 +import "qml" + +ApplicationWindow { + visible: true + title: "Qt Quick UI Forms" + + MessageDialog { + id: aboutDialog + icon: StandardIcon.Information + title: qsTr("About") + text: "Qt Quick UI Forms" + informativeText: qsTr("This example demonstrates how to separate the implementation of an application from the UI using ui.qml files.") + } + + Action { + id: copyAction + text: qsTr("&Copy") + shortcut: StandardKey.Copy + iconName: "edit-copy" + enabled: (!!activeFocusItem && !!activeFocusItem["copy"]) + onTriggered: activeFocusItem.copy() + } + + Action { + id: cutAction + text: qsTr("Cu&t") + shortcut: StandardKey.Cut + iconName: "edit-cut" + enabled: (!!activeFocusItem && !!activeFocusItem["cut"]) + onTriggered: activeFocusItem.cut() + } + + Action { + id: pasteAction + text: qsTr("&Paste") + shortcut: StandardKey.Paste + iconName: "edit-paste" + enabled: (!!activeFocusItem && !!activeFocusItem["paste"]) + onTriggered: activeFocusItem.paste() + } + + menuBar: MenuBar { + Menu { + title: qsTr("&File") + MenuItem { + text: qsTr("E&xit") + shortcut: StandardKey.Quit + onTriggered: Qt.quit() + } + } + Menu { + title: qsTr("&Edit") + MenuItem { + action: cutAction + } + MenuItem { + action: copyAction + } + MenuItem { + action: pasteAction + } + } + Menu { + title: qsTr("&Help") + MenuItem { + text: qsTr("About...") + onTriggered: aboutDialog.open() + } + } + } + + MainForm { + id: mainForm + + anchors.fill: parent + + Layout.minimumWidth: 800 + Layout.minimumHeight: 480 + Layout.preferredWidth: 768 + Layout.preferredHeight: 480 + + tableView.model: CustomerModel + + Component.onCompleted: CustomerModel.selection = tableView.selection + } +} diff --git a/examples/quickcontrols/controls/uiforms/qml/CustomerModel.qml b/examples/quickcontrols/controls/uiforms/qml/CustomerModel.qml new file mode 100644 index 000000000..70a9695dd --- /dev/null +++ b/examples/quickcontrols/controls/uiforms/qml/CustomerModel.qml @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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$ +** +****************************************************************************/ + +pragma Singleton + +import QtQuick 2.0 + +ListModel { + property QtObject selection + ListElement { + customerId: "15881123" + firstName: "Julia" + title: "Ms." + lastName: "Jefferson" + email: "Julia@example.com" + address: "Spandia Avenue, Suite 610" + city: "Toronto" + zipCode: "92334" + phoneNumber: "0803-033330" + notes: "Very demanding customer." + history: "21.4.2014|Order|coffee~23.4.2014|Order|poster~29.4.2014|Invoice|poster 40$~05.5.2014|Overdue Notice|poster 40$" + } + + ListElement { + customerId: "29993496" + firstName: "Tim" + lastName: "Northington" + title: "Mr." + email: "Northington@example.com" + address: "North Fifth Street 55" + city: "San Jose" + zipCode: "95112" + phoneNumber: "09000-3330" + notes: "Very good customer." + history: "18.4.2014|Order|orange juice~23.4.2014|Order|chair~24.4.2014|Complaint|Chair is broken." + } + + ListElement { + customerId: "37713567" + firstName: "Daniel" + lastName: "Krumm" + title: "Mr." + email: "Krumm@example.com" + address: "Waterfront 14" + city: "Berlin" + zipCode: "12334" + phoneNumber: "0708093330" + notes: "This customer has a lot of Complaintts." + history: "15.4.2014|Order|table~25.4.2014|Return|table~28.4.2014|Complaint|Table had wrong color." + } + + ListElement { + customerId: "45817387" + firstName: "Sandra" + lastName: "Booth" + title: "Ms." + email: "Sandrab@example.com" + address: "Folsom Street 23" + city: "San Francisco" + zipCode: "94103" + phoneNumber: "0103436370" + notes: "This customer is not paying." + history: "22.4.2014|Order|coffee~23.4.2014|Order|smartphone~29.4.2014|Invoice|smartphone 200$~05.5.2014|Overdue Notice|smartphone 200$" + } + + ListElement { + customerId: "588902396" + firstName: "Lora" + lastName: "Beckner" + title: "Ms." + email: "LoraB@example.com" + address: " W Wilson Apt 3" + city: "Los Angeles" + zipCode: "90086" + phoneNumber: "0903436360" + notes: "This customer usually pays late." + history: "17.4.2014|Order|soft drink~23.4.2014|Order|computer~29.4.2014|Invoice|computer 1200$~07.5.2014|Overdue Notice|computer 1200$" + } + + ListElement { + customerId: "67873693" + firstName: "Daniel" + lastName: "Krumm" + title: "Mr." + email: "Krumm@example.com" + address: "Waterfront 14" + city: "Berlin" + zipCode: "12334" + phoneNumber: "0303033330" + notes: "This customer has a lot of Complaints." + history: "23.4.2014|Order|jacket~25.4.2014|Return|jacket~28.4.2014|Complaint|Jacket had wrong color." + } + + ListElement { + customerId: "78885693" + firstName: "Vanessa" + lastName: "Newbury" + title: "Ms." + email: "VanessaN@example.com" + address: "Madison Ave. 277" + city: "New York" + zipCode: "10016" + phoneNumber: "0503053530" + notes: "Deliveries sometime do not arrive on time." + history: "19.4.2014|Order|coffee~23.4.2014|Order|bicycle~29.4.2014|Invoice|bicycle 500$~06.5.2014|Overdue Notice|bicycle 500$" + } +} diff --git a/examples/quickcontrols/controls/uiforms/qml/History.qml b/examples/quickcontrols/controls/uiforms/qml/History.qml new file mode 100644 index 000000000..336d717ff --- /dev/null +++ b/examples/quickcontrols/controls/uiforms/qml/History.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 +import io.qt.example 1.0 + +HistoryForm { + id: form + + function readData() { + CustomerModel.selection.forEach(function (rowIndex) { + + var history = CustomerModel.get(rowIndex).history + var entries = history.split("~") + + form.tableView.model.clear() + + var index + for (index = 0; index < entries.length; index++) { + var entry = entries[index] + var data = entry.split("|") + form.tableView.model.append({ + date: data[0], + type: data[1], + text: data[2] + }) + } + }) + } + + Connections { + target: CustomerModel.selection + onSelectionChanged: form.readData() + } + + Component.onCompleted: readData() +} diff --git a/examples/quickcontrols/controls/uiforms/qml/HistoryForm.ui.qml b/examples/quickcontrols/controls/uiforms/qml/HistoryForm.ui.qml new file mode 100644 index 000000000..9445b12fb --- /dev/null +++ b/examples/quickcontrols/controls/uiforms/qml/HistoryForm.ui.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 + +Item { + id: content + + width: 640 + height: 480 + property alias tableView: tableView + + TableView { + id: tableView + + property int columnWidth: width / 3 + + anchors.fill: parent + + TableViewColumn { + role: "date" + title: qsTr("Date") + width: tableView.columnWidth + } + + TableViewColumn { + role: "type" + title: qsTr("Type") + width: tableView.columnWidth + } + + TableViewColumn { + role: "text" + title: qsTr("Description") + width: tableView.columnWidth + } + + model: ListModel { + } + } +} diff --git a/examples/quickcontrols/controls/uiforms/qml/Notes.qml b/examples/quickcontrols/controls/uiforms/qml/Notes.qml new file mode 100644 index 000000000..af506af31 --- /dev/null +++ b/examples/quickcontrols/controls/uiforms/qml/Notes.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 +import io.qt.example 1.0 + +NotesForm { + id: form + + function readData() { + CustomerModel.selection.forEach(function (rowIndex) { + form.textArea.text = CustomerModel.get(rowIndex).notes + }) + + save.enabled = true + cancel.enabled = true + form.textArea.enabled = true + } + + function writeData() { + CustomerModel.selection.forEach(function (rowIndex) { + var data = CustomerModel.get(rowIndex) + data.notes = form.textArea.text + CustomerModel.set(rowIndex, data) + }) + } + + cancel.onClicked: readData() + save.onClicked: writeData() + + Connections { + target: CustomerModel.selection + onSelectionChanged: form.readData() + } + + Component.onCompleted: readData() +} diff --git a/examples/quickcontrols/controls/uiforms/qml/NotesForm.ui.qml b/examples/quickcontrols/controls/uiforms/qml/NotesForm.ui.qml new file mode 100644 index 000000000..9552afcd0 --- /dev/null +++ b/examples/quickcontrols/controls/uiforms/qml/NotesForm.ui.qml @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 + +Item { + id: content + + property alias cancel: cancel + property alias save: save + property alias textArea: textArea + + width: 640 + height: 480 + + ColumnLayout { + anchors.rightMargin: 12 + anchors.leftMargin: 12 + anchors.bottomMargin: 12 + anchors.topMargin: 12 + anchors.fill: parent + + TextArea { + id: textArea + x: 8 + y: 8 + width: 624 + height: 320 + Layout.fillHeight: true + Layout.fillWidth: true + } + RowLayout { + Layout.alignment: Qt.AlignTop | Qt.AlignRight + Button { + id: save + text: qsTr("Save") + enabled: false + } + Button { + id: cancel + text: qsTr("Cancel") + enabled: false + } + } + } +} diff --git a/examples/quickcontrols/controls/uiforms/qml/Settings.qml b/examples/quickcontrols/controls/uiforms/qml/Settings.qml new file mode 100644 index 000000000..658c62d3c --- /dev/null +++ b/examples/quickcontrols/controls/uiforms/qml/Settings.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 +import QtQuick.Dialogs 1.2 +import io.qt.example 1.0 + +SettingsForm { + id: form + anchors.fill: parent + + function readData() { + CustomerModel.selection.forEach(function (rowIndex) { + form.firstName.text = CustomerModel.get(rowIndex).firstName + form.lastName.text = CustomerModel.get(rowIndex).lastName + form.customerId.text = CustomerModel.get(rowIndex).customerId + form.email.text = CustomerModel.get(rowIndex).email + form.address.text = CustomerModel.get(rowIndex).address + form.phoneNumber.text = CustomerModel.get(rowIndex).phoneNumber + form.zipCode.text = CustomerModel.get(rowIndex).zipCode + form.city.text = CustomerModel.get(rowIndex).city + form.title.currentIndex = form.title.find(CustomerModel.get(rowIndex).title) + }) + + save.enabled = true + cancel.enabled = true + gridLayout.enabled = true + } + + function writeData() { + CustomerModel.selection.forEach(function (rowIndex) { + var notes = CustomerModel.get(rowIndex).notes + CustomerModel.set(rowIndex, { + firstName: form.firstName.text, + lastName: form.lastName.text, + customerId: form.customerId.text, + email: form.firstName.email, + address: form.lastName.address, + phoneNumber: form.customerId.phoneNumber, + zipCode: form.customerId.zipCode, + city: form.customerId.city, + title: form.title.currentText, + notes: notes + }) + }) + } + + cancel.onClicked: readData() + save.onClicked: writeData() + + Connections { + target: CustomerModel.selection + onSelectionChanged: form.readData() + } + + Component.onCompleted: readData() +} diff --git a/examples/quickcontrols/controls/uiforms/qml/SettingsForm.ui.qml b/examples/quickcontrols/controls/uiforms/qml/SettingsForm.ui.qml new file mode 100644 index 000000000..5cafe0e7a --- /dev/null +++ b/examples/quickcontrols/controls/uiforms/qml/SettingsForm.ui.qml @@ -0,0 +1,259 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 + +Item { + id: content + + width: 480 + height: 480 + + property alias address: address + property alias gridLayout: gridLayout + property alias cancel: cancel + property alias save: save + + property alias title: title + property alias zipCode: zipCode + property alias city: city + property alias phoneNumber: phoneNumber + property alias customerId: customerId + property alias email: email + property alias lastName: lastName + property alias firstName: firstName + + GridLayout { + id: gridLayout + + anchors.right: parent.right + anchors.left: parent.left + anchors.top: parent.top + anchors.rightMargin: 12 + anchors.leftMargin: 12 + anchors.topMargin: 12 + columnSpacing: 8 + rowSpacing: 8 + rows: 8 + columns: 7 + enabled: false + + Label { + id: label1 + text: qsTr("Title") + Layout.columnSpan: 2 + } + + Label { + id: label2 + text: qsTr("First Name") + Layout.columnSpan: 2 + } + + Item { + id: spacer10 + Layout.preferredHeight: 14 + Layout.preferredWidth: 14 + } + + Label { + id: label3 + text: qsTr("Last Name") + } + + Item { + id: spacer15 + Layout.preferredHeight: 14 + Layout.preferredWidth: 14 + } + + ComboBox { + id: title + Layout.columnSpan: 2 + Layout.fillWidth: true + model: ["Mr.", "Ms."] + } + + TextField { + id: firstName + Layout.minimumWidth: 140 + Layout.fillWidth: true + Layout.columnSpan: 3 + placeholderText: qsTr("first name") + } + + TextField { + id: lastName + Layout.minimumWidth: 140 + Layout.fillWidth: true + Layout.columnSpan: 2 + placeholderText: qsTr("last name") + } + + Label { + id: label4 + text: qsTr("Phone Number") + Layout.columnSpan: 5 + } + + Label { + id: label5 + text: qsTr("Email") + Layout.preferredHeight: 13 + Layout.preferredWidth: 24 + } + + Item { + id: spacer16 + Layout.preferredHeight: 14 + Layout.preferredWidth: 14 + } + + TextField { + id: phoneNumber + Layout.fillWidth: true + Layout.columnSpan: 5 + placeholderText: qsTr("phone number") + } + + TextField { + id: email + Layout.fillWidth: true + Layout.columnSpan: 2 + placeholderText: qsTr("email") + } + + Label { + id: label6 + text: qsTr("Address") + } + + Item { + id: spacer3 + Layout.columnSpan: 6 + Layout.preferredHeight: 14 + Layout.preferredWidth: 14 + } + + TextField { + id: address + Layout.fillWidth: true + Layout.columnSpan: 7 + placeholderText: qsTr("address") + } + + Label { + id: label7 + text: qsTr("City") + } + + Item { + id: spacer4 + Layout.columnSpan: 4 + Layout.preferredHeight: 14 + Layout.preferredWidth: 14 + } + + Label { + id: label8 + text: qsTr("Zip Code") + } + + Item { + id: spacer18 + Layout.preferredHeight: 14 + Layout.preferredWidth: 14 + } + + TextField { + id: city + Layout.fillWidth: true + Layout.columnSpan: 5 + placeholderText: qsTr("city") + } + + TextField { + id: zipCode + Layout.fillWidth: true + Layout.columnSpan: 2 + placeholderText: qsTr("zip code") + } + + Label { + id: label9 + text: qsTr("Customer Id") + } + + Item { + id: spacer19 + Layout.columnSpan: 6 + Layout.preferredHeight: 14 + Layout.preferredWidth: 14 + } + + TextField { + id: customerId + Layout.columnSpan: 7 + Layout.fillWidth: true + placeholderText: qsTr("id") + } + } + + RowLayout { + anchors.topMargin: 12 + anchors.right: parent.right + anchors.rightMargin: 12 + anchors.top: gridLayout.bottom + + Button { + id: save + text: qsTr("Save") + enabled: false + } + + Button { + id: cancel + text: qsTr("Cancel") + enabled: false + } + } +} diff --git a/examples/quickcontrols/controls/uiforms/uiforms.pro b/examples/quickcontrols/controls/uiforms/uiforms.pro new file mode 100644 index 000000000..8b8a8a965 --- /dev/null +++ b/examples/quickcontrols/controls/uiforms/uiforms.pro @@ -0,0 +1,24 @@ +TEMPLATE = app +TARGET = uiforms + +SOURCES += \ + main.cpp + +RESOURCES += \ + uiforms.qrc + +OTHER_FILES += \ + main.qml \ + MainForm.ui.qml \ + qml/Settings.qml \ + qml/History.qml \ + qml/Notes.qml \ + qml/SettingsForm.ui.qml \ + qml/HistoryForm.ui.qml \ + qml/NotesForm.ui.qml \ + qml/CustomerModel.qml + +include(../shared/shared.pri) + +target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/controls/uiforms +INSTALLS += target diff --git a/examples/quickcontrols/controls/uiforms/uiforms.qrc b/examples/quickcontrols/controls/uiforms/uiforms.qrc new file mode 100644 index 000000000..447bb039d --- /dev/null +++ b/examples/quickcontrols/controls/uiforms/uiforms.qrc @@ -0,0 +1,13 @@ + + + main.qml + MainForm.ui.qml + qml/Settings.qml + qml/History.qml + qml/Notes.qml + qml/SettingsForm.ui.qml + qml/HistoryForm.ui.qml + qml/NotesForm.ui.qml + qml/CustomerModel.qml + + diff --git a/examples/quickcontrols/dialogs/dialogs.pro b/examples/quickcontrols/dialogs/dialogs.pro new file mode 100644 index 000000000..538e75686 --- /dev/null +++ b/examples/quickcontrols/dialogs/dialogs.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs + +SUBDIRS = \ + systemdialogs diff --git a/examples/quickcontrols/dialogs/systemdialogs/ColorDialogs.qml b/examples/quickcontrols/dialogs/systemdialogs/ColorDialogs.qml new file mode 100644 index 000000000..90cbccf44 --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/ColorDialogs.qml @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.2 +import QtQuick.Dialogs 1.1 + +Item { + width: 320 + height: 240 + SystemPalette { id: palette } + clip: true + + //! [colordialog] + ColorDialog { + id: colorDialog + visible: colorDialogVisible.checked + modality: colorDialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: "Choose a color" + color: "green" + showAlphaChannel: colorDialogAlpha.checked + onAccepted: { console.log("Accepted: " + color) } + onRejected: { console.log("Rejected") } + } + //! [colordialog] + + Column { + anchors.fill: parent + anchors.margins: 12 + spacing: 8 + Label { + font.bold: true + text: "Color dialog properties:" + } + CheckBox { + id: colorDialogModal + text: "Modal" + checked: true + Binding on checked { value: colorDialog.modality != Qt.NonModal } + } + CheckBox { + id: colorDialogAlpha + text: "Show alpha channel" + Binding on checked { value: colorDialog.showAlphaChannel } + } + CheckBox { + id: colorDialogVisible + text: "Visible" + Binding on checked { value: colorDialog.visible } + } + Row { + id: colorRow + spacing: parent.spacing + height: colorLabel.implicitHeight * 2.0 + Rectangle { + color: colorDialog.color + height: parent.height + width: height * 2 + border.color: "black" + MouseArea { + anchors.fill: parent + onClicked: colorDialog.open() + } + } + Label { + id: colorLabel + text: "current color: " + colorDialog.color + anchors.verticalCenter: parent.verticalCenter + } + } + } + + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: buttonRow.height * 1.2 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + id: buttonRow + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + height: implicitHeight + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.close() + } + Button { + text: "set to green" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.color = "green" + } + } + } +} diff --git a/examples/quickcontrols/dialogs/systemdialogs/CustomDialogs.qml b/examples/quickcontrols/dialogs/systemdialogs/CustomDialogs.qml new file mode 100644 index 000000000..c1022fbba --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/CustomDialogs.qml @@ -0,0 +1,339 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.3 +import QtQuick.Controls 1.2 +import QtQuick.Dialogs 1.2 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.0 + +Item { + id: root + width: 580 + height: 400 + SystemPalette { id: palette } + clip: true + + //! [dialog] + Dialog { + id: helloDialog + modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: customizeTitle.checked ? windowTitleField.text : "Hello" + onButtonClicked: console.log("clicked button " + clickedButton) + onAccepted: lastChosen.text = "Accepted " + + (clickedButton == StandardButton.Ok ? "(OK)" : (clickedButton == StandardButton.Retry ? "(Retry)" : "(Ignore)")) + onRejected: lastChosen.text = "Rejected " + + (clickedButton == StandardButton.Close ? "(Close)" : (clickedButton == StandardButton.Abort ? "(Abort)" : "(Cancel)")) + onHelp: lastChosen.text = "Yelped for help!" + onYes: lastChosen.text = (clickedButton == StandardButton.Yes ? "Yeessss!!" : "Yes, now and always") + onNo: lastChosen.text = (clickedButton == StandardButton.No ? "Oh No." : "No, no, a thousand times no!") + onApply: lastChosen.text = "Apply" + onReset: lastChosen.text = "Reset" + + Label { + text: "Hello world!" + } + } + //! [dialog] + + Dialog { + id: spinboxDialog + modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: customizeTitle.checked ? windowTitleField.text : "Spinbox" + onHelp: { + lastChosen.text = "No help available, sorry. Please answer the question." + visible = true + } + onButtonClicked: { + if (clickedButton === StandardButton.Ok && answer.value == 11.0) + lastChosen.text = "You are correct!" + else + lastChosen.text = "Having failed to give the correct answer, you shall not pass!" + } + + ColumnLayout { + id: column + width: parent ? parent.width : 100 + Label { + text: "What is the average airspeed velocity of an unladen European swallow?" + Layout.columnSpan: 2 + Layout.fillWidth: true + wrapMode: Text.WordWrap + } + RowLayout { + Layout.alignment: Qt.AlignHCenter + SpinBox { + id: answer + onEditingFinished: spinboxDialog.click(StandardButton.Ok) + } + Label { + text: "m/s" + Layout.alignment: Qt.AlignBaseline | Qt.AlignLeft + } + } + } + } + + Dialog { + id: dateDialog + modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: customizeTitle.checked ? windowTitleField.text : "Choose a date" + onButtonClicked: console.log("clicked button " + clickedButton) + onAccepted: { + if (clickedButton == StandardButton.Ok) + lastChosen.text = "Accepted " + calendar.selectedDate.toLocaleDateString() + else + lastChosen.text = (clickedButton == StandardButton.Retry ? "(Retry)" : "(Ignore)") + } + onRejected: lastChosen.text = "Rejected" + + Calendar { + id: calendar + width: parent ? parent.width : implicitWidth + onDoubleClicked: dateDialog.click(StandardButton.Ok) + } + } + + Dialog { + id: filledDialog + modality: dialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: customizeTitle.checked ? windowTitleField.text : "Customized content" + onRejected: lastChosen.text = "Rejected" + onAccepted: lastChosen.text = "Accepted " + + (clickedButton === StandardButton.Retry ? "(Retry)" : "(OK)") + onButtonClicked: if (clickedButton === StandardButton.Retry) lastChosen.text = "Retry" + contentItem: Rectangle { + color: "lightskyblue" + implicitWidth: 400 + implicitHeight: 100 + Label { + text: "Hello blue sky!" + color: "navy" + anchors.centerIn: parent + } + Keys.onPressed: if (event.key === Qt.Key_R && (event.modifiers & Qt.ControlModifier)) filledDialog.click(StandardButton.Retry) + Keys.onEnterPressed: filledDialog.accept() + Keys.onEscapePressed: filledDialog.reject() + Keys.onBackPressed: filledDialog.reject() // especially necessary on Android + } + } + + ColumnLayout { + anchors.fill: parent + anchors.margins: 12 + spacing: 8 + Label { + font.bold: true + text: "Message dialog properties:" + } + CheckBox { + id: dialogModal + text: "Modal" + Binding on checked { value: helloDialog.modality != Qt.NonModal } + } + RowLayout { + CheckBox { + id: customizeTitle + text: "Window Title" + Layout.alignment: Qt.AlignBaseline + checked: true + } + TextField { + id: windowTitleField + Layout.alignment: Qt.AlignBaseline + Layout.fillWidth: true + text: "Custom Dialog" + } + } + Label { + text: "Buttons:" + } + Flow { + spacing: 8 + Layout.fillWidth: true + property bool updating: false + function updateButtons(button, checked) { + if (updating) return + updating = true + var buttons = 0 + for (var i = 0; i < children.length; ++i) + if (children[i].checked) + buttons |= children[i].button + if (!buttons) + buttons = StandardButton.Ok + helloDialog.standardButtons = buttons + spinboxDialog.standardButtons = buttons + dateDialog.standardButtons = buttons + updating = false + } + + CheckBox { + text: "Help" + property int button: StandardButton.Help + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Abort" + property int button: StandardButton.Abort + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Close" + property int button: StandardButton.Close + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Cancel" + property int button: StandardButton.Cancel + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "NoToAll" + property int button: StandardButton.NoToAll + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "No" + property int button: StandardButton.No + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "YesToAll" + property int button: StandardButton.YesToAll + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Yes" + property int button: StandardButton.Yes + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Ignore" + property int button: StandardButton.Ignore + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Retry" + property int button: StandardButton.Retry + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Apply" + property int button: StandardButton.Apply + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Reset" + property int button: StandardButton.Reset + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Restore Defaults" + property int button: StandardButton.RestoreDefaults + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "OK" + checked: true + property int button: StandardButton.Ok + onCheckedChanged: parent.updateButtons(button, checked) + } + + Component.onCompleted: updateButtons() + } + Label { + id: lastChosen + } + Item { Layout.fillHeight: true } + } + + Rectangle { + id: bottomBar + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: buttonRow.height * 1.2 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + id: buttonRow + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + width: parent.width + Button { + text: "Hello World" + anchors.verticalCenter: parent.verticalCenter + onClicked: helloDialog.open() + } + Button { + text: "Input" + anchors.verticalCenter: parent.verticalCenter + onClicked: spinboxDialog.open() + } + Button { + text: "Date" + anchors.verticalCenter: parent.verticalCenter + onClicked: dateDialog.open() + } + Button { + text: "No buttons or margins" + anchors.verticalCenter: parent.verticalCenter + onClicked: filledDialog.open() + } + } + } +} diff --git a/examples/quickcontrols/dialogs/systemdialogs/FileDialogs.qml b/examples/quickcontrols/dialogs/systemdialogs/FileDialogs.qml new file mode 100644 index 000000000..57e474ce2 --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/FileDialogs.qml @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.2 +import QtQuick.Dialogs 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.0 + +Item { + width: 580 + height: 400 + SystemPalette { id: palette } + clip: true + + //! [filedialog] + FileDialog { + id: fileDialog + visible: fileDialogVisible.checked + modality: fileDialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: fileDialogSelectFolder.checked ? "Choose a folder" : + (fileDialogSelectMultiple.checked ? "Choose some files" : "Choose a file") + selectExisting: fileDialogSelectExisting.checked + selectMultiple: fileDialogSelectMultiple.checked + selectFolder: fileDialogSelectFolder.checked + nameFilters: [ "Image files (*.png *.jpg)", "All files (*)" ] + selectedNameFilter: "All files (*)" + sidebarVisible: fileDialogSidebarVisible.checked + onAccepted: { + console.log("Accepted: " + fileUrls) + if (fileDialogOpenFiles.checked) + for (var i = 0; i < fileUrls.length; ++i) + Qt.openUrlExternally(fileUrls[i]) + } + onRejected: { console.log("Rejected") } + } + //! [filedialog] + + ScrollView { + id: scrollView + anchors { + left: parent.left + right: parent.right + top: parent.top + bottom: bottomBar.top + leftMargin: 12 + } + ColumnLayout { + spacing: 8 + Item { Layout.preferredHeight: 4 } // padding + Label { + font.bold: true + text: "File dialog properties:" + } + CheckBox { + id: fileDialogModal + text: "Modal" + checked: true + Binding on checked { value: fileDialog.modality != Qt.NonModal } + } + CheckBox { + id: fileDialogSelectFolder + text: "Select Folder" + Binding on checked { value: fileDialog.selectFolder } + } + CheckBox { + id: fileDialogSelectExisting + text: "Select Existing Files" + checked: true + Binding on checked { value: fileDialog.selectExisting } + } + CheckBox { + id: fileDialogSelectMultiple + text: "Select Multiple Files" + Binding on checked { value: fileDialog.selectMultiple } + } + CheckBox { + id: fileDialogOpenFiles + text: "Open Files After Accepting" + } + CheckBox { + id: fileDialogSidebarVisible + text: "Show Sidebar" + checked: fileDialog.sidebarVisible + Binding on checked { value: fileDialog.sidebarVisible } + } + CheckBox { + id: fileDialogVisible + text: "Visible" + Binding on checked { value: fileDialog.visible } + } + Label { + text: "current view folder: " + fileDialog.folder + } + Label { + text: "name filters: {" + fileDialog.nameFilters + "}" + } + Label { + text: "current filter:" + fileDialog.selectedNameFilter + } + Label { + text: "chosen files: " + fileDialog.fileUrls + } + Label { + text: "chosen single path: " + fileDialog.fileUrl + } + } + } + + Rectangle { + id: bottomBar + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: buttonRow.height * 1.2 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + id: buttonRow + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + height: implicitHeight + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: fileDialog.open() + } + Button { + text: "Pictures" + tooltip: "go to my Pictures directory" + anchors.verticalCenter: parent.verticalCenter + enabled: fileDialog.shortcuts.hasOwnProperty("pictures") + onClicked: fileDialog.folder = fileDialog.shortcuts.pictures + } + Button { + text: "Home" + tooltip: "go to my home directory" + anchors.verticalCenter: parent.verticalCenter + enabled: fileDialog.shortcuts.hasOwnProperty("home") + onClicked: fileDialog.folder = fileDialog.shortcuts.home + } + } + } +} diff --git a/examples/quickcontrols/dialogs/systemdialogs/FontDialogs.qml b/examples/quickcontrols/dialogs/systemdialogs/FontDialogs.qml new file mode 100644 index 000000000..60881dd92 --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/FontDialogs.qml @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.2 +import QtQuick.Dialogs 1.1 + +Item { + width: 320 + height: 360 + SystemPalette { id: palette } + clip: true + + FontDialog { + id: fontDialog + visible: fontDialogVisible.checked + modality: fontDialogModal.checked ? Qt.WindowModal : Qt.NonModal + scalableFonts: fontDialogScalableFonts.checked + nonScalableFonts: fontDialogNonScalableFonts.checked + monospacedFonts: fontDialogMonospacedFonts.checked + proportionalFonts: fontDialogProportionalFonts.checked + title: "Choose a font" + font: Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal }) + currentFont: Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal }) + onCurrentFontChanged: { console.log("CurrentFontChanged: " + currentFont) } + onAccepted: { console.log("Accepted: " + font) } + onRejected: { console.log("Rejected") } + } + + Column { + id: optionsColumn + anchors.fill: parent + anchors.margins: 12 + spacing: 8 + Label { + font.bold: true + text: "Font dialog properties:" + } + CheckBox { + id: fontDialogModal + text: "Modal" + checked: true + Binding on checked { value: fontDialog.modality != Qt.NonModal } + } + CheckBox { + id: fontDialogScalableFonts + text: "Scalable fonts" + Binding on checked { value: fontDialog.scalableFonts } + } + CheckBox { + id: fontDialogNonScalableFonts + text: "Non scalable fonts" + Binding on checked { value: fontDialog.nonScalableFonts } + } + CheckBox { + id: fontDialogMonospacedFonts + text: "Monospaced fonts" + Binding on checked { value: fontDialog.monospacedFonts } + } + CheckBox { + id: fontDialogProportionalFonts + text: "Proportional fonts" + Binding on checked { value: fontDialog.proportionalFonts } + } + CheckBox { + id: fontDialogVisible + text: "Visible" + Binding on checked { value: fontDialog.visible } + } + Label { + text: "Current font:" + } + Label { + id: fontLabel + text: "" + fontDialog.font.family + " - " + fontDialog.font.pointSize + "" + MouseArea { + anchors.fill: parent + onClicked: fontDialog.open() + } + } + } + + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: buttonRow.height * 1.2 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + id: buttonRow + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: fontDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: fontDialog.close() + } + Button { + text: "set to default" + anchors.verticalCenter: parent.verticalCenter + onClicked: fontDialog.font = Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal }) + } + } + } +} diff --git a/examples/quickcontrols/dialogs/systemdialogs/MessageDialogs.qml b/examples/quickcontrols/dialogs/systemdialogs/MessageDialogs.qml new file mode 100644 index 000000000..2f9205b7a --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/MessageDialogs.qml @@ -0,0 +1,326 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.2 +import QtQuick.Dialogs 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.0 + +Item { + id: root + width: 580 + height: 400 + SystemPalette { id: palette } + clip: true + + //! [messagedialog] + MessageDialog { + id: messageDialog + visible: messageDialogVisible.checked + modality: messageDialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: windowTitleField.text + text: customizeText.checked ? textField.text : "" + informativeText: customizeInformativeText.checked ? informativeTextField.text : "" + detailedText: customizeDetailedText.checked ? detailedTextField.text : "" + onButtonClicked: console.log("clicked button " + clickedButton) + onAccepted: lastChosen.text = "Accepted " + + (clickedButton == StandardButton.Ok ? "(OK)" : (clickedButton == StandardButton.Retry ? "(Retry)" : "(Ignore)")) + onRejected: lastChosen.text = "Rejected " + + (clickedButton == StandardButton.Close ? "(Close)" : (clickedButton == StandardButton.Abort ? "(Abort)" : "(Cancel)")) + onHelp: lastChosen.text = "Yelped for help!" + onYes: lastChosen.text = (clickedButton == StandardButton.Yes ? "Yeessss!!" : "Yes, now and always") + onNo: lastChosen.text = (clickedButton == StandardButton.No ? "Oh No." : "No, no, a thousand times no!") + onApply: lastChosen.text = "Apply" + onReset: lastChosen.text = "Reset" + } + //! [messagedialog] + + ScrollView { + id: scrollView + anchors { + left: parent.left + right: parent.right + top: parent.top + bottom: bottomBar.top + leftMargin: 12 + } + ColumnLayout { + spacing: 8 + Item { Layout.preferredHeight: 4 } // padding + Label { + font.bold: true + text: "Message dialog properties:" + } + CheckBox { + id: messageDialogModal + text: "Modal" + checked: true + Binding on checked { value: messageDialog.modality != Qt.NonModal } + } + RowLayout { + CheckBox { + id: customizeTitle + text: "Window Title" + Layout.alignment: Qt.AlignBaseline + checked: true + } + TextField { + id: windowTitleField + Layout.alignment: Qt.AlignBaseline + Layout.fillWidth: true + text: "Alert" + } + } + Label { text: "Icon:" } + Flow { + spacing: 8 + Layout.fillWidth: true + property bool updating: false + function updateIcon(icon, checked) { + if (updating) return + updating = true + messageDialog.icon = (checked ? icon : StandardIcon.NoIcon) + for (var i = 0; i < children.length; ++i) + if (children[i].icon !== icon) + children[i].checked = false + updating = false + } + + CheckBox { + id: iconInformation + text: "Information" + property int icon: StandardIcon.Information + onCheckedChanged: parent.updateIcon(icon, checked) + } + + CheckBox { + id: iconWarning + text: "Warning" + checked: true + property int icon: StandardIcon.Warning + onCheckedChanged: parent.updateIcon(icon, checked) + Component.onCompleted: parent.updateIcon(icon, true) + } + + CheckBox { + id: iconCritical + text: "Critical" + property int icon: StandardIcon.Critical + onCheckedChanged: parent.updateIcon(icon, checked) + } + + CheckBox { + id: iconQuestion + text: "Question" + property int icon: StandardIcon.Question + onCheckedChanged: parent.updateIcon(icon, checked) + } + } + + RowLayout { + CheckBox { + id: customizeText + text: "Primary Text" + Layout.alignment: Qt.AlignBaseline + checked: true + } + TextField { + id: textField + Layout.alignment: Qt.AlignBaseline + Layout.fillWidth: true + text: "Attention Please" + } + } + RowLayout { + CheckBox { + id: customizeInformativeText + text: "Informative Text" + Layout.alignment: Qt.AlignBaseline + checked: true + } + TextField { + id: informativeTextField + Layout.alignment: Qt.AlignBaseline + Layout.fillWidth: true + text: "Be alert!" + } + } + Label { text: "Buttons:" } + Flow { + spacing: 8 + Layout.fillWidth: true + Layout.preferredWidth: root.width - 30 + property bool updating: false + function updateButtons(button, checked) { + if (updating) return + updating = true + var buttons = 0 + for (var i = 0; i < children.length; ++i) + if (children[i].checked) + buttons |= children[i].button + if (!buttons) + buttons = StandardButton.Ok + messageDialog.standardButtons = buttons + updating = false + } + + CheckBox { + text: "Help" + property int button: StandardButton.Help + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Abort" + property int button: StandardButton.Abort + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Close" + property int button: StandardButton.Close + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Cancel" + property int button: StandardButton.Cancel + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "NoToAll" + property int button: StandardButton.NoToAll + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "No" + property int button: StandardButton.No + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "YesToAll" + property int button: StandardButton.YesToAll + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Yes" + property int button: StandardButton.Yes + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Ignore" + property int button: StandardButton.Ignore + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "Retry" + property int button: StandardButton.Retry + onCheckedChanged: parent.updateButtons(button, checked) + } + + CheckBox { + text: "OK" + checked: true + property int button: StandardButton.Ok + onCheckedChanged: parent.updateButtons(button, checked) + } + } + RowLayout { + CheckBox { + id: customizeDetailedText + text: "Detailed Text" + Layout.alignment: Qt.AlignBaseline + checked: true + } + TextField { + id: detailedTextField + Layout.alignment: Qt.AlignBaseline + Layout.fillWidth: true + text: "The world needs more lerts." + } + } + CheckBox { + id: messageDialogVisible + text: "Visible" + Binding on checked { value: messageDialog.visible } + } + Label { + id: lastChosen + } + } + } + + Rectangle { + id: bottomBar + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: buttonRow.height * 1.2 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + id: buttonRow + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: messageDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: messageDialog.close() + } + } + } +} diff --git a/examples/quickcontrols/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg b/examples/quickcontrols/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg new file mode 100644 index 000000000..4517a3930 Binary files /dev/null and b/examples/quickcontrols/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg differ diff --git a/examples/quickcontrols/dialogs/systemdialogs/doc/src/systemdialogs.qdoc b/examples/quickcontrols/dialogs/systemdialogs/doc/src/systemdialogs.qdoc new file mode 100644 index 000000000..b9f05de71 --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/doc/src/systemdialogs.qdoc @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title Qt Quick System Dialog Examples + \example systemdialogs + \brief This example demonstrates the system dialog types in QML + \image systemdialogs-example.jpg + \ingroup qtquickdialog_examples + + This example demonstrates the system dialogs in the \l{Qt Quick Dialogs} + module. The appearance and behavior is platform-dependent. + + A \l FileDialog is used to choose a single file, multiple files or a + single directory, depending on how it is configured. + \snippet systemdialogs/FileDialogs.qml filedialog + + A \l ColorDialog is used to choose a color, with or without alpha (transparency) + depending on how it is configured. + \snippet systemdialogs/ColorDialogs.qml colordialog + + The example can be built as a standalone executable, but each + type of dialog is demonstrated in a separate QML file which can + also be run separately with qmlscene. +*/ diff --git a/examples/quickcontrols/dialogs/systemdialogs/main.cpp b/examples/quickcontrols/dialogs/systemdialogs/main.cpp new file mode 100644 index 000000000..5f65ce040 --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/main.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 "qtquickcontrolsapplication.h" +#include +#include +#include + +int main(int argc, char *argv[]) +{ + QtQuickControlsApplication app(argc, argv); + if (QCoreApplication::arguments().contains(QLatin1String("--coreprofile"))) { + QSurfaceFormat fmt; + fmt.setVersion(4, 4); + fmt.setProfile(QSurfaceFormat::CoreProfile); + QSurfaceFormat::setDefaultFormat(fmt); + } + QQmlApplicationEngine engine(QUrl("qrc:/dialogs/systemdialogs/systemdialogs.qml")); + if (engine.rootObjects().isEmpty()) + return -1; + return app.exec(); +} diff --git a/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.pro b/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.pro new file mode 100644 index 000000000..099e3773f --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.pro @@ -0,0 +1,19 @@ +QT += qml quick +!no_desktop: QT += widgets + +QT += quick qml +SOURCES += main.cpp +include(../../controls/shared/shared.pri) + +OTHER_FILES += \ + systemdialogs.qml \ + FileDialogs.qml \ + ColorDialogs.qml \ + FontDialogs.qml \ + MessageDialogs.qml \ + CustomDialogs.qml + +target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/dialogs/systemdialogs +INSTALLS += target + +RESOURCES += systemdialogs.qrc diff --git a/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qml b/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qml new file mode 100644 index 000000000..f1b215c74 --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.2 + +ApplicationWindow { + visible: true + title: "System Dialogs Gallery" + width: 580 + height: 480 + + TabView { + anchors.fill: parent + anchors.margins: 8 + Tab { + id: controlPage + title: "File" + FileDialogs { } + } + Tab { + title: "Color" + ColorDialogs { } + } + Tab { + title: "Font" + FontDialogs { anchors.fill: parent } + } + Tab { + title: "Message" + MessageDialogs { anchors.fill:parent } + } + Tab { + title: "Custom" + CustomDialogs { anchors.fill:parent } + } + } +} diff --git a/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qrc b/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qrc new file mode 100644 index 000000000..afd81bfee --- /dev/null +++ b/examples/quickcontrols/dialogs/systemdialogs/systemdialogs.qrc @@ -0,0 +1,10 @@ + + + systemdialogs.qml + FileDialogs.qml + ColorDialogs.qml + FontDialogs.qml + MessageDialogs.qml + CustomDialogs.qml + + diff --git a/examples/quickcontrols/extras/dashboard/dashboard.pro b/examples/quickcontrols/extras/dashboard/dashboard.pro new file mode 100644 index 000000000..eb3ee51be --- /dev/null +++ b/examples/quickcontrols/extras/dashboard/dashboard.pro @@ -0,0 +1,21 @@ +TEMPLATE = app +TARGET = dashboard +INCLUDEPATH += . +QT += quick + +SOURCES += \ + main.cpp + +RESOURCES += \ + dashboard.qrc + +OTHER_FILES += \ + qml/dashboard.qml \ + qml/DashboardGaugeStyle.qml \ + qml/IconGaugeStyle.qml \ + qml/TachometerStyle.qml \ + qml/TurnIndicator.qml \ + qml/ValueSource.qml + +target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/extras/dashboard +INSTALLS += target diff --git a/examples/quickcontrols/extras/dashboard/dashboard.qrc b/examples/quickcontrols/extras/dashboard/dashboard.qrc new file mode 100644 index 000000000..605e1678b --- /dev/null +++ b/examples/quickcontrols/extras/dashboard/dashboard.qrc @@ -0,0 +1,13 @@ + + + fonts/DejaVuSans.ttf + images/fuel-icon.png + images/temperature-icon.png + qml/dashboard.qml + qml/DashboardGaugeStyle.qml + qml/IconGaugeStyle.qml + qml/TachometerStyle.qml + qml/TurnIndicator.qml + qml/ValueSource.qml + + diff --git a/examples/quickcontrols/extras/dashboard/fonts/DejaVuSans.ttf b/examples/quickcontrols/extras/dashboard/fonts/DejaVuSans.ttf new file mode 100644 index 000000000..19ed0b468 Binary files /dev/null and b/examples/quickcontrols/extras/dashboard/fonts/DejaVuSans.ttf differ diff --git a/examples/quickcontrols/extras/dashboard/fonts/LICENSE b/examples/quickcontrols/extras/dashboard/fonts/LICENSE new file mode 100644 index 000000000..254e2cc42 --- /dev/null +++ b/examples/quickcontrols/extras/dashboard/fonts/LICENSE @@ -0,0 +1,99 @@ +Fonts are (c) Bitstream (see below). DejaVu changes are in public domain. +Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below) + +Bitstream Vera Fonts Copyright +------------------------------ + +Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is +a trademark of Bitstream, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of the fonts accompanying this license ("Fonts") and associated +documentation files (the "Font Software"), to reproduce and distribute the +Font Software, including without limitation the rights to use, copy, merge, +publish, distribute, and/or sell copies of the Font Software, and to permit +persons to whom the Font Software is furnished to do so, subject to the +following conditions: + +The above copyright and trademark notices and this permission notice shall +be included in all copies of one or more of the Font Software typefaces. + +The Font Software may be modified, altered, or added to, and in particular +the designs of glyphs or characters in the Fonts may be modified and +additional glyphs or characters may be added to the Fonts, only if the fonts +are renamed to names not containing either the words "Bitstream" or the word +"Vera". + +This License becomes null and void to the extent applicable to Fonts or Font +Software that has been modified and is distributed under the "Bitstream +Vera" names. + +The Font Software may be sold as part of a larger software package but no +copy of one or more of the Font Software typefaces may be sold by itself. + +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, +TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME +FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING +ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE +FONT SOFTWARE. + +Except as contained in this notice, the names of Gnome, the Gnome +Foundation, and Bitstream Inc., shall not be used in advertising or +otherwise to promote the sale, use or other dealings in this Font Software +without prior written authorization from the Gnome Foundation or Bitstream +Inc., respectively. For further information, contact: fonts at gnome dot +org. + +Arev Fonts Copyright +------------------------------ + +Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of the fonts accompanying this license ("Fonts") and +associated documentation files (the "Font Software"), to reproduce +and distribute the modifications to the Bitstream Vera Font Software, +including without limitation the rights to use, copy, merge, publish, +distribute, and/or sell copies of the Font Software, and to permit +persons to whom the Font Software is furnished to do so, subject to +the following conditions: + +The above copyright and trademark notices and this permission notice +shall be included in all copies of one or more of the Font Software +typefaces. + +The Font Software may be modified, altered, or added to, and in +particular the designs of glyphs or characters in the Fonts may be +modified and additional glyphs or characters may be added to the +Fonts, only if the fonts are renamed to names not containing either +the words "Tavmjong Bah" or the word "Arev". + +This License becomes null and void to the extent applicable to Fonts +or Font Software that has been modified and is distributed under the +"Tavmjong Bah Arev" names. + +The Font Software may be sold as part of a larger software package but +no copy of one or more of the Font Software typefaces may be sold by +itself. + +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL +TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +Except as contained in this notice, the name of Tavmjong Bah shall not +be used in advertising or otherwise to promote the sale, use or other +dealings in this Font Software without prior written authorization +from Tavmjong Bah. For further information, contact: tavmjong @ free +. fr. + +$Id: LICENSE 2133 2007-11-28 02:46:28Z lechimp $ diff --git a/examples/quickcontrols/extras/dashboard/images/fuel-icon.png b/examples/quickcontrols/extras/dashboard/images/fuel-icon.png new file mode 100644 index 000000000..70da758c2 Binary files /dev/null and b/examples/quickcontrols/extras/dashboard/images/fuel-icon.png differ diff --git a/examples/quickcontrols/extras/dashboard/images/temperature-icon.png b/examples/quickcontrols/extras/dashboard/images/temperature-icon.png new file mode 100644 index 000000000..5a4334e01 Binary files /dev/null and b/examples/quickcontrols/extras/dashboard/images/temperature-icon.png differ diff --git a/examples/quickcontrols/extras/dashboard/main.cpp b/examples/quickcontrols/extras/dashboard/main.cpp new file mode 100644 index 000000000..74ea07720 --- /dev/null +++ b/examples/quickcontrols/extras/dashboard/main.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 +#include +#include + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QFontDatabase::addApplicationFont(":/fonts/DejaVuSans.ttf"); + app.setFont(QFont("DejaVu Sans")); + + QQmlApplicationEngine engine(QUrl("qrc:/qml/dashboard.qml")); + if (engine.rootObjects().isEmpty()) + return -1; + return app.exec(); +} diff --git a/examples/quickcontrols/extras/dashboard/qml/DashboardGaugeStyle.qml b/examples/quickcontrols/extras/dashboard/qml/DashboardGaugeStyle.qml new file mode 100644 index 000000000..598fce563 --- /dev/null +++ b/examples/quickcontrols/extras/dashboard/qml/DashboardGaugeStyle.qml @@ -0,0 +1,164 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls.Styles 1.4 + +CircularGaugeStyle { + tickmarkInset: toPixels(0.04) + minorTickmarkInset: tickmarkInset + labelStepSize: 20 + labelInset: toPixels(0.23) + + property real xCenter: outerRadius + property real yCenter: outerRadius + property real needleLength: outerRadius - tickmarkInset * 1.25 + property real needleTipWidth: toPixels(0.02) + property real needleBaseWidth: toPixels(0.06) + property bool halfGauge: false + + function toPixels(percentage) { + return percentage * outerRadius; + } + + function degToRad(degrees) { + return degrees * (Math.PI / 180); + } + + function radToDeg(radians) { + return radians * (180 / Math.PI); + } + + function paintBackground(ctx) { + if (halfGauge) { + ctx.beginPath(); + ctx.rect(0, 0, ctx.canvas.width, ctx.canvas.height / 2); + ctx.clip(); + } + + ctx.beginPath(); + ctx.fillStyle = "black"; + ctx.ellipse(0, 0, ctx.canvas.width, ctx.canvas.height); + ctx.fill(); + + ctx.beginPath(); + ctx.lineWidth = tickmarkInset; + ctx.strokeStyle = "black"; + ctx.arc(xCenter, yCenter, outerRadius - ctx.lineWidth / 2, outerRadius - ctx.lineWidth / 2, 0, Math.PI * 2); + ctx.stroke(); + + ctx.beginPath(); + ctx.lineWidth = tickmarkInset / 2; + ctx.strokeStyle = "#222"; + ctx.arc(xCenter, yCenter, outerRadius - ctx.lineWidth / 2, outerRadius - ctx.lineWidth / 2, 0, Math.PI * 2); + ctx.stroke(); + + ctx.beginPath(); + var gradient = ctx.createRadialGradient(xCenter, yCenter, outerRadius * 0.8, xCenter, yCenter, outerRadius); + gradient.addColorStop(0, Qt.rgba(1, 1, 1, 0)); + gradient.addColorStop(0.7, Qt.rgba(1, 1, 1, 0.13)); + gradient.addColorStop(1, Qt.rgba(1, 1, 1, 1)); + ctx.fillStyle = gradient; + ctx.arc(xCenter, yCenter, outerRadius - tickmarkInset, outerRadius - tickmarkInset, 0, Math.PI * 2); + ctx.fill(); + } + + background: Canvas { + onPaint: { + var ctx = getContext("2d"); + ctx.reset(); + paintBackground(ctx); + } + + Text { + id: speedText + font.pixelSize: toPixels(0.3) + text: kphInt + color: "white" + horizontalAlignment: Text.AlignRight + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.verticalCenter + anchors.topMargin: toPixels(0.1) + + readonly property int kphInt: control.value + } + Text { + text: "km/h" + color: "white" + font.pixelSize: toPixels(0.09) + anchors.top: speedText.bottom + anchors.horizontalCenter: parent.horizontalCenter + } + } + + needle: Canvas { + implicitWidth: needleBaseWidth + implicitHeight: needleLength + + property real xCenter: width / 2 + property real yCenter: height / 2 + + onPaint: { + var ctx = getContext("2d"); + ctx.reset(); + + ctx.beginPath(); + ctx.moveTo(xCenter, height); + ctx.lineTo(xCenter - needleBaseWidth / 2, height - needleBaseWidth / 2); + ctx.lineTo(xCenter - needleTipWidth / 2, 0); + ctx.lineTo(xCenter, yCenter - needleLength); + ctx.lineTo(xCenter, 0); + ctx.closePath(); + ctx.fillStyle = Qt.rgba(0.66, 0, 0, 0.66); + ctx.fill(); + + ctx.beginPath(); + ctx.moveTo(xCenter, height) + ctx.lineTo(width, height - needleBaseWidth / 2); + ctx.lineTo(xCenter + needleTipWidth / 2, 0); + ctx.lineTo(xCenter, 0); + ctx.closePath(); + ctx.fillStyle = Qt.lighter(Qt.rgba(0.66, 0, 0, 0.66)); + ctx.fill(); + } + } + + foreground: null +} diff --git a/examples/quickcontrols/extras/dashboard/qml/IconGaugeStyle.qml b/examples/quickcontrols/extras/dashboard/qml/IconGaugeStyle.qml new file mode 100644 index 000000000..0c3d93204 --- /dev/null +++ b/examples/quickcontrols/extras/dashboard/qml/IconGaugeStyle.qml @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Extras 1.4 + +DashboardGaugeStyle { + id: fuelGaugeStyle + minimumValueAngle: -60 + maximumValueAngle: 60 + tickmarkStepSize: 1 + labelStepSize: 1 + labelInset: toPixels(-0.25) + minorTickmarkCount: 3 + + needleLength: toPixels(0.85) + needleBaseWidth: toPixels(0.08) + needleTipWidth: toPixels(0.03) + + halfGauge: true + + property string icon: "" + property color minWarningColor: "transparent" + property color maxWarningColor: "transparent" + readonly property real minWarningStartAngle: minimumValueAngle - 90 + readonly property real maxWarningStartAngle: maximumValueAngle - 90 + + tickmark: Rectangle { + implicitWidth: toPixels(0.06) + antialiasing: true + implicitHeight: toPixels(0.2) + color: "#c8c8c8" + } + + minorTickmark: Rectangle { + implicitWidth: toPixels(0.03) + antialiasing: true + implicitHeight: toPixels(0.15) + color: "#c8c8c8" + } + + background: Item { + Canvas { + anchors.fill: parent + onPaint: { + var ctx = getContext("2d"); + ctx.reset(); + + paintBackground(ctx); + + if (minWarningColor != "transparent") { + ctx.beginPath(); + ctx.lineWidth = fuelGaugeStyle.toPixels(0.08); + ctx.strokeStyle = minWarningColor; + ctx.arc(outerRadius, outerRadius, + // Start the line in from the decorations, and account for the width of the line itself. + outerRadius - tickmarkInset - ctx.lineWidth / 2, + degToRad(minWarningStartAngle), + degToRad(minWarningStartAngle + angleRange / (minorTickmarkCount + 1)), false); + ctx.stroke(); + } + if (maxWarningColor != "transparent") { + ctx.beginPath(); + ctx.lineWidth = fuelGaugeStyle.toPixels(0.08); + ctx.strokeStyle = maxWarningColor; + ctx.arc(outerRadius, outerRadius, + // Start the line in from the decorations, and account for the width of the line itself. + outerRadius - tickmarkInset - ctx.lineWidth / 2, + degToRad(maxWarningStartAngle - angleRange / (minorTickmarkCount + 1)), + degToRad(maxWarningStartAngle), false); + ctx.stroke(); + } + } + } + + Image { + source: icon + anchors.bottom: parent.verticalCenter + anchors.bottomMargin: toPixels(0.3) + anchors.horizontalCenter: parent.horizontalCenter + width: toPixels(0.3) + height: width + fillMode: Image.PreserveAspectFit + } + } +} diff --git a/examples/quickcontrols/extras/dashboard/qml/TachometerStyle.qml b/examples/quickcontrols/extras/dashboard/qml/TachometerStyle.qml new file mode 100644 index 000000000..a0f7b6b9a --- /dev/null +++ b/examples/quickcontrols/extras/dashboard/qml/TachometerStyle.qml @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Extras 1.4 + +DashboardGaugeStyle { + id: tachometerStyle + tickmarkStepSize: 1 + labelStepSize: 1 + needleLength: toPixels(0.85) + needleBaseWidth: toPixels(0.08) + needleTipWidth: toPixels(0.03) + + tickmark: Rectangle { + implicitWidth: toPixels(0.03) + antialiasing: true + implicitHeight: toPixels(0.08) + color: styleData.index === 7 || styleData.index === 8 ? Qt.rgba(0.5, 0, 0, 1) : "#c8c8c8" + } + + minorTickmark: null + + tickmarkLabel: Text { + font.pixelSize: Math.max(6, toPixels(0.12)) + text: styleData.value + color: styleData.index === 7 || styleData.index === 8 ? Qt.rgba(0.5, 0, 0, 1) : "#c8c8c8" + antialiasing: true + } + + background: Canvas { + onPaint: { + var ctx = getContext("2d"); + ctx.reset(); + paintBackground(ctx); + + ctx.beginPath(); + ctx.lineWidth = tachometerStyle.toPixels(0.08); + ctx.strokeStyle = Qt.rgba(0.5, 0, 0, 1); + var warningCircumference = maximumValueAngle - minimumValueAngle * 0.1; + var startAngle = maximumValueAngle - 90; + ctx.arc(outerRadius, outerRadius, + // Start the line in from the decorations, and account for the width of the line itself. + outerRadius - tickmarkInset - ctx.lineWidth / 2, + degToRad(startAngle - angleRange / 8 + angleRange * 0.015), + degToRad(startAngle - angleRange * 0.015), false); + ctx.stroke(); + } + + Text { + id: rpmText + font.pixelSize: tachometerStyle.toPixels(0.3) + text: rpmInt + color: "white" + horizontalAlignment: Text.AlignRight + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.verticalCenter + anchors.topMargin: 20 + + readonly property int rpmInt: valueSource.rpm + } + Text { + text: "x1000" + color: "white" + font.pixelSize: tachometerStyle.toPixels(0.1) + anchors.top: parent.top + anchors.topMargin: parent.height / 4 + anchors.horizontalCenter: parent.horizontalCenter + } + Text { + text: "RPM" + color: "white" + font.pixelSize: tachometerStyle.toPixels(0.1) + anchors.top: rpmText.bottom + anchors.horizontalCenter: parent.horizontalCenter + } + } +} diff --git a/examples/quickcontrols/extras/dashboard/qml/TurnIndicator.qml b/examples/quickcontrols/extras/dashboard/qml/TurnIndicator.qml new file mode 100644 index 000000000..cf9c41db3 --- /dev/null +++ b/examples/quickcontrols/extras/dashboard/qml/TurnIndicator.qml @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 + +Item { + // This enum is actually keyboard-related, but it serves its purpose + // as an indication of direction for us. + property int direction: Qt.LeftArrow + property bool on: false + + property bool flashing: false + + scale: direction === Qt.LeftArrow ? 1 : -1 + + Timer { + id: flashTimer + interval: 500 + running: on + repeat: true + onTriggered: flashing = !flashing + } + + function paintOutlinePath(ctx) { + ctx.beginPath(); + ctx.moveTo(0, height * 0.5); + ctx.lineTo(0.6 * width, 0); + ctx.lineTo(0.6 * width, height * 0.28); + ctx.lineTo(width, height * 0.28); + ctx.lineTo(width, height * 0.72); + ctx.lineTo(0.6 * width, height * 0.72); + ctx.lineTo(0.6 * width, height); + ctx.lineTo(0, height * 0.5); + } + + Canvas { + id: backgroundCanvas + anchors.fill: parent + + onPaint: { + var ctx = getContext("2d"); + ctx.reset(); + + paintOutlinePath(ctx); + + ctx.lineWidth = 1; + ctx.strokeStyle = "black"; + ctx.stroke(); + } + } + + Canvas { + id: foregroundCanvas + anchors.fill: parent + visible: on && flashing + + onPaint: { + var ctx = getContext("2d"); + ctx.reset(); + + paintOutlinePath(ctx); + + ctx.fillStyle = "green"; + ctx.fill(); + } + } +} diff --git a/examples/quickcontrols/extras/dashboard/qml/ValueSource.qml b/examples/quickcontrols/extras/dashboard/qml/ValueSource.qml new file mode 100644 index 000000000..39d35966a --- /dev/null +++ b/examples/quickcontrols/extras/dashboard/qml/ValueSource.qml @@ -0,0 +1,320 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 + +Item { + id: valueSource + property real kph: 0 + property real rpm: 1 + property real fuel: 0.85 + property string gear: { + var g; + if (kph == 0) { + return "P"; + } + if (kph < 30) { + return "1"; + } + if (kph < 50) { + return "2"; + } + if (kph < 80) { + return "3"; + } + if (kph < 120) { + return "4"; + } + if (kph < 160) { + return "5"; + } + } + property int turnSignal: gear == "P" && !start ? randomDirection() : -1 + property real temperature: 0.6 + property bool start: true + + function randomDirection() { + return Math.random() > 0.5 ? Qt.LeftArrow : Qt.RightArrow; + } + + SequentialAnimation { + running: true + loops: 1 + + // We want a small pause at the beginning, but we only want it to happen once. + PauseAnimation { + duration: 1000 + } + + PropertyAction { + target: valueSource + property: "start" + value: false + } + + SequentialAnimation { + loops: Animation.Infinite + + ParallelAnimation { + NumberAnimation { + target: valueSource + property: "kph" + easing.type: Easing.InOutSine + from: 0 + to: 30 + duration: 3000 + } + NumberAnimation { + target: valueSource + property: "rpm" + easing.type: Easing.InOutSine + from: 1 + to: 6.1 + duration: 3000 + } + } + ParallelAnimation { + // We changed gears so we lost a bit of speed. + NumberAnimation { + target: valueSource + property: "kph" + easing.type: Easing.InOutSine + from: 30 + to: 26 + duration: 600 + } + NumberAnimation { + target: valueSource + property: "rpm" + easing.type: Easing.InOutSine + from: 6 + to: 2.4 + duration: 600 + } + } + ParallelAnimation { + NumberAnimation { + target: valueSource + property: "kph" + easing.type: Easing.InOutSine + to: 60 + duration: 3000 + } + NumberAnimation { + target: valueSource + property: "rpm" + easing.type: Easing.InOutSine + to: 5.6 + duration: 3000 + } + } + ParallelAnimation { + // We changed gears so we lost a bit of speed. + NumberAnimation { + target: valueSource + property: "kph" + easing.type: Easing.InOutSine + to: 56 + duration: 600 + } + NumberAnimation { + target: valueSource + property: "rpm" + easing.type: Easing.InOutSine + to: 2.3 + duration: 600 + } + } + ParallelAnimation { + NumberAnimation { + target: valueSource + property: "kph" + easing.type: Easing.InOutSine + to: 100 + duration: 3000 + } + NumberAnimation { + target: valueSource + property: "rpm" + easing.type: Easing.InOutSine + to: 5.1 + duration: 3000 + } + } + ParallelAnimation { + // We changed gears so we lost a bit of speed. + NumberAnimation { + target: valueSource + property: "kph" + easing.type: Easing.InOutSine + to: 96 + duration: 600 + } + NumberAnimation { + target: valueSource + property: "rpm" + easing.type: Easing.InOutSine + to: 2.2 + duration: 600 + } + } + + ParallelAnimation { + NumberAnimation { + target: valueSource + property: "kph" + easing.type: Easing.InOutSine + to: 140 + duration: 3000 + } + NumberAnimation { + target: valueSource + property: "rpm" + easing.type: Easing.InOutSine + to: 6.2 + duration: 3000 + } + } + + // Start downshifting. + + // Fifth to fourth gear. + ParallelAnimation { + NumberAnimation { + target: valueSource + property: "kph" + easing.type: Easing.Linear + to: 100 + duration: 5000 + } + + NumberAnimation { + target: valueSource + property: "rpm" + easing.type: Easing.InOutSine + to: 3.1 + duration: 5000 + } + } + + // Fourth to third gear. + NumberAnimation { + target: valueSource + property: "rpm" + easing.type: Easing.InOutSine + to: 5.5 + duration: 600 + } + + ParallelAnimation { + NumberAnimation { + target: valueSource + property: "kph" + easing.type: Easing.InOutSine + to: 60 + duration: 5000 + } + NumberAnimation { + target: valueSource + property: "rpm" + easing.type: Easing.InOutSine + to: 2.6 + duration: 5000 + } + } + + // Third to second gear. + NumberAnimation { + target: valueSource + property: "rpm" + easing.type: Easing.InOutSine + to: 6.3 + duration: 600 + } + + ParallelAnimation { + NumberAnimation { + target: valueSource + property: "kph" + easing.type: Easing.InOutSine + to: 30 + duration: 5000 + } + NumberAnimation { + target: valueSource + property: "rpm" + easing.type: Easing.InOutSine + to: 2.6 + duration: 5000 + } + } + + NumberAnimation { + target: valueSource + property: "rpm" + easing.type: Easing.InOutSine + to: 6.5 + duration: 600 + } + + // Second to first gear. + ParallelAnimation { + NumberAnimation { + target: valueSource + property: "kph" + easing.type: Easing.InOutSine + to: 0 + duration: 5000 + } + NumberAnimation { + target: valueSource + property: "rpm" + easing.type: Easing.InOutSine + to: 1 + duration: 4500 + } + } + + PauseAnimation { + duration: 5000 + } + } + } +} diff --git a/examples/quickcontrols/extras/dashboard/qml/dashboard.qml b/examples/quickcontrols/extras/dashboard/qml/dashboard.qml new file mode 100644 index 000000000..756d96a50 --- /dev/null +++ b/examples/quickcontrols/extras/dashboard/qml/dashboard.qml @@ -0,0 +1,174 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Window 2.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Extras 1.4 + +Window { + id: root + visible: true + width: 1024 + height: 600 + + color: "#161616" + title: "Qt Quick Extras Demo" + + ValueSource { + id: valueSource + } + + // Dashboards are typically in a landscape orientation, so we need to ensure + // our height is never greater than our width. + Item { + id: container + width: root.width + height: Math.min(root.width, root.height) + anchors.centerIn: parent + + Row { + id: gaugeRow + spacing: container.width * 0.02 + anchors.centerIn: parent + + TurnIndicator { + id: leftIndicator + anchors.verticalCenter: parent.verticalCenter + width: height + height: container.height * 0.1 - gaugeRow.spacing + + direction: Qt.LeftArrow + on: valueSource.turnSignal == Qt.LeftArrow + } + + Item { + width: height + height: container.height * 0.25 - gaugeRow.spacing + anchors.verticalCenter: parent.verticalCenter + + CircularGauge { + id: fuelGauge + value: valueSource.fuel + maximumValue: 1 + y: parent.height / 2 - height / 2 - container.height * 0.01 + width: parent.width + height: parent.height * 0.7 + + style: IconGaugeStyle { + id: fuelGaugeStyle + + icon: "qrc:/images/fuel-icon.png" + minWarningColor: Qt.rgba(0.5, 0, 0, 1) + + tickmarkLabel: Text { + color: "white" + visible: styleData.value === 0 || styleData.value === 1 + font.pixelSize: fuelGaugeStyle.toPixels(0.225) + text: styleData.value === 0 ? "E" : (styleData.value === 1 ? "F" : "") + } + } + } + + CircularGauge { + value: valueSource.temperature + maximumValue: 1 + width: parent.width + height: parent.height * 0.7 + y: parent.height / 2 + container.height * 0.01 + + style: IconGaugeStyle { + id: tempGaugeStyle + + icon: "qrc:/images/temperature-icon.png" + maxWarningColor: Qt.rgba(0.5, 0, 0, 1) + + tickmarkLabel: Text { + color: "white" + visible: styleData.value === 0 || styleData.value === 1 + font.pixelSize: tempGaugeStyle.toPixels(0.225) + text: styleData.value === 0 ? "C" : (styleData.value === 1 ? "H" : "") + } + } + } + } + + CircularGauge { + id: speedometer + value: valueSource.kph + anchors.verticalCenter: parent.verticalCenter + maximumValue: 280 + // We set the width to the height, because the height will always be + // the more limited factor. Also, all circular controls letterbox + // their contents to ensure that they remain circular. However, we + // don't want to extra space on the left and right of our gauges, + // because they're laid out horizontally, and that would create + // large horizontal gaps between gauges on wide screens. + width: height + height: container.height * 0.5 + + style: DashboardGaugeStyle {} + } + + CircularGauge { + id: tachometer + width: height + height: container.height * 0.25 - gaugeRow.spacing + value: valueSource.rpm + maximumValue: 8 + anchors.verticalCenter: parent.verticalCenter + + style: TachometerStyle {} + } + + TurnIndicator { + id: rightIndicator + anchors.verticalCenter: parent.verticalCenter + width: height + height: container.height * 0.1 - gaugeRow.spacing + + direction: Qt.RightArrow + on: valueSource.turnSignal == Qt.RightArrow + } + + } + } +} diff --git a/examples/quickcontrols/extras/extras.pro b/examples/quickcontrols/extras/extras.pro new file mode 100644 index 000000000..7f7b72156 --- /dev/null +++ b/examples/quickcontrols/extras/extras.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs +SUBDIRS += \ + gallery \ + dashboard \ + flat diff --git a/examples/quickcontrols/extras/flat/Content.qml b/examples/quickcontrols/extras/flat/Content.qml new file mode 100644 index 000000000..2969f7305 --- /dev/null +++ b/examples/quickcontrols/extras/flat/Content.qml @@ -0,0 +1,706 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.4 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles.Flat 1.0 as Flat +import QtQuick.Extras 1.4 +import QtQuick.XmlListModel 2.0 + +Item { + anchors.fill: parent + + Text { + id: text + visible: false + } + + FontMetrics { + id: fontMetrics + font.family: Flat.FlatStyle.fontFamily + } + + readonly property int layoutSpacing: Math.round(5 * Flat.FlatStyle.scaleFactor) + + property var componentModel: [ + { name: "Buttons", component: buttonsComponent }, + { name: "Calendar", component: calendarComponent }, + { name: "DelayButton", component: delayButtonComponent }, + { name: "Dial", component: dialComponent }, + { name: "Input", component: inputComponent }, + { name: "PieMenu", component: pieMenuComponent }, + { name: "Progress", component: progressComponent }, + { name: "TableView", component: tableViewComponent }, + { name: "TextArea", component: textAreaComponent }, + { name: "Tumbler", component: tumblerComponent } + ] + + Loader { + id: componentLoader + anchors.fill: parent + sourceComponent: componentModel[controlData.componentIndex].component + } + + property Component buttonsComponent: ScrollView { + id: scrollView + horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff + + Flickable { + anchors.fill: parent + contentWidth: viewport.width + contentHeight: buttoncolumn.implicitHeight + textMargins * 1.5 + ColumnLayout { + id: buttoncolumn + anchors.fill: parent + anchors.margins: textMargins + anchors.topMargin: textMargins / 2 + spacing: textMargins / 2 + enabled: !settingsData.allDisabled + + GroupBox { + title: "Button" + checkable: settingsData.checks + flat: !settingsData.frames + Layout.fillWidth: true + GridLayout { + columns: Math.max(1, Math.floor(scrollView.width / button.implicitWidth - 0.5)) + Button { + id: button + text: "Normal" + } + Button { + text: "Default" + isDefault: true + } + Button { + text: "Checkable" + checkable: true + } + Button { + text: "Menu" + menu: Menu { + MenuItem { text: "Normal"; shortcut: "Ctrl+N" } + MenuSeparator { } + MenuItem { text: "Checkable 1"; checkable: true; checked: true } + MenuItem { text: "Checkable 2"; checkable: true; checked: true } + MenuSeparator { } + } + visible: Qt.application.supportsMultipleWindows + } + } + } + + GroupBox { + title: "RadioButton" + checkable: settingsData.checks + flat: !settingsData.frames + Layout.fillWidth: true + ExclusiveGroup { id: radiobuttongroup } + ColumnLayout { + anchors.fill: parent + Repeater { + model: ["First", "Second", "Third"] + RadioButton { + text: modelData + checked: index === 0 + exclusiveGroup: radiobuttongroup + Layout.fillWidth: true + } + } + } + } + + GroupBox { + title: "CheckBox" + checkable: settingsData.checks + flat: !settingsData.frames + Layout.fillWidth: true + ColumnLayout { + anchors.fill: parent + Repeater { + model: ["First", "Second", "Third"] + CheckBox { + text: modelData + checked: index === 0 + Layout.fillWidth: true + } + } + } + } + + GroupBox { + title: "Switch" + checkable: settingsData.checks + flat: !settingsData.frames + Layout.fillWidth: true + ColumnLayout { + anchors.fill: parent + Repeater { + model: ["First", "Second", "Third"] + RowLayout { + spacing: layoutSpacing * 2 + Label { + text: modelData + font.family: Flat.FlatStyle.fontFamily + renderType: Text.QtRendering + Layout.preferredWidth: fontMetrics.advanceWidth("Second") + } + Switch { checked: index == 0 } + } + } + } + } + + GroupBox { + title: "ToggleButton" + checkable: settingsData.checks + flat: !settingsData.frames + Layout.fillWidth: true + GridLayout { + columns: Math.max(1, !!children[0] ? Math.floor(scrollView.width / children[0].implicitWidth - 0.5) : children.length) + ToggleButton { + text: "Pump 1" + checked: true + } + ToggleButton { + text: "Pump 2" + checked: false + } + } + } + + GroupBox { + title: "StatusIndicator" + checkable: settingsData.checks + flat: !settingsData.frames + Layout.fillWidth: true + GridLayout { + columns: Math.max(1, Math.floor(scrollView.width / recordButton.implicitWidth - 0.5)) + columnSpacing: layoutSpacing * 4 + + Button { + id: recordButton + text: "Record" + Layout.alignment: Qt.AlignTop + onClicked: recordStatusIndicator.active = !recordStatusIndicator.active + + StatusIndicator { + id: recordStatusIndicator + active: false + anchors.left: parent.left + anchors.leftMargin: Math.max(6, Math.round(text.implicitHeight * 0.4)) + anchors.verticalCenter: parent.verticalCenter + rotation: 90 + } + } + ColumnLayout { + Repeater { + model: 3 + delegate: RowLayout { + Layout.alignment: Qt.AlignCenter + StatusIndicator { + active: true + color: "#f09116" + } + Label { + text: "Camera " + (index + 1) + font.family: Flat.FlatStyle.fontFamily + renderType: Text.QtRendering + } + } + } + } + } + } + } + } + } + + property Component progressComponent: ScrollView { + id: scrollView + horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff + Flickable { + anchors.fill: parent + contentWidth: viewport.width + contentHeight: progresscolumn.implicitHeight + textMargins * 1.5 + ColumnLayout { + id: progresscolumn + anchors.fill: parent + anchors.leftMargin: textMargins + anchors.rightMargin: textMargins + anchors.bottomMargin: textMargins + anchors.topMargin: textMargins / 2 + spacing: textMargins / 2 + enabled: !settingsData.allDisabled + + GroupBox { + title: "BusyIndicator" + checkable: settingsData.checks + flat: !settingsData.frames + Layout.fillWidth: true + BusyIndicator { + id: busyindicator + anchors.centerIn: parent + running: scrollView.visible + } + } + + GroupBox { + title: "ProgressBar" + checkable: settingsData.checks + flat: !settingsData.frames + Layout.fillWidth: true + ColumnLayout { + anchors.fill: parent + ProgressBar { + value: slider.value + maximumValue: slider.maximumValue + Layout.fillWidth: true + } + ProgressBar { + indeterminate: true + value: slider.value + maximumValue: slider.maximumValue + Layout.fillWidth: true + } + } + } + + GroupBox { + title: "Slider" + checkable: settingsData.checks + flat: !settingsData.frames + Layout.fillWidth: true + ColumnLayout { + anchors.fill: parent + Slider { + id: slider + // TODO: can't use maximumValue / 2 here, otherwise the gauges + // initially show up as empty; find out why. + value: 50 + // If we use the default value of 1 here, we run into QTBUG-42358, + // even though that report specifically uses 100 as an example... + maximumValue: 100 + Layout.fillWidth: true + } + } + } + + GroupBox { + title: "Gauge" + checkable: settingsData.checks + flat: !settingsData.frames + Layout.fillWidth: true + Gauge { + id: gauge + value: slider.value * 1.4 + orientation: window.width < window.height ? Qt.Vertical : Qt.Horizontal + minimumValue: slider.minimumValue * 1.4 + maximumValue: slider.maximumValue * 1.4 + tickmarkStepSize: 20 + + anchors.centerIn: parent + } + } + + GroupBox { + title: "CircularGauge" + checkable: settingsData.checks + flat: !settingsData.frames + Layout.fillWidth: true + Layout.minimumWidth: 0 + CircularGauge { + id: circularGauge + value: slider.value * 3.2 + minimumValue: slider.minimumValue * 3.2 + maximumValue: slider.maximumValue * 3.2 + + anchors.centerIn: parent + width: Math.min(implicitWidth, parent.width) + height: Math.min(implicitHeight, parent.height) + + style: Flat.CircularGaugeStyle { + tickmarkStepSize: 20 + labelStepSize: 40 + minorTickmarkCount: 2 + } + + Column { + anchors.centerIn: parent + + Label { + text: Math.floor(circularGauge.value) + anchors.horizontalCenter: parent.horizontalCenter + renderType: Text.QtRendering + font.pixelSize: unitLabel.font.pixelSize * 2 + font.family: Flat.FlatStyle.fontFamily + font.weight: Font.Light + } + Label { + id: unitLabel + text: "km/h" + renderType: Text.QtRendering + font.family: Flat.FlatStyle.fontFamily + anchors.horizontalCenter: parent.horizontalCenter + } + } + } + } + } + } + } + + property Component inputComponent: ScrollView { + id: scrollView + horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff + Flickable { + anchors.fill: parent + contentWidth: viewport.width + contentHeight: inputcolumn.implicitHeight + textMargins * 1.5 + ColumnLayout { + id: inputcolumn + anchors.fill: parent + anchors.margins: textMargins + spacing: textMargins / 2 + enabled: !settingsData.allDisabled + + GroupBox { + title: "TextField" + checkable: settingsData.checks + flat: !settingsData.frames + Layout.fillWidth: true + ColumnLayout { + anchors.fill: parent + TextField { + z: 1 + placeholderText: "TextField" + Layout.fillWidth: true + } + TextField { + placeholderText: "Password" + echoMode: TextInput.Password // TODO: PasswordEchoOnEdit + Layout.fillWidth: true + } + } + } + + GroupBox { + title: "ComboBox" + checkable: settingsData.checks + flat: !settingsData.frames + Layout.fillWidth: true + visible: Qt.application.supportsMultipleWindows + ColumnLayout { + anchors.fill: parent + ComboBox { + model: ["Option 1", "Option 2", "Option 3"] + Layout.fillWidth: true + } + ComboBox { + editable: true + model: ListModel { + id: combomodel + ListElement { text: "Option 1" } + ListElement { text: "Option 2" } + ListElement { text: "Option 3" } + } + onAccepted: { + if (find(currentText) === -1) { + combomodel.append({text: editText}) + currentIndex = find(editText) + } + } + Layout.fillWidth: true + } + } + } + + GroupBox { + title: "SpinBox" + checkable: settingsData.checks + flat: !settingsData.frames + Layout.fillWidth: true + GridLayout { + anchors.fill: parent + columns: Math.max(1, Math.floor(scrollView.width / spinbox.implicitWidth - 0.5)) + SpinBox { + id: spinbox + Layout.fillWidth: true + } + SpinBox { + decimals: 1 + Layout.fillWidth: true + } + } + } + } + } + } + + Component { + id: tableViewComponent + TableView { + id: view + enabled: !settingsData.allDisabled + TableViewColumn { + role: "title" + title: "Title" + width: view.width / 2 + resizable: false + movable: false + } + TableViewColumn { + role: "author" + title: "Author" + width: view.width / 2 + resizable: false + movable: false + } + + frameVisible: false + backgroundVisible: true + alternatingRowColors: false + model: ListModel { + ListElement { + title: "Moby-Dick" + author: "Herman Melville" + } + ListElement { + title: "The Adventures of Tom Sawyer" + author: "Mark Twain" + } + ListElement { + title: "Cat’s Cradle" + author: "Kurt Vonnegut" + } + ListElement { + title: "Farenheit 451" + author: "Ray Bradbury" + } + ListElement { + title: "It" + author: "Stephen King" + } + ListElement { + title: "On the Road" + author: "Jack Kerouac" + } + ListElement { + title: "Of Mice and Men" + author: "John Steinbeck" + } + ListElement { + title: "Do Androids Dream of Electric Sheep?" + author: "Philip K. Dick" + } + ListElement { + title: "Uncle Tom’s Cabin" + author: "Harriet Beecher Stowe" + } + ListElement { + title: "The Call of the Wild" + author: "Jack London" + } + ListElement { + title: "The Old Man and the Sea" + author: "Ernest Hemingway" + } + ListElement { + title: "A Streetcar Named Desire" + author: "Tennessee Williams" + } + ListElement { + title: "Catch-22" + author: "Joseph Heller" + } + ListElement { + title: "One Flew Over the Cuckoo’s Nest" + author: "Ken Kesey" + } + ListElement { + title: "The Murders in the Rue Morgue" + author: "Edgar Allan Poe" + } + ListElement { + title: "Breakfast at Tiffany’s" + author: "Truman Capote" + } + ListElement { + title: "Death of a Salesman" + author: "Arthur Miller" + } + ListElement { + title: "Post Office" + author: "Charles Bukowski" + } + ListElement { + title: "Herbert West—Reanimator" + author: "H. P. Lovecraft" + } + } + } + } + Component { + id: calendarComponent + Item { + enabled: !settingsData.allDisabled + Calendar { + anchors.centerIn: parent + weekNumbersVisible: true + frameVisible: settingsData.frames + } + } + } + Component { + id: textAreaComponent + TextArea { + enabled: !settingsData.allDisabled + frameVisible: false + flickableItem.flickableDirection: Flickable.VerticalFlick + text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum quis justo a sem faucibus mattis nec vitae nisi. Fusce fringilla nulla a tellus vehicula sodales. Etiam volutpat suscipit erat vitae adipiscing. Sed vestibulum massa nisl, eget posuere urna porta ac. Morbi at nunc ligula. Cras et mauris aliquet ligula sodales suscipit eget imperdiet augue. Ut eget dui eu magna malesuada imperdiet. Donec imperdiet urna eu consequat ornare. Cras at metus tristique, ullamcorper nisl ut, faucibus mauris. Fusce in euismod arcu. Donec tristique rutrum porta. Praesent mattis ac tortor quis scelerisque. Integer luctus nulla ut lacinia tempus." + } + } + Component { + id: pieMenuComponent + Item { + enabled: !settingsData.allDisabled + + Column { + anchors.fill: parent + anchors.bottom: parent.bottom + anchors.bottomMargin: controlData.textMargins + spacing: Math.round(controlData.textMargins * 0.5) + + Image { + id: pieMenuImage + source: "qrc:/images/piemenu-image-rgb.jpg" + fillMode: Image.PreserveAspectFit + width: parent.width + height: Math.min((width / sourceSize.width) * sourceSize.height, (parent.height - parent.spacing) * 0.88) + } + Item { + width: parent.width + height: parent.height - pieMenuImage.height - parent.spacing + + Text { + id: instructionText + anchors.fill: parent + anchors.leftMargin: controlData.textMargins + anchors.rightMargin: controlData.textMargins + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: "Tap and hold to open menu" + font.family: Flat.FlatStyle.fontFamily + font.pixelSize: Math.round(20 * Flat.FlatStyle.scaleFactor) + fontSizeMode: Text.Fit + color: Flat.FlatStyle.lightFrameColor + } + } + } + MouseArea { + id: mouseArea + anchors.fill: parent + onPressAndHold: pieMenu.popup(mouse.x, mouse.y) + } + PieMenu { + id: pieMenu + triggerMode: TriggerMode.TriggerOnClick + + MenuItem { + iconSource: "qrc:/images/piemenu-rgb-" + (pieMenu.currentIndex === 0 ? "pressed" : "normal") + ".png" + onTriggered: pieMenuImage.source = "qrc:/images/piemenu-image-rgb.jpg" + } + MenuItem { + iconSource: "qrc:/images/piemenu-bw-" + (pieMenu.currentIndex === 1 ? "pressed" : "normal") + ".png" + onTriggered: pieMenuImage.source = "qrc:/images/piemenu-image-bw.jpg" + } + MenuItem { + iconSource: "qrc:/images/piemenu-sepia-" + (pieMenu.currentIndex === 2 ? "pressed" : "normal") + ".png" + onTriggered: pieMenuImage.source = "qrc:/images/piemenu-image-sepia.jpg" + } + } + } + } + Component { + id: delayButtonComponent + Item { + enabled: !settingsData.allDisabled + DelayButton { + text: progress < 1 ? "START" : "STOP" + anchors.centerIn: parent + } + } + } + Component { + id: dialComponent + Item { + enabled: !settingsData.allDisabled + Dial { + anchors.centerIn: parent + } + } + } + Component { + id: tumblerComponent + Item { + enabled: !settingsData.allDisabled + Tumbler { + anchors.centerIn: parent + TumblerColumn { + model: { + var hours = []; + for (var i = 1; i <= 24; ++i) + hours.push(i < 10 ? "0" + i : i); + hours; + } + } + TumblerColumn { + model: { + var minutes = []; + for (var i = 0; i < 60; ++i) + minutes.push(i < 10 ? "0" + i : i); + minutes; + } + } + } + } + } +} diff --git a/examples/quickcontrols/extras/flat/SettingsIcon.qml b/examples/quickcontrols/extras/flat/SettingsIcon.qml new file mode 100644 index 000000000..e494e5370 --- /dev/null +++ b/examples/quickcontrols/extras/flat/SettingsIcon.qml @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.4 + +Canvas { + onPaint: { + var ctx = getContext("2d"); + ctx.reset(); + + ctx.scale(width, height); + + ctx.beginPath(); + ctx.moveTo(0.706,0.542); + ctx.bezierCurveTo(0.709,0.527,0.711,0.512,0.711,0.49700000000000005); + ctx.bezierCurveTo(0.711,0.4820000000000001,0.709,0.465,0.706,0.451); + ctx.lineTo(0.752,0.41600000000000004); + ctx.lineTo(0.759,0.41); + ctx.lineTo(0.756,0.4); + ctx.bezierCurveTo(0.756,0.399,0.749,0.382,0.737,0.36200000000000004); + ctx.bezierCurveTo(0.725,0.3420000000000001,0.714,0.328,0.714,0.327); + ctx.lineTo(0.708,0.319); + ctx.lineTo(0.698,0.324); + ctx.lineTo(0.645,0.346); + ctx.bezierCurveTo(0.623,0.32499999999999996,0.595,0.309,0.5650000000000001,0.3); + ctx.lineTo(0.558,0.243); + ctx.lineTo(0.557,0.23299999999999998); + ctx.lineTo(0.547,0.23099999999999998); + ctx.bezierCurveTo(0.546,0.23099999999999998,0.528,0.22799999999999998,0.505,0.22799999999999998); + ctx.bezierCurveTo(0.481,0.22799999999999998,0.463,0.23099999999999998,0.463,0.23099999999999998); + ctx.lineTo(0.453,0.23299999999999998); + ctx.lineTo(0.452,0.243); + ctx.lineTo(0.444,0.299); + ctx.bezierCurveTo(0.41400000000000003,0.308,0.387,0.324,0.364,0.345); + ctx.lineTo(0.312,0.323); + ctx.lineTo(0.302,0.319); + ctx.lineTo(0.296,0.327); + ctx.bezierCurveTo(0.296,0.327,0.284,0.342,0.27299999999999996,0.362); + ctx.bezierCurveTo(0.26,0.383,0.254,0.399,0.254,0.4); + ctx.lineTo(0.25,0.41); + ctx.lineTo(0.258,0.416); + ctx.lineTo(0.303,0.45099999999999996); + ctx.bezierCurveTo(0.3,0.465,0.299,0.48,0.299,0.497); + ctx.bezierCurveTo(0.299,0.513,0.3,0.528,0.304,0.543); + ctx.lineTo(0.259,0.577); + ctx.lineTo(0.25,0.584); + ctx.lineTo(0.254,0.593); + ctx.bezierCurveTo(0.254,0.594,0.261,0.61,0.273,0.63); + ctx.bezierCurveTo(0.28500000000000003,0.65,0.29500000000000004,0.664,0.29600000000000004,0.665); + ctx.lineTo(0.30200000000000005,0.673); + ctx.lineTo(0.31200000000000006,0.669); + ctx.lineTo(0.36500000000000005,0.647); + ctx.bezierCurveTo(0.38700000000000007,0.668,0.41400000000000003,0.684,0.44400000000000006,0.6930000000000001); + ctx.lineTo(0.45200000000000007,0.7510000000000001); + ctx.lineTo(0.45300000000000007,0.7620000000000001); + ctx.lineTo(0.4640000000000001,0.7630000000000001); + ctx.bezierCurveTo(0.4640000000000001,0.7630000000000001,0.4820000000000001,0.7640000000000001,0.5060000000000001,0.7640000000000001); + ctx.bezierCurveTo(0.5300000000000001,0.7640000000000001,0.5470000000000002,0.7620000000000001,0.5480000000000002,0.7620000000000001); + ctx.lineTo(0.5580000000000002,0.7610000000000001); + ctx.lineTo(0.5590000000000002,0.7510000000000001); + ctx.lineTo(0.5660000000000002,0.6940000000000001); + ctx.bezierCurveTo(0.5960000000000002,0.685,0.6230000000000002,0.669,0.6460000000000001,0.648); + ctx.lineTo(0.6990000000000002,0.67); + ctx.lineTo(0.7090000000000002,0.674); + ctx.lineTo(0.7150000000000002,0.665); + ctx.bezierCurveTo(0.7150000000000002,0.665,0.7260000000000002,0.65,0.7370000000000002,0.63); + ctx.bezierCurveTo(0.7490000000000002,0.61,0.7560000000000002,0.594,0.7560000000000002,0.593); + ctx.lineTo(0.7600000000000002,0.584); + ctx.lineTo(0.751,0.577); + ctx.lineTo(0.706,0.542); + ctx.closePath(); + ctx.moveTo(0.505,0.622); + ctx.bezierCurveTo(0.436,0.622,0.38,0.566,0.38,0.497); + ctx.bezierCurveTo(0.38,0.428,0.436,0.372,0.505,0.372); + ctx.bezierCurveTo(0.5740000000000001,0.372,0.63,0.428,0.63,0.497); + ctx.bezierCurveTo(0.63,0.565,0.574,0.622,0.505,0.622); + ctx.closePath(); + ctx.fillStyle = "#333333"; + ctx.fill(); + } +} diff --git a/examples/quickcontrols/extras/flat/flat.pro b/examples/quickcontrols/extras/flat/flat.pro new file mode 100644 index 000000000..6a6906648 --- /dev/null +++ b/examples/quickcontrols/extras/flat/flat.pro @@ -0,0 +1,19 @@ +TEMPLATE = app +TARGET = flat +QT += quick + +SOURCES += \ + main.cpp + +RESOURCES += \ + flat.qrc + +OTHER_FILES += \ + main.qml + +DISTFILES += \ + Content.qml \ + SettingsIcon.qml + +target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/extras/flat +INSTALLS += target diff --git a/examples/quickcontrols/extras/flat/flat.qrc b/examples/quickcontrols/extras/flat/flat.qrc new file mode 100644 index 000000000..5b06a55ce --- /dev/null +++ b/examples/quickcontrols/extras/flat/flat.qrc @@ -0,0 +1,16 @@ + + + main.qml + images/piemenu-bw-normal.png + images/piemenu-bw-pressed.png + images/piemenu-rgb-normal.png + images/piemenu-rgb-pressed.png + images/piemenu-sepia-normal.png + images/piemenu-sepia-pressed.png + images/piemenu-image-bw.jpg + images/piemenu-image-rgb.jpg + images/piemenu-image-sepia.jpg + Content.qml + SettingsIcon.qml + + diff --git a/examples/quickcontrols/extras/flat/images/piemenu-bw-normal.png b/examples/quickcontrols/extras/flat/images/piemenu-bw-normal.png new file mode 100644 index 000000000..ef57111fb Binary files /dev/null and b/examples/quickcontrols/extras/flat/images/piemenu-bw-normal.png differ diff --git a/examples/quickcontrols/extras/flat/images/piemenu-bw-pressed.png b/examples/quickcontrols/extras/flat/images/piemenu-bw-pressed.png new file mode 100644 index 000000000..b6bd1d20d Binary files /dev/null and b/examples/quickcontrols/extras/flat/images/piemenu-bw-pressed.png differ diff --git a/examples/quickcontrols/extras/flat/images/piemenu-image-bw.jpg b/examples/quickcontrols/extras/flat/images/piemenu-image-bw.jpg new file mode 100644 index 000000000..ce4d8ffda Binary files /dev/null and b/examples/quickcontrols/extras/flat/images/piemenu-image-bw.jpg differ diff --git a/examples/quickcontrols/extras/flat/images/piemenu-image-rgb.jpg b/examples/quickcontrols/extras/flat/images/piemenu-image-rgb.jpg new file mode 100644 index 000000000..2d7d22056 Binary files /dev/null and b/examples/quickcontrols/extras/flat/images/piemenu-image-rgb.jpg differ diff --git a/examples/quickcontrols/extras/flat/images/piemenu-image-sepia.jpg b/examples/quickcontrols/extras/flat/images/piemenu-image-sepia.jpg new file mode 100644 index 000000000..3ef7b1f0f Binary files /dev/null and b/examples/quickcontrols/extras/flat/images/piemenu-image-sepia.jpg differ diff --git a/examples/quickcontrols/extras/flat/images/piemenu-rgb-normal.png b/examples/quickcontrols/extras/flat/images/piemenu-rgb-normal.png new file mode 100644 index 000000000..2278f4a9e Binary files /dev/null and b/examples/quickcontrols/extras/flat/images/piemenu-rgb-normal.png differ diff --git a/examples/quickcontrols/extras/flat/images/piemenu-rgb-pressed.png b/examples/quickcontrols/extras/flat/images/piemenu-rgb-pressed.png new file mode 100644 index 000000000..f45846b17 Binary files /dev/null and b/examples/quickcontrols/extras/flat/images/piemenu-rgb-pressed.png differ diff --git a/examples/quickcontrols/extras/flat/images/piemenu-sepia-normal.png b/examples/quickcontrols/extras/flat/images/piemenu-sepia-normal.png new file mode 100644 index 000000000..f1e9ffd26 Binary files /dev/null and b/examples/quickcontrols/extras/flat/images/piemenu-sepia-normal.png differ diff --git a/examples/quickcontrols/extras/flat/images/piemenu-sepia-pressed.png b/examples/quickcontrols/extras/flat/images/piemenu-sepia-pressed.png new file mode 100644 index 000000000..0f2b35171 Binary files /dev/null and b/examples/quickcontrols/extras/flat/images/piemenu-sepia-pressed.png differ diff --git a/examples/quickcontrols/extras/flat/main.cpp b/examples/quickcontrols/extras/flat/main.cpp new file mode 100644 index 000000000..57f48cda2 --- /dev/null +++ b/examples/quickcontrols/extras/flat/main.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 +#include +#include + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + if (qgetenv("QT_QUICK_CONTROLS_STYLE").isEmpty()) { +#ifdef QT_STATIC + // Need a full path to find the style when built statically + qputenv("QT_QUICK_CONTROLS_STYLE", ":/ExtrasImports/QtQuick/Controls/Styles/Flat"); +#else + qputenv("QT_QUICK_CONTROLS_STYLE", "Flat"); +#endif + } + QQmlApplicationEngine engine; + engine.load(QUrl("qrc:/main.qml")); + if (engine.rootObjects().isEmpty()) + return -1; + return app.exec(); +} diff --git a/examples/quickcontrols/extras/flat/main.qml b/examples/quickcontrols/extras/flat/main.qml new file mode 100644 index 000000000..aec94c368 --- /dev/null +++ b/examples/quickcontrols/extras/flat/main.qml @@ -0,0 +1,479 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.4 +import QtQuick.Layouts 1.0 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles.Flat 1.0 as Flat +import QtQuick.Extras 1.4 +import QtQuick.Extras.Private 1.0 + +ApplicationWindow { + id: window + width: 480 + height: 860 + title: "Flat Example" + visible: true + + readonly property bool contentLoaded: contentLoader.item + readonly property alias anchorItem: controlsMenu + property int currentMenu: -1 + readonly property int textMargins: Math.round(32 * Flat.FlatStyle.scaleFactor) + readonly property int menuMargins: Math.round(13 * Flat.FlatStyle.scaleFactor) + readonly property int menuWidth: Math.min(window.width, window.height) * 0.75 + + onCurrentMenuChanged: { + xBehavior.enabled = true; + anchorCurrentMenu(); + } + + onMenuWidthChanged: anchorCurrentMenu() + + function anchorCurrentMenu() { + switch (currentMenu) { + case -1: + anchorItem.x = -menuWidth; + break; + case 0: + anchorItem.x = 0; + break; + case 1: + anchorItem.x = -menuWidth * 2; + break; + } + } + + Item { + id: container + anchors.fill: parent + + Item { + id: loadingScreen + anchors.fill: parent + visible: !contentLoaded + + Timer { + running: true + interval: 100 + // TODO: Find a way to know when the loading screen has been rendered instead + // of using an abritrary amount of time. + onTriggered: contentLoader.sourceComponent = Qt.createComponent("Content.qml") + } + + Column { + anchors.centerIn: parent + spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) + + BusyIndicator { + anchors.horizontalCenter: parent.horizontalCenter + } + + Label { + text: "Loading Light Flat UI..." + width: Math.min(loadingScreen.width, loadingScreen.height) * 0.8 + height: font.pixelSize + anchors.horizontalCenter: parent.horizontalCenter + renderType: Text.QtRendering + font.pixelSize: Math.round(26 * Flat.FlatStyle.scaleFactor) + horizontalAlignment: Text.AlignHCenter + fontSizeMode: Text.Fit + font.family: Flat.FlatStyle.fontFamily + font.weight: Font.Light + } + } + } + + Rectangle { + id: controlsMenu + x: container.x - width + z: contentContainer.z + 1 + width: menuWidth + height: parent.height + + // Don't let the menus become visible when resizing the window + Binding { + target: controlsMenu + property: "x" + value: container.x - controlsMenu.width + when: !xBehavior.enabled && !xNumberAnimation.running && currentMenu == -1 + } + + Behavior on x { + id: xBehavior + enabled: false + NumberAnimation { + id: xNumberAnimation + easing.type: Easing.OutExpo + duration: 500 + onRunningChanged: xBehavior.enabled = false + } + } + + Rectangle { + id: controlsTitleBar + width: parent.width + height: toolBar.height + color: Flat.FlatStyle.defaultTextColor + + Label { + text: "Controls" + font.family: Flat.FlatStyle.fontFamily + font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor) + renderType: Text.QtRendering + color: "white" + anchors.left: parent.left + anchors.leftMargin: menuMargins + anchors.verticalCenter: parent.verticalCenter + } + } + + ListView { + id: controlView + width: parent.width + anchors.top: controlsTitleBar.bottom + anchors.bottom: parent.bottom + clip: true + currentIndex: 0 + model: contentLoaded ? contentLoader.item.componentModel : null + delegate: MouseArea { + id: delegateItem + width: parent.width + height: 64 * Flat.FlatStyle.scaleFactor + onClicked: { + if (controlView.currentIndex != index) + controlView.currentIndex = index; + + currentMenu = -1; + } + + Rectangle { + width: parent.width + height: Flat.FlatStyle.onePixel + anchors.bottom: parent.bottom + color: Flat.FlatStyle.lightFrameColor + } + + Label { + text: delegateItem.ListView.view.model[index].name + font.pixelSize: Math.round(15 * Flat.FlatStyle.scaleFactor) + font.family: Flat.FlatStyle.fontFamily + renderType: Text.QtRendering + color: delegateItem.ListView.isCurrentItem ? Flat.FlatStyle.styleColor : Flat.FlatStyle.defaultTextColor + anchors.left: parent.left + anchors.leftMargin: menuMargins + anchors.verticalCenter: parent.verticalCenter + } + } + + Rectangle { + width: parent.height + height: 8 * Flat.FlatStyle.scaleFactor + rotation: 90 + anchors.left: parent.right + transformOrigin: Item.TopLeft + + gradient: Gradient { + GradientStop { + color: Qt.rgba(0, 0, 0, 0.15) + position: 0 + } + GradientStop { + color: Qt.rgba(0, 0, 0, 0.05) + position: 0.5 + } + GradientStop { + color: Qt.rgba(0, 0, 0, 0) + position: 1 + } + } + } + } + } + + Item { + id: contentContainer + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.left: controlsMenu.right + width: parent.width + + ToolBar { + id: toolBar + visible: !loadingScreen.visible + width: parent.width + height: 54 * Flat.FlatStyle.scaleFactor + z: contentLoader.z + 1 + style: Flat.ToolBarStyle { + padding.left: 0 + padding.right: 0 + } + + RowLayout { + anchors.fill: parent + + MouseArea { + id: controlsButton + Layout.preferredWidth: toolBar.height + textMargins + Layout.preferredHeight: toolBar.height + onClicked: currentMenu = currentMenu == 0 ? -1 : 0 + + Column { + id: controlsIcon + anchors.left: parent.left + anchors.leftMargin: textMargins + anchors.verticalCenter: parent.verticalCenter + spacing: Math.round(2 * Flat.FlatStyle.scaleFactor) + + Repeater { + model: 3 + + Rectangle { + width: Math.round(4 * Flat.FlatStyle.scaleFactor) + height: width + radius: width / 2 + color: Flat.FlatStyle.defaultTextColor + } + } + } + } + + Text { + text: "Light Flat UI Demo" + font.family: Flat.FlatStyle.fontFamily + font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor) + horizontalAlignment: Text.AlignHCenter + color: "#666666" + Layout.fillWidth: true + } + + MouseArea { + id: settingsButton + Layout.preferredWidth: controlsButton.Layout.preferredWidth + Layout.preferredHeight: controlsButton.Layout.preferredHeight + onClicked: currentMenu = currentMenu == 1 ? -1 : 1 + + SettingsIcon { + width: Math.round(32 * Flat.FlatStyle.scaleFactor) + height: Math.round(32 * Flat.FlatStyle.scaleFactor) + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: textMargins - Math.round(8 * Flat.FlatStyle.scaleFactor) + } + } + } + } + + Loader { + id: contentLoader + anchors.left: parent.left + anchors.right: parent.right + anchors.top: toolBar.bottom + anchors.bottom: parent.bottom + + property QtObject settingsData: QtObject { + readonly property bool checks: disableSingleItemsAction.checked + readonly property bool frames: !greyBackgroundAction.checked + readonly property bool allDisabled: disableAllAction.checked + } + property QtObject controlData: QtObject { + readonly property int componentIndex: controlView.currentIndex + readonly property int textMargins: window.textMargins + } + + MouseArea { + enabled: currentMenu != -1 + // We would be able to just set this to true here, if it weren't for QTBUG-43083. + hoverEnabled: enabled + anchors.fill: parent + preventStealing: true + onClicked: currentMenu = -1 + focus: enabled + z: 1000 + } + } + } + + Rectangle { + id: settingsMenu + z: contentContainer.z + 1 + width: menuWidth + height: parent.height + anchors.left: contentContainer.right + + Rectangle { + id: optionsTitleBar + width: parent.width + height: toolBar.height + color: Flat.FlatStyle.defaultTextColor + + Label { + text: "Options" + font.family: Flat.FlatStyle.fontFamily + font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor) + renderType: Text.QtRendering + color: "white" + anchors.left: parent.left + anchors.leftMargin: menuMargins + anchors.verticalCenter: parent.verticalCenter + } + } + + Action { + id: disableAllAction + checkable: true + checked: false + } + + Action { + id: disableSingleItemsAction + checkable: true + checked: false + } + + Action { + id: greyBackgroundAction + checkable: true + checked: false + } + + ListView { + id: optionsListView + width: parent.width + anchors.top: optionsTitleBar.bottom + anchors.bottom: parent.bottom + clip: true + interactive: delegateHeight * count > height + + readonly property int delegateHeight: 64 * Flat.FlatStyle.scaleFactor + + model: [ + { name: "Disable all", action: disableAllAction }, + { name: "Disable single items", action: disableSingleItemsAction }, + { name: "Grey background", action: greyBackgroundAction }, + { name: "Exit", action: null } + ] + delegate: Rectangle { + id: optionDelegateItem + width: parent.width + height: optionsListView.delegateHeight + + Rectangle { + width: parent.width + height: Flat.FlatStyle.onePixel + anchors.bottom: parent.bottom + color: Flat.FlatStyle.lightFrameColor + } + + Loader { + sourceComponent: optionText !== "Exit" + ? optionsListView.checkBoxComponent : optionsListView.exitComponent + anchors.fill: parent + anchors.leftMargin: menuMargins + + property string optionText: optionsListView.model[index].name + property int optionIndex: index + } + } + + property Component checkBoxComponent: Item { + Label { + text: optionText + font.family: Flat.FlatStyle.fontFamily + font.pixelSize: Math.round(15 * Flat.FlatStyle.scaleFactor) + fontSizeMode: Text.Fit + renderType: Text.QtRendering + verticalAlignment: Text.AlignVCenter + color: Flat.FlatStyle.defaultTextColor + height: parent.height + anchors.left: parent.left + anchors.right: checkBox.left + anchors.rightMargin: Flat.FlatStyle.twoPixels + } + + CheckBox { + id: checkBox + checked: optionsListView.model[optionIndex].action.checked + anchors.right: parent.right + anchors.rightMargin: menuMargins + anchors.verticalCenter: parent.verticalCenter + onCheckedChanged: optionsListView.model[optionIndex].action.checked = checkBox.checked + } + } + + property Component exitComponent: MouseArea { + anchors.fill: parent + onClicked: Qt.quit() + + Label { + text: optionText + font.family: Flat.FlatStyle.fontFamily + font.pixelSize: Math.round(15 * Flat.FlatStyle.scaleFactor) + renderType: Text.QtRendering + color: Flat.FlatStyle.defaultTextColor + anchors.verticalCenter: parent.verticalCenter + } + } + + Rectangle { + width: parent.height + height: 8 * Flat.FlatStyle.scaleFactor + rotation: -90 + anchors.right: parent.left + transformOrigin: Item.TopRight + + gradient: Gradient { + GradientStop { + color: Qt.rgba(0, 0, 0, 0.15) + position: 0 + } + GradientStop { + color: Qt.rgba(0, 0, 0, 0.05) + position: 0.5 + } + GradientStop { + color: Qt.rgba(0, 0, 0, 0) + position: 1 + } + } + } + } + } + } +} diff --git a/examples/quickcontrols/extras/gallery/fonts/LICENSE.txt b/examples/quickcontrols/extras/gallery/fonts/LICENSE.txt new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/examples/quickcontrols/extras/gallery/fonts/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/examples/quickcontrols/extras/gallery/fonts/OpenSans-Regular.ttf b/examples/quickcontrols/extras/gallery/fonts/OpenSans-Regular.ttf new file mode 100644 index 000000000..db433349b Binary files /dev/null and b/examples/quickcontrols/extras/gallery/fonts/OpenSans-Regular.ttf differ diff --git a/examples/quickcontrols/extras/gallery/gallery.pro b/examples/quickcontrols/extras/gallery/gallery.pro new file mode 100644 index 000000000..548df63f4 --- /dev/null +++ b/examples/quickcontrols/extras/gallery/gallery.pro @@ -0,0 +1,34 @@ +TEMPLATE = app +TARGET = gallery +INCLUDEPATH += . +QT += quick + +SOURCES += \ + main.cpp + +RESOURCES += \ + gallery.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols/extras/gallery +INSTALLS += target + +OTHER_FILES += \ + qml/BlackButtonBackground.qml \ + qml/BlackButtonStyle.qml \ + qml/CircularGaugeDarkStyle.qml \ + qml/CircularGaugeDefaultStyle.qml \ + qml/CircularGaugeLightStyle.qml \ + qml/CircularGaugeView.qml \ + qml/ControlLabel.qml \ + qml/ControlView.qml \ + qml/ControlViewToolBar.qml \ + qml/CustomizerSwitch.qml \ + qml/CustomizerLabel.qml \ + qml/CustomizerSlider.qml \ + qml/FlickableMoreIndicator.qml \ + qml/gallery.qml \ + qml/PieMenuControlView.qml \ + qml/PieMenuDefaultStyle.qml \ + qml/PieMenuDarkStyle.qml \ + qml/StylePicker.qml \ + gallery.qrc diff --git a/examples/quickcontrols/extras/gallery/gallery.qrc b/examples/quickcontrols/extras/gallery/gallery.qrc new file mode 100644 index 000000000..97beb6b1b --- /dev/null +++ b/examples/quickcontrols/extras/gallery/gallery.qrc @@ -0,0 +1,36 @@ + + + fonts/OpenSans-Regular.ttf + images/background-light.png + images/background.png + images/center-light.png + images/center.png + images/icon-go.png + images/icon-settings.png + images/info.png + images/needle-light.png + images/needle.png + images/qt-logo.png + images/zoom_in.png + images/zoom_out.png + qml/BlackButtonBackground.qml + qml/BlackButtonStyle.qml + qml/CircularGaugeDarkStyle.qml + qml/CircularGaugeDefaultStyle.qml + qml/CircularGaugeLightStyle.qml + qml/CircularGaugeView.qml + qml/ControlView.qml + qml/ControlViewToolbar.qml + qml/CustomizerSwitch.qml + qml/CustomizerLabel.qml + qml/CustomizerSlider.qml + qml/FlickableMoreIndicator.qml + qml/gallery.qml + qml/PieMenuControlView.qml + qml/StylePicker.qml + qml/PieMenuDarkStyle.qml + qml/PieMenuDefaultStyle.qml + qml/ControlLabel.qml + images/icon-back.png + + diff --git a/examples/quickcontrols/extras/gallery/images/background-light.png b/examples/quickcontrols/extras/gallery/images/background-light.png new file mode 100644 index 000000000..2f7698452 Binary files /dev/null and b/examples/quickcontrols/extras/gallery/images/background-light.png differ diff --git a/examples/quickcontrols/extras/gallery/images/background.png b/examples/quickcontrols/extras/gallery/images/background.png new file mode 100644 index 000000000..a3f4302bc Binary files /dev/null and b/examples/quickcontrols/extras/gallery/images/background.png differ diff --git a/examples/quickcontrols/extras/gallery/images/center-light.png b/examples/quickcontrols/extras/gallery/images/center-light.png new file mode 100644 index 000000000..75add20ce Binary files /dev/null and b/examples/quickcontrols/extras/gallery/images/center-light.png differ diff --git a/examples/quickcontrols/extras/gallery/images/center.png b/examples/quickcontrols/extras/gallery/images/center.png new file mode 100644 index 000000000..fd3696404 Binary files /dev/null and b/examples/quickcontrols/extras/gallery/images/center.png differ diff --git a/examples/quickcontrols/extras/gallery/images/icon-back.png b/examples/quickcontrols/extras/gallery/images/icon-back.png new file mode 100644 index 000000000..0b037ff69 Binary files /dev/null and b/examples/quickcontrols/extras/gallery/images/icon-back.png differ diff --git a/examples/quickcontrols/extras/gallery/images/icon-go.png b/examples/quickcontrols/extras/gallery/images/icon-go.png new file mode 100644 index 000000000..bcb2a822a Binary files /dev/null and b/examples/quickcontrols/extras/gallery/images/icon-go.png differ diff --git a/examples/quickcontrols/extras/gallery/images/icon-settings.png b/examples/quickcontrols/extras/gallery/images/icon-settings.png new file mode 100644 index 000000000..7763ba20e Binary files /dev/null and b/examples/quickcontrols/extras/gallery/images/icon-settings.png differ diff --git a/examples/quickcontrols/extras/gallery/images/info.png b/examples/quickcontrols/extras/gallery/images/info.png new file mode 100644 index 000000000..5c7a9df3c Binary files /dev/null and b/examples/quickcontrols/extras/gallery/images/info.png differ diff --git a/examples/quickcontrols/extras/gallery/images/needle-light.png b/examples/quickcontrols/extras/gallery/images/needle-light.png new file mode 100644 index 000000000..d486d9e53 Binary files /dev/null and b/examples/quickcontrols/extras/gallery/images/needle-light.png differ diff --git a/examples/quickcontrols/extras/gallery/images/needle.png b/examples/quickcontrols/extras/gallery/images/needle.png new file mode 100644 index 000000000..6b10c604a Binary files /dev/null and b/examples/quickcontrols/extras/gallery/images/needle.png differ diff --git a/examples/quickcontrols/extras/gallery/images/qt-logo.png b/examples/quickcontrols/extras/gallery/images/qt-logo.png new file mode 100644 index 000000000..14ddf2a02 Binary files /dev/null and b/examples/quickcontrols/extras/gallery/images/qt-logo.png differ diff --git a/examples/quickcontrols/extras/gallery/images/zoom_in.png b/examples/quickcontrols/extras/gallery/images/zoom_in.png new file mode 100644 index 000000000..412821064 Binary files /dev/null and b/examples/quickcontrols/extras/gallery/images/zoom_in.png differ diff --git a/examples/quickcontrols/extras/gallery/images/zoom_out.png b/examples/quickcontrols/extras/gallery/images/zoom_out.png new file mode 100644 index 000000000..772d6ac17 Binary files /dev/null and b/examples/quickcontrols/extras/gallery/images/zoom_out.png differ diff --git a/examples/quickcontrols/extras/gallery/main.cpp b/examples/quickcontrols/extras/gallery/main.cpp new file mode 100644 index 000000000..1d5d23139 --- /dev/null +++ b/examples/quickcontrols/extras/gallery/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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 + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + QQmlApplicationEngine engine(QUrl("qrc:/qml/gallery.qml")); + if (engine.rootObjects().isEmpty()) + return -1; + return app.exec(); +} diff --git a/examples/quickcontrols/extras/gallery/qml/BlackButtonBackground.qml b/examples/quickcontrols/extras/gallery/qml/BlackButtonBackground.qml new file mode 100644 index 000000000..94852f38c --- /dev/null +++ b/examples/quickcontrols/extras/gallery/qml/BlackButtonBackground.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 + +Rectangle { + property bool pressed: false + + gradient: Gradient { + GradientStop { + color: pressed ? "#222" : "#333" + position: 0 + } + GradientStop { + color: "#222" + position: 1 + } + } + Rectangle { + height: 1 + width: parent.width + anchors.top: parent.top + color: "#444" + visible: !pressed + } + Rectangle { + height: 1 + width: parent.width + anchors.bottom: parent.bottom + color: "#000" + } +} diff --git a/examples/quickcontrols/extras/gallery/qml/BlackButtonStyle.qml b/examples/quickcontrols/extras/gallery/qml/BlackButtonStyle.qml new file mode 100644 index 000000000..e3e60d88b --- /dev/null +++ b/examples/quickcontrols/extras/gallery/qml/BlackButtonStyle.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 + +ButtonStyle { + property color fontColor + + property url rightAlignedIconSource + + background: BlackButtonBackground { + pressed: control.pressed + } + label: Item { + implicitWidth: row.implicitWidth + implicitHeight: row.implicitHeight + baselineOffset: row.y + text.y + text.baselineOffset + + Row { + id: row + anchors.left: control.text.length === 0 ? undefined : parent.left + anchors.leftMargin: control.text.length === 0 ? 0 : textSingleton.implicitHeight + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: control.text.length === 0 ? parent.horizontalCenter : undefined + + Image { + source: control.iconSource + width: Math.min(sourceSize.width, height) + height: text.implicitHeight + fillMode: Image.PreserveAspectFit + } + Text { + id: text + text: control.text + color: fontColor + font.pixelSize: control.height * 0.25 + font.family: openSans.name + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + anchors.verticalCenter: parent.verticalCenter + } + } + + Loader { + active: rightAlignedIconSource.toString().length !== 0 + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: textSingleton.implicitHeight + + sourceComponent: Image { + width: Math.min(sourceSize.width, height) + height: text.implicitHeight + fillMode: Image.PreserveAspectFit + source: rightAlignedIconSource + } + } + } +} diff --git a/examples/quickcontrols/extras/gallery/qml/CircularGaugeDarkStyle.qml b/examples/quickcontrols/extras/gallery/qml/CircularGaugeDarkStyle.qml new file mode 100644 index 000000000..9993a97a6 --- /dev/null +++ b/examples/quickcontrols/extras/gallery/qml/CircularGaugeDarkStyle.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls.Styles 1.4 + +CircularGaugeStyle { + id: root + tickmarkStepSize: 10 + minorTickmarkCount: 1 + labelStepSize: 20 + tickmarkInset: outerRadius * 0.06 + minorTickmarkInset: tickmarkInset + labelInset: outerRadius * 0.23 + + background: Image { + source: "qrc:/images/background.png" + } + + needle: Image { + id: needleImage + transformOrigin: Item.Bottom + source: "qrc:/images/needle.png" + scale: { + var distanceFromLabelToRadius = labelInset / 2; + var idealHeight = outerRadius - distanceFromLabelToRadius; + var originalImageHeight = needleImage.sourceSize.height; + idealHeight / originalImageHeight; + } + } + + foreground: Item { + Image { + anchors.centerIn: parent + source: "qrc:/images/center.png" + scale: (outerRadius * 0.25) / sourceSize.height + } + } + + tickmark: Rectangle { + implicitWidth: outerRadius * 0.02 + antialiasing: true + implicitHeight: outerRadius * 0.05 + color: "#888" + } + + minorTickmark: Rectangle { + implicitWidth: outerRadius * 0.01 + antialiasing: true + implicitHeight: outerRadius * 0.02 + color: "#444" + } + + tickmarkLabel: Text { + font.pixelSize: Math.max(6, outerRadius * 0.1) + text: styleData.value + color: "white" + } +} diff --git a/examples/quickcontrols/extras/gallery/qml/CircularGaugeDefaultStyle.qml b/examples/quickcontrols/extras/gallery/qml/CircularGaugeDefaultStyle.qml new file mode 100644 index 000000000..b7f1b2412 --- /dev/null +++ b/examples/quickcontrols/extras/gallery/qml/CircularGaugeDefaultStyle.qml @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls.Styles 1.4 + +CircularGaugeStyle { + labelStepSize: 20 +} diff --git a/examples/quickcontrols/extras/gallery/qml/CircularGaugeLightStyle.qml b/examples/quickcontrols/extras/gallery/qml/CircularGaugeLightStyle.qml new file mode 100644 index 000000000..8e1f34ea7 --- /dev/null +++ b/examples/quickcontrols/extras/gallery/qml/CircularGaugeLightStyle.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls.Styles 1.4 + +CircularGaugeStyle { + id: root + tickmarkStepSize: 10 + minorTickmarkCount: 2 + labelStepSize: 40 + tickmarkInset: outerRadius * 0.06 + minorTickmarkInset: tickmarkInset + labelInset: outerRadius * 0.23 + + background: Image { + source: "qrc:/images/background-light.png" + } + + needle: Image { + id: needleImage + source: "qrc:/images/needle-light.png" + transformOrigin: Item.Bottom + scale: { + var distanceFromLabelToRadius = labelInset / 2; + var idealHeight = outerRadius - distanceFromLabelToRadius; + var originalImageHeight = needleImage.sourceSize.height; + idealHeight / originalImageHeight; + } + } + + foreground: Item { + Image { + anchors.centerIn: parent + source: "qrc:/images/center-light.png" + scale: (outerRadius * 0.25) / sourceSize.height + } + } + + tickmark: Rectangle { + implicitWidth: outerRadius * 0.01 + antialiasing: true + implicitHeight: outerRadius * 0.04 + color: "#999" + } + + minorTickmark: Rectangle { + implicitWidth: outerRadius * 0.01 + antialiasing: true + implicitHeight: outerRadius * 0.02 + color: "#bbb" + } + + tickmarkLabel: Text { + font.family: "Helvetica neue" + font.pixelSize: Math.max(6, outerRadius * 0.1) + text: styleData.value + color: "#333" + } +} diff --git a/examples/quickcontrols/extras/gallery/qml/CircularGaugeView.qml b/examples/quickcontrols/extras/gallery/qml/CircularGaugeView.qml new file mode 100644 index 000000000..cd03ebbe5 --- /dev/null +++ b/examples/quickcontrols/extras/gallery/qml/CircularGaugeView.qml @@ -0,0 +1,230 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.1 +import QtQuick.Extras 1.4 + +ControlView { + id: controlView + darkBackground: customizerItem.currentStyleDark + + property color fontColor: darkBackground ? "white" : "black" + + property bool accelerating: false + + Keys.onSpacePressed: accelerating = true + Keys.onReleased: { + if (event.key === Qt.Key_Space) { + accelerating = false; + event.accepted = true; + } + } + + Button { + id: accelerate + text: "Accelerate" + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + height: root.height * 0.125 + + onPressedChanged: accelerating = pressed + + style: BlackButtonStyle { + background: BlackButtonBackground { + pressed: control.pressed + } + label: Text { + text: control.text + color: "white" + font.pixelSize: Math.max(textSingleton.font.pixelSize, root.toPixels(0.04)) + font.family: openSans.name + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + } + } + + control: CircularGauge { + id: gauge + minimumValue: customizerItem.minimumValue + maximumValue: customizerItem.maximumValue + width: controlBounds.width + height: controlBounds.height + + value: accelerating ? maximumValue : 0 + style: styleMap[customizerItem.currentStylePath] + + // This stops the styles being recreated when a new one is chosen. + property var styleMap: { + var styles = {}; + for (var i = 0; i < customizerItem.allStylePaths.length; ++i) { + var path = customizerItem.allStylePaths[i]; + styles[path] = Qt.createComponent(path, gauge); + } + styles; + } + + // Called to update the style after the user has edited a property. + Connections { + target: customizerItem + onMinimumValueAngleChanged: __style.minimumValueAngle = customizerItem.minimumValueAngle + onMaximumValueAngleChanged: __style.maximumValueAngle = customizerItem.maximumValueAngle + onLabelStepSizeChanged: __style.tickmarkStepSize = __style.labelStepSize = customizerItem.labelStepSize + } + + Behavior on value { + NumberAnimation { + easing.type: Easing.OutCubic + duration: 6000 + } + } + } + + customizer: Column { + readonly property var allStylePaths: { + var paths = []; + for (var i = 0; i < stylePicker.model.count; ++i) { + paths.push(stylePicker.model.get(i).path); + } + paths; + } + property alias currentStylePath: stylePicker.currentStylePath + property alias currentStyleDark: stylePicker.currentStyleDark + property alias minimumValue: minimumValueSlider.value + property alias maximumValue: maximumValueSlider.value + property alias minimumValueAngle: minimumAngleSlider.value + property alias maximumValueAngle: maximumAngleSlider.value + property alias labelStepSize: labelStepSizeSlider.value + + id: circularGaugeColumn + spacing: customizerPropertySpacing + + readonly property bool isDefaultStyle: stylePicker.model.get(stylePicker.currentIndex).name === "Default" + + Item { + id: stylePickerBottomSpacing + width: parent.width + height: stylePicker.height + textSingleton.implicitHeight + + StylePicker { + id: stylePicker + currentIndex: 1 + + model: ListModel { + ListElement { + name: "Default" + path: "CircularGaugeDefaultStyle.qml" + dark: true + } + ListElement { + name: "Dark" + path: "CircularGaugeDarkStyle.qml" + dark: true + } + ListElement { + name: "Light" + path: "CircularGaugeLightStyle.qml" + dark: false + } + } + } + } + + CustomizerLabel { + text: "Minimum angle" + } + + CustomizerSlider { + id: minimumAngleSlider + minimumValue: -180 + value: -145 + maximumValue: 180 + width: parent.width + } + + CustomizerLabel { + text: "Maximum angle" + } + + CustomizerSlider { + id: maximumAngleSlider + minimumValue: -180 + value: 145 + maximumValue: 180 + } + + CustomizerLabel { + text: "Minimum value" + } + + CustomizerSlider { + id: minimumValueSlider + minimumValue: 0 + value: 0 + maximumValue: 360 + stepSize: 1 + } + + CustomizerLabel { + text: "Maximum value" + } + + CustomizerSlider { + id: maximumValueSlider + minimumValue: 0 + value: 240 + maximumValue: 300 + stepSize: 1 + } + + CustomizerLabel { + text: "Label step size" + } + + CustomizerSlider { + id: labelStepSizeSlider + minimumValue: 10 + value: 20 + maximumValue: 100 + stepSize: 20 + } + } +} diff --git a/examples/quickcontrols/extras/gallery/qml/ControlLabel.qml b/examples/quickcontrols/extras/gallery/qml/ControlLabel.qml new file mode 100644 index 000000000..6fdcec110 --- /dev/null +++ b/examples/quickcontrols/extras/gallery/qml/ControlLabel.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Extras 1.4 + +Text { + font.pixelSize: Math.max(textSingleton.font.pixelSize, Math.min(32, root.toPixels(0.045))) + color: "#4e4e4e" + styleColor: "#ffffff" + style: Text.Raised +} diff --git a/examples/quickcontrols/extras/gallery/qml/ControlView.qml b/examples/quickcontrols/extras/gallery/qml/ControlView.qml new file mode 100644 index 000000000..565ab9d90 --- /dev/null +++ b/examples/quickcontrols/extras/gallery/qml/ControlView.qml @@ -0,0 +1,188 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.1 + +Rectangle { + id: view + color: darkBackground ? "transparent" : lightBackgroundColor + + Keys.onReleased: { + if (event.key === Qt.Key_Back) { + stackView.pop(); + event.accepted = true; + } + } + + property bool darkBackground: true + + property Component control + property Component customizer + + property alias controlItem: controlLoader.item + property alias customizerItem: customizerLoader.item + + property bool isCustomizerVisible: false + + property real margin: root.toPixels(0.05) + + property rect controlBounds: Qt.rect(largestControlItem.x + controlBoundsItem.x, + largestControlItem.y + controlBoundsItem.y, controlBoundsItem.width, controlBoundsItem.height) + + Item { + id: largestControlItem + x: margin + y: margin + width: isCustomizerVisible ? widthWhenCustomizing : widthWhenNotCustomizing + height: isCustomizerVisible ? heightWhenCustomizing : heightWhenNotCustomizing + + readonly property real widthWhenCustomizing: (!isScreenPortrait ? parent.width / 2 : parent.width) - margin * 2 + readonly property real heightWhenCustomizing: (isScreenPortrait ? parent.height / 2 : parent.height - toolbar.height) - margin * 2 + readonly property real widthWhenNotCustomizing: parent.width - margin * 2 + readonly property real heightWhenNotCustomizing: parent.height - toolbar.height - margin * 2 + + Item { + id: controlBoundsItem + x: parent.width / 2 - controlBoundsItem.width / 2 + y: customizer && customizerItem.visible ? 0 : (isScreenPortrait ? (parent.height / 2) - (controlBoundsItem.height / 2) : 0) + width: Math.min(parent.widthWhenCustomizing, parent.widthWhenNotCustomizing) + height: Math.min(parent.heightWhenCustomizing, parent.heightWhenNotCustomizing) + + Behavior on x { + id: controlXBehavior + enabled: false + NumberAnimation {} + } + + Behavior on y { + id: controlYBehavior + enabled: false + NumberAnimation {} + } + + Loader { + id: controlLoader + sourceComponent: control + anchors.centerIn: parent + + property alias view: view + } + } + } + + Flickable { + id: flickable + // Hide the customizer on the right of the screen if it's not visible. + x: (isScreenPortrait ? 0 : (isCustomizerVisible ? largestControlItem.x + largestControlItem.width + margin : view.width)) + margin + y: (isScreenPortrait ? largestControlItem.y + largestControlItem.height : 0) + margin + width: largestControlItem.width + height: parent.height - y - toolbar.height - margin + anchors.leftMargin: margin + anchors.rightMargin: margin + visible: customizerLoader.opacity > 0 + + flickableDirection: Flickable.VerticalFlick + + clip: true + contentWidth: width + contentHeight: customizerLoader.height + + Behavior on x { + id: flickableXBehavior + enabled: false + NumberAnimation {} + } + + Behavior on y { + id: flickableYBehavior + enabled: false + NumberAnimation {} + } + + Loader { + id: customizerLoader + sourceComponent: customizer + opacity: 0 + width: flickable.width + + property alias view: view + + Behavior on opacity { + NumberAnimation { + duration: 300 + } + } + } + } + + ControlViewToolbar { + id: toolbar + + onCustomizeClicked: { + controlXBehavior.enabled = !isScreenPortrait; + controlYBehavior.enabled = isScreenPortrait; + + isCustomizerVisible = !isCustomizerVisible; + + if (isScreenPortrait) { + flickableXBehavior.enabled = false; + flickableYBehavior.enabled = true; + } else { + flickableXBehavior.enabled = true; + flickableYBehavior.enabled = false; + } + + customizerLoader.opacity = isCustomizerVisible ? 1 : 0; + } + } + + FlickableMoreIndicator { + flickable: flickable + atTop: true + gradientColor: view.darkBackground ? darkBackgroundColor : lightBackgroundColor + } + + FlickableMoreIndicator { + flickable: flickable + atTop: false + gradientColor: view.darkBackground ? darkBackgroundColor : lightBackgroundColor + } +} diff --git a/examples/quickcontrols/extras/gallery/qml/ControlViewToolbar.qml b/examples/quickcontrols/extras/gallery/qml/ControlViewToolbar.qml new file mode 100644 index 000000000..60a7e3f8c --- /dev/null +++ b/examples/quickcontrols/extras/gallery/qml/ControlViewToolbar.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.1 + +BlackButtonBackground { + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + height: root.height * 0.125 + + signal customizeClicked + + gradient: Gradient { + GradientStop { + color: "#333" + position: 0 + } + GradientStop { + color: "#222" + position: 1 + } + } + + Button { + id: back + width: parent.height + height: parent.height + anchors.left: parent.left + anchors.bottom: parent.bottom + iconSource: "qrc:/images/icon-back.png" + onClicked: stackView.pop() + + style: BlackButtonStyle { + } + + } + + Button { + id: customize + width: parent.height + height: parent.height + anchors.right: parent.right + anchors.bottom: parent.bottom + iconSource: "qrc:/images/icon-settings.png" + visible: customizer + + style: BlackButtonStyle { + } + + onClicked: customizeClicked() + } +} diff --git a/examples/quickcontrols/extras/gallery/qml/CustomizerLabel.qml b/examples/quickcontrols/extras/gallery/qml/CustomizerLabel.qml new file mode 100644 index 000000000..0e9f4592a --- /dev/null +++ b/examples/quickcontrols/extras/gallery/qml/CustomizerLabel.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 + +Text { + color: darkBackground ? root.darkFontColor : root.lightFontColor + font.pixelSize: root.toPixels(0.04) + font.family: openSans.name + anchors.horizontalCenter: parent.horizontalCenter +} diff --git a/examples/quickcontrols/extras/gallery/qml/CustomizerSlider.qml b/examples/quickcontrols/extras/gallery/qml/CustomizerSlider.qml new file mode 100644 index 000000000..6a004e864 --- /dev/null +++ b/examples/quickcontrols/extras/gallery/qml/CustomizerSlider.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 + +Slider { + id: slider + width: parent.width + height: root.toPixels(0.1) + + style: SliderStyle { + handle: Rectangle { + height: root.toPixels(0.06) + width: height + radius: width/2 + color: "#fff" + } + + groove: Rectangle { + implicitHeight: root.toPixels(0.015) + implicitWidth: 100 + radius: height/2 + border.color: "#333" + color: "#222" + Rectangle { + height: parent.height + width: styleData.handlePosition + implicitHeight: 6 + implicitWidth: 100 + radius: height/2 + color: "#555" + } + } + + } +} diff --git a/examples/quickcontrols/extras/gallery/qml/CustomizerSwitch.qml b/examples/quickcontrols/extras/gallery/qml/CustomizerSwitch.qml new file mode 100644 index 000000000..a64a7f8a0 --- /dev/null +++ b/examples/quickcontrols/extras/gallery/qml/CustomizerSwitch.qml @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.1 + +Switch { + anchors.horizontalCenter: parent.horizontalCenter +} diff --git a/examples/quickcontrols/extras/gallery/qml/FlickableMoreIndicator.qml b/examples/quickcontrols/extras/gallery/qml/FlickableMoreIndicator.qml new file mode 100644 index 000000000..1fb18c01c --- /dev/null +++ b/examples/quickcontrols/extras/gallery/qml/FlickableMoreIndicator.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 + +Rectangle { + anchors.top: atTop ? flickable.top : undefined + anchors.bottom: atTop ? undefined : flickable.bottom + anchors.left: isScreenPortrait ? parent.left : parent.horizontalCenter + anchors.right: parent.right + height: 30 + visible: flickable.visible + opacity: atTop + ? (flickable.contentY > showDistance ? 1 : 0) + : (flickable.contentY < flickable.contentHeight - showDistance ? 1 : 0) + scale: atTop ? 1 : -1 + + readonly property real showDistance: 0 + property Flickable flickable + property color gradientColor + /*! \c true if this indicator is at the top of the item */ + property bool atTop + + Behavior on opacity { + NumberAnimation { + } + } + + gradient: Gradient { + GradientStop { + position: 0.0 + color: gradientColor + } + GradientStop { + position: 1.0 + color: "transparent" + } + } +} diff --git a/examples/quickcontrols/extras/gallery/qml/PieMenuControlView.qml b/examples/quickcontrols/extras/gallery/qml/PieMenuControlView.qml new file mode 100644 index 000000000..bbaa8637a --- /dev/null +++ b/examples/quickcontrols/extras/gallery/qml/PieMenuControlView.qml @@ -0,0 +1,187 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtGraphicalEffects 1.0 +import QtQuick.Controls 1.1 +import QtQuick.Extras 1.4 + +Rectangle { + id: view + color: customizerItem.currentStyleDark ? "#111" : "#555" + + Behavior on color { + ColorAnimation {} + } + + Keys.onReleased: { + if (event.key === Qt.Key_Back) { + stackView.pop(); + event.accepted = true; + } + } + + property bool darkBackground: true + + property Component mouseArea + + property Component customizer: Item { + property alias currentStylePath: stylePicker.currentStylePath + property alias currentStyleDark: stylePicker.currentStyleDark + + StylePicker { + id: stylePicker + currentIndex: 0 + width: Math.round(Math.max(textSingleton.implicitHeight * 6 * 2, parent.width * 0.5)) + anchors.centerIn: parent + + model: ListModel { + ListElement { + name: "Default" + path: "PieMenuDefaultStyle.qml" + dark: false + } + ListElement { + name: "Dark" + path: "PieMenuDarkStyle.qml" + dark: true + } + } + } + } + + property alias controlItem: pieMenu + property alias customizerItem: customizerLoader.item + + Item { + id: controlBoundsItem + width: parent.width + height: parent.height - toolbar.height + visible: customizerLoader.opacity === 0 + + Image { + id: bgImage + anchors.centerIn: parent + height: 48 + Text { + id: bgLabel + anchors.top: parent.bottom + anchors.topMargin: 20 + anchors.horizontalCenter: parent.horizontalCenter + text: "Tap to open" + color: "#999" + font.pointSize: 20 + } + } + + MouseArea { + id: touchArea + anchors.fill: parent + onClicked: pieMenu.popup(touchArea.mouseX, touchArea.mouseY) + } + + PieMenu { + id: pieMenu + triggerMode: TriggerMode.TriggerOnClick + width: Math.min(controlBoundsItem.width, controlBoundsItem.height) * 0.5 + height: width + + style: Qt.createComponent(customizerItem.currentStylePath) + + MenuItem { + text: "Zoom In" + onTriggered: { + bgImage.source = iconSource + bgLabel.text = text + " selected" + } + iconSource: "qrc:/images/zoom_in.png" + } + MenuItem { + text: "Zoom Out" + onTriggered: { + bgImage.source = iconSource + bgLabel.text = text + " selected" + } + iconSource: "qrc:/images/zoom_out.png" + } + MenuItem { + text: "Info" + onTriggered: { + bgImage.source = iconSource + bgLabel.text = text + " selected" + } + iconSource: "qrc:/images/info.png" + } + } + } + Loader { + id: customizerLoader + sourceComponent: customizer + opacity: 0 + anchors.left: parent.left + anchors.right: parent.right + anchors.leftMargin: 30 + anchors.rightMargin: 30 + y: parent.height / 2 - height / 2 - toolbar.height + visible: customizerLoader.opacity > 0 + + property alias view: view + + Behavior on y { + NumberAnimation { + duration: 300 + } + } + + Behavior on opacity { + NumberAnimation { + duration: 300 + } + } + } + + ControlViewToolbar { + id: toolbar + + onCustomizeClicked: { + customizerLoader.opacity = customizerLoader.opacity == 0 ? 1 : 0; + } + } +} diff --git a/examples/quickcontrols/extras/gallery/qml/PieMenuDarkStyle.qml b/examples/quickcontrols/extras/gallery/qml/PieMenuDarkStyle.qml new file mode 100644 index 000000000..98e042981 --- /dev/null +++ b/examples/quickcontrols/extras/gallery/qml/PieMenuDarkStyle.qml @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.Controls.Styles 1.4 + +PieMenuStyle { + backgroundColor: "#222" + shadowColor: Qt.rgba(1, 1, 1, 0.26) +} diff --git a/examples/quickcontrols/extras/gallery/qml/PieMenuDefaultStyle.qml b/examples/quickcontrols/extras/gallery/qml/PieMenuDefaultStyle.qml new file mode 100644 index 000000000..02a189d6b --- /dev/null +++ b/examples/quickcontrols/extras/gallery/qml/PieMenuDefaultStyle.qml @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.Controls.Styles 1.4 + +PieMenuStyle { +} diff --git a/examples/quickcontrols/extras/gallery/qml/StylePicker.qml b/examples/quickcontrols/extras/gallery/qml/StylePicker.qml new file mode 100644 index 000000000..f1d2cad22 --- /dev/null +++ b/examples/quickcontrols/extras/gallery/qml/StylePicker.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Extras 1.4 + +ListView { + id: stylePicker + width: parent.width + height: root.height * 0.06 + interactive: false + spacing: -1 + + orientation: ListView.Horizontal + + readonly property string currentStylePath: stylePicker.model.get(stylePicker.currentIndex).path + readonly property bool currentStyleDark: stylePicker.model.get(stylePicker.currentIndex).dark !== undefined + ? stylePicker.model.get(stylePicker.currentIndex).dark + : true + + ExclusiveGroup { + id: styleExclusiveGroup + } + + delegate: Button { + width: Math.round(stylePicker.width / stylePicker.model.count) + height: stylePicker.height + checkable: true + checked: index === ListView.view.currentIndex + exclusiveGroup: styleExclusiveGroup + + onCheckedChanged: { + if (checked) { + ListView.view.currentIndex = index; + } + } + + style: ButtonStyle { + background: Rectangle { + readonly property color checkedColor: currentStyleDark ? "#444" : "#777" + readonly property color uncheckedColor: currentStyleDark ? "#222" : "#bbb" + color: checked ? checkedColor : uncheckedColor + border.color: checkedColor + border.width: 1 + radius: 1 + } + + label: Text { + text: name + color: currentStyleDark ? "white" : (checked ? "white" : "black") + font.pixelSize: root.toPixels(0.04) + font.family: openSans.name + anchors.centerIn: parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + } + } +} diff --git a/examples/quickcontrols/extras/gallery/qml/gallery.qml b/examples/quickcontrols/extras/gallery/qml/gallery.qml new file mode 100644 index 000000000..d6b46dc15 --- /dev/null +++ b/examples/quickcontrols/extras/gallery/qml/gallery.qml @@ -0,0 +1,439 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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.2 +import QtGraphicalEffects 1.0 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Dialogs 1.0 +import QtQuick.Extras 1.4 +import QtQuick.Layouts 1.0 +import QtQuick.Window 2.1 + +Window { + id: root + objectName: "window" + visible: true + width: 480 + height: 800 + + color: "#161616" + title: "Qt Quick Extras Demo" + + function toPixels(percentage) { + return percentage * Math.min(root.width, root.height); + } + + property bool isScreenPortrait: height > width + property color lightFontColor: "#222" + property color darkFontColor: "#e7e7e7" + readonly property color lightBackgroundColor: "#cccccc" + readonly property color darkBackgroundColor: "#161616" + property real customizerPropertySpacing: 10 + property real colorPickerRowSpacing: 8 + + Text { + id: textSingleton + } + + property Component circularGauge: CircularGaugeView {} + + property Component dial: ControlView { + darkBackground: false + + control: Column { + id: dialColumn + width: controlBounds.width + height: controlBounds.height - spacing + spacing: root.toPixels(0.05) + + ColumnLayout { + id: volumeColumn + width: parent.width + height: (dialColumn.height - dialColumn.spacing) / 2 + spacing: height * 0.025 + + Dial { + id: volumeDial + anchors.horizontalCenter: parent.horizontalCenter + Layout.fillWidth: true + Layout.fillHeight: true + + /*! + Determines whether the dial animates its rotation to the new value when + a single click or touch is received on the dial. + */ + property bool animate: customizerItem.animate + + Behavior on value { + enabled: volumeDial.animate && !volumeDial.pressed + NumberAnimation { + duration: 300 + easing.type: Easing.OutSine + } + } + } + + ControlLabel { + id: volumeText + text: "Volume" + anchors.horizontalCenter: parent.horizontalCenter + } + } + + ColumnLayout { + id: trebleColumn + width: parent.width + height: (dialColumn.height - dialColumn.spacing) / 2 + spacing: height * 0.025 + + Dial { + id: dial2 + anchors.horizontalCenter: parent.horizontalCenter + Layout.fillWidth: true + Layout.fillHeight: true + + stepSize: 1 + maximumValue: 10 + + style: DialStyle { + labelInset: outerRadius * 0 + } + } + + ControlLabel { + id: trebleText + text: "Treble" + anchors.horizontalCenter: parent.horizontalCenter + } + } + } + + customizer: Column { + spacing: customizerPropertySpacing + + property alias animate: animateCheckBox.checked + + CustomizerLabel { + text: "Animate" + } + + CustomizerSwitch { + id: animateCheckBox + } + } + } + + property Component delayButton: ControlView { + darkBackground: false + + control: DelayButton { + text: "Alarm" + anchors.centerIn: parent + } + } + + property Component gauge: ControlView { + id: gaugeView + control: Gauge { + id: gauge + width: orientation === Qt.Vertical ? implicitWidth : gaugeView.controlBounds.width + height: orientation === Qt.Vertical ? gaugeView.controlBounds.height : implicitHeight + anchors.centerIn: parent + + minimumValue: 0 + value: customizerItem.value + maximumValue: 100 + orientation: customizerItem.orientationFlag ? Qt.Vertical : Qt.Horizontal + tickmarkAlignment: orientation === Qt.Vertical + ? (customizerItem.alignFlag ? Qt.AlignLeft : Qt.AlignRight) + : (customizerItem.alignFlag ? Qt.AlignTop : Qt.AlignBottom) + } + + customizer: Column { + spacing: customizerPropertySpacing + + property alias value: valueSlider.value + property alias orientationFlag: orientationCheckBox.checked + property alias alignFlag: alignCheckBox.checked + + CustomizerLabel { + text: "Value" + } + + CustomizerSlider { + id: valueSlider + minimumValue: 0 + value: 50 + maximumValue: 100 + } + + CustomizerLabel { + text: "Vertical orientation" + } + + CustomizerSwitch { + id: orientationCheckBox + checked: true + } + + CustomizerLabel { + text: controlItem.orientation === Qt.Vertical ? "Left align" : "Top align" + } + + CustomizerSwitch { + id: alignCheckBox + checked: true + } + } + } + + property Component toggleButton: ControlView { + darkBackground: false + + control: ToggleButton { + text: checked ? "On" : "Off" + anchors.centerIn: parent + } + } + + property Component pieMenu: PieMenuControlView {} + + property Component statusIndicator: ControlView { + id: statusIndicatorView + darkBackground: false + + Timer { + id: recordingFlashTimer + running: true + repeat: true + interval: 1000 + } + + ColumnLayout { + id: indicatorLayout + width: statusIndicatorView.controlBounds.width * 0.25 + height: statusIndicatorView.controlBounds.height * 0.75 + anchors.centerIn: parent + + Repeater { + model: ListModel { + id: indicatorModel + ListElement { + name: "Power" + indicatorColor: "#35e02f" + } + ListElement { + name: "Recording" + indicatorColor: "red" + } + } + + ColumnLayout { + Layout.preferredWidth: indicatorLayout.width + spacing: 0 + + StatusIndicator { + id: indicator + color: indicatorColor + Layout.preferredWidth: statusIndicatorView.controlBounds.width * 0.07 + Layout.preferredHeight: Layout.preferredWidth + Layout.alignment: Qt.AlignHCenter + on: true + + Connections { + target: recordingFlashTimer + onTriggered: if (name == "Recording") indicator.active = !indicator.active + } + } + ControlLabel { + id: indicatorLabel + text: name + Layout.alignment: Qt.AlignHCenter + Layout.maximumWidth: parent.width + horizontalAlignment: Text.AlignHCenter + } + } + } + } + } + + property Component tumbler: ControlView { + id: tumblerView + darkBackground: false + + Tumbler { + id: tumbler + anchors.centerIn: parent + + // TODO: Use FontMetrics with 5.4 + Label { + id: characterMetrics + font.bold: true + font.pixelSize: textSingleton.font.pixelSize * 1.25 + font.family: openSans.name + visible: false + text: "M" + } + + readonly property real delegateTextMargins: characterMetrics.width * 1.5 + readonly property var days: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] + + TumblerColumn { + id: tumblerDayColumn + + function updateModel() { + var previousIndex = tumblerDayColumn.currentIndex; + var newDays = tumbler.days[monthColumn.currentIndex]; + + if (!model) { + var array = []; + for (var i = 0; i < newDays; ++i) { + array.push(i + 1); + } + model = array; + } else { + // If we've already got days in the model, just add or remove + // the minimum amount necessary to make spinning the month column fast. + var difference = model.length - newDays; + if (model.length > newDays) { + model.splice(model.length - 1, difference); + } else { + var lastDay = model[model.length - 1]; + for (i = lastDay; i < lastDay + difference; ++i) { + model.push(i + 1); + } + } + } + + tumbler.setCurrentIndexAt(0, Math.min(newDays - 1, previousIndex)); + } + } + TumblerColumn { + id: monthColumn + width: characterMetrics.width * 3 + tumbler.delegateTextMargins + model: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] + onCurrentIndexChanged: tumblerDayColumn.updateModel() + } + TumblerColumn { + width: characterMetrics.width * 4 + tumbler.delegateTextMargins + model: ListModel { + Component.onCompleted: { + for (var i = 2000; i < 2100; ++i) { + append({value: i.toString()}); + } + } + } + } + } + } + + + FontLoader { + id: openSans + source: "qrc:/fonts/OpenSans-Regular.ttf" + } + + property var componentMap: { + "CircularGauge": circularGauge, + "DelayButton": delayButton, + "Dial": dial, + "Gauge": gauge, + "PieMenu": pieMenu, + "StatusIndicator": statusIndicator, + "ToggleButton": toggleButton, + "Tumbler": tumbler + } + + StackView { + id: stackView + anchors.fill: parent + + initialItem: ListView { + model: ListModel { + ListElement { + title: "CircularGauge" + } + ListElement { + title: "DelayButton" + } + ListElement { + title: "Dial" + } + ListElement { + title: "Gauge" + } + ListElement { + title: "PieMenu" + } + ListElement { + title: "StatusIndicator" + } + ListElement { + title: "ToggleButton" + } + ListElement { + title: "Tumbler" + } + } + + delegate: Button { + width: stackView.width + height: root.height * 0.125 + text: title + + style: BlackButtonStyle { + fontColor: root.darkFontColor + rightAlignedIconSource: "qrc:/images/icon-go.png" + } + + onClicked: { + if (stackView.depth == 1) { + // Only push the control view if we haven't already pushed it... + stackView.push({item: componentMap[title]}); + stackView.currentItem.forceActiveFocus(); + } + } + } + } + } +} + + diff --git a/examples/quickcontrols/quickcontrols.pro b/examples/quickcontrols/quickcontrols.pro new file mode 100644 index 000000000..dfe855099 --- /dev/null +++ b/examples/quickcontrols/quickcontrols.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs +SUBDIRS = \ + controls \ + dialogs \ + extras diff --git a/src/controls/doc/qtquickcontrols.qdocconf b/src/controls/doc/qtquickcontrols.qdocconf index a38c0ee75..801cfb759 100644 --- a/src/controls/doc/qtquickcontrols.qdocconf +++ b/src/controls/doc/qtquickcontrols.qdocconf @@ -39,9 +39,9 @@ depends = qtcore qtdoc qtgui qtwidgets qtqml qtquick qtquicklayouts qtquickdialo # Specify the install path under QT_INSTALL_EXAMPLES # Examples will be installed under quick/controls - 'controls' subdirectory # is given as part of \example commands -exampledirs += ../../../examples/quick/controls \ +exampledirs += ../../../examples/quickcontrols/controls \ snippets -examplesinstallpath = qtquickcontrols/quick/controls +examplesinstallpath = qtquickcontrols/quickcontrols/controls headerdirs += .. diff --git a/src/dialogs/doc/qtquickdialogs.qdocconf b/src/dialogs/doc/qtquickdialogs.qdocconf index 30f3635a3..d4c55b848 100644 --- a/src/dialogs/doc/qtquickdialogs.qdocconf +++ b/src/dialogs/doc/qtquickdialogs.qdocconf @@ -24,9 +24,9 @@ qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.sortPages = true depends = qtqml qtquick qtgui qtwidgets qtdoc qtcore -exampledirs += ../../../examples/quick/dialogs +exampledirs += ../../../examples/quickcontrols/dialogs -examplesinstallpath = qtquickcontrols/quick/dialogs +examplesinstallpath = qtquickcontrols/quickcontrols/dialogs headerdirs += .. diff --git a/src/extras/doc/qtquickextras.qdocconf b/src/extras/doc/qtquickextras.qdocconf index 747465fc0..f854b89e9 100644 --- a/src/extras/doc/qtquickextras.qdocconf +++ b/src/extras/doc/qtquickextras.qdocconf @@ -29,8 +29,8 @@ qhp.QtQuickExtras.subprojects.qtquickextrasexamples.sortPages = true depends = qtqml qtquick qtdoc qtquickcontrols qtgui -exampledirs += ../../../examples/quick/extras -examplesinstallpath = qtquickcontrols/quick/extras +exampledirs += ../../../examples/quickcontrols/extras +examplesinstallpath = qtquickcontrols/quickcontrols/extras headerdirs += ../ -- cgit v1.2.3