From 966c0348c7a19a17c5be53f87ef54d4fbab8d8c8 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 26 Sep 2016 12:48:47 +0200 Subject: Refactor tst_snippets to make it easier to add non-screenshot snippets Add a separate test for non-screenshot snippets and move the screenshot snippets to their own folder. Change-Id: Ic3e7370321e346b83f7df42205e204d1265ce5b0 Reviewed-by: J-P Nurmi --- src/imports/controls/doc/qtquickcontrols2.qdocconf | 3 +- .../doc/snippets/qtlabscalendar-calendarmodel.qml | 57 ---------- .../qtlabscalendar-dayofweekrow-layout.qml | 47 --------- .../doc/snippets/qtlabscalendar-dayofweekrow.qml | 35 ------- .../snippets/qtlabscalendar-monthgrid-layout.qml | 61 ----------- .../doc/snippets/qtlabscalendar-monthgrid.qml | 37 ------- .../qtlabscalendar-weeknumbercolumn-layout.qml | 49 --------- .../snippets/qtlabscalendar-weeknumbercolumn.qml | 37 ------- .../qtquickcontrols2-busyindicator-custom.qml | 88 ---------------- .../snippets/qtquickcontrols2-button-custom.qml | 55 ---------- .../snippets/qtquickcontrols2-button-disabled.qml | 35 ------- .../snippets/qtquickcontrols2-button-focused.qml | 35 ------- .../snippets/qtquickcontrols2-button-normal.qml | 34 ------ .../snippets/qtquickcontrols2-button-pressed.qml | 35 ------- .../snippets/qtquickcontrols2-checkbox-checked.qml | 34 ------ .../snippets/qtquickcontrols2-checkbox-custom.qml | 66 ------------ .../qtquickcontrols2-checkbox-disabled.qml | 34 ------ .../snippets/qtquickcontrols2-checkbox-focused.qml | 34 ------ .../snippets/qtquickcontrols2-checkbox-normal.qml | 33 ------ .../qtquickcontrols2-checkdelegate-custom.qml | 75 -------------- .../snippets/qtquickcontrols2-combobox-custom.qml | 113 -------------------- .../qtquickcontrols2-combobox-delegate.qml | 53 ---------- .../snippets/qtquickcontrols2-combobox-popup.qml | 47 --------- .../doc/snippets/qtquickcontrols2-dial-custom.qml | 67 ------------ .../doc/snippets/qtquickcontrols2-dial-handle.qml | 41 -------- .../doc/snippets/qtquickcontrols2-frame-custom.qml | 43 -------- .../doc/snippets/qtquickcontrols2-frame.qml | 41 -------- .../qtquickcontrols2-groupbox-checkable.qml | 48 --------- .../snippets/qtquickcontrols2-groupbox-custom.qml | 49 --------- .../snippets/qtquickcontrols2-groupbox-label.qml | 41 -------- .../doc/snippets/qtquickcontrols2-groupbox.qml | 42 -------- .../qtquickcontrols2-itemdelegate-custom.qml | 61 ----------- .../doc/snippets/qtquickcontrols2-itemdelegate.qml | 46 --------- .../doc/snippets/qtquickcontrols2-label-custom.qml | 36 ------- .../doc/snippets/qtquickcontrols2-label.qml | 35 ------- .../doc/snippets/qtquickcontrols2-menu-custom.qml | 60 ----------- .../qtquickcontrols2-pageindicator-custom.qml | 53 ---------- .../qtquickcontrols2-pageindicator-delegate.qml | 40 ------- .../qtquickcontrols2-pageindicator-interactive.qml | 58 ----------- .../snippets/qtquickcontrols2-pageindicator.qml | 35 ------- .../doc/snippets/qtquickcontrols2-pane-custom.qml | 41 -------- .../doc/snippets/qtquickcontrols2-pane.qml | 41 -------- .../qtquickcontrols2-progressbar-custom.qml | 57 ---------- .../qtquickcontrols2-progressbar-disabled.qml | 34 ------ .../qtquickcontrols2-progressbar-normal.qml | 33 ------ .../qtquickcontrols2-radiobutton-checked.qml | 34 ------ .../qtquickcontrols2-radiobutton-custom.qml | 66 ------------ .../qtquickcontrols2-radiobutton-disabled.qml | 34 ------ .../qtquickcontrols2-radiobutton-focused.qml | 34 ------ .../qtquickcontrols2-radiobutton-normal.qml | 33 ------ .../qtquickcontrols2-radiodelegate-custom.qml | 75 -------------- .../qtquickcontrols2-rangeslider-custom.qml | 76 -------------- .../qtquickcontrols2-rangeslider-disabled.qml | 35 ------- ...kcontrols2-rangeslider-first-handle-focused.qml | 35 ------- .../qtquickcontrols2-rangeslider-first-handle.qml | 39 ------- .../qtquickcontrols2-rangeslider-normal.qml | 34 ------ ...controls2-rangeslider-second-handle-focused.qml | 35 ------- .../qtquickcontrols2-rangeslider-second-handle.qml | 39 ------- .../snippets/qtquickcontrols2-scrollbar-active.qml | 46 --------- .../snippets/qtquickcontrols2-scrollbar-custom.qml | 46 --------- .../qtquickcontrols2-scrollindicator-active.qml | 46 --------- .../qtquickcontrols2-scrollindicator-custom.qml | 45 -------- .../snippets/qtquickcontrols2-slider-custom.qml | 64 ------------ .../snippets/qtquickcontrols2-slider-disabled.qml | 34 ------ .../snippets/qtquickcontrols2-slider-focused.qml | 34 ------ .../snippets/qtquickcontrols2-slider-handle.qml | 38 ------- .../snippets/qtquickcontrols2-slider-normal.qml | 33 ------ .../snippets/qtquickcontrols2-spinbox-custom.qml | 96 ----------------- .../snippets/qtquickcontrols2-spinbox-double.qml | 56 ---------- .../doc/snippets/qtquickcontrols2-spinbox-down.qml | 38 ------- .../snippets/qtquickcontrols2-spinbox-textual.qml | 55 ---------- .../doc/snippets/qtquickcontrols2-spinbox-up.qml | 38 ------- .../doc/snippets/qtquickcontrols2-spinbox.qml | 35 ------- .../qtquickcontrols2-swipedelegate-custom.qml | 74 ------------- .../qtquickcontrols2-swipeview-indicator.qml | 63 ----------- .../snippets/qtquickcontrols2-switch-checked.qml | 34 ------ .../snippets/qtquickcontrols2-switch-custom.qml | 65 ------------ .../snippets/qtquickcontrols2-switch-disabled.qml | 34 ------ .../snippets/qtquickcontrols2-switch-focused.qml | 34 ------ .../snippets/qtquickcontrols2-switch-normal.qml | 33 ------ .../qtquickcontrols2-switchdelegate-custom.qml | 74 ------------- .../snippets/qtquickcontrols2-tabbar-custom.qml | 49 --------- .../snippets/qtquickcontrols2-tabbar-flickable.qml | 50 --------- .../doc/snippets/qtquickcontrols2-tabbar.qml | 64 ------------ .../doc/snippets/qtquickcontrols2-tabbutton.qml | 43 -------- .../snippets/qtquickcontrols2-textarea-custom.qml | 42 -------- .../qtquickcontrols2-textarea-flickable.qml | 50 --------- .../snippets/qtquickcontrols2-textfield-custom.qml | 43 -------- .../qtquickcontrols2-textfield-disabled.qml | 35 ------- .../qtquickcontrols2-textfield-focused.qml | 35 ------- .../snippets/qtquickcontrols2-textfield-normal.qml | 34 ------ .../snippets/qtquickcontrols2-toolbar-custom.qml | 59 ----------- .../doc/snippets/qtquickcontrols2-toolbar.qml | 47 --------- .../qtquickcontrols2-toolbutton-custom.qml | 55 ---------- .../snippets/qtquickcontrols2-tooltip-hover.qml | 41 -------- .../qtquickcontrols2-tooltip-pressandhold.qml | 39 ------- .../snippets/qtquickcontrols2-tooltip-slider.qml | 53 ---------- .../doc/snippets/qtquickcontrols2-tooltip.qml | 51 --------- .../snippets/qtquickcontrols2-tumbler-custom.qml | 79 -------------- .../snippets/qtquickcontrols2-tumbler-delegate.qml | 47 --------- .../screenshots/qtlabscalendar-calendarmodel.qml | 57 ++++++++++ .../qtlabscalendar-dayofweekrow-layout.qml | 47 +++++++++ .../screenshots/qtlabscalendar-dayofweekrow.qml | 35 +++++++ .../qtlabscalendar-monthgrid-layout.qml | 61 +++++++++++ .../screenshots/qtlabscalendar-monthgrid.qml | 37 +++++++ .../qtlabscalendar-weeknumbercolumn-layout.qml | 49 +++++++++ .../qtlabscalendar-weeknumbercolumn.qml | 37 +++++++ .../qtquickcontrols2-busyindicator-custom.qml | 88 ++++++++++++++++ .../screenshots/qtquickcontrols2-button-custom.qml | 55 ++++++++++ .../qtquickcontrols2-button-disabled.qml | 35 +++++++ .../qtquickcontrols2-button-focused.qml | 35 +++++++ .../screenshots/qtquickcontrols2-button-normal.qml | 34 ++++++ .../qtquickcontrols2-button-pressed.qml | 35 +++++++ .../qtquickcontrols2-checkbox-checked.qml | 34 ++++++ .../qtquickcontrols2-checkbox-custom.qml | 66 ++++++++++++ .../qtquickcontrols2-checkbox-disabled.qml | 34 ++++++ .../qtquickcontrols2-checkbox-focused.qml | 34 ++++++ .../qtquickcontrols2-checkbox-normal.qml | 33 ++++++ .../qtquickcontrols2-checkdelegate-custom.qml | 75 ++++++++++++++ .../qtquickcontrols2-combobox-custom.qml | 113 ++++++++++++++++++++ .../qtquickcontrols2-combobox-delegate.qml | 53 ++++++++++ .../qtquickcontrols2-combobox-popup.qml | 47 +++++++++ .../screenshots/qtquickcontrols2-dial-custom.qml | 67 ++++++++++++ .../screenshots/qtquickcontrols2-dial-handle.qml | 41 ++++++++ .../screenshots/qtquickcontrols2-frame-custom.qml | 43 ++++++++ .../screenshots/qtquickcontrols2-frame.qml | 41 ++++++++ .../qtquickcontrols2-groupbox-checkable.qml | 48 +++++++++ .../qtquickcontrols2-groupbox-custom.qml | 49 +++++++++ .../qtquickcontrols2-groupbox-label.qml | 41 ++++++++ .../screenshots/qtquickcontrols2-groupbox.qml | 42 ++++++++ .../qtquickcontrols2-itemdelegate-custom.qml | 61 +++++++++++ .../screenshots/qtquickcontrols2-itemdelegate.qml | 46 +++++++++ .../screenshots/qtquickcontrols2-label-custom.qml | 36 +++++++ .../screenshots/qtquickcontrols2-label.qml | 35 +++++++ .../screenshots/qtquickcontrols2-menu-custom.qml | 60 +++++++++++ .../qtquickcontrols2-pageindicator-custom.qml | 53 ++++++++++ .../qtquickcontrols2-pageindicator-delegate.qml | 40 +++++++ .../qtquickcontrols2-pageindicator-interactive.qml | 58 +++++++++++ .../screenshots/qtquickcontrols2-pageindicator.qml | 35 +++++++ .../screenshots/qtquickcontrols2-pane-custom.qml | 41 ++++++++ .../snippets/screenshots/qtquickcontrols2-pane.qml | 41 ++++++++ .../qtquickcontrols2-progressbar-custom.qml | 57 ++++++++++ .../qtquickcontrols2-progressbar-disabled.qml | 34 ++++++ .../qtquickcontrols2-progressbar-normal.qml | 33 ++++++ .../qtquickcontrols2-radiobutton-checked.qml | 34 ++++++ .../qtquickcontrols2-radiobutton-custom.qml | 66 ++++++++++++ .../qtquickcontrols2-radiobutton-disabled.qml | 34 ++++++ .../qtquickcontrols2-radiobutton-focused.qml | 34 ++++++ .../qtquickcontrols2-radiobutton-normal.qml | 33 ++++++ .../qtquickcontrols2-radiodelegate-custom.qml | 75 ++++++++++++++ .../qtquickcontrols2-rangeslider-custom.qml | 76 ++++++++++++++ .../qtquickcontrols2-rangeslider-disabled.qml | 35 +++++++ ...kcontrols2-rangeslider-first-handle-focused.qml | 35 +++++++ .../qtquickcontrols2-rangeslider-first-handle.qml | 39 +++++++ .../qtquickcontrols2-rangeslider-normal.qml | 34 ++++++ ...controls2-rangeslider-second-handle-focused.qml | 35 +++++++ .../qtquickcontrols2-rangeslider-second-handle.qml | 39 +++++++ .../qtquickcontrols2-scrollbar-active.qml | 46 +++++++++ .../qtquickcontrols2-scrollbar-custom.qml | 46 +++++++++ .../qtquickcontrols2-scrollindicator-active.qml | 46 +++++++++ .../qtquickcontrols2-scrollindicator-custom.qml | 45 ++++++++ .../screenshots/qtquickcontrols2-slider-custom.qml | 64 ++++++++++++ .../qtquickcontrols2-slider-disabled.qml | 34 ++++++ .../qtquickcontrols2-slider-focused.qml | 34 ++++++ .../screenshots/qtquickcontrols2-slider-handle.qml | 38 +++++++ .../screenshots/qtquickcontrols2-slider-normal.qml | 33 ++++++ .../qtquickcontrols2-spinbox-custom.qml | 96 +++++++++++++++++ .../qtquickcontrols2-spinbox-double.qml | 56 ++++++++++ .../screenshots/qtquickcontrols2-spinbox-down.qml | 38 +++++++ .../qtquickcontrols2-spinbox-textual.qml | 55 ++++++++++ .../screenshots/qtquickcontrols2-spinbox-up.qml | 38 +++++++ .../screenshots/qtquickcontrols2-spinbox.qml | 35 +++++++ .../qtquickcontrols2-swipedelegate-custom.qml | 74 +++++++++++++ .../qtquickcontrols2-swipeview-indicator.qml | 63 +++++++++++ .../qtquickcontrols2-switch-checked.qml | 34 ++++++ .../screenshots/qtquickcontrols2-switch-custom.qml | 65 ++++++++++++ .../qtquickcontrols2-switch-disabled.qml | 34 ++++++ .../qtquickcontrols2-switch-focused.qml | 34 ++++++ .../screenshots/qtquickcontrols2-switch-normal.qml | 33 ++++++ .../qtquickcontrols2-switchdelegate-custom.qml | 74 +++++++++++++ .../screenshots/qtquickcontrols2-tabbar-custom.qml | 49 +++++++++ .../qtquickcontrols2-tabbar-flickable.qml | 50 +++++++++ .../screenshots/qtquickcontrols2-tabbar.qml | 64 ++++++++++++ .../screenshots/qtquickcontrols2-tabbutton.qml | 43 ++++++++ .../qtquickcontrols2-textarea-custom.qml | 42 ++++++++ .../qtquickcontrols2-textarea-flickable.qml | 50 +++++++++ .../qtquickcontrols2-textfield-custom.qml | 43 ++++++++ .../qtquickcontrols2-textfield-disabled.qml | 35 +++++++ .../qtquickcontrols2-textfield-focused.qml | 35 +++++++ .../qtquickcontrols2-textfield-normal.qml | 34 ++++++ .../qtquickcontrols2-toolbar-custom.qml | 59 +++++++++++ .../screenshots/qtquickcontrols2-toolbar.qml | 47 +++++++++ .../qtquickcontrols2-toolbutton-custom.qml | 55 ++++++++++ .../screenshots/qtquickcontrols2-tooltip-hover.qml | 41 ++++++++ .../qtquickcontrols2-tooltip-pressandhold.qml | 39 +++++++ .../qtquickcontrols2-tooltip-slider.qml | 53 ++++++++++ .../screenshots/qtquickcontrols2-tooltip.qml | 51 +++++++++ .../qtquickcontrols2-tumbler-custom.qml | 79 ++++++++++++++ .../qtquickcontrols2-tumbler-delegate.qml | 47 +++++++++ tests/auto/sanity/tst_sanity.cpp | 3 +- tests/auto/snippets/tst_snippets.cpp | 115 +++++++++++++-------- 201 files changed, 4770 insertions(+), 4743 deletions(-) delete mode 100644 src/imports/controls/doc/snippets/qtlabscalendar-calendarmodel.qml delete mode 100644 src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml delete mode 100644 src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow.qml delete mode 100644 src/imports/controls/doc/snippets/qtlabscalendar-monthgrid-layout.qml delete mode 100644 src/imports/controls/doc/snippets/qtlabscalendar-monthgrid.qml delete mode 100644 src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml delete mode 100644 src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-busyindicator-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-button-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-button-disabled.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-button-focused.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-button-normal.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-button-pressed.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-checked.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-disabled.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-focused.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-normal.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-checkdelegate-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-combobox-delegate.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-combobox-popup.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-dial-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-dial-handle.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-frame-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-frame.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-checkable.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-label.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-groupbox.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-label-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-label.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-menu-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-delegate.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-interactive.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-pane-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-pane.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-disabled.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-normal.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-checked.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-disabled.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-focused.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-normal.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-radiodelegate-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-disabled.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle-focused.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-normal.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle-focused.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-active.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-active.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-slider-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-slider-disabled.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-slider-focused.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-slider-handle.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-slider-normal.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-double.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-down.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-textual.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-up.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-spinbox.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-indicator.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-switch-checked.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-switch-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-switch-disabled.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-switch-focused.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-switch-normal.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-switchdelegate-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-flickable.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-tabbar.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-tabbutton.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-textarea-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-textarea-flickable.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-textfield-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-textfield-disabled.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-textfield-focused.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-textfield-normal.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-toolbar-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-toolbar.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-toolbutton-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-hover.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-pressandhold.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-slider.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-tooltip.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-custom.qml delete mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-delegate.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtlabscalendar-calendarmodel.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow-layout.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid-layout.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn-layout.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkdelegate-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-interactive.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-disabled.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-normal.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-checked.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-disabled.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-focused.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-normal.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-disabled.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-first-handle-focused.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-first-handle.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-normal.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-second-handle-focused.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-second-handle.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-disabled.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-focused.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-normal.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switchdelegate-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-flickable.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml diff --git a/src/imports/controls/doc/qtquickcontrols2.qdocconf b/src/imports/controls/doc/qtquickcontrols2.qdocconf index bec995d3..e83e418e 100644 --- a/src/imports/controls/doc/qtquickcontrols2.qdocconf +++ b/src/imports/controls/doc/qtquickcontrols2.qdocconf @@ -39,7 +39,8 @@ exampledirs += ../../../../examples/quickcontrols2 \ ../../../quicktemplates2 \ ../../calendar \ ../../../../tests/auto/controls/data \ - snippets + snippets \ + snippets/screenshots examplesinstallpath = quickcontrols2 diff --git a/src/imports/controls/doc/snippets/qtlabscalendar-calendarmodel.qml b/src/imports/controls/doc/snippets/qtlabscalendar-calendarmodel.qml deleted file mode 100644 index dfbf4fbc..00000000 --- a/src/imports/controls/doc/snippets/qtlabscalendar-calendarmodel.qml +++ /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 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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import Qt.labs.calendar 1.0 -import QtQuick.Controls 2.0 - -//! [1] -ListView { - id: listview - - width: 200; height: 200 - snapMode: ListView.SnapOneItem - orientation: ListView.Horizontal - highlightRangeMode: ListView.StrictlyEnforceRange - - model: CalendarModel { - from: new Date(2015, 0, 1) - to: new Date(2015, 11, 31) - } - - delegate: MonthGrid { - width: listview.width - height: listview.height - - month: model.month - year: model.year - locale: Qt.locale("en_US") - } - - ScrollIndicator.horizontal: ScrollIndicator { } -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml b/src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml deleted file mode 100644 index ce41d224..00000000 --- a/src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml +++ /dev/null @@ -1,47 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Layouts 1.0 -import Qt.labs.calendar 1.0 - -//! [1] -ColumnLayout { - DayOfWeekRow { - locale: grid.locale - Layout.fillWidth: true - } - - MonthGrid { - id: grid - month: Calendar.December - year: 2015 - locale: Qt.locale("en_US") - Layout.fillWidth: true - } -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow.qml b/src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow.qml deleted file mode 100644 index 5ea3714c..00000000 --- a/src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow.qml +++ /dev/null @@ -1,35 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import Qt.labs.calendar 1.0 - -//! [1] -DayOfWeekRow { - locale: Qt.locale("en_US") -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtlabscalendar-monthgrid-layout.qml b/src/imports/controls/doc/snippets/qtlabscalendar-monthgrid-layout.qml deleted file mode 100644 index 346e6099..00000000 --- a/src/imports/controls/doc/snippets/qtlabscalendar-monthgrid-layout.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 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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Layouts 1.0 -import Qt.labs.calendar 1.0 - -//! [1] -GridLayout { - columns: 2 - - DayOfWeekRow { - locale: grid.locale - - Layout.column: 1 - Layout.fillWidth: true - } - - WeekNumberColumn { - month: grid.month - year: grid.year - locale: grid.locale - - Layout.fillHeight: true - } - - MonthGrid { - id: grid - month: Calendar.December - year: 2015 - locale: Qt.locale("en_US") - - Layout.fillWidth: true - Layout.fillHeight: true - } -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtlabscalendar-monthgrid.qml b/src/imports/controls/doc/snippets/qtlabscalendar-monthgrid.qml deleted file mode 100644 index 16f872b8..00000000 --- a/src/imports/controls/doc/snippets/qtlabscalendar-monthgrid.qml +++ /dev/null @@ -1,37 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import Qt.labs.calendar 1.0 - -//! [1] -MonthGrid { - month: Calendar.December - year: 2015 - locale: Qt.locale("en_US") -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml b/src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml deleted file mode 100644 index d105553f..00000000 --- a/src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.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 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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Layouts 1.0 -import Qt.labs.calendar 1.0 - -//! [1] -RowLayout { - WeekNumberColumn { - month: grid.month - year: grid.year - locale: grid.locale - Layout.fillHeight: true - } - - MonthGrid { - id: grid - month: Calendar.December - year: 2015 - locale: Qt.locale("en_US") - Layout.fillHeight: true - } -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn.qml b/src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn.qml deleted file mode 100644 index e58e5c7b..00000000 --- a/src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn.qml +++ /dev/null @@ -1,37 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import Qt.labs.calendar 1.0 - -//! [1] -WeekNumberColumn { - month: Calendar.December - year: 2015 - locale: Qt.locale("en_US") -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-busyindicator-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-busyindicator-custom.qml deleted file mode 100644 index 82ed9cdc..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-busyindicator-custom.qml +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -BusyIndicator { - id: control - - contentItem: Item { - implicitWidth: 64 - implicitHeight: 64 - - Item { - id: item - x: parent.width / 2 - 32 - y: parent.height / 2 - 32 - width: 64 - height: 64 - opacity: control.running ? 1 : 0 - - Behavior on opacity { - OpacityAnimator { - duration: 250 - } - } - - RotationAnimator { - target: item - running: control.visible && control.running - from: 0 - to: 360 - loops: Animation.Infinite - duration: 1250 - } - - Repeater { - id: repeater - model: 6 - - Rectangle { - x: item.width / 2 - width / 2 - y: item.height / 2 - height / 2 - implicitWidth: 10 - implicitHeight: 10 - radius: 5 - color: "#21be2b" - transform: [ - Translate { - y: -Math.min(item.width, item.height) * 0.5 + 5 - }, - Rotation { - angle: index / repeater.count * 360 - origin.x: 5 - origin.y: 5 - } - ] - } - } - } - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-button-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-button-custom.qml deleted file mode 100644 index eac6b831..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-button-custom.qml +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -Button { - id: control - text: qsTr("Button") - - contentItem: Text { - text: control.text - font: control.font - opacity: enabled ? 1.0 : 0.3 - color: control.down ? "#17a81a" : "#21be2b" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - elide: Text.ElideRight - } - - background: Rectangle { - implicitWidth: 100 - implicitHeight: 40 - opacity: enabled ? 1 : 0.3 - border.color: control.down ? "#17a81a" : "#21be2b" - border.width: 1 - radius: 2 - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-button-disabled.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-button-disabled.qml deleted file mode 100644 index f4555c90..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-button-disabled.qml +++ /dev/null @@ -1,35 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Button { - width: 80 - text: "Disabled" - enabled: false -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-button-focused.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-button-focused.qml deleted file mode 100644 index a99346a6..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-button-focused.qml +++ /dev/null @@ -1,35 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Button { - width: 80 - text: "Focused" - focus: true -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-button-normal.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-button-normal.qml deleted file mode 100644 index f206bcec..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-button-normal.qml +++ /dev/null @@ -1,34 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Button { - width: 80 - text: "Normal" -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-button-pressed.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-button-pressed.qml deleted file mode 100644 index 8a941561..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-button-pressed.qml +++ /dev/null @@ -1,35 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Button { - width: 80 - text: "Pressed" - down: true -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-checked.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-checked.qml deleted file mode 100644 index 075e6342..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-checked.qml +++ /dev/null @@ -1,34 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -CheckBox { - text: "Checked" - checked: true -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-custom.qml deleted file mode 100644 index 0465ec80..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-custom.qml +++ /dev/null @@ -1,66 +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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -CheckBox { - id: control - text: qsTr("CheckBox") - checked: true - - indicator: Rectangle { - implicitWidth: 26 - implicitHeight: 26 - x: control.leftPadding - y: parent.height / 2 - height / 2 - radius: 3 - border.color: control.down ? "#17a81a" : "#21be2b" - - Rectangle { - width: 14 - height: 14 - x: 6 - y: 6 - radius: 2 - color: control.down ? "#17a81a" : "#21be2b" - visible: control.checked - } - } - - contentItem: Text { - text: control.text - font: control.font - opacity: enabled ? 1.0 : 0.3 - color: control.down ? "#17a81a" : "#21be2b" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - leftPadding: control.indicator.width + control.spacing - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-disabled.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-disabled.qml deleted file mode 100644 index 4878cf31..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-disabled.qml +++ /dev/null @@ -1,34 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -CheckBox { - text: "Disabled" - enabled: false -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-focused.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-focused.qml deleted file mode 100644 index 93f1c214..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-focused.qml +++ /dev/null @@ -1,34 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -CheckBox { - text: "Focused" - focus: true -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-normal.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-normal.qml deleted file mode 100644 index a840116e..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-normal.qml +++ /dev/null @@ -1,33 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -CheckBox { - text: "Normal" -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-checkdelegate-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-checkdelegate-custom.qml deleted file mode 100644 index 483f9838..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkdelegate-custom.qml +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -CheckDelegate { - id: control - text: qsTr("CheckDelegate") - checked: true - - contentItem: Text { - rightPadding: control.indicator.width + control.spacing - text: control.text - font: control.font - opacity: enabled ? 1.0 : 0.3 - color: control.down ? "#17a81a" : "#21be2b" - elide: Text.ElideRight - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - } - - indicator: Rectangle { - implicitWidth: 26 - implicitHeight: 26 - x: control.width - width - control.rightPadding - y: control.topPadding + control.availableHeight / 2 - height / 2 - radius: 3 - color: "transparent" - border.color: control.down ? "#17a81a" : "#21be2b" - - Rectangle { - width: 14 - height: 14 - x: 6 - y: 6 - radius: 2 - color: control.down ? "#17a81a" : "#21be2b" - visible: control.checked - } - } - - background: Rectangle { - implicitWidth: 100 - implicitHeight: 40 - visible: control.down || control.highlighted - color: control.down ? "#bdbebf" : "#eeeeee" - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml deleted file mode 100644 index bd261e52..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -ComboBox { - id: control - model: ["First", "Second", "Third"] - - delegate: ItemDelegate { - width: control.width - contentItem: Text { - text: modelData - color: "#21be2b" - font: control.font - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - } - highlighted: control.highlightedIndex == index - } - - indicator: Canvas { - id: canvas - x: control.width - width - control.rightPadding - y: control.topPadding + (control.availableHeight - height) / 2 - width: 12 - height: 8 - contextType: "2d" - - Connections { - target: control - onPressedChanged: canvas.requestPaint() - } - - onPaint: { - context.reset(); - context.moveTo(0, 0); - context.lineTo(width, 0); - context.lineTo(width / 2, height); - context.closePath(); - context.fillStyle = control.pressed ? "#17a81a" : "#21be2b"; - context.fill(); - } - } - - contentItem: Text { - leftPadding: 0 - rightPadding: control.indicator.width + control.spacing - - text: control.displayText - font: control.font - color: control.pressed ? "#17a81a" : "#21be2b" - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - elide: Text.ElideRight - } - - background: Rectangle { - implicitWidth: 120 - implicitHeight: 40 - border.color: control.pressed ? "#17a81a" : "#21be2b" - border.width: control.visualFocus ? 2 : 1 - radius: 2 - } - - popup: Popup { - y: control.height - 1 - width: control.width - implicitHeight: listview.contentHeight - padding: 1 - - contentItem: ListView { - id: listview - clip: true - model: control.popup.visible ? control.delegateModel : null - currentIndex: control.highlightedIndex - - ScrollIndicator.vertical: ScrollIndicator { } - } - - background: Rectangle { - border.color: "#21be2b" - radius: 2 - } - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-delegate.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-delegate.qml deleted file mode 100644 index d8b5d1fa..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-delegate.qml +++ /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 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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Item { - id: root - width: combo.width - height: combo.height + combo.popup.contentItem.height - ComboBox { - id: combo - model: ["First", "Second", "Third"] - popup.contentItem.parent: root - popup.contentItem.y: combo.height - delegate: ItemDelegate { - width: combo.width - text: modelData - autoExclusive: true - checked: combo.currentIndex === index - Rectangle { - visible: index === 0 - anchors.fill: parent - color: 'transparent' - border.color: 'red' - } - } - } -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-popup.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-popup.qml deleted file mode 100644 index 36569e15..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-popup.qml +++ /dev/null @@ -1,47 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Item { - id: root - width: combo.width - height: combo.height + combo.popup.contentItem.height - ComboBox { - id: combo - model: ["First", "Second", "Third"] - popup.contentItem.parent: root - popup.contentItem.y: combo.height - } - Rectangle { - parent: combo.popup.contentItem - anchors.fill: parent - color: 'transparent' - border.color: 'red' - } -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-dial-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dial-custom.qml deleted file mode 100644 index 658acc4b..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-dial-custom.qml +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -Dial { - id: control - background: Rectangle { - x: control.width / 2 - width / 2 - y: control.height / 2 - height / 2 - width: Math.max(64, Math.min(control.width, control.height)) - height: width - color: "transparent" - radius: width / 2 - border.color: control.pressed ? "#17a81a" : "#21be2b" - opacity: control.enabled ? 1 : 0.3 - } - - handle: Rectangle { - id: handleItem - x: background.x + background.width / 2 - handle.width / 2 - y: background.y + background.height / 2 - handle.height / 2 - width: 16 - height: 16 - color: control.pressed ? "#17a81a" : "#21be2b" - radius: 8 - antialiasing: true - opacity: control.enabled ? 1 : 0.3 - transform: [ - Translate { - y: -Math.min(background.width, background.height) * 0.4 + handle.height / 2 - }, - Rotation { - angle: control.angle - origin.x: handle.width / 2 - origin.y: handle.height / 2 - } - ] - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-dial-handle.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dial-handle.qml deleted file mode 100644 index 19d943a6..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-dial-handle.qml +++ /dev/null @@ -1,41 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Dial { - id: dial - - Rectangle { - parent: dial.handle - anchors.fill: parent - color: 'transparent' - border.color: 'red' - antialiasing: true - } -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-frame-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-frame-custom.qml deleted file mode 100644 index d11c431e..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-frame-custom.qml +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -Frame { - background: Rectangle { - color: "transparent" - border.color: "#21be2b" - radius: 2 - } - - Label { - text: qsTr("Content goes here!") - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-frame.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-frame.qml deleted file mode 100644 index 1ede733d..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-frame.qml +++ /dev/null @@ -1,41 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 2.0 - -//! [1] -Frame { - ColumnLayout { - anchors.fill: parent - CheckBox { text: qsTr("E-mail") } - CheckBox { text: qsTr("Calendar") } - CheckBox { text: qsTr("Contacts") } - } -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-checkable.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-checkable.qml deleted file mode 100644 index a2999925..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-checkable.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 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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 2.0 - -//! [1] -GroupBox { - label: CheckBox { - id: checkBox - checked: true - text: qsTr("Synchronize") - } - - ColumnLayout { - anchors.fill: parent - enabled: checkBox.checked - CheckBox { text: qsTr("E-mail") } - CheckBox { text: qsTr("Calendar") } - CheckBox { text: qsTr("Contacts") } - } -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-custom.qml deleted file mode 100644 index cb9ed049..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-custom.qml +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -GroupBox { - id: control - title: qsTr("GroupBox") - - background: Rectangle { - y: control.topPadding - control.padding - width: parent.width - height: parent.height - control.topPadding + control.padding - color: "transparent" - border.color: "#21be2b" - radius: 2 - } - - Label { - text: qsTr("Content goes here!") - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-label.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-label.qml deleted file mode 100644 index 74d0ea52..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-label.qml +++ /dev/null @@ -1,41 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -GroupBox { - width: 100 - height: 100 - title: "GroupBox" - Rectangle { - parent: label - anchors.fill: parent - color: 'transparent' - border.color: 'red' - } -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox.qml deleted file mode 100644 index f79f3aef..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox.qml +++ /dev/null @@ -1,42 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 2.0 - -//! [1] -GroupBox { - title: qsTr("Synchronize") - ColumnLayout { - anchors.fill: parent - CheckBox { text: qsTr("E-mail") } - CheckBox { text: qsTr("Calendar") } - CheckBox { text: qsTr("Contacts") } - } -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate-custom.qml deleted file mode 100644 index 002aae69..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate-custom.qml +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -ItemDelegate { - id: control - text: qsTr("ItemDelegate") - - contentItem: Text { - rightPadding: control.spacing - text: control.text - font: control.font - color: control.enabled ? (control.down ? "#17a81a" : "#21be2b") : "#bdbebf" - elide: Text.ElideRight - visible: control.text - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - } - - background: Rectangle { - implicitWidth: 100 - implicitHeight: 40 - opacity: enabled ? 1 : 0.3 - color: control.down ? "#dddedf" : "#eeeeee" - - Rectangle { - width: parent.width - height: 1 - color: control.down ? "#17a81a" : "#21be2b" - anchors.bottom: parent.bottom - } - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate.qml deleted file mode 100644 index 143b3323..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate.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 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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -//! [1] -ListView { - width: 160 - height: 240 - - model: Qt.fontFamilies() - - delegate: ItemDelegate { - text: modelData - width: parent.width - onClicked: console.log("clicked:", modelData) - } - - ScrollIndicator.vertical: ScrollIndicator { } -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-label-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-label-custom.qml deleted file mode 100644 index 98dbdc5e..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-label-custom.qml +++ /dev/null @@ -1,36 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -Label { - text: qsTr("Label") - color: "#21be2b" -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-label.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-label.qml deleted file mode 100644 index 4346c0eb..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-label.qml +++ /dev/null @@ -1,35 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -//! [1] -Label { - text: "Label" -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-menu-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-menu-custom.qml deleted file mode 100644 index a6971232..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-menu-custom.qml +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -Item { - id: window - width: menu.contentItem.width - height: menu.contentItem.height - visible: true - -// Indent it like this so that the indenting in the generated doc is normal. -Menu { - id: menu - contentItem.parent: window - background: Rectangle { - implicitWidth: 200 - implicitHeight: 200 - color: "#ffffff" - border.color: "#353637" - } - - MenuItem { - text: qsTr("New...") - } - MenuItem { - text: qsTr("Open...") - } - MenuItem { - text: qsTr("Save") - } -} -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-custom.qml deleted file mode 100644 index 65112ef4..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-custom.qml +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -PageIndicator { - id: control - count: 5 - currentIndex: 2 - - delegate: Rectangle { - implicitWidth: 8 - implicitHeight: 8 - - radius: width / 2 - color: "#21be2b" - - opacity: index === control.currentIndex ? 0.95 : pressed ? 0.7 : 0.45 - - Behavior on opacity { - OpacityAnimator { - duration: 100 - } - } - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-delegate.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-delegate.qml deleted file mode 100644 index 4b3ccf23..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-delegate.qml +++ /dev/null @@ -1,40 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -PageIndicator { - count: 5 - currentIndex: 2 - Rectangle { - parent: contentItem.children[0] - anchors.fill: parent - color: 'transparent' - border.color: 'red' - } -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-interactive.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-interactive.qml deleted file mode 100644 index 88cadc27..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-interactive.qml +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -import QtQuick.Controls 2.0 - -Pane { -//! [1] -SwipeView { - id: view - currentIndex: pageIndicator.currentIndex - anchors.fill: parent - - Page { - title: qsTr("Home") - } - Page { - title: qsTr("Discover") - } - Page { - title: qsTr("Activity") - } -} - -PageIndicator { - id: pageIndicator - interactive: true - count: view.count - currentIndex: view.currentIndex - - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter -} -//! [1] -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator.qml deleted file mode 100644 index 237bc6e7..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator.qml +++ /dev/null @@ -1,35 +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$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -//! [1] -PageIndicator { - count: 5 - currentIndex: 2 -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-pane-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-pane-custom.qml deleted file mode 100644 index 80519939..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-pane-custom.qml +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -Pane { - background: Rectangle { - color: "#eeeeee" - } - - Label { - text: qsTr("Content goes here!") - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-pane.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-pane.qml deleted file mode 100644 index 3d86499f..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-pane.qml +++ /dev/null @@ -1,41 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 2.0 - -//! [1] -Pane { - ColumnLayout { - anchors.fill: parent - CheckBox { text: qsTr("E-mail") } - CheckBox { text: qsTr("Calendar") } - CheckBox { text: qsTr("Contacts") } - } -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-custom.qml deleted file mode 100644 index 00c9ae67..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-custom.qml +++ /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 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -ProgressBar { - id: control - value: 0.5 - - background: Rectangle { - implicitWidth: 200 - implicitHeight: 4 - x: control.leftPadding - y: parent.height / 2 - height / 2 - color: "#e6e6e6" - radius: 2 - } - - contentItem: Item { - implicitWidth: background.implicitWidth - implicitHeight: background.implicitHeight - - Rectangle { - width: control.visualPosition * background.width - height: parent.height - radius: 2 - color: "#17a81a" - } - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-disabled.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-disabled.qml deleted file mode 100644 index 81c9f4ac..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-disabled.qml +++ /dev/null @@ -1,34 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -ProgressBar { - value: 0.5 - enabled: false -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-normal.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-normal.qml deleted file mode 100644 index a332d4c5..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-normal.qml +++ /dev/null @@ -1,33 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -ProgressBar { - value: 0.5 -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-checked.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-checked.qml deleted file mode 100644 index c1b1acce..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-checked.qml +++ /dev/null @@ -1,34 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -RadioButton { - text: "Checked" - checked: true -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-custom.qml deleted file mode 100644 index dba262be..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-custom.qml +++ /dev/null @@ -1,66 +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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -RadioButton { - id: control - text: qsTr("RadioButton") - checked: true - - indicator: Rectangle { - implicitWidth: 26 - implicitHeight: 26 - x: control.leftPadding - y: parent.height / 2 - height / 2 - radius: 13 - border.color: control.down ? "#17a81a" : "#21be2b" - - Rectangle { - width: 14 - height: 14 - x: 6 - y: 6 - radius: 7 - color: control.down ? "#17a81a" : "#21be2b" - visible: control.checked - } - } - - contentItem: Text { - text: control.text - font: control.font - opacity: enabled ? 1.0 : 0.3 - color: control.down ? "#17a81a" : "#21be2b" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - leftPadding: control.indicator.width + control.spacing - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-disabled.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-disabled.qml deleted file mode 100644 index 7ab68910..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-disabled.qml +++ /dev/null @@ -1,34 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -RadioButton { - text: "Disabled" - enabled: false -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-focused.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-focused.qml deleted file mode 100644 index 316a4653..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-focused.qml +++ /dev/null @@ -1,34 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -RadioButton { - text: "Focused" - focus: true -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-normal.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-normal.qml deleted file mode 100644 index b5ea853b..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-normal.qml +++ /dev/null @@ -1,33 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -RadioButton { - text: "Normal" -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiodelegate-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-radiodelegate-custom.qml deleted file mode 100644 index 6efb7803..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiodelegate-custom.qml +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -RadioDelegate { - id: control - text: qsTr("RadioDelegate") - checked: true - - contentItem: Text { - rightPadding: control.indicator.width + control.spacing - text: control.text - font: control.font - opacity: enabled ? 1.0 : 0.3 - color: control.down ? "#17a81a" : "#21be2b" - elide: Text.ElideRight - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - } - - indicator: Rectangle { - implicitWidth: 26 - implicitHeight: 26 - x: control.width - width - control.rightPadding - y: parent.height / 2 - height / 2 - radius: 13 - color: "transparent" - border.color: control.down ? "#17a81a" : "#21be2b" - - Rectangle { - width: 14 - height: 14 - x: 6 - y: 6 - radius: 7 - color: control.down ? "#17a81a" : "#21be2b" - visible: control.checked - } - } - - background: Rectangle { - implicitWidth: 100 - implicitHeight: 40 - visible: control.down || control.highlighted - color: control.down ? "#bdbebf" : "#eeeeee" - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml deleted file mode 100644 index 7e488d14..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.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 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -RangeSlider { - id: control - first.value: 0.25 - second.value: 0.75 - - background: Rectangle { - x: control.leftPadding - y: control.topPadding + control.availableHeight / 2 - height / 2 - implicitWidth: 200 - implicitHeight: 4 - width: control.availableWidth - height: implicitHeight - radius: 2 - color: "#bdbebf" - - Rectangle { - x: control.first.visualPosition * parent.width - width: control.second.visualPosition * parent.width - x - height: parent.height - color: "#21be2b" - radius: 2 - } - } - - first.handle: Rectangle { - x: control.leftPadding + first.visualPosition * (control.availableWidth - width) - y: control.topPadding + control.availableHeight / 2 - height / 2 - implicitWidth: 26 - implicitHeight: 26 - radius: 13 - color: first.pressed ? "#f0f0f0" : "#f6f6f6" - border.color: "#bdbebf" - } - - second.handle: Rectangle { - x: control.leftPadding + second.visualPosition * (control.availableWidth - width) - y: control.topPadding + control.availableHeight / 2 - height / 2 - implicitWidth: 26 - implicitHeight: 26 - radius: 13 - color: second.pressed ? "#f0f0f0" : "#f6f6f6" - border.color: "#bdbebf" - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-disabled.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-disabled.qml deleted file mode 100644 index e239b72f..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-disabled.qml +++ /dev/null @@ -1,35 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -RangeSlider { - first.value: 0.25 - second.value: 0.75 - enabled: false -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle-focused.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle-focused.qml deleted file mode 100644 index a05c8291..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle-focused.qml +++ /dev/null @@ -1,35 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -RangeSlider { - first.value: 0.25 - second.value: 0.75 - first.handle.focus: true -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle.qml deleted file mode 100644 index c5f064b0..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle.qml +++ /dev/null @@ -1,39 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -RangeSlider { - first.value: 0.25 - second.value: 0.75 - Rectangle { - anchors.fill: first.handle - color: "transparent" - border.color: "red" - } -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-normal.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-normal.qml deleted file mode 100644 index a41fbfad..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-normal.qml +++ /dev/null @@ -1,34 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -RangeSlider { - first.value: 0.25 - second.value: 0.75 -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle-focused.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle-focused.qml deleted file mode 100644 index ec19d0c0..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle-focused.qml +++ /dev/null @@ -1,35 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -RangeSlider { - first.value: 0.25 - second.value: 0.75 - second.handle.focus: true -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle.qml deleted file mode 100644 index 2e2123de..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle.qml +++ /dev/null @@ -1,39 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -RangeSlider { - first.value: 0.25 - second.value: 0.75 - Rectangle { - anchors.fill: second.handle - color: "transparent" - border.color: "red" - } -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-active.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-active.qml deleted file mode 100644 index 086541c8..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-active.qml +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Item { - width: 100 - height: 100 - - //! [1] - Flickable { - anchors.fill: parent - - contentWidth: parent.width * 2 - contentHeight: parent.height * 2 - - ScrollBar.horizontal: ScrollBar { id: hbar; active: vbar.active } - ScrollBar.vertical: ScrollBar { id: vbar; active: hbar.active } - } - //! [1] -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-custom.qml deleted file mode 100644 index 0bf13b3c..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-custom.qml +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -ScrollBar { - id: control - size: 0.3 - position: 0.2 - active: true - orientation: Qt.Vertical - - contentItem: Rectangle { - implicitWidth: 6 - implicitHeight: 100 - radius: width / 2 - color: control.pressed ? "#81e889" : "#c2f4c6" - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-active.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-active.qml deleted file mode 100644 index c118c7aa..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-active.qml +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Item { - width: 100 - height: 100 - - //! [1] - Flickable { - anchors.fill: parent - - contentWidth: parent.width * 2 - contentHeight: parent.height * 2 - - ScrollIndicator.horizontal: ScrollIndicator { id: hbar; active: vbar.active } - ScrollIndicator.vertical: ScrollIndicator { id: vbar; active: hbar.active } - } - //! [1] -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-custom.qml deleted file mode 100644 index 5720f4f7..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-custom.qml +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -ScrollIndicator { - id: control - size: 0.3 - position: 0.2 - active: true - orientation: Qt.Vertical - - contentItem: Rectangle { - implicitWidth: 2 - implicitHeight: 100 - color: "#c2f4c6" - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-slider-custom.qml deleted file mode 100644 index ebc11f46..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-custom.qml +++ /dev/null @@ -1,64 +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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -Slider { - id: control - value: 0.5 - - background: Rectangle { - x: control.leftPadding - y: control.topPadding + control.availableHeight / 2 - height / 2 - implicitWidth: 200 - implicitHeight: 4 - width: control.availableWidth - height: implicitHeight - radius: 2 - color: "#bdbebf" - - Rectangle { - width: control.visualPosition * parent.width - height: parent.height - color: "#21be2b" - radius: 2 - } - } - - handle: Rectangle { - x: control.leftPadding + control.visualPosition * (control.availableWidth - width) - y: control.topPadding + control.availableHeight / 2 - height / 2 - implicitWidth: 26 - implicitHeight: 26 - radius: 13 - color: control.pressed ? "#f0f0f0" : "#f6f6f6" - border.color: "#bdbebf" - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-disabled.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-slider-disabled.qml deleted file mode 100644 index bde161aa..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-disabled.qml +++ /dev/null @@ -1,34 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Slider { - value: 0.5 - enabled: false -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-focused.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-slider-focused.qml deleted file mode 100644 index b32f8b5a..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-focused.qml +++ /dev/null @@ -1,34 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Slider { - value: 0.5 - focus: true -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-handle.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-slider-handle.qml deleted file mode 100644 index 20b569f3..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-handle.qml +++ /dev/null @@ -1,38 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Slider { - value: 0.5 - Rectangle { - anchors.fill: handle - color: "transparent" - border.color: "red" - } -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-normal.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-slider-normal.qml deleted file mode 100644 index 8363e862..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-normal.qml +++ /dev/null @@ -1,33 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Slider { - value: 0.5 -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-custom.qml deleted file mode 100644 index 6433fd80..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-custom.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 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -SpinBox { - id: control - value: 50 - editable: true - - contentItem: TextInput { - z: 2 - text: control.textFromValue(control.value, control.locale) - - font: control.font - color: "#21be2b" - selectionColor: "#21be2b" - selectedTextColor: "#ffffff" - horizontalAlignment: Qt.AlignHCenter - verticalAlignment: Qt.AlignVCenter - - readOnly: !control.editable - validator: control.validator - inputMethodHints: Qt.ImhFormattedNumbersOnly - } - - up.indicator: Rectangle { - x: control.mirrored ? 0 : parent.width - width - height: parent.height - implicitWidth: 40 - implicitHeight: 40 - color: up.pressed ? "#e4e4e4" : "#f6f6f6" - border.color: enabled ? "#21be2b" : "#bdbebf" - - Text { - text: "+" - font.pixelSize: control.font.pixelSize * 2 - color: "#21be2b" - anchors.fill: parent - fontSizeMode: Text.Fit - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - - down.indicator: Rectangle { - x: control.mirrored ? parent.width - width : 0 - height: parent.height - implicitWidth: 40 - implicitHeight: 40 - color: down.pressed ? "#e4e4e4" : "#f6f6f6" - border.color: enabled ? "#21be2b" : "#bdbebf" - - Text { - text: "-" - font.pixelSize: control.font.pixelSize * 2 - color: "#21be2b" - anchors.fill: parent - fontSizeMode: Text.Fit - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - - background: Rectangle { - implicitWidth: 140 - border.color: "#bdbebf" - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-double.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-double.qml deleted file mode 100644 index 15af31ae..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-double.qml +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -//! [1] -SpinBox { - id: spinbox - from: 0 - value: 110 - to: 100 * 100 - stepSize: 100 - anchors.centerIn: parent - - property int decimals: 2 - property real realValue: value / 100 - - validator: DoubleValidator { - bottom: Math.min(spinbox.from, spinbox.to) - top: Math.max(spinbox.from, spinbox.to) - } - - textFromValue: function(value, locale) { - return Number(value / 100).toLocaleString(locale, 'f', spinbox.decimals) - } - - valueFromText: function(text, locale) { - return Number.fromLocaleString(locale, text) * 100 - } -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-down.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-down.qml deleted file mode 100644 index 419dae5c..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-down.qml +++ /dev/null @@ -1,38 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -SpinBox { - value: 50 - Rectangle { - anchors.fill: down.indicator - color: "transparent" - border.color: "red" - } -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-textual.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-textual.qml deleted file mode 100644 index 814b8b28..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-textual.qml +++ /dev/null @@ -1,55 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -//! [1] -SpinBox { - from: 0 - to: items.length - 1 - value: 1 // "Medium" - - property var items: ["Small", "Medium", "Large"] - - validator: RegExpValidator { - regExp: new RegExp("(Small|Medium|Large)", "i") - } - - textFromValue: function(value) { - return items[value]; - } - - valueFromText: function(text) { - for (var i = 0; i < items.length; ++i) { - if (items[i].toLowerCase().indexOf(text.toLowerCase()) === 0) - return i - } - return sb.value - } -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-up.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-up.qml deleted file mode 100644 index b4b0fab3..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-up.qml +++ /dev/null @@ -1,38 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -SpinBox { - value: 50 - Rectangle { - anchors.fill: up.indicator - color: "transparent" - border.color: "red" - } -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox.qml deleted file mode 100644 index 6616ed60..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox.qml +++ /dev/null @@ -1,35 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -//! [1] -SpinBox { - value: 50 -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate-custom.qml deleted file mode 100644 index ae63efed..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate-custom.qml +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -SwipeDelegate { - id: control - text: qsTr("SwipeDelegate") - - Component { - id: component - - Rectangle { - color: control.swipe.complete && control.down ? "#333" : "#444" - width: parent.width - height: parent.height - clip: true - - Label { - text: qsTr("Press me!") - color: "#21be2b" - anchors.centerIn: parent - } - } - } - - swipe.left: component - swipe.right: component - - contentItem: Text { - text: control.text - font: control.font - color: control.enabled ? (control.down ? "#17a81a" : "#21be2b") : "#bdbebf" - elide: Text.ElideRight - visible: control.text - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - - Behavior on x { - enabled: !control.down - NumberAnimation { - easing.type: Easing.InOutCubic - duration: 400 - } - } - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-indicator.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-indicator.qml deleted file mode 100644 index 2ba8df9c..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-indicator.qml +++ /dev/null @@ -1,63 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Item { - width: 200 - height: 320 - - //! [1] - SwipeView { - id: view - - currentIndex: 1 - anchors.fill: parent - - Item { - id: firstPage - } - Item { - id: secondPage - } - Item { - id: thirdPage - } - } - - PageIndicator { - id: indicator - - count: view.count - currentIndex: view.currentIndex - - anchors.bottom: view.bottom - anchors.horizontalCenter: parent.horizontalCenter - } - //! [1] -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-checked.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-switch-checked.qml deleted file mode 100644 index f9a18b1c..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-checked.qml +++ /dev/null @@ -1,34 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Switch { - text: "Checked" - checked: true -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-switch-custom.qml deleted file mode 100644 index 698c1a05..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-custom.qml +++ /dev/null @@ -1,65 +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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -Switch { - id: control - text: qsTr("Switch") - - indicator: Rectangle { - implicitWidth: 48 - implicitHeight: 26 - x: control.leftPadding - y: parent.height / 2 - height / 2 - radius: 13 - color: control.checked ? "#17a81a" : "#ffffff" - border.color: control.checked ? "#17a81a" : "#cccccc" - - Rectangle { - x: control.checked ? parent.width - width : 0 - width: 26 - height: 26 - radius: 13 - color: control.down ? "#cccccc" : "#ffffff" - border.color: control.checked ? (control.down ? "#17a81a" : "#21be2b") : "#999999" - } - } - - contentItem: Text { - text: control.text - font: control.font - opacity: enabled ? 1.0 : 0.3 - color: control.down ? "#17a81a" : "#21be2b" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - leftPadding: control.indicator.width + control.spacing - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-disabled.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-switch-disabled.qml deleted file mode 100644 index a40586b5..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-disabled.qml +++ /dev/null @@ -1,34 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Switch { - text: "Disabled" - enabled: false -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-focused.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-switch-focused.qml deleted file mode 100644 index f98f2c90..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-focused.qml +++ /dev/null @@ -1,34 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Switch { - text: "Focused" - focus: true -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-normal.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-switch-normal.qml deleted file mode 100644 index a55c2854..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-normal.qml +++ /dev/null @@ -1,33 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Switch { - text: "Normal" -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-switchdelegate-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-switchdelegate-custom.qml deleted file mode 100644 index 8d0daa0a..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-switchdelegate-custom.qml +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -SwitchDelegate { - id: control - text: qsTr("SwitchDelegate") - checked: true - - contentItem: Text { - rightPadding: control.indicator.width + control.spacing - text: control.text - font: control.font - opacity: enabled ? 1.0 : 0.3 - color: control.down ? "#17a81a" : "#21be2b" - elide: Text.ElideRight - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - } - - indicator: Rectangle { - implicitWidth: 48 - implicitHeight: 26 - x: control.width - width - control.rightPadding - y: parent.height / 2 - height / 2 - radius: 13 - color: control.checked ? "#17a81a" : "transparent" - border.color: control.checked ? "#17a81a" : "#cccccc" - - Rectangle { - x: control.checked ? parent.width - width : 0 - width: 26 - height: 26 - radius: 13 - color: control.down ? "#cccccc" : "#ffffff" - border.color: control.checked ? (control.down ? "#17a81a" : "#21be2b") : "#999999" - } - } - - background: Rectangle { - implicitWidth: 100 - implicitHeight: 40 - visible: control.down || control.highlighted - color: control.down ? "#bdbebf" : "#eeeeee" - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-custom.qml deleted file mode 100644 index 1873fba9..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-custom.qml +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -TabBar { - id: control - - background: Rectangle { - color: "#eeeeee" - } - - TabButton { - text: qsTr("Home") - } - TabButton { - text: qsTr("Discover") - } - TabButton { - text: qsTr("Activity") - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-flickable.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-flickable.qml deleted file mode 100644 index 2a4fac0e..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-flickable.qml +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -Item { - width: 360 - height: bar.height - -//! [1] -TabBar { - id: bar - width: parent.width - - Repeater { - model: ["First", "Second", "Third", "Fourth", "Fifth"] - - TabButton { - text: modelData - width: Math.max(100, bar.width / 5) - } - } -} -//! [1] -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar.qml deleted file mode 100644 index b445ee67..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar.qml +++ /dev/null @@ -1,64 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.0 - -Column { - width: 300 - - //! [1] - TabBar { - id: bar - width: parent.width - TabButton { - text: qsTr("Home") - } - TabButton { - text: qsTr("Discover") - } - TabButton { - text: qsTr("Activity") - } - } - - StackLayout { - width: parent.width - currentIndex: bar.currentIndex - Item { - id: homeTab - } - Item { - id: discoverTab - } - Item { - id: activityTab - } - } - //! [1] -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbutton.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tabbutton.qml deleted file mode 100644 index 67e5e1e0..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbutton.qml +++ /dev/null @@ -1,43 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -//! [1] -TabBar { - TabButton { - text: qsTr("Home") - } - TabButton { - text: qsTr("Discover") - } - TabButton { - text: qsTr("Activity") - } -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-textarea-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-textarea-custom.qml deleted file mode 100644 index f70c7135..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-textarea-custom.qml +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -TextArea { - id: control - placeholderText: qsTr("Enter description") - - background: Rectangle { - implicitWidth: 200 - implicitHeight: 40 - border.color: control.enabled ? "#21be2b" : "transparent" - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-textarea-flickable.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-textarea-flickable.qml deleted file mode 100644 index e11750cb..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-textarea-flickable.qml +++ /dev/null @@ -1,50 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Item { - width: 100 - height: 100 - - Binding { target: flickable.ScrollBar.vertical; property: "active"; value: true } - - //! [1] - Flickable { - id: flickable - anchors.fill: parent - - TextArea.flickable: TextArea { - text: "TextArea\n...\n...\n...\n...\n...\n...\n" - wrapMode: TextArea.Wrap - } - - ScrollBar.vertical: ScrollBar { } - } - //! [1] -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-custom.qml deleted file mode 100644 index 0deb0e5c..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-custom.qml +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -TextField { - id: control - placeholderText: qsTr("Enter description") - - background: Rectangle { - implicitWidth: 200 - implicitHeight: 40 - color: control.enabled ? "transparent" : "#353637" - border.color: control.enabled ? "#21be2b" : "transparent" - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-disabled.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-disabled.qml deleted file mode 100644 index ac798f53..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-disabled.qml +++ /dev/null @@ -1,35 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -TextField { - width: 80 - text: "Disabled" - enabled: false -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-focused.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-focused.qml deleted file mode 100644 index a4e1b3b1..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-focused.qml +++ /dev/null @@ -1,35 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -TextField { - width: 80 - text: "Focused" - focus: true -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-normal.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-normal.qml deleted file mode 100644 index 12c7ead9..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-normal.qml +++ /dev/null @@ -1,34 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -TextField { - width: 80 - text: "Normal" -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-toolbar-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-toolbar-custom.qml deleted file mode 100644 index 3e98808c..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-toolbar-custom.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -import QtQuick 2.6 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 2.0 - -//! [file] -ToolBar { - id: control - - background: Rectangle { - implicitHeight: 40 - color: "#eeeeee" - - Rectangle { - width: parent.width - height: 1 - anchors.bottom: parent.bottom - color: "transparent" - border.color: "#21be2b" - } - } - - RowLayout { - anchors.fill: parent - ToolButton { - text: qsTr("Undo") - } - ToolButton { - text: qsTr("Redo") - } - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-toolbar.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-toolbar.qml deleted file mode 100644 index fd6754f8..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-toolbar.qml +++ /dev/null @@ -1,47 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 2.0 - -//! [1] -ToolBar { - RowLayout { - anchors.fill: parent - ToolButton { - text: qsTr("\u25C0 Qt") - onClicked: stack.pop() - } - Item { Layout.fillWidth: true } - Switch { - checked: true - text: qsTr("Notifications") - } - } -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-toolbutton-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-toolbutton-custom.qml deleted file mode 100644 index 10491cb5..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-toolbutton-custom.qml +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -ToolButton { - id: control - text: qsTr("ToolButton") - width: 120 - - contentItem: Text { - text: control.text - font: control.font - opacity: enabled ? 1.0 : 0.3 - color: control.down ? "#17a81a" : "#21be2b" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - elide: Text.ElideRight - } - - background: Rectangle { - implicitWidth: 40 - implicitHeight: 40 - color: Qt.darker("#33333333", control.enabled && (control.checked || control.highlighted) ? 1.5 : 1.0) - opacity: enabled ? 1 : 0.3 - visible: control.down || (control.enabled && (control.checked || control.highlighted)) - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-hover.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-hover.qml deleted file mode 100644 index 330ab83c..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-hover.qml +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -//! [1] -Button { - text: qsTr("Button") - hoverEnabled: true - - ToolTip.delay: 1000 - ToolTip.timeout: 5000 - ToolTip.visible: hovered - ToolTip.text: qsTr("This tool tip is shown after hovering the button for a second.") -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-pressandhold.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-pressandhold.qml deleted file mode 100644 index eddb09e6..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-pressandhold.qml +++ /dev/null @@ -1,39 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -//! [1] -Button { - text: qsTr("Button") - - ToolTip.visible: pressed - ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval - ToolTip.text: qsTr("This tool tip is shown after pressing and holding the button down.") -} -//! [1] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-slider.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-slider.qml deleted file mode 100644 index e6a386c1..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-slider.qml +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Window 2.2 -import QtQuick.Controls 2.0 - -Item { - id: root - width: slider.width - height: slider.height * 2.0 - - Binding { target: slider.anchors; property: "centerIn"; value: root } - Binding { target: slider.anchors; property: "verticalCenterOffset"; value: slider.height / 2 } - Binding { target: slider; property: "pressed"; value: root.Window.active } - - //! [1] - Slider { - id: slider - value: 0.5 - - ToolTip { - parent: slider.handle - visible: slider.pressed - text: slider.position.toFixed(1) - } - } - //! [1] -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip.qml deleted file mode 100644 index c85f91bb..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip.qml +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Window 2.2 -import QtQuick.Controls 2.0 - -Item { - id: root - width: 360 - height: button.height * 2 - - property Button button: children[0] - - Binding { target: button; property: "down"; value: root.Window.active } - Binding { target: button.anchors; property: "bottom"; value: root.bottom } - Binding { target: button.anchors; property: "horizontalCenter"; value: root.horizontalCenter } - - //! [1] - Button { - text: qsTr("Button") - - ToolTip.visible: pressed - ToolTip.text: qsTr("A descriptive tool tip of what the button does") - } - //! [1] -} diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-custom.qml deleted file mode 100644 index d2b4f960..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-custom.qml +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ - -//! [file] -import QtQuick 2.6 -import QtQuick.Controls 2.0 - -Tumbler { - id: control - model: 15 - visibleItemCount: 5 - - background: Item { - Rectangle { - opacity: control.enabled ? 0.2 : 0.1 - border.color: "#000000" - width: parent.width - height: 1 - anchors.top: parent.top - } - - Rectangle { - opacity: control.enabled ? 0.2 : 0.1 - border.color: "#000000" - width: parent.width - height: 1 - anchors.bottom: parent.bottom - } - } - - delegate: Text { - text: qsTr("Item %1").arg(modelData + 1) - font: control.font - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - opacity: 1.0 - Math.abs(Tumbler.displacement) / (visibleItemCount / 2) - } - - Rectangle { - anchors.horizontalCenter: control.horizontalCenter - y: control.height * 0.4 - width: 40 - height: 1 - color: "#21be2b" - } - - Rectangle { - anchors.horizontalCenter: control.horizontalCenter - y: control.height * 0.6 - width: 40 - height: 1 - color: "#21be2b" - } -} -//! [file] diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-delegate.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-delegate.qml deleted file mode 100644 index 4d389ab7..00000000 --- a/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-delegate.qml +++ /dev/null @@ -1,47 +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$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -Tumbler { - id: tumbler - model: 5 - - Column { - Repeater { - model: 3 - - Rectangle { - width: tumbler.contentItem.width - height: tumbler.contentItem.height / 3 - color: 'transparent' - border.color: 'red' - } - } - } -} diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-calendarmodel.qml b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-calendarmodel.qml new file mode 100644 index 00000000..dfbf4fbc --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-calendarmodel.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Qt.labs.calendar 1.0 +import QtQuick.Controls 2.0 + +//! [1] +ListView { + id: listview + + width: 200; height: 200 + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + highlightRangeMode: ListView.StrictlyEnforceRange + + model: CalendarModel { + from: new Date(2015, 0, 1) + to: new Date(2015, 11, 31) + } + + delegate: MonthGrid { + width: listview.width + height: listview.height + + month: model.month + year: model.year + locale: Qt.locale("en_US") + } + + ScrollIndicator.horizontal: ScrollIndicator { } +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow-layout.qml b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow-layout.qml new file mode 100644 index 00000000..ce41d224 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow-layout.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.0 +import Qt.labs.calendar 1.0 + +//! [1] +ColumnLayout { + DayOfWeekRow { + locale: grid.locale + Layout.fillWidth: true + } + + MonthGrid { + id: grid + month: Calendar.December + year: 2015 + locale: Qt.locale("en_US") + Layout.fillWidth: true + } +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow.qml b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow.qml new file mode 100644 index 00000000..5ea3714c --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Qt.labs.calendar 1.0 + +//! [1] +DayOfWeekRow { + locale: Qt.locale("en_US") +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid-layout.qml b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid-layout.qml new file mode 100644 index 00000000..346e6099 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid-layout.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.0 +import Qt.labs.calendar 1.0 + +//! [1] +GridLayout { + columns: 2 + + DayOfWeekRow { + locale: grid.locale + + Layout.column: 1 + Layout.fillWidth: true + } + + WeekNumberColumn { + month: grid.month + year: grid.year + locale: grid.locale + + Layout.fillHeight: true + } + + MonthGrid { + id: grid + month: Calendar.December + year: 2015 + locale: Qt.locale("en_US") + + Layout.fillWidth: true + Layout.fillHeight: true + } +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid.qml b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid.qml new file mode 100644 index 00000000..16f872b8 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid.qml @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Qt.labs.calendar 1.0 + +//! [1] +MonthGrid { + month: Calendar.December + year: 2015 + locale: Qt.locale("en_US") +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn-layout.qml b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn-layout.qml new file mode 100644 index 00000000..d105553f --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn-layout.qml @@ -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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.0 +import Qt.labs.calendar 1.0 + +//! [1] +RowLayout { + WeekNumberColumn { + month: grid.month + year: grid.year + locale: grid.locale + Layout.fillHeight: true + } + + MonthGrid { + id: grid + month: Calendar.December + year: 2015 + locale: Qt.locale("en_US") + Layout.fillHeight: true + } +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn.qml b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn.qml new file mode 100644 index 00000000..e58e5c7b --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn.qml @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Qt.labs.calendar 1.0 + +//! [1] +WeekNumberColumn { + month: Calendar.December + year: 2015 + locale: Qt.locale("en_US") +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml new file mode 100644 index 00000000..82ed9cdc --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +BusyIndicator { + id: control + + contentItem: Item { + implicitWidth: 64 + implicitHeight: 64 + + Item { + id: item + x: parent.width / 2 - 32 + y: parent.height / 2 - 32 + width: 64 + height: 64 + opacity: control.running ? 1 : 0 + + Behavior on opacity { + OpacityAnimator { + duration: 250 + } + } + + RotationAnimator { + target: item + running: control.visible && control.running + from: 0 + to: 360 + loops: Animation.Infinite + duration: 1250 + } + + Repeater { + id: repeater + model: 6 + + Rectangle { + x: item.width / 2 - width / 2 + y: item.height / 2 - height / 2 + implicitWidth: 10 + implicitHeight: 10 + radius: 5 + color: "#21be2b" + transform: [ + Translate { + y: -Math.min(item.width, item.height) * 0.5 + 5 + }, + Rotation { + angle: index / repeater.count * 360 + origin.x: 5 + origin.y: 5 + } + ] + } + } + } + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml new file mode 100644 index 00000000..eac6b831 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +Button { + id: control + text: qsTr("Button") + + contentItem: Text { + text: control.text + font: control.font + opacity: enabled ? 1.0 : 0.3 + color: control.down ? "#17a81a" : "#21be2b" + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + + background: Rectangle { + implicitWidth: 100 + implicitHeight: 40 + opacity: enabled ? 1 : 0.3 + border.color: control.down ? "#17a81a" : "#21be2b" + border.width: 1 + radius: 2 + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml new file mode 100644 index 00000000..f4555c90 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Button { + width: 80 + text: "Disabled" + enabled: false +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml new file mode 100644 index 00000000..a99346a6 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Button { + width: 80 + text: "Focused" + focus: true +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml new file mode 100644 index 00000000..f206bcec --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Button { + width: 80 + text: "Normal" +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml new file mode 100644 index 00000000..8a941561 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Button { + width: 80 + text: "Pressed" + down: true +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml new file mode 100644 index 00000000..075e6342 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +CheckBox { + text: "Checked" + checked: true +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml new file mode 100644 index 00000000..0465ec80 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +CheckBox { + id: control + text: qsTr("CheckBox") + checked: true + + indicator: Rectangle { + implicitWidth: 26 + implicitHeight: 26 + x: control.leftPadding + y: parent.height / 2 - height / 2 + radius: 3 + border.color: control.down ? "#17a81a" : "#21be2b" + + Rectangle { + width: 14 + height: 14 + x: 6 + y: 6 + radius: 2 + color: control.down ? "#17a81a" : "#21be2b" + visible: control.checked + } + } + + contentItem: Text { + text: control.text + font: control.font + opacity: enabled ? 1.0 : 0.3 + color: control.down ? "#17a81a" : "#21be2b" + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + leftPadding: control.indicator.width + control.spacing + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml new file mode 100644 index 00000000..4878cf31 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +CheckBox { + text: "Disabled" + enabled: false +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml new file mode 100644 index 00000000..93f1c214 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +CheckBox { + text: "Focused" + focus: true +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml new file mode 100644 index 00000000..a840116e --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml @@ -0,0 +1,33 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +CheckBox { + text: "Normal" +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkdelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkdelegate-custom.qml new file mode 100644 index 00000000..483f9838 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkdelegate-custom.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +CheckDelegate { + id: control + text: qsTr("CheckDelegate") + checked: true + + contentItem: Text { + rightPadding: control.indicator.width + control.spacing + text: control.text + font: control.font + opacity: enabled ? 1.0 : 0.3 + color: control.down ? "#17a81a" : "#21be2b" + elide: Text.ElideRight + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + + indicator: Rectangle { + implicitWidth: 26 + implicitHeight: 26 + x: control.width - width - control.rightPadding + y: control.topPadding + control.availableHeight / 2 - height / 2 + radius: 3 + color: "transparent" + border.color: control.down ? "#17a81a" : "#21be2b" + + Rectangle { + width: 14 + height: 14 + x: 6 + y: 6 + radius: 2 + color: control.down ? "#17a81a" : "#21be2b" + visible: control.checked + } + } + + background: Rectangle { + implicitWidth: 100 + implicitHeight: 40 + visible: control.down || control.highlighted + color: control.down ? "#bdbebf" : "#eeeeee" + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml new file mode 100644 index 00000000..bd261e52 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +ComboBox { + id: control + model: ["First", "Second", "Third"] + + delegate: ItemDelegate { + width: control.width + contentItem: Text { + text: modelData + color: "#21be2b" + font: control.font + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter + } + highlighted: control.highlightedIndex == index + } + + indicator: Canvas { + id: canvas + x: control.width - width - control.rightPadding + y: control.topPadding + (control.availableHeight - height) / 2 + width: 12 + height: 8 + contextType: "2d" + + Connections { + target: control + onPressedChanged: canvas.requestPaint() + } + + onPaint: { + context.reset(); + context.moveTo(0, 0); + context.lineTo(width, 0); + context.lineTo(width / 2, height); + context.closePath(); + context.fillStyle = control.pressed ? "#17a81a" : "#21be2b"; + context.fill(); + } + } + + contentItem: Text { + leftPadding: 0 + rightPadding: control.indicator.width + control.spacing + + text: control.displayText + font: control.font + color: control.pressed ? "#17a81a" : "#21be2b" + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + + background: Rectangle { + implicitWidth: 120 + implicitHeight: 40 + border.color: control.pressed ? "#17a81a" : "#21be2b" + border.width: control.visualFocus ? 2 : 1 + radius: 2 + } + + popup: Popup { + y: control.height - 1 + width: control.width + implicitHeight: listview.contentHeight + padding: 1 + + contentItem: ListView { + id: listview + clip: true + model: control.popup.visible ? control.delegateModel : null + currentIndex: control.highlightedIndex + + ScrollIndicator.vertical: ScrollIndicator { } + } + + background: Rectangle { + border.color: "#21be2b" + radius: 2 + } + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml new file mode 100644 index 00000000..d8b5d1fa --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Item { + id: root + width: combo.width + height: combo.height + combo.popup.contentItem.height + ComboBox { + id: combo + model: ["First", "Second", "Third"] + popup.contentItem.parent: root + popup.contentItem.y: combo.height + delegate: ItemDelegate { + width: combo.width + text: modelData + autoExclusive: true + checked: combo.currentIndex === index + Rectangle { + visible: index === 0 + anchors.fill: parent + color: 'transparent' + border.color: 'red' + } + } + } +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml new file mode 100644 index 00000000..36569e15 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Item { + id: root + width: combo.width + height: combo.height + combo.popup.contentItem.height + ComboBox { + id: combo + model: ["First", "Second", "Third"] + popup.contentItem.parent: root + popup.contentItem.y: combo.height + } + Rectangle { + parent: combo.popup.contentItem + anchors.fill: parent + color: 'transparent' + border.color: 'red' + } +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml new file mode 100644 index 00000000..658acc4b --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +Dial { + id: control + background: Rectangle { + x: control.width / 2 - width / 2 + y: control.height / 2 - height / 2 + width: Math.max(64, Math.min(control.width, control.height)) + height: width + color: "transparent" + radius: width / 2 + border.color: control.pressed ? "#17a81a" : "#21be2b" + opacity: control.enabled ? 1 : 0.3 + } + + handle: Rectangle { + id: handleItem + x: background.x + background.width / 2 - handle.width / 2 + y: background.y + background.height / 2 - handle.height / 2 + width: 16 + height: 16 + color: control.pressed ? "#17a81a" : "#21be2b" + radius: 8 + antialiasing: true + opacity: control.enabled ? 1 : 0.3 + transform: [ + Translate { + y: -Math.min(background.width, background.height) * 0.4 + handle.height / 2 + }, + Rotation { + angle: control.angle + origin.x: handle.width / 2 + origin.y: handle.height / 2 + } + ] + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml new file mode 100644 index 00000000..19d943a6 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Dial { + id: dial + + Rectangle { + parent: dial.handle + anchors.fill: parent + color: 'transparent' + border.color: 'red' + antialiasing: true + } +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml new file mode 100644 index 00000000..d11c431e --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +Frame { + background: Rectangle { + color: "transparent" + border.color: "#21be2b" + radius: 2 + } + + Label { + text: qsTr("Content goes here!") + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml new file mode 100644 index 00000000..1ede733d --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.0 +import QtQuick.Controls 2.0 + +//! [1] +Frame { + ColumnLayout { + anchors.fill: parent + CheckBox { text: qsTr("E-mail") } + CheckBox { text: qsTr("Calendar") } + CheckBox { text: qsTr("Contacts") } + } +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml new file mode 100644 index 00000000..a2999925 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.0 +import QtQuick.Controls 2.0 + +//! [1] +GroupBox { + label: CheckBox { + id: checkBox + checked: true + text: qsTr("Synchronize") + } + + ColumnLayout { + anchors.fill: parent + enabled: checkBox.checked + CheckBox { text: qsTr("E-mail") } + CheckBox { text: qsTr("Calendar") } + CheckBox { text: qsTr("Contacts") } + } +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml new file mode 100644 index 00000000..cb9ed049 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +GroupBox { + id: control + title: qsTr("GroupBox") + + background: Rectangle { + y: control.topPadding - control.padding + width: parent.width + height: parent.height - control.topPadding + control.padding + color: "transparent" + border.color: "#21be2b" + radius: 2 + } + + Label { + text: qsTr("Content goes here!") + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml new file mode 100644 index 00000000..74d0ea52 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +GroupBox { + width: 100 + height: 100 + title: "GroupBox" + Rectangle { + parent: label + anchors.fill: parent + color: 'transparent' + border.color: 'red' + } +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml new file mode 100644 index 00000000..f79f3aef --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.0 +import QtQuick.Controls 2.0 + +//! [1] +GroupBox { + title: qsTr("Synchronize") + ColumnLayout { + anchors.fill: parent + CheckBox { text: qsTr("E-mail") } + CheckBox { text: qsTr("Calendar") } + CheckBox { text: qsTr("Contacts") } + } +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml new file mode 100644 index 00000000..002aae69 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +ItemDelegate { + id: control + text: qsTr("ItemDelegate") + + contentItem: Text { + rightPadding: control.spacing + text: control.text + font: control.font + color: control.enabled ? (control.down ? "#17a81a" : "#21be2b") : "#bdbebf" + elide: Text.ElideRight + visible: control.text + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + + background: Rectangle { + implicitWidth: 100 + implicitHeight: 40 + opacity: enabled ? 1 : 0.3 + color: control.down ? "#dddedf" : "#eeeeee" + + Rectangle { + width: parent.width + height: 1 + color: control.down ? "#17a81a" : "#21be2b" + anchors.bottom: parent.bottom + } + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml new file mode 100644 index 00000000..143b3323 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +//! [1] +ListView { + width: 160 + height: 240 + + model: Qt.fontFamilies() + + delegate: ItemDelegate { + text: modelData + width: parent.width + onClicked: console.log("clicked:", modelData) + } + + ScrollIndicator.vertical: ScrollIndicator { } +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml new file mode 100644 index 00000000..98dbdc5e --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +Label { + text: qsTr("Label") + color: "#21be2b" +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml new file mode 100644 index 00000000..4346c0eb --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +//! [1] +Label { + text: "Label" +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml new file mode 100644 index 00000000..a6971232 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +Item { + id: window + width: menu.contentItem.width + height: menu.contentItem.height + visible: true + +// Indent it like this so that the indenting in the generated doc is normal. +Menu { + id: menu + contentItem.parent: window + background: Rectangle { + implicitWidth: 200 + implicitHeight: 200 + color: "#ffffff" + border.color: "#353637" + } + + MenuItem { + text: qsTr("New...") + } + MenuItem { + text: qsTr("Open...") + } + MenuItem { + text: qsTr("Save") + } +} +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml new file mode 100644 index 00000000..65112ef4 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +PageIndicator { + id: control + count: 5 + currentIndex: 2 + + delegate: Rectangle { + implicitWidth: 8 + implicitHeight: 8 + + radius: width / 2 + color: "#21be2b" + + opacity: index === control.currentIndex ? 0.95 : pressed ? 0.7 : 0.45 + + Behavior on opacity { + OpacityAnimator { + duration: 100 + } + } + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml new file mode 100644 index 00000000..4b3ccf23 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +PageIndicator { + count: 5 + currentIndex: 2 + Rectangle { + parent: contentItem.children[0] + anchors.fill: parent + color: 'transparent' + border.color: 'red' + } +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-interactive.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-interactive.qml new file mode 100644 index 00000000..88cadc27 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-interactive.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +import QtQuick.Controls 2.0 + +Pane { +//! [1] +SwipeView { + id: view + currentIndex: pageIndicator.currentIndex + anchors.fill: parent + + Page { + title: qsTr("Home") + } + Page { + title: qsTr("Discover") + } + Page { + title: qsTr("Activity") + } +} + +PageIndicator { + id: pageIndicator + interactive: true + count: view.count + currentIndex: view.currentIndex + + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter +} +//! [1] +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml new file mode 100644 index 00000000..237bc6e7 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +//! [1] +PageIndicator { + count: 5 + currentIndex: 2 +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml new file mode 100644 index 00000000..80519939 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +Pane { + background: Rectangle { + color: "#eeeeee" + } + + Label { + text: qsTr("Content goes here!") + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml new file mode 100644 index 00000000..3d86499f --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.0 +import QtQuick.Controls 2.0 + +//! [1] +Pane { + ColumnLayout { + anchors.fill: parent + CheckBox { text: qsTr("E-mail") } + CheckBox { text: qsTr("Calendar") } + CheckBox { text: qsTr("Contacts") } + } +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml new file mode 100644 index 00000000..00c9ae67 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +ProgressBar { + id: control + value: 0.5 + + background: Rectangle { + implicitWidth: 200 + implicitHeight: 4 + x: control.leftPadding + y: parent.height / 2 - height / 2 + color: "#e6e6e6" + radius: 2 + } + + contentItem: Item { + implicitWidth: background.implicitWidth + implicitHeight: background.implicitHeight + + Rectangle { + width: control.visualPosition * background.width + height: parent.height + radius: 2 + color: "#17a81a" + } + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-disabled.qml new file mode 100644 index 00000000..81c9f4ac --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-disabled.qml @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ProgressBar { + value: 0.5 + enabled: false +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-normal.qml new file mode 100644 index 00000000..a332d4c5 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-normal.qml @@ -0,0 +1,33 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +ProgressBar { + value: 0.5 +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-checked.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-checked.qml new file mode 100644 index 00000000..c1b1acce --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-checked.qml @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +RadioButton { + text: "Checked" + checked: true +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml new file mode 100644 index 00000000..dba262be --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +RadioButton { + id: control + text: qsTr("RadioButton") + checked: true + + indicator: Rectangle { + implicitWidth: 26 + implicitHeight: 26 + x: control.leftPadding + y: parent.height / 2 - height / 2 + radius: 13 + border.color: control.down ? "#17a81a" : "#21be2b" + + Rectangle { + width: 14 + height: 14 + x: 6 + y: 6 + radius: 7 + color: control.down ? "#17a81a" : "#21be2b" + visible: control.checked + } + } + + contentItem: Text { + text: control.text + font: control.font + opacity: enabled ? 1.0 : 0.3 + color: control.down ? "#17a81a" : "#21be2b" + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + leftPadding: control.indicator.width + control.spacing + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-disabled.qml new file mode 100644 index 00000000..7ab68910 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-disabled.qml @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +RadioButton { + text: "Disabled" + enabled: false +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-focused.qml new file mode 100644 index 00000000..316a4653 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-focused.qml @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +RadioButton { + text: "Focused" + focus: true +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-normal.qml new file mode 100644 index 00000000..b5ea853b --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-normal.qml @@ -0,0 +1,33 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +RadioButton { + text: "Normal" +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml new file mode 100644 index 00000000..6efb7803 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +RadioDelegate { + id: control + text: qsTr("RadioDelegate") + checked: true + + contentItem: Text { + rightPadding: control.indicator.width + control.spacing + text: control.text + font: control.font + opacity: enabled ? 1.0 : 0.3 + color: control.down ? "#17a81a" : "#21be2b" + elide: Text.ElideRight + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + + indicator: Rectangle { + implicitWidth: 26 + implicitHeight: 26 + x: control.width - width - control.rightPadding + y: parent.height / 2 - height / 2 + radius: 13 + color: "transparent" + border.color: control.down ? "#17a81a" : "#21be2b" + + Rectangle { + width: 14 + height: 14 + x: 6 + y: 6 + radius: 7 + color: control.down ? "#17a81a" : "#21be2b" + visible: control.checked + } + } + + background: Rectangle { + implicitWidth: 100 + implicitHeight: 40 + visible: control.down || control.highlighted + color: control.down ? "#bdbebf" : "#eeeeee" + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml new file mode 100644 index 00000000..7e488d14 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +RangeSlider { + id: control + first.value: 0.25 + second.value: 0.75 + + background: Rectangle { + x: control.leftPadding + y: control.topPadding + control.availableHeight / 2 - height / 2 + implicitWidth: 200 + implicitHeight: 4 + width: control.availableWidth + height: implicitHeight + radius: 2 + color: "#bdbebf" + + Rectangle { + x: control.first.visualPosition * parent.width + width: control.second.visualPosition * parent.width - x + height: parent.height + color: "#21be2b" + radius: 2 + } + } + + first.handle: Rectangle { + x: control.leftPadding + first.visualPosition * (control.availableWidth - width) + y: control.topPadding + control.availableHeight / 2 - height / 2 + implicitWidth: 26 + implicitHeight: 26 + radius: 13 + color: first.pressed ? "#f0f0f0" : "#f6f6f6" + border.color: "#bdbebf" + } + + second.handle: Rectangle { + x: control.leftPadding + second.visualPosition * (control.availableWidth - width) + y: control.topPadding + control.availableHeight / 2 - height / 2 + implicitWidth: 26 + implicitHeight: 26 + radius: 13 + color: second.pressed ? "#f0f0f0" : "#f6f6f6" + border.color: "#bdbebf" + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-disabled.qml new file mode 100644 index 00000000..e239b72f --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-disabled.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +RangeSlider { + first.value: 0.25 + second.value: 0.75 + enabled: false +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-first-handle-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-first-handle-focused.qml new file mode 100644 index 00000000..a05c8291 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-first-handle-focused.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +RangeSlider { + first.value: 0.25 + second.value: 0.75 + first.handle.focus: true +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-first-handle.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-first-handle.qml new file mode 100644 index 00000000..c5f064b0 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-first-handle.qml @@ -0,0 +1,39 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +RangeSlider { + first.value: 0.25 + second.value: 0.75 + Rectangle { + anchors.fill: first.handle + color: "transparent" + border.color: "red" + } +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-normal.qml new file mode 100644 index 00000000..a41fbfad --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-normal.qml @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +RangeSlider { + first.value: 0.25 + second.value: 0.75 +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-second-handle-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-second-handle-focused.qml new file mode 100644 index 00000000..ec19d0c0 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-second-handle-focused.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +RangeSlider { + first.value: 0.25 + second.value: 0.75 + second.handle.focus: true +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-second-handle.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-second-handle.qml new file mode 100644 index 00000000..2e2123de --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-second-handle.qml @@ -0,0 +1,39 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +RangeSlider { + first.value: 0.25 + second.value: 0.75 + Rectangle { + anchors.fill: second.handle + color: "transparent" + border.color: "red" + } +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml new file mode 100644 index 00000000..086541c8 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Item { + width: 100 + height: 100 + + //! [1] + Flickable { + anchors.fill: parent + + contentWidth: parent.width * 2 + contentHeight: parent.height * 2 + + ScrollBar.horizontal: ScrollBar { id: hbar; active: vbar.active } + ScrollBar.vertical: ScrollBar { id: vbar; active: hbar.active } + } + //! [1] +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml new file mode 100644 index 00000000..0bf13b3c --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +ScrollBar { + id: control + size: 0.3 + position: 0.2 + active: true + orientation: Qt.Vertical + + contentItem: Rectangle { + implicitWidth: 6 + implicitHeight: 100 + radius: width / 2 + color: control.pressed ? "#81e889" : "#c2f4c6" + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml new file mode 100644 index 00000000..c118c7aa --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Item { + width: 100 + height: 100 + + //! [1] + Flickable { + anchors.fill: parent + + contentWidth: parent.width * 2 + contentHeight: parent.height * 2 + + ScrollIndicator.horizontal: ScrollIndicator { id: hbar; active: vbar.active } + ScrollIndicator.vertical: ScrollIndicator { id: vbar; active: hbar.active } + } + //! [1] +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml new file mode 100644 index 00000000..5720f4f7 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +ScrollIndicator { + id: control + size: 0.3 + position: 0.2 + active: true + orientation: Qt.Vertical + + contentItem: Rectangle { + implicitWidth: 2 + implicitHeight: 100 + color: "#c2f4c6" + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml new file mode 100644 index 00000000..ebc11f46 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +Slider { + id: control + value: 0.5 + + background: Rectangle { + x: control.leftPadding + y: control.topPadding + control.availableHeight / 2 - height / 2 + implicitWidth: 200 + implicitHeight: 4 + width: control.availableWidth + height: implicitHeight + radius: 2 + color: "#bdbebf" + + Rectangle { + width: control.visualPosition * parent.width + height: parent.height + color: "#21be2b" + radius: 2 + } + } + + handle: Rectangle { + x: control.leftPadding + control.visualPosition * (control.availableWidth - width) + y: control.topPadding + control.availableHeight / 2 - height / 2 + implicitWidth: 26 + implicitHeight: 26 + radius: 13 + color: control.pressed ? "#f0f0f0" : "#f6f6f6" + border.color: "#bdbebf" + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-disabled.qml new file mode 100644 index 00000000..bde161aa --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-disabled.qml @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Slider { + value: 0.5 + enabled: false +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-focused.qml new file mode 100644 index 00000000..b32f8b5a --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-focused.qml @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Slider { + value: 0.5 + focus: true +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml new file mode 100644 index 00000000..20b569f3 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Slider { + value: 0.5 + Rectangle { + anchors.fill: handle + color: "transparent" + border.color: "red" + } +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-normal.qml new file mode 100644 index 00000000..8363e862 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-normal.qml @@ -0,0 +1,33 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Slider { + value: 0.5 +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml new file mode 100644 index 00000000..6433fd80 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +SpinBox { + id: control + value: 50 + editable: true + + contentItem: TextInput { + z: 2 + text: control.textFromValue(control.value, control.locale) + + font: control.font + color: "#21be2b" + selectionColor: "#21be2b" + selectedTextColor: "#ffffff" + horizontalAlignment: Qt.AlignHCenter + verticalAlignment: Qt.AlignVCenter + + readOnly: !control.editable + validator: control.validator + inputMethodHints: Qt.ImhFormattedNumbersOnly + } + + up.indicator: Rectangle { + x: control.mirrored ? 0 : parent.width - width + height: parent.height + implicitWidth: 40 + implicitHeight: 40 + color: up.pressed ? "#e4e4e4" : "#f6f6f6" + border.color: enabled ? "#21be2b" : "#bdbebf" + + Text { + text: "+" + font.pixelSize: control.font.pixelSize * 2 + color: "#21be2b" + anchors.fill: parent + fontSizeMode: Text.Fit + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + } + + down.indicator: Rectangle { + x: control.mirrored ? parent.width - width : 0 + height: parent.height + implicitWidth: 40 + implicitHeight: 40 + color: down.pressed ? "#e4e4e4" : "#f6f6f6" + border.color: enabled ? "#21be2b" : "#bdbebf" + + Text { + text: "-" + font.pixelSize: control.font.pixelSize * 2 + color: "#21be2b" + anchors.fill: parent + fontSizeMode: Text.Fit + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + } + + background: Rectangle { + implicitWidth: 140 + border.color: "#bdbebf" + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml new file mode 100644 index 00000000..15af31ae --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +//! [1] +SpinBox { + id: spinbox + from: 0 + value: 110 + to: 100 * 100 + stepSize: 100 + anchors.centerIn: parent + + property int decimals: 2 + property real realValue: value / 100 + + validator: DoubleValidator { + bottom: Math.min(spinbox.from, spinbox.to) + top: Math.max(spinbox.from, spinbox.to) + } + + textFromValue: function(value, locale) { + return Number(value / 100).toLocaleString(locale, 'f', spinbox.decimals) + } + + valueFromText: function(text, locale) { + return Number.fromLocaleString(locale, text) * 100 + } +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml new file mode 100644 index 00000000..419dae5c --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +SpinBox { + value: 50 + Rectangle { + anchors.fill: down.indicator + color: "transparent" + border.color: "red" + } +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml new file mode 100644 index 00000000..814b8b28 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +//! [1] +SpinBox { + from: 0 + to: items.length - 1 + value: 1 // "Medium" + + property var items: ["Small", "Medium", "Large"] + + validator: RegExpValidator { + regExp: new RegExp("(Small|Medium|Large)", "i") + } + + textFromValue: function(value) { + return items[value]; + } + + valueFromText: function(text) { + for (var i = 0; i < items.length; ++i) { + if (items[i].toLowerCase().indexOf(text.toLowerCase()) === 0) + return i + } + return sb.value + } +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml new file mode 100644 index 00000000..b4b0fab3 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +SpinBox { + value: 50 + Rectangle { + anchors.fill: up.indicator + color: "transparent" + border.color: "red" + } +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml new file mode 100644 index 00000000..6616ed60 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +//! [1] +SpinBox { + value: 50 +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml new file mode 100644 index 00000000..ae63efed --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +SwipeDelegate { + id: control + text: qsTr("SwipeDelegate") + + Component { + id: component + + Rectangle { + color: control.swipe.complete && control.down ? "#333" : "#444" + width: parent.width + height: parent.height + clip: true + + Label { + text: qsTr("Press me!") + color: "#21be2b" + anchors.centerIn: parent + } + } + } + + swipe.left: component + swipe.right: component + + contentItem: Text { + text: control.text + font: control.font + color: control.enabled ? (control.down ? "#17a81a" : "#21be2b") : "#bdbebf" + elide: Text.ElideRight + visible: control.text + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + + Behavior on x { + enabled: !control.down + NumberAnimation { + easing.type: Easing.InOutCubic + duration: 400 + } + } + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml new file mode 100644 index 00000000..2ba8df9c --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Item { + width: 200 + height: 320 + + //! [1] + SwipeView { + id: view + + currentIndex: 1 + anchors.fill: parent + + Item { + id: firstPage + } + Item { + id: secondPage + } + Item { + id: thirdPage + } + } + + PageIndicator { + id: indicator + + count: view.count + currentIndex: view.currentIndex + + anchors.bottom: view.bottom + anchors.horizontalCenter: parent.horizontalCenter + } + //! [1] +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml new file mode 100644 index 00000000..f9a18b1c --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Switch { + text: "Checked" + checked: true +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml new file mode 100644 index 00000000..698c1a05 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +Switch { + id: control + text: qsTr("Switch") + + indicator: Rectangle { + implicitWidth: 48 + implicitHeight: 26 + x: control.leftPadding + y: parent.height / 2 - height / 2 + radius: 13 + color: control.checked ? "#17a81a" : "#ffffff" + border.color: control.checked ? "#17a81a" : "#cccccc" + + Rectangle { + x: control.checked ? parent.width - width : 0 + width: 26 + height: 26 + radius: 13 + color: control.down ? "#cccccc" : "#ffffff" + border.color: control.checked ? (control.down ? "#17a81a" : "#21be2b") : "#999999" + } + } + + contentItem: Text { + text: control.text + font: control.font + opacity: enabled ? 1.0 : 0.3 + color: control.down ? "#17a81a" : "#21be2b" + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + leftPadding: control.indicator.width + control.spacing + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml new file mode 100644 index 00000000..a40586b5 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Switch { + text: "Disabled" + enabled: false +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml new file mode 100644 index 00000000..f98f2c90 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Switch { + text: "Focused" + focus: true +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml new file mode 100644 index 00000000..a55c2854 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml @@ -0,0 +1,33 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Switch { + text: "Normal" +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switchdelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switchdelegate-custom.qml new file mode 100644 index 00000000..8d0daa0a --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switchdelegate-custom.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +SwitchDelegate { + id: control + text: qsTr("SwitchDelegate") + checked: true + + contentItem: Text { + rightPadding: control.indicator.width + control.spacing + text: control.text + font: control.font + opacity: enabled ? 1.0 : 0.3 + color: control.down ? "#17a81a" : "#21be2b" + elide: Text.ElideRight + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + } + + indicator: Rectangle { + implicitWidth: 48 + implicitHeight: 26 + x: control.width - width - control.rightPadding + y: parent.height / 2 - height / 2 + radius: 13 + color: control.checked ? "#17a81a" : "transparent" + border.color: control.checked ? "#17a81a" : "#cccccc" + + Rectangle { + x: control.checked ? parent.width - width : 0 + width: 26 + height: 26 + radius: 13 + color: control.down ? "#cccccc" : "#ffffff" + border.color: control.checked ? (control.down ? "#17a81a" : "#21be2b") : "#999999" + } + } + + background: Rectangle { + implicitWidth: 100 + implicitHeight: 40 + visible: control.down || control.highlighted + color: control.down ? "#bdbebf" : "#eeeeee" + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml new file mode 100644 index 00000000..1873fba9 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +TabBar { + id: control + + background: Rectangle { + color: "#eeeeee" + } + + TabButton { + text: qsTr("Home") + } + TabButton { + text: qsTr("Discover") + } + TabButton { + text: qsTr("Activity") + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-flickable.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-flickable.qml new file mode 100644 index 00000000..2a4fac0e --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-flickable.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +Item { + width: 360 + height: bar.height + +//! [1] +TabBar { + id: bar + width: parent.width + + Repeater { + model: ["First", "Second", "Third", "Fourth", "Fifth"] + + TabButton { + text: modelData + width: Math.max(100, bar.width / 5) + } + } +} +//! [1] +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml new file mode 100644 index 00000000..b445ee67 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.3 +import QtQuick.Controls 2.0 + +Column { + width: 300 + + //! [1] + TabBar { + id: bar + width: parent.width + TabButton { + text: qsTr("Home") + } + TabButton { + text: qsTr("Discover") + } + TabButton { + text: qsTr("Activity") + } + } + + StackLayout { + width: parent.width + currentIndex: bar.currentIndex + Item { + id: homeTab + } + Item { + id: discoverTab + } + Item { + id: activityTab + } + } + //! [1] +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml new file mode 100644 index 00000000..67e5e1e0 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +//! [1] +TabBar { + TabButton { + text: qsTr("Home") + } + TabButton { + text: qsTr("Discover") + } + TabButton { + text: qsTr("Activity") + } +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml new file mode 100644 index 00000000..f70c7135 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +TextArea { + id: control + placeholderText: qsTr("Enter description") + + background: Rectangle { + implicitWidth: 200 + implicitHeight: 40 + border.color: control.enabled ? "#21be2b" : "transparent" + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml new file mode 100644 index 00000000..e11750cb --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Item { + width: 100 + height: 100 + + Binding { target: flickable.ScrollBar.vertical; property: "active"; value: true } + + //! [1] + Flickable { + id: flickable + anchors.fill: parent + + TextArea.flickable: TextArea { + text: "TextArea\n...\n...\n...\n...\n...\n...\n" + wrapMode: TextArea.Wrap + } + + ScrollBar.vertical: ScrollBar { } + } + //! [1] +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml new file mode 100644 index 00000000..0deb0e5c --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +TextField { + id: control + placeholderText: qsTr("Enter description") + + background: Rectangle { + implicitWidth: 200 + implicitHeight: 40 + color: control.enabled ? "transparent" : "#353637" + border.color: control.enabled ? "#21be2b" : "transparent" + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml new file mode 100644 index 00000000..ac798f53 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +TextField { + width: 80 + text: "Disabled" + enabled: false +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml new file mode 100644 index 00000000..a4e1b3b1 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +TextField { + width: 80 + text: "Focused" + focus: true +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml new file mode 100644 index 00000000..12c7ead9 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +TextField { + width: 80 + text: "Normal" +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml new file mode 100644 index 00000000..3e98808c --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Layouts 1.0 +import QtQuick.Controls 2.0 + +//! [file] +ToolBar { + id: control + + background: Rectangle { + implicitHeight: 40 + color: "#eeeeee" + + Rectangle { + width: parent.width + height: 1 + anchors.bottom: parent.bottom + color: "transparent" + border.color: "#21be2b" + } + } + + RowLayout { + anchors.fill: parent + ToolButton { + text: qsTr("Undo") + } + ToolButton { + text: qsTr("Redo") + } + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml new file mode 100644 index 00000000..fd6754f8 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.0 +import QtQuick.Controls 2.0 + +//! [1] +ToolBar { + RowLayout { + anchors.fill: parent + ToolButton { + text: qsTr("\u25C0 Qt") + onClicked: stack.pop() + } + Item { Layout.fillWidth: true } + Switch { + checked: true + text: qsTr("Notifications") + } + } +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml new file mode 100644 index 00000000..10491cb5 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +ToolButton { + id: control + text: qsTr("ToolButton") + width: 120 + + contentItem: Text { + text: control.text + font: control.font + opacity: enabled ? 1.0 : 0.3 + color: control.down ? "#17a81a" : "#21be2b" + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + + background: Rectangle { + implicitWidth: 40 + implicitHeight: 40 + color: Qt.darker("#33333333", control.enabled && (control.checked || control.highlighted) ? 1.5 : 1.0) + opacity: enabled ? 1 : 0.3 + visible: control.down || (control.enabled && (control.checked || control.highlighted)) + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml new file mode 100644 index 00000000..330ab83c --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +//! [1] +Button { + text: qsTr("Button") + hoverEnabled: true + + ToolTip.delay: 1000 + ToolTip.timeout: 5000 + ToolTip.visible: hovered + ToolTip.text: qsTr("This tool tip is shown after hovering the button for a second.") +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml new file mode 100644 index 00000000..eddb09e6 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml @@ -0,0 +1,39 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +//! [1] +Button { + text: qsTr("Button") + + ToolTip.visible: pressed + ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval + ToolTip.text: qsTr("This tool tip is shown after pressing and holding the button down.") +} +//! [1] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml new file mode 100644 index 00000000..e6a386c1 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.0 + +Item { + id: root + width: slider.width + height: slider.height * 2.0 + + Binding { target: slider.anchors; property: "centerIn"; value: root } + Binding { target: slider.anchors; property: "verticalCenterOffset"; value: slider.height / 2 } + Binding { target: slider; property: "pressed"; value: root.Window.active } + + //! [1] + Slider { + id: slider + value: 0.5 + + ToolTip { + parent: slider.handle + visible: slider.pressed + text: slider.position.toFixed(1) + } + } + //! [1] +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml new file mode 100644 index 00000000..c85f91bb --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.0 + +Item { + id: root + width: 360 + height: button.height * 2 + + property Button button: children[0] + + Binding { target: button; property: "down"; value: root.Window.active } + Binding { target: button.anchors; property: "bottom"; value: root.bottom } + Binding { target: button.anchors; property: "horizontalCenter"; value: root.horizontalCenter } + + //! [1] + Button { + text: qsTr("Button") + + ToolTip.visible: pressed + ToolTip.text: qsTr("A descriptive tool tip of what the button does") + } + //! [1] +} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml new file mode 100644 index 00000000..d2b4f960 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +//! [file] +import QtQuick 2.6 +import QtQuick.Controls 2.0 + +Tumbler { + id: control + model: 15 + visibleItemCount: 5 + + background: Item { + Rectangle { + opacity: control.enabled ? 0.2 : 0.1 + border.color: "#000000" + width: parent.width + height: 1 + anchors.top: parent.top + } + + Rectangle { + opacity: control.enabled ? 0.2 : 0.1 + border.color: "#000000" + width: parent.width + height: 1 + anchors.bottom: parent.bottom + } + } + + delegate: Text { + text: qsTr("Item %1").arg(modelData + 1) + font: control.font + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + opacity: 1.0 - Math.abs(Tumbler.displacement) / (visibleItemCount / 2) + } + + Rectangle { + anchors.horizontalCenter: control.horizontalCenter + y: control.height * 0.4 + width: 40 + height: 1 + color: "#21be2b" + } + + Rectangle { + anchors.horizontalCenter: control.horizontalCenter + y: control.height * 0.6 + width: 40 + height: 1 + color: "#21be2b" + } +} +//! [file] diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml new file mode 100644 index 00000000..4d389ab7 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Tumbler { + id: tumbler + model: 5 + + Column { + Repeater { + model: 3 + + Rectangle { + width: tumbler.contentItem.width + height: tumbler.contentItem.height / 3 + color: 'transparent' + border.color: 'red' + } + } + } +} diff --git a/tests/auto/sanity/tst_sanity.cpp b/tests/auto/sanity/tst_sanity.cpp index 10348ba4..23b56384 100644 --- a/tests/auto/sanity/tst_sanity.cpp +++ b/tests/auto/sanity/tst_sanity.cpp @@ -139,10 +139,11 @@ private: void tst_Sanity::initTestCase() { QDirIterator it(QQC2_IMPORT_PATH, QStringList() << "*.qml" << "*.js", QDir::Files, QDirIterator::Subdirectories); + const QStringList excludeDirs = QStringList() << QStringLiteral("snippets") << QStringLiteral("screenshots") << QStringLiteral("designer"); while (it.hasNext()) { it.next(); QFileInfo info = it.fileInfo(); - if (info.dir().dirName() != QStringLiteral("snippets") && info.dir().dirName() != QStringLiteral("designer")) + if (!excludeDirs.contains(info.dir().dirName())) files.insert(info.dir().dirName() + "/" + info.fileName(), info.filePath()); } } diff --git a/tests/auto/snippets/tst_snippets.cpp b/tests/auto/snippets/tst_snippets.cpp index 6ca9e72c..7972591b 100644 --- a/tests/auto/snippets/tst_snippets.cpp +++ b/tests/auto/snippets/tst_snippets.cpp @@ -46,75 +46,100 @@ class tst_Snippets : public QObject private slots: void initTestCase(); + void verify(); + void verify_data(); + void screenshots(); void screenshots_data(); private: - QMap filePaths; - QStringList nonVisualSnippets; + QMap snippetPaths; + QMap screenshotSnippetPaths; }; +static QMap findSnippets(const QDir &inputDir, const QDir &outputDir = QDir()) +{ + QMap snippetPaths; + QDirIterator it(inputDir.path(), QStringList() << "qtquick*.qml" << "qtlabs*.qml", QDir::Files | QDir::Readable); + while (it.hasNext()) { + QFileInfo fi(it.next()); + const QString outDirPath = !outputDir.path().isEmpty() ? outputDir.filePath(fi.baseName() + ".png") : QString(); + snippetPaths.insert(fi.baseName(), qMakePair(fi.filePath(), outDirPath)); + } + return snippetPaths; +} + void tst_Snippets::initTestCase() { - QDir outdir(QDir::current().filePath("screenshots")); - QVERIFY(outdir.exists() || QDir::current().mkpath("screenshots")); + qInfo() << "Snippets are taken from" << QQC2_SNIPPETS_PATH; - QString datadir(QQC2_SNIPPETS_PATH); - QVERIFY(!datadir.isEmpty()); + QDir snippetsDir(QQC2_SNIPPETS_PATH); + QVERIFY(!snippetsDir.path().isEmpty()); - qInfo() << datadir; + snippetPaths = findSnippets(snippetsDir); + QVERIFY(!snippetPaths.isEmpty()); - QDirIterator it(datadir, QStringList() << "qtquick*.qml" << "qtlabs*.qml", QDir::Files | QDir::Readable, QDirIterator::Subdirectories); - while (it.hasNext()) { - QFileInfo fi(it.next()); - filePaths.insert(fi.baseName(), qMakePair(fi.filePath(), outdir.filePath(fi.baseName() + ".png"))); - } - QVERIFY(!filePaths.isEmpty()); + QDir screenshotOutputDir(QDir::current().filePath("screenshots")); + QVERIFY(screenshotOutputDir.exists() || QDir::current().mkpath("screenshots")); - nonVisualSnippets << "qtquickcontrols2-stackview-custom.qml" - << "qtquickcontrols2-swipeview-custom.qml" - << "qtquickcontrols2-tooltip-custom.qml"; + QDir screenshotSnippetsDir(QQC2_SNIPPETS_PATH "/screenshots"); + QVERIFY(!screenshotSnippetsDir.path().isEmpty()); + + screenshotSnippetPaths = findSnippets(screenshotSnippetsDir, screenshotOutputDir); + QVERIFY(!screenshotSnippetPaths.isEmpty()); } Q_DECLARE_METATYPE(QList) -void tst_Snippets::screenshots() +static void loadAndShow(QQuickView *view, const QString &source) { - QFETCH(QString, input); - QFETCH(QString, output); - qRegisterMetaType >(); - - QQuickView view; - QSignalSpy warnings(view.engine(), SIGNAL(warnings(QList))); + QSignalSpy warnings(view->engine(), SIGNAL(warnings(QList))); QVERIFY(warnings.isValid()); - view.setSource(QUrl::fromLocalFile(input)); - QCOMPARE(view.status(), QQuickView::Ready); - QVERIFY(view.errors().isEmpty()); - QVERIFY(view.rootObject()); + view->setSource(QUrl::fromLocalFile(source)); + QCOMPARE(view->status(), QQuickView::Ready); + QVERIFY(view->errors().isEmpty()); + QVERIFY(view->rootObject()); QVERIFY(warnings.isEmpty()); - view.show(); - view.requestActivate(); - QVERIFY(QTest::qWaitForWindowActive(&view)); + view->show(); + view->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(view)); +} - bool generateScreenshot = true; - for (const QString &baseName : qAsConst(nonVisualSnippets)) { - if (input.contains(baseName)) { - generateScreenshot = false; - break; - } - } +void tst_Snippets::verify() +{ + QFETCH(QString, input); - if (generateScreenshot) { - QSharedPointer result = view.contentItem()->grabToImage(); - QSignalSpy spy(result.data(), SIGNAL(ready())); - QVERIFY(spy.isValid()); - QVERIFY(spy.wait()); - QVERIFY(result->saveToFile(output)); - } + QQuickView view; + loadAndShow(&view, input); + QGuiApplication::processEvents(); +} + +void tst_Snippets::verify_data() +{ + QTest::addColumn("input"); + + QMap::const_iterator it; + for (it = snippetPaths.constBegin(); it != snippetPaths.constEnd(); ++it) + QTest::newRow(qPrintable(it.key())) << it.value().first; +} + +void tst_Snippets::screenshots() +{ + QFETCH(QString, input); + QFETCH(QString, output); + + QQuickView view; + loadAndShow(&view, input); + + QSharedPointer result = view.contentItem()->grabToImage(); + QSignalSpy spy(result.data(), SIGNAL(ready())); + QVERIFY(spy.isValid()); + QVERIFY(spy.wait()); + QVERIFY(result->saveToFile(output)); QGuiApplication::processEvents(); } @@ -125,7 +150,7 @@ void tst_Snippets::screenshots_data() QTest::addColumn("output"); QMap::const_iterator it; - for (it = filePaths.constBegin(); it != filePaths.constEnd(); ++it) + for (it = screenshotSnippetPaths.constBegin(); it != screenshotSnippetPaths.constEnd(); ++it) QTest::newRow(qPrintable(it.key())) << it.value().first << it.value().second; } -- cgit v1.2.3 From e1b1191e8df727f546bdbbb7da6b14e897c70e7c Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 22 Sep 2016 13:44:52 +0200 Subject: Popup: fix some of the documentation review findings Change-Id: I69b60faab1588a45e005ba721c9796680bad6ac1 Task-number: QTBUG-55904 Reviewed-by: J-P Nurmi --- .../screenshots/qtquickcontrols2-popup-custom.qml | 52 +++++++++++++ .../doc/src/includes/qquickpopup-padding.qdocinc | 10 +++ .../doc/src/qtquickcontrols2-customize.qdoc | 18 +++++ src/quicktemplates2/qquickpopup.cpp | 86 ++++++++++++++++++++-- 4 files changed, 159 insertions(+), 7 deletions(-) create mode 100644 src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-popup-custom.qml create mode 100644 src/imports/controls/doc/src/includes/qquickpopup-padding.qdocinc diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-popup-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-popup-custom.qml new file mode 100644 index 00000000..32025cc7 --- /dev/null +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-popup-custom.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Controls 2.0 +import QtQuick.Window 2.2 + +Item { + id: root + width: 200 + height: 200 + + Binding { + target: root + property: "visible" + value: root.Window.active + } +//! [1] +Popup { + background: Rectangle { + implicitWidth: 200 + implicitHeight: 200 + border.color: "#444" + } + contentItem: Column {} +} +//! [1] +} diff --git a/src/imports/controls/doc/src/includes/qquickpopup-padding.qdocinc b/src/imports/controls/doc/src/includes/qquickpopup-padding.qdocinc new file mode 100644 index 00000000..31f5d2db --- /dev/null +++ b/src/imports/controls/doc/src/includes/qquickpopup-padding.qdocinc @@ -0,0 +1,10 @@ +//! [padding] + +The padding properties are used to control the geometry of the +\l {contentItem}{content item}. + +Popup uses the same approach to padding as \l {Control::padding}{Control}. +For a visual explanation of the padding system, see the \l {Control Layout} +section of the documentation. + +//! [padding] diff --git a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc index 559c89f0..852a1e03 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc @@ -489,6 +489,24 @@ \snippet qtquickcontrols2-pane-custom.qml file + \section2 Customizing Popup + + Popup consists of a \l {Popup::background}{background} and + \l {Popup::contentItem}{content item}. + + \image qtquickcontrols2-popup-custom.png + + \quotefromfile qtquickcontrols2-popup-custom.qml + \skipto import QtQuick 2.6 + \printuntil import QtQuick.Controls 2.0 + \codeline + \skipto Popup + \printuntil { + \printuntil } + \printuntil } + \printuntil } + + \section2 Customizing ProgressBar ProgressBar consists of two visual items: \l {Control::background}{background} diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index 6deda711..a3d68266 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -91,7 +91,10 @@ QT_BEGIN_NAMESPACE scene, it is recommended to use ApplicationWindow. ApplicationWindow also provides background dimming effects. - \sa {Popup Controls}, ApplicationWindow + Popup lays out its content in a similar fashion to \l Control. For more + information, see the \l {Control Layout} section of the documentation. + + \sa {Popup Controls}, {Customizing Popup}, ApplicationWindow */ /*! @@ -820,6 +823,8 @@ QQuickPopup::~QQuickPopup() \qmlmethod void QtQuick.Controls::Popup::open() Opens the popup. + + \sa visible */ void QQuickPopup::open() { @@ -835,6 +840,8 @@ void QQuickPopup::open() \qmlmethod void QtQuick.Controls::Popup::close() Closes the popup. + + \sa visible */ void QQuickPopup::close() { @@ -850,6 +857,8 @@ void QQuickPopup::close() \qmlproperty real QtQuick.Controls::Popup::x This property holds the x-coordinate of the popup. + + \sa y, z */ qreal QQuickPopup::x() const { @@ -867,6 +876,8 @@ void QQuickPopup::setX(qreal x) \qmlproperty real QtQuick.Controls::Popup::y This property holds the y-coordinate of the popup. + + \sa x, z */ qreal QQuickPopup::y() const { @@ -910,7 +921,14 @@ void QQuickPopup::setPosition(const QPointF &pos) \qmlproperty real QtQuick.Controls::Popup::z This property holds the z-value of the popup. Z-value determines - the stacking order of popups. The default z-value is \c 0. + the stacking order of popups. + + If two visible popups have the same z-value, the last one that + was opened will be on top. + + The default z-value is \c 0. + + \sa x, y */ qreal QQuickPopup::z() const { @@ -1075,7 +1093,8 @@ void QQuickPopup::setContentHeight(qreal height) \qmlproperty real QtQuick.Controls::Popup::availableWidth \readonly - This property holds the width available after deducting horizontal padding. + This property holds the width available to the \l contentItem after + deducting horizontal padding from the \l {Item::}{width} of the popup. \sa padding, leftPadding, rightPadding */ @@ -1089,7 +1108,8 @@ qreal QQuickPopup::availableWidth() const \qmlproperty real QtQuick.Controls::Popup::availableHeight \readonly - This property holds the height available after deducting vertical padding. + This property holds the height available to the \l contentItem after + deducting vertical padding from the \l {Item::}{height} of the popup. \sa padding, topPadding, bottomPadding */ @@ -1265,6 +1285,8 @@ void QQuickPopup::resetBottomMargin() This property holds the default padding. + \include qquickpopup-padding.qdocinc + \sa availableWidth, availableHeight, topPadding, leftPadding, rightPadding, bottomPadding */ qreal QQuickPopup::padding() const @@ -1290,6 +1312,8 @@ void QQuickPopup::resetPadding() This property holds the top padding. + \include qquickpopup-padding.qdocinc + \sa padding, bottomPadding, availableHeight */ qreal QQuickPopup::topPadding() const @@ -1315,6 +1339,8 @@ void QQuickPopup::resetTopPadding() This property holds the left padding. + \include qquickpopup-padding.qdocinc + \sa padding, rightPadding, availableWidth */ qreal QQuickPopup::leftPadding() const @@ -1340,6 +1366,8 @@ void QQuickPopup::resetLeftPadding() This property holds the right padding. + \include qquickpopup-padding.qdocinc + \sa padding, leftPadding, availableWidth */ qreal QQuickPopup::rightPadding() const @@ -1365,6 +1393,8 @@ void QQuickPopup::resetRightPadding() This property holds the bottom padding. + \include qquickpopup-padding.qdocinc + \sa padding, topPadding, availableHeight */ qreal QQuickPopup::bottomPadding() const @@ -1492,6 +1522,14 @@ void QQuickPopup::setParentItem(QQuickItem *parent) \note If the background item has no explicit size specified, it automatically follows the popup's size. In most cases, there is no need to specify width or height for a background item. + + \note Most popups use the implicit size of the background item to calculate + the implicit size of the popup itself. If you replace the background item + with a custom one, you should also consider providing a sensible implicit + size for it (unless it is an item like \l Image which has its own implicit + size). + + \sa {Customizing Popup} */ QQuickItem *QQuickPopup::background() const { @@ -1518,6 +1556,17 @@ void QQuickPopup::setBackground(QQuickItem *background) popup is made visible, the content item is automatically reparented to the \l {ApplicationWindow::overlay}{overlay item} of its application window. + + \note The content item is automatically resized to fit within the + \l padding of the popup. + + \note Most popups use the implicit size of the content item to calculate + the implicit size of the popup itself. If you replace the content item + with a custom one, you should also consider providing a sensible implicit + size for it (unless it is an item like \l Text which has its own implicit + size). + + \sa {Customizing Popup} */ QQuickItem *QQuickPopup::contentItem() const { @@ -1537,7 +1586,13 @@ void QQuickPopup::setContentItem(QQuickItem *item) This property holds the list of content data. - \sa Item::data + The list contains all objects that have been declared in QML as children + of the popup. + + \note Unlike \c contentChildren, \c contentData does include non-visual QML + objects. + + \sa Item::data, contentChildren */ QQmlListProperty QQuickPopup::contentData() { @@ -1554,7 +1609,13 @@ QQmlListProperty QQuickPopup::contentData() This property holds the list of content children. - \sa Item::children + The list contains all items that have been declared in QML as children + of the popup. + + \note Unlike \c contentData, \c contentChildren does not include non-visual + QML objects. + + \sa Item::children, contentData */ QQmlListProperty QQuickPopup::contentChildren() { @@ -1589,7 +1650,14 @@ void QQuickPopup::setClip(bool clip) /*! \qmlproperty bool QtQuick.Controls::Popup::focus - This property holds whether the popup has focus. The default value is \c false. + This property holds whether the popup wants focus. + + When the popup actually receives focus, \l activeFocus will be \c true. + For more information, see \l {Keyboard Focus in Qt Quick}. + + The default value is \c false. + + \sa activeFocus */ bool QQuickPopup::hasFocus() const { @@ -1611,6 +1679,8 @@ void QQuickPopup::setFocus(bool focus) \readonly This property holds whether the popup has active focus. + + \sa focus, {Keyboard Focus in Qt Quick} */ bool QQuickPopup::hasActiveFocus() const { @@ -1685,6 +1755,8 @@ void QQuickPopup::resetDim() \qmlproperty bool QtQuick.Controls::Popup::visible This property holds whether the popup is visible. The default value is \c false. + + \sa open(), close() */ bool QQuickPopup::isVisible() const { -- cgit v1.2.3 From 1ba9feea60bae12febdb6d640eb5f2617c8d4b79 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 21 Sep 2016 11:07:34 +0200 Subject: Doc: Add drop shadow for tutorial images ...Using the new \borderedimage macro. Change-Id: I6a15944e898cd9b70bd8fd0999399d405dde9e59 Reviewed-by: J-P Nurmi --- .../doc/src/qtquickcontrols2-chattutorial.qdoc | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc b/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc index fe339133..afdac5a3 100644 --- a/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc +++ b/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc @@ -187,7 +187,7 @@ This line determines where the example will be copied to when running Now we can build and run the application: -\image qtquickcontrols2-chattutorial-chapter1.png +\borderedimage qtquickcontrols2-chattutorial-chapter1.png \section1 Chapter 2: Lists @@ -261,7 +261,7 @@ The image will be \c 40 pixels wide and \c 40 pixels high. We'll base the height of the delegate on the image's height, so that we don't have any empty vertical space. -\image qtquickcontrols2-chattutorial-chapter2.png +\borderedimage qtquickcontrols2-chattutorial-chapter2.png \section1 Chapter 3: Navigation @@ -312,7 +312,7 @@ In chapter 2, we added a ListView below the header. If you run the application for that chapter, you'll see that the contents of the view can be scrolled over the top of the header: -\image qtquickcontrols2-chattutorial-chapter2-listview-header.gif +\borderedimage qtquickcontrols2-chattutorial-chapter2-listview-header.gif This is not that nice, especially if the text in the delegates is long enough that it reaches the text in the header. What we @@ -332,7 +332,7 @@ usual, comes from the application style. Here it is in action: \printuntil } \printuntil } -\image qtquickcontrols2-chattutorial-chapter3-listview-header.gif +\borderedimage qtquickcontrols2-chattutorial-chapter3-listview-header.gif It has no layout of its own, so we center the label within it ourselves. @@ -433,7 +433,7 @@ After filling the width and height of its parent, we also set some margins on the view. This gives us a nice alignment with the placeholder text in the "compose message" field: -\image qtquickcontrols2-chattutorial-chapter3-view-margins.png +\borderedimage qtquickcontrols2-chattutorial-chapter3-view-margins.png Next, we set \l {ListView::}{displayMarginBeginning} and \l {ListView::}{displayMarginEnd}. These properties ensure that the delegates @@ -485,7 +485,7 @@ does not go outside of the screen. Finally, the button is only enabled when there is actually a message to send. -\image qtquickcontrols2-chattutorial-chapter3.gif +\borderedimage qtquickcontrols2-chattutorial-chapter3.gif \section1 Chapter 4: Models @@ -663,7 +663,7 @@ timestamp that we want to display below every message: \printuntil } \printuntil } -\image qtquickcontrols2-chattutorial-chapter4-message-timestamp.png +\borderedimage qtquickcontrols2-chattutorial-chapter4-message-timestamp.png Now that we have a proper model, we can use its \c recipient role in the expression for the \c sentByMe property. @@ -685,7 +685,7 @@ smaller value. However, in the image below, the message text is quite long, so the smaller value (the width of the view) is chosen, ensuring that the text stops at the opposite edge of the screen: -\image qtquickcontrols2-chattutorial-chapter4-long-message.png +\borderedimage qtquickcontrols2-chattutorial-chapter4-long-message.png In order to display the timestamp for each message that we discussed earlier, we use a Label. The date and time are formatted with @@ -701,7 +701,7 @@ First, we call the invokable \c sendMessage() function of the model, which inserts a new row into the Conversations database table. Then, we clear the text field to make way for future input. -\image qtquickcontrols2-chattutorial-chapter4.gif +\borderedimage qtquickcontrols2-chattutorial-chapter4.gif \section1 Chapter 5: Styling @@ -714,12 +714,12 @@ So far, we've just been testing the application with the Default style. If we run it with the \l {Material Style}, for example, we'll immediately see some issues. Here is the Contacts page: -\image qtquickcontrols2-chattutorial-chapter5-contacts-material-test.png +\borderedimage qtquickcontrols2-chattutorial-chapter5-contacts-material-test.png The header text is black on a dark blue background, which is very difficult to read. The same thing occurs with the Conversations page: -\image qtquickcontrols2-chattutorial-chapter5-conversations-material-test.png +\borderedimage qtquickcontrols2-chattutorial-chapter5-conversations-material-test.png The solution is to tell the toolbar that it should use the \e "Dark" theme, so that this information is propagated to its children, allowing them to switch @@ -789,13 +789,13 @@ We'll make the same changes to \c ConversationPage.qml: Now both pages look correct: -\image qtquickcontrols2-chattutorial-chapter5-contacts-material.png -\image qtquickcontrols2-chattutorial-chapter5-conversations-material.png +\borderedimage qtquickcontrols2-chattutorial-chapter5-contacts-material.png +\borderedimage qtquickcontrols2-chattutorial-chapter5-conversations-material.png Let's try out the Universal style: -\image qtquickcontrols2-chattutorial-chapter5-contacts-universal.png -\image qtquickcontrols2-chattutorial-chapter5-conversations-universal.png +\borderedimage qtquickcontrols2-chattutorial-chapter5-contacts-universal.png +\borderedimage qtquickcontrols2-chattutorial-chapter5-conversations-universal.png No issues there. For a relatively simple application such as this one, there should be very few adjustments necessary when switching styles. @@ -814,8 +814,8 @@ Theme=Dark Once this is done, build and run the application. This is what you should see: -\image qtquickcontrols2-chattutorial-chapter5-contacts-material-dark.png -\image qtquickcontrols2-chattutorial-chapter5-conversations-material-dark.png +\borderedimage qtquickcontrols2-chattutorial-chapter5-contacts-material-dark.png +\borderedimage qtquickcontrols2-chattutorial-chapter5-conversations-material-dark.png Both pages look fine. Now add an entry for the Universal style: @@ -826,8 +826,8 @@ Theme=Dark After building and running the application, you should see these results: -\image qtquickcontrols2-chattutorial-chapter5-contacts-universal-dark.png -\image qtquickcontrols2-chattutorial-chapter5-conversations-universal-dark.png +\borderedimage qtquickcontrols2-chattutorial-chapter5-contacts-universal-dark.png +\borderedimage qtquickcontrols2-chattutorial-chapter5-conversations-universal-dark.png \section1 Summary -- cgit v1.2.3 From 25a3f25ce98c0a88582e97cfcdede970e7cc4a6d Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 27 Sep 2016 14:47:06 +0200 Subject: SpinBox: don't call valueFromText when non-editable If there are custom values like 00:00:00 for time and valueFromText is not implemented, tab navigation sets the value to 0, because the default implementation cannot evaluate it. Change-Id: I0384a2015b2c2a4dc2ee0e57f1ece410c339838e Task-number: QTBUG-56215 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickspinbox.cpp | 4 ++-- tests/auto/controls/data/tst_spinbox.qml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/quicktemplates2/qquickspinbox.cpp b/src/quicktemplates2/qquickspinbox.cpp index b7595b71..116d1e12 100644 --- a/src/quicktemplates2/qquickspinbox.cpp +++ b/src/quicktemplates2/qquickspinbox.cpp @@ -612,7 +612,7 @@ void QQuickSpinBox::keyReleaseEvent(QKeyEvent *event) Q_D(QQuickSpinBox); QQuickControl::keyReleaseEvent(event); - if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) + if (d->editable && (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)) d->updateValue(); d->up->setPressed(false); @@ -704,7 +704,7 @@ void QQuickSpinBox::itemChange(ItemChange change, const ItemChangeData &value) { Q_D(QQuickSpinBox); QQuickControl::itemChange(change, value); - if (change == ItemActiveFocusHasChanged && !value.boolValue) + if (d->editable && change == ItemActiveFocusHasChanged && !value.boolValue) d->updateValue(); } diff --git a/tests/auto/controls/data/tst_spinbox.qml b/tests/auto/controls/data/tst_spinbox.qml index d8422706..b370a05f 100644 --- a/tests/auto/controls/data/tst_spinbox.qml +++ b/tests/auto/controls/data/tst_spinbox.qml @@ -478,4 +478,36 @@ TestCase { control.destroy() } + + function test_valueFromText_data() { + return [ + { tag: "editable", editable: true }, + { tag: "non-editable", editable: false } + ] + } + + function test_valueFromText(data) { + var control = spinBox.createObject(testCase, {editable: data.editable}) + verify(control) + + control.forceActiveFocus() + verify(control.activeFocus) + + var valueFromTextCalls = 0 + control.valueFromText = function(text, locale) { + ++valueFromTextCalls + return Number.fromLocaleString(locale, text); + } + + keyClick(Qt.Key_Enter) + compare(valueFromTextCalls, data.editable ? 1 : 0) + + keyClick(Qt.Key_Return) + compare(valueFromTextCalls, data.editable ? 2 : 0) + + control.focus = false + compare(valueFromTextCalls, data.editable ? 3 : 0) + + control.destroy() + } } -- cgit v1.2.3 From bde0f36262987b244d215bc10f68b09e4a380660 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 28 Sep 2016 15:59:10 +0200 Subject: Fix QQuickToolTipAttached parent The parent must not be a null item. Change-Id: Ide71a69e8cde8114542fa97570e0e5f5d724a884 Task-number: QTBUG-56243 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquicktooltip.cpp | 6 +++--- src/quicktemplates2/qquicktooltip_p.h | 2 +- tests/auto/controls/data/tst_tooltip.qml | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp index e08078f6..6b025fe5 100644 --- a/src/quicktemplates2/qquicktooltip.cpp +++ b/src/quicktemplates2/qquicktooltip.cpp @@ -250,7 +250,7 @@ QQuickToolTipAttached *QQuickToolTip::qmlAttachedProperties(QObject *object) if (!item) qmlInfo(object) << "ToolTip must be attached to an Item"; - return new QQuickToolTipAttached(item); + return new QQuickToolTipAttached(object); } void QQuickToolTip::open() @@ -350,8 +350,8 @@ QQuickToolTip *QQuickToolTipAttachedPrivate::instance(bool create) const return tip; } -QQuickToolTipAttached::QQuickToolTipAttached(QQuickItem *item) : - QObject(*(new QQuickToolTipAttachedPrivate), item) +QQuickToolTipAttached::QQuickToolTipAttached(QObject *parent) : + QObject(*(new QQuickToolTipAttachedPrivate), parent) { } diff --git a/src/quicktemplates2/qquicktooltip_p.h b/src/quicktemplates2/qquicktooltip_p.h index 227c6a4e..e39862bf 100644 --- a/src/quicktemplates2/qquicktooltip_p.h +++ b/src/quicktemplates2/qquicktooltip_p.h @@ -111,7 +111,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickToolTipAttached : public QObject Q_PROPERTY(QQuickToolTip *toolTip READ toolTip CONSTANT FINAL) public: - explicit QQuickToolTipAttached(QQuickItem *item); + explicit QQuickToolTipAttached(QObject *parent); QString text() const; void setText(const QString &text); diff --git a/tests/auto/controls/data/tst_tooltip.qml b/tests/auto/controls/data/tst_tooltip.qml index 04064fa1..b80a2cae 100644 --- a/tests/auto/controls/data/tst_tooltip.qml +++ b/tests/auto/controls/data/tst_tooltip.qml @@ -185,6 +185,7 @@ TestCase { function test_warning() { ignoreWarning(Qt.resolvedUrl("tst_tooltip.qml") + ":68:5: QML QtObject: ToolTip must be attached to an Item") - object.ToolTip.text = "" + ignoreWarning(":1:30: QML ToolTip: cannot find any window to open popup in.") + object.ToolTip.show("") // don't crash (QTBUG-56243) } } -- cgit v1.2.3 From c56b68bd76a0a608824054e09ec6e9ab34295188 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 28 Sep 2016 19:25:41 +0200 Subject: Don't execute disabled transitions If an enter or exit transition for a Drawer is disabled, don't execute it at all when the drawer gets opened or closed. This besides being more semantically correct, makes possible to control manually the opening of a Drawer, for instance to implement an external handle with which is possible to drag the drawer open or close. If a Transition is disabled, is up to the caller to set correctly the position value. Change-Id: I5a0d96e3b7c948725dff2068f9d0a7ab1d3847e9 Reviewed-by: J-P Nurmi --- src/quicktemplates2/qquickdrawer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp index 8319cf2c..d35b30cf 100644 --- a/src/quicktemplates2/qquickdrawer.cpp +++ b/src/quicktemplates2/qquickdrawer.cpp @@ -422,7 +422,7 @@ bool QQuickDrawerPrivate::handleMouseReleaseEvent(QQuickItem *item, QMouseEvent static QList prepareTransition(QQuickDrawer *drawer, QQuickTransition *transition, qreal to) { QList actions; - if (!transition || !QQuickPopupPrivate::get(drawer)->window) + if (!transition || !QQuickPopupPrivate::get(drawer)->window || !transition->enabled()) return actions; qmlExecuteDeferred(transition); -- cgit v1.2.3 From 5d2c242d2d3fd6af724514ee00a6440864be0ade Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 29 Sep 2016 07:55:30 +0200 Subject: Gallery: make most pages scrollable Add a ScrollablePage type, which provides the scrolling behavior. The available space can be quite limited, especially in landscape on low resolution devices. Change-Id: I4d2911aa6bfa6d8573a1385b5a06ef2cf3e2e548 Reviewed-by: Mitch Curtis --- examples/quickcontrols2/gallery/gallery.qrc | 1 + .../gallery/pages/BusyIndicatorPage.qml | 8 +-- .../quickcontrols2/gallery/pages/ButtonPage.qml | 65 ++++++++++------------ .../quickcontrols2/gallery/pages/CheckBoxPage.qml | 57 ++++++++----------- .../quickcontrols2/gallery/pages/ComboBoxPage.qml | 6 +- examples/quickcontrols2/gallery/pages/DialPage.qml | 4 +- .../quickcontrols2/gallery/pages/FramePage.qml | 10 ++-- .../quickcontrols2/gallery/pages/GroupBoxPage.qml | 10 ++-- examples/quickcontrols2/gallery/pages/MenuPage.qml | 8 +-- .../gallery/pages/PageIndicatorPage.qml | 6 +- .../quickcontrols2/gallery/pages/PopupPage.qml | 8 +-- .../gallery/pages/ProgressBarPage.qml | 8 +-- .../gallery/pages/RadioButtonPage.qml | 55 ++++++++---------- .../gallery/pages/RangeSliderPage.qml | 8 +-- .../gallery/pages/ScrollablePage.qml | 61 ++++++++++++++++++++ .../quickcontrols2/gallery/pages/SliderPage.qml | 8 +-- .../quickcontrols2/gallery/pages/SpinBoxPage.qml | 6 +- .../quickcontrols2/gallery/pages/SwitchPage.qml | 55 ++++++++---------- .../quickcontrols2/gallery/pages/TextAreaPage.qml | 38 +++++-------- .../quickcontrols2/gallery/pages/TextFieldPage.qml | 6 +- .../quickcontrols2/gallery/pages/ToolTipPage.qml | 4 +- .../quickcontrols2/gallery/pages/TumblerPage.qml | 4 +- 22 files changed, 227 insertions(+), 209 deletions(-) create mode 100644 examples/quickcontrols2/gallery/pages/ScrollablePage.qml diff --git a/examples/quickcontrols2/gallery/gallery.qrc b/examples/quickcontrols2/gallery/gallery.qrc index d5c1b1d9..2dc78732 100644 --- a/examples/quickcontrols2/gallery/gallery.qrc +++ b/examples/quickcontrols2/gallery/gallery.qrc @@ -52,6 +52,7 @@ pages/ProgressBarPage.qml pages/RadioButtonPage.qml pages/RangeSliderPage.qml + pages/ScrollablePage.qml pages/ScrollBarPage.qml pages/ScrollIndicatorPage.qml pages/SliderPage.qml diff --git a/examples/quickcontrols2/gallery/pages/BusyIndicatorPage.qml b/examples/quickcontrols2/gallery/pages/BusyIndicatorPage.qml index ec73ac36..26950555 100644 --- a/examples/quickcontrols2/gallery/pages/BusyIndicatorPage.qml +++ b/examples/quickcontrols2/gallery/pages/BusyIndicatorPage.qml @@ -41,12 +41,12 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Pane { - id: pane +ScrollablePage { + id: page Column { spacing: 40 - anchors.fill: parent + width: parent.width Label { width: parent.width @@ -57,7 +57,7 @@ Pane { } BusyIndicator { - readonly property int size: Math.min(pane.availableWidth, pane.availableHeight) / 5 + readonly property int size: Math.min(page.availableWidth, page.availableHeight) / 5 width: size height: size anchors.horizontalCenter: parent.horizontalCenter diff --git a/examples/quickcontrols2/gallery/pages/ButtonPage.qml b/examples/quickcontrols2/gallery/pages/ButtonPage.qml index da817eba..add29e83 100644 --- a/examples/quickcontrols2/gallery/pages/ButtonPage.qml +++ b/examples/quickcontrols2/gallery/pages/ButtonPage.qml @@ -41,51 +41,42 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Flickable { - id: flickable - contentHeight: pane.height +ScrollablePage { + id: page - readonly property int itemWidth: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 2, pane.availableWidth / 3)) + readonly property int itemWidth: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 2, page.availableWidth / 3)) - Pane { - id: pane + Column { + spacing: 40 width: parent.width - Column { - id: column - spacing: 40 + Label { width: parent.width + wrapMode: Label.Wrap + horizontalAlignment: Qt.AlignHCenter + text: "Button presents a push-button that can be pushed or clicked by the user. " + + "Buttons are normally used to perform an action, or to answer a question." + } - Label { - width: parent.width - wrapMode: Label.Wrap - horizontalAlignment: Qt.AlignHCenter - text: "Button presents a push-button that can be pushed or clicked by the user. " - + "Buttons are normally used to perform an action, or to answer a question." - } - - Column { - spacing: 20 - anchors.horizontalCenter: parent.horizontalCenter + Column { + spacing: 20 + anchors.horizontalCenter: parent.horizontalCenter - Button { - text: "First" - width: itemWidth - } - Button { - id: button - text: "Second" - width: itemWidth - highlighted: true - } - Button { - text: "Third" - enabled: false - width: itemWidth - } + Button { + text: "First" + width: itemWidth + } + Button { + id: button + text: "Second" + width: itemWidth + highlighted: true + } + Button { + text: "Third" + enabled: false + width: itemWidth } } } - - ScrollIndicator.vertical: ScrollIndicator { } } diff --git a/examples/quickcontrols2/gallery/pages/CheckBoxPage.qml b/examples/quickcontrols2/gallery/pages/CheckBoxPage.qml index 3e08555b..ee8b14dc 100644 --- a/examples/quickcontrols2/gallery/pages/CheckBoxPage.qml +++ b/examples/quickcontrols2/gallery/pages/CheckBoxPage.qml @@ -41,46 +41,37 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Flickable { - id: flickable - contentHeight: pane.height +ScrollablePage { + id: page - Pane { - id: pane + Column { + spacing: 40 width: parent.width - Column { - id: column - spacing: 40 + Label { width: parent.width + wrapMode: Label.Wrap + horizontalAlignment: Qt.AlignHCenter + text: "CheckBox presents an option button that can be toggled on or off. " + + "Check boxes are typically used to select one or more options from a set of options." + } - Label { - width: parent.width - wrapMode: Label.Wrap - horizontalAlignment: Qt.AlignHCenter - text: "CheckBox presents an option button that can be toggled on or off. " - + "Check boxes are typically used to select one or more options from a set of options." - } - - Column { - spacing: 20 - anchors.horizontalCenter: parent.horizontalCenter + Column { + spacing: 20 + anchors.horizontalCenter: parent.horizontalCenter - CheckBox { - text: "First" - checked: true - } - CheckBox { - text: "Second" - } - CheckBox { - text: "Third" - checked: true - enabled: false - } + CheckBox { + text: "First" + checked: true + } + CheckBox { + text: "Second" + } + CheckBox { + text: "Third" + checked: true + enabled: false } } } - - ScrollIndicator.vertical: ScrollIndicator { } } diff --git a/examples/quickcontrols2/gallery/pages/ComboBoxPage.qml b/examples/quickcontrols2/gallery/pages/ComboBoxPage.qml index 58c5b97d..66fb10dd 100644 --- a/examples/quickcontrols2/gallery/pages/ComboBoxPage.qml +++ b/examples/quickcontrols2/gallery/pages/ComboBoxPage.qml @@ -41,8 +41,8 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Pane { - id: pane +ScrollablePage { + id: page Column { spacing: 40 @@ -58,7 +58,7 @@ Pane { ComboBox { model: ["First", "Second", "Third"] - width: Math.max(implicitWidth, Math.min(implicitWidth * 2, pane.availableWidth / 3)) + width: Math.max(implicitWidth, Math.min(implicitWidth * 2, page.availableWidth / 3)) anchors.horizontalCenter: parent.horizontalCenter } } diff --git a/examples/quickcontrols2/gallery/pages/DialPage.qml b/examples/quickcontrols2/gallery/pages/DialPage.qml index bac6fb47..9f07c11e 100644 --- a/examples/quickcontrols2/gallery/pages/DialPage.qml +++ b/examples/quickcontrols2/gallery/pages/DialPage.qml @@ -41,8 +41,8 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Pane { - id: pane +ScrollablePage { + id: page Column { spacing: 40 diff --git a/examples/quickcontrols2/gallery/pages/FramePage.qml b/examples/quickcontrols2/gallery/pages/FramePage.qml index 1979007c..51b640c1 100644 --- a/examples/quickcontrols2/gallery/pages/FramePage.qml +++ b/examples/quickcontrols2/gallery/pages/FramePage.qml @@ -41,14 +41,14 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Pane { - id: pane +ScrollablePage { + id: page - readonly property int itemWidth: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 3, pane.availableWidth / 3 * 2)) + readonly property int itemWidth: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 3, page.availableWidth / 3 * 2)) Column { spacing: 40 - anchors.fill: parent + width: parent.width Label { width: parent.width @@ -62,7 +62,7 @@ Pane { Column { spacing: 20 - width: pane.itemWidth + width: page.itemWidth RadioButton { text: "First" diff --git a/examples/quickcontrols2/gallery/pages/GroupBoxPage.qml b/examples/quickcontrols2/gallery/pages/GroupBoxPage.qml index 194c14b4..b0db5374 100644 --- a/examples/quickcontrols2/gallery/pages/GroupBoxPage.qml +++ b/examples/quickcontrols2/gallery/pages/GroupBoxPage.qml @@ -41,14 +41,14 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Pane { - id: pane +ScrollablePage { + id: page - readonly property int itemWidth: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 3, pane.availableWidth / 3 * 2)) + readonly property int itemWidth: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 3, page.availableWidth / 3 * 2)) Column { spacing: 40 - anchors.fill: parent + width: parent.width Label { width: parent.width @@ -63,7 +63,7 @@ Pane { Column { spacing: 20 - width: pane.itemWidth + width: page.itemWidth RadioButton { text: "First" diff --git a/examples/quickcontrols2/gallery/pages/MenuPage.qml b/examples/quickcontrols2/gallery/pages/MenuPage.qml index ec1c88cd..1e975bd0 100644 --- a/examples/quickcontrols2/gallery/pages/MenuPage.qml +++ b/examples/quickcontrols2/gallery/pages/MenuPage.qml @@ -41,12 +41,12 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Pane { - id: pane +ScrollablePage { + id: page Column { spacing: 40 - anchors.fill: parent + width: parent.width Label { width: parent.width @@ -59,7 +59,7 @@ Pane { id: button text: "Open" anchors.horizontalCenter: parent.horizontalCenter - width: Math.max(implicitWidth, Math.min(implicitWidth * 2, pane.availableWidth / 3)) + width: Math.max(implicitWidth, Math.min(implicitWidth * 2, page.availableWidth / 3)) onClicked: optionsMenu.open() } diff --git a/examples/quickcontrols2/gallery/pages/PageIndicatorPage.qml b/examples/quickcontrols2/gallery/pages/PageIndicatorPage.qml index 8dfd9725..e7f7e251 100644 --- a/examples/quickcontrols2/gallery/pages/PageIndicatorPage.qml +++ b/examples/quickcontrols2/gallery/pages/PageIndicatorPage.qml @@ -41,12 +41,12 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Pane { - id: pane +ScrollablePage { + id: page Column { spacing: 40 - anchors.fill: parent + width: parent.width Label { width: parent.width diff --git a/examples/quickcontrols2/gallery/pages/PopupPage.qml b/examples/quickcontrols2/gallery/pages/PopupPage.qml index 5a70c617..66c46143 100644 --- a/examples/quickcontrols2/gallery/pages/PopupPage.qml +++ b/examples/quickcontrols2/gallery/pages/PopupPage.qml @@ -41,12 +41,12 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Pane { - id: pane +ScrollablePage { + id: page Column { spacing: 40 - anchors.fill: parent + width: parent.width Label { width: parent.width @@ -60,7 +60,7 @@ Pane { id: button text: "Open" anchors.horizontalCenter: parent.horizontalCenter - width: Math.max(implicitWidth, Math.min(implicitWidth * 2, pane.availableWidth / 3)) + width: Math.max(implicitWidth, Math.min(implicitWidth * 2, page.availableWidth / 3)) onClicked: settingsPopup.open() } diff --git a/examples/quickcontrols2/gallery/pages/ProgressBarPage.qml b/examples/quickcontrols2/gallery/pages/ProgressBarPage.qml index 901cddd8..92f26dd0 100644 --- a/examples/quickcontrols2/gallery/pages/ProgressBarPage.qml +++ b/examples/quickcontrols2/gallery/pages/ProgressBarPage.qml @@ -41,14 +41,14 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Pane { - id: pane +ScrollablePage { + id: page - readonly property int itemWidth: Math.max(bar.implicitWidth, pane.availableWidth / 3) + readonly property int itemWidth: Math.max(bar.implicitWidth, page.availableWidth / 3) Column { spacing: 40 - anchors.fill: parent + width: parent.width Label { width: parent.width diff --git a/examples/quickcontrols2/gallery/pages/RadioButtonPage.qml b/examples/quickcontrols2/gallery/pages/RadioButtonPage.qml index c57c7baf..0cc1f0bd 100644 --- a/examples/quickcontrols2/gallery/pages/RadioButtonPage.qml +++ b/examples/quickcontrols2/gallery/pages/RadioButtonPage.qml @@ -41,45 +41,36 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Flickable { - id: flickable - contentHeight: pane.height +ScrollablePage { + id: page - Pane { - id: pane + Column { + spacing: 40 width: parent.width - Column { - id: column - spacing: 40 + Label { width: parent.width + wrapMode: Label.Wrap + horizontalAlignment: Qt.AlignHCenter + text: "RadioButton presents an option button that can be toggled on or off. " + + "Radio buttons are typically used to select one option from a set of options." + } - Label { - width: parent.width - wrapMode: Label.Wrap - horizontalAlignment: Qt.AlignHCenter - text: "RadioButton presents an option button that can be toggled on or off. " - + "Radio buttons are typically used to select one option from a set of options." - } - - Column { - spacing: 20 - anchors.horizontalCenter: parent.horizontalCenter + Column { + spacing: 20 + anchors.horizontalCenter: parent.horizontalCenter - RadioButton { - text: "First" - } - RadioButton { - text: "Second" - checked: true - } - RadioButton { - text: "Third" - enabled: false - } + RadioButton { + text: "First" + } + RadioButton { + text: "Second" + checked: true + } + RadioButton { + text: "Third" + enabled: false } } } - - ScrollIndicator.vertical: ScrollIndicator { } } diff --git a/examples/quickcontrols2/gallery/pages/RangeSliderPage.qml b/examples/quickcontrols2/gallery/pages/RangeSliderPage.qml index 5a73c09d..62cbeb88 100644 --- a/examples/quickcontrols2/gallery/pages/RangeSliderPage.qml +++ b/examples/quickcontrols2/gallery/pages/RangeSliderPage.qml @@ -41,14 +41,14 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Pane { - id: pane +ScrollablePage { + id: page - readonly property int itemWidth: Math.max(slider.implicitWidth, Math.min(slider.implicitWidth * 2, pane.availableWidth / 3)) + readonly property int itemWidth: Math.max(slider.implicitWidth, Math.min(slider.implicitWidth * 2, page.availableWidth / 3)) Column { spacing: 40 - anchors.fill: parent + width: parent.width Label { width: parent.width diff --git a/examples/quickcontrols2/gallery/pages/ScrollablePage.qml b/examples/quickcontrols2/gallery/pages/ScrollablePage.qml new file mode 100644 index 00000000..2a0f1165 --- /dev/null +++ b/examples/quickcontrols2/gallery/pages/ScrollablePage.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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.6 +import QtQuick.Controls 2.0 + +Page { + id: page + + default property alias content: pane.contentItem + + Flickable { + anchors.fill: parent + contentHeight: pane.implicitHeight + flickableDirection: Flickable.AutoFlickIfNeeded + + Pane { + id: pane + width: parent.width + } + + ScrollIndicator.vertical: ScrollIndicator { } + } +} diff --git a/examples/quickcontrols2/gallery/pages/SliderPage.qml b/examples/quickcontrols2/gallery/pages/SliderPage.qml index 43da4209..d9853c22 100644 --- a/examples/quickcontrols2/gallery/pages/SliderPage.qml +++ b/examples/quickcontrols2/gallery/pages/SliderPage.qml @@ -41,14 +41,14 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Pane { - id: pane +ScrollablePage { + id: page - readonly property int itemWidth: Math.max(slider.implicitWidth, Math.min(slider.implicitWidth * 2, pane.availableWidth / 3)) + readonly property int itemWidth: Math.max(slider.implicitWidth, Math.min(slider.implicitWidth * 2, page.availableWidth / 3)) Column { spacing: 40 - anchors.fill: parent + width: parent.width Label { width: parent.width diff --git a/examples/quickcontrols2/gallery/pages/SpinBoxPage.qml b/examples/quickcontrols2/gallery/pages/SpinBoxPage.qml index febc869a..2b3664cf 100644 --- a/examples/quickcontrols2/gallery/pages/SpinBoxPage.qml +++ b/examples/quickcontrols2/gallery/pages/SpinBoxPage.qml @@ -41,14 +41,14 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Pane { - id: pane +ScrollablePage { + id: page readonly property int itemWidth: Math.max(box.implicitWidth, Math.min(box.implicitWidth * 2, pane.availableWidth / 3)) Column { spacing: 40 - anchors.fill: parent + width: parent.width Label { width: parent.width diff --git a/examples/quickcontrols2/gallery/pages/SwitchPage.qml b/examples/quickcontrols2/gallery/pages/SwitchPage.qml index f69a1409..1315268d 100644 --- a/examples/quickcontrols2/gallery/pages/SwitchPage.qml +++ b/examples/quickcontrols2/gallery/pages/SwitchPage.qml @@ -41,45 +41,36 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Flickable { - id: flickable - contentHeight: pane.height +ScrollablePage { + id: page - Pane { - id: pane + Column { + spacing: 40 width: parent.width - Column { - id: column - spacing: 40 + Label { width: parent.width + wrapMode: Label.Wrap + horizontalAlignment: Qt.AlignHCenter + text: "Switch is an option button that can be dragged or toggled on or off. " + + "Switches are typically used to select between two states." + } - Label { - width: parent.width - wrapMode: Label.Wrap - horizontalAlignment: Qt.AlignHCenter - text: "Switch is an option button that can be dragged or toggled on or off. " - + "Switches are typically used to select between two states." - } - - Column { - spacing: 20 - anchors.horizontalCenter: parent.horizontalCenter + Column { + spacing: 20 + anchors.horizontalCenter: parent.horizontalCenter - Switch { - text: "First" - } - Switch { - text: "Second" - checked: true - } - Switch { - text: "Third" - enabled: false - } + Switch { + text: "First" + } + Switch { + text: "Second" + checked: true + } + Switch { + text: "Third" + enabled: false } } } - - ScrollIndicator.vertical: ScrollIndicator { } } diff --git a/examples/quickcontrols2/gallery/pages/TextAreaPage.qml b/examples/quickcontrols2/gallery/pages/TextAreaPage.qml index 733ac24b..ca28e2b7 100644 --- a/examples/quickcontrols2/gallery/pages/TextAreaPage.qml +++ b/examples/quickcontrols2/gallery/pages/TextAreaPage.qml @@ -41,34 +41,26 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Flickable { - id: flickable - contentHeight: pane.height +ScrollablePage { + id: page - Pane { - id: pane + Column { + spacing: 40 width: parent.width - Column { - spacing: 40 - anchors.fill: parent - - Label { - width: parent.width - wrapMode: Label.Wrap - horizontalAlignment: Qt.AlignHCenter - text: "TextArea is a multi-line text editor." - } + Label { + width: parent.width + wrapMode: Label.Wrap + horizontalAlignment: Qt.AlignHCenter + text: "TextArea is a multi-line text editor." + } - TextArea { - width: Math.max(implicitWidth, Math.min(implicitWidth * 3, pane.availableWidth / 3)) - anchors.horizontalCenter: parent.horizontalCenter + TextArea { + width: Math.max(implicitWidth, Math.min(implicitWidth * 3, pane.availableWidth / 3)) + anchors.horizontalCenter: parent.horizontalCenter - wrapMode: TextArea.Wrap - text: "TextArea\n...\n...\n..." - } + wrapMode: TextArea.Wrap + text: "TextArea\n...\n...\n..." } } - - ScrollIndicator.vertical: ScrollIndicator { } } diff --git a/examples/quickcontrols2/gallery/pages/TextFieldPage.qml b/examples/quickcontrols2/gallery/pages/TextFieldPage.qml index cbae30cd..9092e10d 100644 --- a/examples/quickcontrols2/gallery/pages/TextFieldPage.qml +++ b/examples/quickcontrols2/gallery/pages/TextFieldPage.qml @@ -41,12 +41,12 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Pane { - id: pane +ScrollablePage { + id: page Column { spacing: 40 - anchors.fill: parent + width: parent.width Label { width: parent.width diff --git a/examples/quickcontrols2/gallery/pages/ToolTipPage.qml b/examples/quickcontrols2/gallery/pages/ToolTipPage.qml index 06a5fbf9..e0f769eb 100644 --- a/examples/quickcontrols2/gallery/pages/ToolTipPage.qml +++ b/examples/quickcontrols2/gallery/pages/ToolTipPage.qml @@ -41,8 +41,8 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Pane { - id: pane +ScrollablePage { + id: page Column { spacing: 40 diff --git a/examples/quickcontrols2/gallery/pages/TumblerPage.qml b/examples/quickcontrols2/gallery/pages/TumblerPage.qml index ff295b43..d12cc999 100644 --- a/examples/quickcontrols2/gallery/pages/TumblerPage.qml +++ b/examples/quickcontrols2/gallery/pages/TumblerPage.qml @@ -41,8 +41,8 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -Pane { - id: pane +ScrollablePage { + id: page Column { spacing: 40 -- cgit v1.2.3 From 7433cc2f91d1aba045ab4920d6732c85d2ee33b9 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 29 Sep 2016 16:34:48 +0200 Subject: Fix crash when flicking a ListView-based Tumbler This only happens in 5.7, and seemingly only when the delegate uses attached properties (like displacement). Other fixes required and/or relevant to the patch: - Fixed some instances of displacementChanged possibly not being emitted. - Use QPointer for the attached object's Tumbler pointer, as it was being accessed while null after this patch. Change-Id: I7d881d815faf57f1a8bc0ea8e73a7331523d2f9b Reviewed-by: J-P Nurmi --- src/quicktemplates2/qquicktumbler.cpp | 35 ++++++++++++++++++++++--- tests/auto/controls/data/tst_tumbler.qml | 45 +++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 5 deletions(-) diff --git a/src/quicktemplates2/qquicktumbler.cpp b/src/quicktemplates2/qquicktumbler.cpp index 580859ef..8c9c1d10 100644 --- a/src/quicktemplates2/qquicktumbler.cpp +++ b/src/quicktemplates2/qquicktumbler.cpp @@ -436,9 +436,10 @@ public: void itemChildRemoved(QQuickItem *, QQuickItem *) override; void _q_calculateDisplacement(); + void emitIfDisplacementChanged(qreal oldDisplacement, qreal newDisplacement); // The Tumbler that contains the delegate. Required to calculated the displacement. - QQuickTumbler *tumbler; + QPointer tumbler; // The index of the delegate. Used to calculate the displacement. int index; // The displacement for our delegate. @@ -476,14 +477,23 @@ void QQuickTumblerAttachedPrivate::_q_calculateDisplacement() const int previousDisplacement = displacement; displacement = 0; + if (!tumbler) { + emitIfDisplacementChanged(previousDisplacement, displacement); + return; + } + const int count = tumbler->count(); // This can happen in tests, so it may happen in normal usage too. - if (count == 0) + if (count == 0) { + emitIfDisplacementChanged(previousDisplacement, displacement); return; + } ContentItemType contentType = contentItemType(tumbler->contentItem()); - if (contentType == UnsupportedContentItemType) + if (contentType == UnsupportedContentItemType) { + emitIfDisplacementChanged(previousDisplacement, displacement); return; + } qreal offset = 0; @@ -507,8 +517,13 @@ void QQuickTumblerAttachedPrivate::_q_calculateDisplacement() displacement = reverseDisplacement - index; } + emitIfDisplacementChanged(previousDisplacement, displacement); +} + +void QQuickTumblerAttachedPrivate::emitIfDisplacementChanged(qreal oldDisplacement, qreal newDisplacement) +{ Q_Q(QQuickTumblerAttached); - if (displacement != previousDisplacement) + if (newDisplacement != oldDisplacement) emit q->displacementChanged(); } @@ -532,6 +547,18 @@ QQuickTumblerAttached::QQuickTumblerAttached(QQuickItem *delegateItem) : QQuickTumblerAttached::~QQuickTumblerAttached() { + Q_D(QQuickTumblerAttached); + if (!d->tumbler || !d->tumbler->contentItem()) + return; + + QQuickItem *rootContentItem = d->tumbler->contentItem(); + const ContentItemType contentType = contentItemType(rootContentItem); + QQuickItem *actualItem = actualContentItem(rootContentItem, contentType); + if (!actualItem) + return; + + QQuickItemPrivate *p = QQuickItemPrivate::get(actualItem); + p->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Children); } /*! diff --git a/tests/auto/controls/data/tst_tumbler.qml b/tests/auto/controls/data/tst_tumbler.qml index 22cde065..401f7537 100644 --- a/tests/auto/controls/data/tst_tumbler.qml +++ b/tests/auto/controls/data/tst_tumbler.qml @@ -63,7 +63,8 @@ TestCase { } function cleanup() { - tumbler.destroy(); + if (tumbler) + tumbler.destroy(); } function tumblerXCenter() { @@ -234,6 +235,48 @@ TestCase { tryCompare(tumbler.dayTumbler, "currentIndex", 27); } + Component { + id: timePickerComponent + + Row { + property alias minuteTumbler: minuteTumbler + property alias amPmTumbler: amPmTumbler + + Tumbler { + id: minuteTumbler + currentIndex: 6 + model: 60 + width: 50 + height: 150 + } + + Tumbler { + id: amPmTumbler + model: ["AM", "PM"] + width: 50 + height: 150 + contentItem: ListView { + anchors.fill: parent + model: amPmTumbler.model + delegate: amPmTumbler.delegate + } + } + } + } + + function test_listViewTimePicker() { + tumbler.destroy(); + + var root = timePickerComponent.createObject(testCase); + verify(root); + + mouseDrag(root.minuteTumbler, root.minuteTumbler.width / 2, root.minuteTumbler.height / 2, 0, 50); + // Shouldn't crash. + mouseDrag(root.amPmTumbler, root.amPmTumbler.width / 2, root.amPmTumbler.height / 2, 0, 50); + + root.destroy(); + } + function test_displacement_data() { var data = [ // At 0 offset, the first item is current. -- cgit v1.2.3 From b4ce31415baba84ca82aec68f4480b3e6ac89b90 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 29 Sep 2016 15:58:07 +0200 Subject: TabBar: fix mixing of fixed and implicitly resized tabs Don't calculate the implicit item width based on the total width of the whole control, but based on the available width that is left after subtracting the items that have an explicit width and won't be resized. Change-Id: Iae18dd9c9756b6f2afa143baab7d2501ce9d4697 Task-number: QTBUG-56265 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquicktabbar.cpp | 22 +++++++++++++++++----- tests/auto/controls/data/tst_tabbar.qml | 26 ++++++++++++++++++++------ 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/quicktemplates2/qquicktabbar.cpp b/src/quicktemplates2/qquicktabbar.cpp index 6fe734bb..bf6c4e74 100644 --- a/src/quicktemplates2/qquicktabbar.cpp +++ b/src/quicktemplates2/qquicktabbar.cpp @@ -113,16 +113,28 @@ void QQuickTabBarPrivate::updateLayout() Q_Q(QQuickTabBar); const int count = contentModel->count(); if (count > 0 && contentItem) { - const qreal itemWidth = (contentItem->width() - qMax(0, count - 1) * spacing) / count; + qreal reservedWidth = 0; + QVector resizableItems; + resizableItems.reserve(count); for (int i = 0; i < count; ++i) { QQuickItem *item = q->itemAt(i); if (item) { QQuickItemPrivate *p = QQuickItemPrivate::get(item); - if (!p->widthValid) { - item->setWidth(itemWidth); - p->widthValid = false; - } + if (!p->widthValid) + resizableItems += item; + else + reservedWidth += item->width(); + } + } + + if (!resizableItems.isEmpty()) { + const qreal totalSpacing = qMax(0, count - 1) * spacing; + const qreal itemWidth = (contentItem->width() - reservedWidth - totalSpacing) / resizableItems.count(); + + for (QQuickItem *item : qAsConst(resizableItems)) { + item->setWidth(itemWidth); + QQuickItemPrivate::get(item)->widthValid = false; } } } diff --git a/tests/auto/controls/data/tst_tabbar.qml b/tests/auto/controls/data/tst_tabbar.qml index b46f7f00..351db999 100644 --- a/tests/auto/controls/data/tst_tabbar.qml +++ b/tests/auto/controls/data/tst_tabbar.qml @@ -504,17 +504,31 @@ TestCase { control.destroy() } - function test_layout() { - var control = tabBar.createObject(testCase, {spacing: 0, width: 200}) + function test_layout_data() { + return [ + { tag: "spacing:0", spacing: 0 }, + { tag: "spacing:1", spacing: 1 }, + { tag: "spacing:10", spacing: 10 }, + ] + } + + function test_layout(data) { + var control = tabBar.createObject(testCase, {spacing: data.spacing, width: 200}) - var tab1 = tabButton.createObject(control) + var tab1 = tabButton.createObject(control, {text: "First"}) control.addItem(tab1) tryCompare(tab1, "width", control.width) - var tab2 = tabButton.createObject(control) + var tab2 = tabButton.createObject(control, {text: "Second"}) control.addItem(tab2) - tryCompare(tab1, "width", control.width / 2) - tryCompare(tab2, "width", control.width / 2) + tryCompare(tab1, "width", (control.width - data.spacing) / 2) + compare(tab2.width, (control.width - data.spacing) / 2) + + var tab3 = tabButton.createObject(control, {width: 50, text: "Third"}) + control.addItem(tab3) + tryCompare(tab1, "width", (control.width - 2 * data.spacing - 50) / 2) + compare(tab2.width, (control.width - 2 * data.spacing - 50) / 2) + compare(tab3.width, 50) control.destroy() } -- cgit v1.2.3 From c74dde76c5e27396e70ab1b8498f2c74f68134c0 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 30 Sep 2016 09:55:08 +0200 Subject: TabBar: re-layout as appropriate in tab button size changes Auto-tested by the next change. Change-Id: I28ff7e82c0255b93d23cff7cbe111406d525f24b Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickcontainer.cpp | 9 +++++---- src/quicktemplates2/qquickcontainer_p_p.h | 1 + src/quicktemplates2/qquicktabbar.cpp | 14 +++++++++++++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/quicktemplates2/qquickcontainer.cpp b/src/quicktemplates2/qquickcontainer.cpp index 34e198fc..be2acf39 100644 --- a/src/quicktemplates2/qquickcontainer.cpp +++ b/src/quicktemplates2/qquickcontainer.cpp @@ -144,7 +144,8 @@ static QQuickItem *effectiveContentItem(QQuickItem *item) return item; } -QQuickContainerPrivate::QQuickContainerPrivate() : contentModel(nullptr), currentIndex(-1), updatingCurrent(false) +QQuickContainerPrivate::QQuickContainerPrivate() : contentModel(nullptr), currentIndex(-1), updatingCurrent(false), + changeTypes(Destroyed | Parent | SiblingOrder) { } @@ -164,7 +165,7 @@ void QQuickContainerPrivate::cleanup() for (int i = 0; i < count; ++i) { QQuickItem *item = itemAt(i); if (item) - QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Destroyed | QQuickItemPrivate::Parent | QQuickItemPrivate::SiblingOrder); + QQuickItemPrivate::get(item)->removeItemChangeListener(this, changeTypes); } if (contentItem) { @@ -196,7 +197,7 @@ void QQuickContainerPrivate::insertItem(int index, QQuickItem *item) updatingCurrent = true; item->setParentItem(effectiveContentItem(contentItem)); - QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::Destroyed | QQuickItemPrivate::Parent | QQuickItemPrivate::SiblingOrder); + QQuickItemPrivate::get(item)->addItemChangeListener(this, changeTypes); contentModel->insert(index, item); q->itemAdded(index, item); @@ -242,7 +243,7 @@ void QQuickContainerPrivate::removeItem(int index, QQuickItem *item) currentChanged = true; } - QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Destroyed | QQuickItemPrivate::Parent | QQuickItemPrivate::SiblingOrder); + QQuickItemPrivate::get(item)->removeItemChangeListener(this, changeTypes); item->setParentItem(nullptr); contentModel->remove(index); diff --git a/src/quicktemplates2/qquickcontainer_p_p.h b/src/quicktemplates2/qquickcontainer_p_p.h index 30076a31..3b60ad8c 100644 --- a/src/quicktemplates2/qquickcontainer_p_p.h +++ b/src/quicktemplates2/qquickcontainer_p_p.h @@ -90,6 +90,7 @@ public: QQmlObjectModel *contentModel; int currentIndex; bool updatingCurrent; + QQuickItemPrivate::ChangeTypes changeTypes; }; QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquicktabbar.cpp b/src/quicktemplates2/qquicktabbar.cpp index bf6c4e74..27df1c99 100644 --- a/src/quicktemplates2/qquicktabbar.cpp +++ b/src/quicktemplates2/qquicktabbar.cpp @@ -86,11 +86,15 @@ public: void updateCurrentIndex(); void updateLayout(); + void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) override; + + bool updatingLayout; QQuickTabBar::Position position; }; -QQuickTabBarPrivate::QQuickTabBarPrivate() : position(QQuickTabBar::Header) +QQuickTabBarPrivate::QQuickTabBarPrivate() : updatingLayout(false), position(QQuickTabBar::Header) { + changeTypes |= Geometry; } void QQuickTabBarPrivate::updateCurrentItem() @@ -132,14 +136,22 @@ void QQuickTabBarPrivate::updateLayout() const qreal totalSpacing = qMax(0, count - 1) * spacing; const qreal itemWidth = (contentItem->width() - reservedWidth - totalSpacing) / resizableItems.count(); + updatingLayout = true; for (QQuickItem *item : qAsConst(resizableItems)) { item->setWidth(itemWidth); QQuickItemPrivate::get(item)->widthValid = false; } + updatingLayout = false; } } } +void QQuickTabBarPrivate::itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &) +{ + if (!updatingLayout) + updateLayout(); +} + QQuickTabBar::QQuickTabBar(QQuickItem *parent) : QQuickContainer(*(new QQuickTabBarPrivate), parent) { -- cgit v1.2.3 From ab779f64f2e01ed7aafc3358ac2f0bf42f349516 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 29 Sep 2016 21:01:45 +0200 Subject: TabButton: use Text's implicit size instead of content size Using content size was a workaround (applied in 5f5654f) that helped with mis-aligned tab labels, but broke the implicit size calculation of TabButton itself. Now that the mis-alignment issue in QQuickText has been fixed in qtdeclarative commit 79cfc87, we can restore the correct implicit size calculation. This makes it possible to create tabs that are not squeezed to fit in TabBar: TabBar { TabButton { text: "Foo"; width: implicitWidth } TabButton { text: "Bar"; width: implicitWidth } TabButton { text: "Baz"; width: implicitWidth } } Task-number: QTBUG-55129 Change-Id: If0dbb00794299e324b7a8d8ce1370fe0a3491fe8 Reviewed-by: Mitch Curtis --- src/imports/controls/TabButton.qml | 4 ++-- src/imports/controls/material/TabButton.qml | 4 ++-- tests/auto/controls/data/tst_tabbar.qml | 6 ++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/imports/controls/TabButton.qml b/src/imports/controls/TabButton.qml index 870edb6d..56b57602 100644 --- a/src/imports/controls/TabButton.qml +++ b/src/imports/controls/TabButton.qml @@ -41,9 +41,9 @@ T.TabButton { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, - contentItem.contentWidth + leftPadding + rightPadding) + contentItem.implicitWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, - contentItem.contentHeight + topPadding + bottomPadding) + contentItem.implicitHeight + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset padding: 6 diff --git a/src/imports/controls/material/TabButton.qml b/src/imports/controls/material/TabButton.qml index 095645b4..535dfc02 100644 --- a/src/imports/controls/material/TabButton.qml +++ b/src/imports/controls/material/TabButton.qml @@ -42,9 +42,9 @@ T.TabButton { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, - contentItem.contentWidth + leftPadding + rightPadding) + contentItem.implicitWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, - contentItem.contentHeight + topPadding + bottomPadding) + contentItem.implicitHeight + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset padding: 12 diff --git a/tests/auto/controls/data/tst_tabbar.qml b/tests/auto/controls/data/tst_tabbar.qml index 351db999..eee3205f 100644 --- a/tests/auto/controls/data/tst_tabbar.qml +++ b/tests/auto/controls/data/tst_tabbar.qml @@ -530,6 +530,12 @@ TestCase { compare(tab2.width, (control.width - 2 * data.spacing - 50) / 2) compare(tab3.width, 50) + var expectedWidth = tab3.contentItem.implicitWidth + tab3.leftPadding + tab3.rightPadding + tab3.width = tab3.implicitWidth + tryCompare(tab1, "width", (control.width - 2 * data.spacing - expectedWidth) / 2) + tryCompare(tab2, "width", (control.width - 2 * data.spacing - expectedWidth) / 2) + compare(tab3.width, expectedWidth) + control.destroy() } } -- cgit v1.2.3 From be668040b31488ca8e3d8bad10b6bead2bc74491 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 30 Sep 2016 11:08:38 +0200 Subject: Improve tst_tumbler - Don't create a tumbler indiscriminately in init(). Some tests don't use the tumbler, and it just creates more headaches for debugging, as there is extra, unrelated qDebug output for the unused tumbler. - Don't create the tumbler with createQmlObject(). Having code in a string is difficult to maintain and doesn't have the benefit of e.g. the static error checking that Creator can do. - Instead of only automatically cleaning up the tumbler item in cleanup(), introduce a "cleanupItem" that all dynamically created items can use as their parent so that they too can benefit from automatic cleanup. - Comment out incomplete test and mention that it's a TODO. Change-Id: I070fbb018bc9270555774bb0de2d72b7889edb35 Reviewed-by: J-P Nurmi --- tests/auto/controls/data/tst_tumbler.qml | 99 ++++++++++++++++++++++---------- 1 file changed, 69 insertions(+), 30 deletions(-) diff --git a/tests/auto/controls/data/tst_tumbler.qml b/tests/auto/controls/data/tst_tumbler.qml index 401f7537..2e0e3295 100644 --- a/tests/auto/controls/data/tst_tumbler.qml +++ b/tests/auto/controls/data/tst_tumbler.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -51,20 +51,38 @@ TestCase { name: "Tumbler" property var tumbler: null + // With the help of cleanup(), ensures that all items created during a test function + // are destroyed if that test fails. + property Item cleanupItem readonly property real implicitTumblerWidth: 60 readonly property real implicitTumblerHeight: 200 readonly property real defaultImplicitDelegateHeight: implicitTumblerHeight / 3 readonly property real defaultListViewTumblerOffset: -defaultImplicitDelegateHeight + Component { + id: itemComponent + + Item { + anchors.fill: parent + } + } + function init() { - tumbler = Qt.createQmlObject("import QtQuick.Controls 2.0; Tumbler { }", testCase, ""); - verify(tumbler, "Tumbler: failed to create an instance"); - compare(tumbler.contentItem.parent, tumbler); + cleanupItem = itemComponent.createObject(testCase); + verify(cleanupItem); } function cleanup() { - if (tumbler) - tumbler.destroy(); + var destroyed = false; + cleanupItem.Component.destruction.connect(function() { destroyed = true; }); + + cleanupItem.destroy(); + + // Waiting until it's deleted before continuing makes debugging + // test failures much easier, because there aren't unrelated items hanging around. + // TODO: Replace with tryVerify(!tumbler) in 5.8. + while (!destroyed) + wait(0) } function tumblerXCenter() { @@ -93,11 +111,21 @@ TestCase { } } - function tst_dynamicContentItemChange() { - // test that currentIndex is maintained between contentItem changes... + Component { + id: tumblerComponent + + Tumbler {} } + // TODO: test that currentIndex is maintained between contentItem changes... +// function tst_dynamicContentItemChange() { +// } + function test_currentIndex() { + tumbler = tumblerComponent.createObject(cleanupItem); + verify(tumbler); + compare(tumbler.contentItem.parent, tumbler); + tumbler.model = 5; compare(tumbler.currentIndex, 0); @@ -123,6 +151,9 @@ TestCase { } function test_keyboardNavigation() { + tumbler = tumblerComponent.createObject(cleanupItem); + verify(tumbler); + tumbler.model = 5; tumbler.forceActiveFocus(); tumbler.contentItem.highlightMoveDuration = 0; @@ -151,6 +182,9 @@ TestCase { } function test_itemsCorrectlyPositioned() { + tumbler = tumblerComponent.createObject(cleanupItem); + verify(tumbler); + tumbler.model = 4; tumbler.height = 120; compare(tumbler.contentItem.delegateHeight, 40); @@ -159,7 +193,7 @@ TestCase { wait(tumbler.contentItem.highlightMoveDuration); var firstItemCenterPos = itemCenterPos(1); var firstItem = tumbler.contentItem.itemAt(firstItemCenterPos.x, firstItemCenterPos.y); - var actualPos = testCase.mapFromItem(firstItem, 0, 0); + var actualPos = cleanupItem.mapFromItem(firstItem, 0, 0); compare(actualPos.x, tumbler.leftPadding); compare(actualPos.y, tumbler.topPadding + 40); @@ -170,7 +204,7 @@ TestCase { firstItem = tumbler.contentItem.itemAt(firstItemCenterPos.x, firstItemCenterPos.y); verify(firstItem); // Test QTBUG-40298. - actualPos = testCase.mapFromItem(firstItem, 0, 0); + actualPos = cleanupItem.mapFromItem(firstItem, 0, 0); compare(actualPos.x, tumbler.leftPadding); compare(actualPos.y, tumbler.topPadding); @@ -187,8 +221,11 @@ TestCase { } function test_focusPastTumbler() { + tumbler = tumblerComponent.createObject(cleanupItem); + verify(tumbler); + var mouseArea = Qt.createQmlObject( - "import QtQuick 2.2; TextInput { activeFocusOnTab: true; width: 50; height: 50 }", testCase, ""); + "import QtQuick 2.2; TextInput { activeFocusOnTab: true; width: 50; height: 50 }", cleanupItem, ""); tumbler.forceActiveFocus(); verify(tumbler.activeFocus); @@ -196,16 +233,12 @@ TestCase { keyClick(Qt.Key_Tab); verify(!tumbler.activeFocus); verify(mouseArea.activeFocus); - - mouseArea.destroy(); } function test_datePicker() { - tumbler.destroy(); - var component = Qt.createComponent("TumblerDatePicker.qml"); compare(component.status, Component.Ready, component.errorString()); - tumbler = component.createObject(testCase); + tumbler = component.createObject(cleanupItem); // Should not be any warnings. compare(tumbler.dayTumbler.currentIndex, 0); @@ -265,16 +298,12 @@ TestCase { } function test_listViewTimePicker() { - tumbler.destroy(); - - var root = timePickerComponent.createObject(testCase); + var root = timePickerComponent.createObject(cleanupItem); verify(root); mouseDrag(root.minuteTumbler, root.minuteTumbler.width / 2, root.minuteTumbler.height / 2, 0, 50); // Shouldn't crash. mouseDrag(root.amPmTumbler, root.amPmTumbler.width / 2, root.amPmTumbler.height / 2, 0, 50); - - root.destroy(); } function test_displacement_data() { @@ -332,6 +361,9 @@ TestCase { } function test_displacement(data) { + tumbler = tumblerComponent.createObject(cleanupItem); + verify(tumbler); + // TODO: test setting these in the opposite order (delegate after model // doesn't seem to cause a change in delegates in PathView) tumbler.delegate = displacementDelegate; @@ -406,11 +438,10 @@ TestCase { } function test_displacementListView(data) { - tumbler.destroy(); // Sanity check that they're aren't any children at this stage. - tryCompare(testCase.children, "length", 0); + tryCompare(cleanupItem.children, "length", 0); - tumbler = listViewTumblerComponent.createObject(testCase); + tumbler = listViewTumblerComponent.createObject(cleanupItem); verify(tumbler); tumbler.delegate = displacementDelegate; @@ -480,9 +511,7 @@ TestCase { } function test_listViewFlickAboveBounds(data) { - tumbler.destroy(); - - tumbler = listViewTumblerComponent.createObject(testCase); + tumbler = listViewTumblerComponent.createObject(cleanupItem); verify(tumbler); tumbler.delegate = displacementDelegate; @@ -548,6 +577,9 @@ TestCase { } function test_visibleItemCount(data) { + tumbler = tumblerComponent.createObject(cleanupItem); + verify(tumbler); + tumbler.delegate = objectNameDelegate; tumbler.visibleItemCount = data.visibleItemCount; @@ -579,6 +611,9 @@ TestCase { } function test_attachedProperties() { + tumbler = tumblerComponent.createObject(cleanupItem); + verify(tumbler); + // TODO: crashes somewhere in QML's guts // tumbler.model = 5; // tumbler.delegate = wrongDelegateTypeComponent; @@ -590,14 +625,15 @@ TestCase { noParentDelegateComponent.createObject(null); ignoreWarning("Tumbler: attempting to access attached property on item without an \"index\" property"); - var object = noParentDelegateComponent.createObject(testCase); + var object = noParentDelegateComponent.createObject(cleanupItem); + verify(object); object.destroy(); // Should not be any warnings from this, as ListView, for example, doesn't produce warnings for the same code. - var gridView = gridViewComponent.createObject(testCase); + var gridView = gridViewComponent.createObject(cleanupItem); object = simpleDisplacementDelegate.createObject(gridView); + verify(object); object.destroy(); - gridView.destroy(); } property Component paddingDelegate: Text { @@ -644,6 +680,9 @@ TestCase { } function test_padding(data) { + tumbler = tumblerComponent.createObject(cleanupItem); + verify(tumbler); + tumbler.delegate = paddingDelegate; tumbler.model = 5; compare(tumbler.padding, 0); -- cgit v1.2.3 From b749f0041d14234083d150e48d273f08c4b1d253 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 30 Sep 2016 12:32:10 +0200 Subject: Button: add GIFs for flat & highlighted docs This also removes the state table in the detailed description, since we have GIFs now. Change-Id: I4503b67478051eb872f46127da6718092d77d4ff Task-number: QTBUG-55904 Reviewed-by: J-P Nurmi --- .../doc/images/qtquickcontrols2-button-custom.png | Bin 1294 -> 0 bytes .../images/qtquickcontrols2-button-disabled.png | Bin 1569 -> 0 bytes .../doc/images/qtquickcontrols2-button-flat.gif | Bin 0 -> 2388 bytes .../images/qtquickcontrols2-button-highlighted.gif | Bin 0 -> 1856 bytes .../doc/images/qtquickcontrols2-button.gif | Bin 2171 -> 1863 bytes .../doc/images/qtquickcontrols2-button.png | Bin 1518 -> 0 bytes src/quicktemplates2/qquickbutton.cpp | 15 ++---- .../gifs/data/qtquickcontrols2-button-flat.qml | 56 +++++++++++++++++++++ .../data/qtquickcontrols2-button-highlighted.qml | 56 +++++++++++++++++++++ tests/manual/gifs/data/qtquickcontrols2-button.qml | 2 +- tests/manual/gifs/tst_gifs.cpp | 14 +++++- 11 files changed, 129 insertions(+), 14 deletions(-) delete mode 100644 src/imports/controls/doc/images/qtquickcontrols2-button-custom.png delete mode 100644 src/imports/controls/doc/images/qtquickcontrols2-button-disabled.png create mode 100644 src/imports/controls/doc/images/qtquickcontrols2-button-flat.gif create mode 100644 src/imports/controls/doc/images/qtquickcontrols2-button-highlighted.gif delete mode 100644 src/imports/controls/doc/images/qtquickcontrols2-button.png create mode 100644 tests/manual/gifs/data/qtquickcontrols2-button-flat.qml create mode 100644 tests/manual/gifs/data/qtquickcontrols2-button-highlighted.qml diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-button-custom.png deleted file mode 100644 index 5e68ed44..00000000 Binary files a/src/imports/controls/doc/images/qtquickcontrols2-button-custom.png and /dev/null differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button-disabled.png b/src/imports/controls/doc/images/qtquickcontrols2-button-disabled.png deleted file mode 100644 index 3375152c..00000000 Binary files a/src/imports/controls/doc/images/qtquickcontrols2-button-disabled.png and /dev/null differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button-flat.gif b/src/imports/controls/doc/images/qtquickcontrols2-button-flat.gif new file mode 100644 index 00000000..e2bd8b6f Binary files /dev/null and b/src/imports/controls/doc/images/qtquickcontrols2-button-flat.gif differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button-highlighted.gif b/src/imports/controls/doc/images/qtquickcontrols2-button-highlighted.gif new file mode 100644 index 00000000..7de076d3 Binary files /dev/null and b/src/imports/controls/doc/images/qtquickcontrols2-button-highlighted.gif differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button.gif b/src/imports/controls/doc/images/qtquickcontrols2-button.gif index 89dcba31..7f2de718 100644 Binary files a/src/imports/controls/doc/images/qtquickcontrols2-button.gif and b/src/imports/controls/doc/images/qtquickcontrols2-button.gif differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button.png b/src/imports/controls/doc/images/qtquickcontrols2-button.png deleted file mode 100644 index d8a39e55..00000000 Binary files a/src/imports/controls/doc/images/qtquickcontrols2-button.png and /dev/null differ diff --git a/src/quicktemplates2/qquickbutton.cpp b/src/quicktemplates2/qquickbutton.cpp index 901f730d..fc34aba4 100644 --- a/src/quicktemplates2/qquickbutton.cpp +++ b/src/quicktemplates2/qquickbutton.cpp @@ -57,17 +57,6 @@ QT_BEGIN_NAMESPACE a question. Typical buttons are \e OK, \e Apply, \e Cancel, \e Close, \e Yes, \e No, and \e Help. - \table - \row \li \image qtquickcontrols2-button-normal.png - \li A button in its normal state. - \row \li \image qtquickcontrols2-button-pressed.png - \li A button that is pressed. - \row \li \image qtquickcontrols2-button-focused.png - \li A button that has active focus. - \row \li \image qtquickcontrols2-button-disabled.png - \li A button that is disabled. - \endtable - A button emits the signal \l {AbstractButton::}{clicked()} when it is activated by the user. Connect to this signal to perform the button's action. Buttons also provide the signals \l {AbstractButton::}{canceled()}, \l {AbstractButton::}{doubleClicked()}, \l {AbstractButton::}{pressed()}, @@ -160,6 +149,8 @@ QFont QQuickButton::defaultFont() const This property holds whether the button is highlighted. + \image qtquickcontrols2-button-highlighted.gif + A button can be highlighted in order to draw the user's attention towards it. It has no effect on keyboard interaction. @@ -186,6 +177,8 @@ void QQuickButton::setHighlighted(bool highlighted) This property holds whether the button is flat. + \image qtquickcontrols2-button-flat.gif + A flat button typically does not draw a background unless it is pressed or checked. The default value is \c false. diff --git a/tests/manual/gifs/data/qtquickcontrols2-button-flat.qml b/tests/manual/gifs/data/qtquickcontrols2-button-flat.qml new file mode 100644 index 00000000..e20e3bc2 --- /dev/null +++ b/tests/manual/gifs/data/qtquickcontrols2-button-flat.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE: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.6 +import QtQuick.Window 2.0 +import QtQuick.Controls 2.0 + +Window { + width: button.width + height: button.height + visible: true + + Button { + id: button + text: pressed ? "Pressed" : "Button" + flat: true + anchors.centerIn: parent + } +} diff --git a/tests/manual/gifs/data/qtquickcontrols2-button-highlighted.qml b/tests/manual/gifs/data/qtquickcontrols2-button-highlighted.qml new file mode 100644 index 00000000..b031c731 --- /dev/null +++ b/tests/manual/gifs/data/qtquickcontrols2-button-highlighted.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE: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.6 +import QtQuick.Window 2.0 +import QtQuick.Controls 2.0 + +Window { + width: button.width + height: button.height + visible: true + + Button { + id: button + text: pressed ? "Pressed" : "Button" + highlighted: true + anchors.centerIn: parent + } +} diff --git a/tests/manual/gifs/data/qtquickcontrols2-button.qml b/tests/manual/gifs/data/qtquickcontrols2-button.qml index 7ac9f81c..31b8da47 100644 --- a/tests/manual/gifs/data/qtquickcontrols2-button.qml +++ b/tests/manual/gifs/data/qtquickcontrols2-button.qml @@ -49,7 +49,7 @@ Window { Button { id: button - text: pressed ? "Pressed" : "Normal" + text: pressed ? "Pressed" : "Button" anchors.centerIn: parent } } diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp index 24472036..e893d86e 100644 --- a/tests/manual/gifs/tst_gifs.cpp +++ b/tests/manual/gifs/tst_gifs.cpp @@ -54,6 +54,7 @@ private slots: void rangeSlider(); void busyIndicator(); void switchGif(); + void button_data(); void button(); void tabBar(); void menu(); @@ -325,14 +326,23 @@ void tst_Gifs::switchGif() gifRecorder.waitForFinish(); } +void tst_Gifs::button_data() +{ + QTest::addColumn("qmlFileName"); + QTest::newRow("button") << QString::fromLatin1("qtquickcontrols2-button.qml"); + QTest::newRow("button-flat") << QString::fromLatin1("qtquickcontrols2-button-flat.qml"); + QTest::newRow("button-highlighted") << QString::fromLatin1("qtquickcontrols2-button-highlighted.qml"); +} + void tst_Gifs::button() { + QFETCH(QString, qmlFileName); + GifRecorder gifRecorder; gifRecorder.setDataDirPath(dataDirPath); gifRecorder.setOutputDir(outputDir); gifRecorder.setRecordingDuration(3); - gifRecorder.setQmlFileName("qtquickcontrols2-button.qml"); - gifRecorder.setHighQuality(true); + gifRecorder.setQmlFileName(qmlFileName); gifRecorder.start(); -- cgit v1.2.3 From 7a418e470b1fa91d73d7ee8d299bd4a95b40eab9 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 30 Sep 2016 14:55:05 +0200 Subject: CheckBox: add GIFs to documentation - Replace the state table in the detailed description with a GIF. - Add a GIF for the tri-state documentation. Change-Id: I00f3835edad6eb454d06847ab342ce0eeb30156b Task-number: QTBUG-55904 Reviewed-by: J-P Nurmi --- .../images/qtquickcontrols2-checkbox-checked.png | Bin 1905 -> 0 bytes .../images/qtquickcontrols2-checkbox-disabled.png | Bin 1529 -> 0 bytes .../images/qtquickcontrols2-checkbox-focused.png | Bin 1628 -> 0 bytes .../images/qtquickcontrols2-checkbox-normal.png | Bin 1339 -> 0 bytes .../images/qtquickcontrols2-checkbox-tristate.gif | Bin 0 -> 4033 bytes .../doc/images/qtquickcontrols2-checkbox.gif | Bin 0 -> 2864 bytes src/quicktemplates2/qquickcheckbox.cpp | 17 ++--- .../data/qtquickcontrols2-checkbox-tristate.qml | 77 +++++++++++++++++++++ .../manual/gifs/data/qtquickcontrols2-checkbox.qml | 72 +++++++++++++++++++ tests/manual/gifs/tst_gifs.cpp | 58 ++++++++++++++++ 10 files changed, 213 insertions(+), 11 deletions(-) delete mode 100644 src/imports/controls/doc/images/qtquickcontrols2-checkbox-checked.png delete mode 100644 src/imports/controls/doc/images/qtquickcontrols2-checkbox-disabled.png delete mode 100644 src/imports/controls/doc/images/qtquickcontrols2-checkbox-focused.png delete mode 100644 src/imports/controls/doc/images/qtquickcontrols2-checkbox-normal.png create mode 100644 src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gif create mode 100644 src/imports/controls/doc/images/qtquickcontrols2-checkbox.gif create mode 100644 tests/manual/gifs/data/qtquickcontrols2-checkbox-tristate.qml create mode 100644 tests/manual/gifs/data/qtquickcontrols2-checkbox.qml diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-checked.png b/src/imports/controls/doc/images/qtquickcontrols2-checkbox-checked.png deleted file mode 100644 index 71cb90ca..00000000 Binary files a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-checked.png and /dev/null differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-disabled.png b/src/imports/controls/doc/images/qtquickcontrols2-checkbox-disabled.png deleted file mode 100644 index 0c4d3bf7..00000000 Binary files a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-disabled.png and /dev/null differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-focused.png b/src/imports/controls/doc/images/qtquickcontrols2-checkbox-focused.png deleted file mode 100644 index 5fb6daaf..00000000 Binary files a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-focused.png and /dev/null differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-normal.png b/src/imports/controls/doc/images/qtquickcontrols2-checkbox-normal.png deleted file mode 100644 index 69700ee0..00000000 Binary files a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-normal.png and /dev/null differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gif b/src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gif new file mode 100644 index 00000000..50986f1b Binary files /dev/null and b/src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gif differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox.gif b/src/imports/controls/doc/images/qtquickcontrols2-checkbox.gif new file mode 100644 index 00000000..beacdb37 Binary files /dev/null and b/src/imports/controls/doc/images/qtquickcontrols2-checkbox.gif differ diff --git a/src/quicktemplates2/qquickcheckbox.cpp b/src/quicktemplates2/qquickcheckbox.cpp index a777c2b4..ae967c34 100644 --- a/src/quicktemplates2/qquickcheckbox.cpp +++ b/src/quicktemplates2/qquickcheckbox.cpp @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE \ingroup qtquickcontrols2-buttons \brief An option button that can be checked or unchecked. + \image qtquickcontrols2-checkbox.gif + CheckBox presents an option button that can be toggled on (checked) or off (unchecked). Check boxes are typically used to select one or more options from a set of options. For larger sets of options, such as those @@ -65,17 +67,6 @@ QT_BEGIN_NAMESPACE the checkbox. This state is useful when several child nodes are selected in a treeview, for example. - \table - \row \li \image qtquickcontrols2-checkbox-normal.png - \li A check box in its normal state. - \row \li \image qtquickcontrols2-checkbox-checked.png - \li A check box that is checked. - \row \li \image qtquickcontrols2-checkbox-focused.png - \li A check box that has active focus. - \row \li \image qtquickcontrols2-checkbox-disabled.png - \li A check box that is disabled. - \endtable - \code ColumnLayout { CheckBox { @@ -120,6 +111,10 @@ QQuickCheckBox::QQuickCheckBox(QQuickItem *parent) : This property holds whether the checkbox is a tri-state checkbox. + In the animation below, the first checkbox is tri-state: + + \image qtquickcontrols2-checkbox-tristate.gif + The default is \c false, i.e., the checkbox has only two states. */ bool QQuickCheckBox::isTristate() const diff --git a/tests/manual/gifs/data/qtquickcontrols2-checkbox-tristate.qml b/tests/manual/gifs/data/qtquickcontrols2-checkbox-tristate.qml new file mode 100644 index 00000000..ef7e18d4 --- /dev/null +++ b/tests/manual/gifs/data/qtquickcontrols2-checkbox-tristate.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE: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.6 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.0 + +Window { + width: column.implicitWidth + height: column.implicitHeight + visible: true + + property alias english: english + property alias norwegian: norwegian + + ColumnLayout { + id: column + anchors.centerIn: parent + + CheckBox { + text: qsTr("Languages") + checkState: english.checked && norwegian.checked + ? Qt.Checked : (english.checked || norwegian.checked) ? Qt.PartiallyChecked : Qt.Unchecked + tristate: true + } + CheckBox { + id: english + text: qsTr("English") + checked: true + leftPadding: indicator.width + } + CheckBox { + id: norwegian + text: qsTr("Norwegian") + checked: true + leftPadding: indicator.width + } + } +} diff --git a/tests/manual/gifs/data/qtquickcontrols2-checkbox.qml b/tests/manual/gifs/data/qtquickcontrols2-checkbox.qml new file mode 100644 index 00000000..ef53721d --- /dev/null +++ b/tests/manual/gifs/data/qtquickcontrols2-checkbox.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE: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.6 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.0 + +Window { + width: column.implicitWidth + height: column.implicitHeight + visible: true + + property alias second: second + property alias third: third + + ColumnLayout { + id: column + anchors.centerIn: parent + + CheckBox { + checked: true + text: qsTr("First") + } + CheckBox { + id: second + text: qsTr("Second") + } + CheckBox { + id: third + checked: true + text: qsTr("Third") + } + } +} diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp index e893d86e..27234e63 100644 --- a/tests/manual/gifs/tst_gifs.cpp +++ b/tests/manual/gifs/tst_gifs.cpp @@ -65,6 +65,8 @@ private slots: void delegates(); void dial_data(); void dial(); + void checkBox(); + void checkBoxTriState(); private: void moveSmoothly(QQuickWindow *window, const QPoint &from, const QPoint &to, int movements, @@ -607,6 +609,62 @@ void tst_Gifs::dial() gifRecorder.waitForFinish(); } +void tst_Gifs::checkBox() +{ + GifRecorder gifRecorder; + gifRecorder.setDataDirPath(dataDirPath); + gifRecorder.setOutputDir(outputDir); + gifRecorder.setRecordingDuration(5); + gifRecorder.setQmlFileName("qtquickcontrols2-checkbox.qml"); + + gifRecorder.start(); + + QQuickWindow *window = gifRecorder.window(); + QQuickItem *second = window->property("second").value(); + QVERIFY(second); + QQuickItem *third = window->property("third").value(); + QVERIFY(third); + + QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, + second->mapToScene(QPointF(second->width() / 2, second->height() / 2)).toPoint(), 400); + QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, + third->mapToScene(QPointF(third->width() / 2, third->height() / 2)).toPoint(), 800); + QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, + third->mapToScene(QPointF(third->width() / 2, third->height() / 2)).toPoint(), 800); + QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, + second->mapToScene(QPointF(second->width() / 2, second->height() / 2)).toPoint(), 800); + + gifRecorder.waitForFinish(); +} + +void tst_Gifs::checkBoxTriState() +{ + GifRecorder gifRecorder; + gifRecorder.setDataDirPath(dataDirPath); + gifRecorder.setOutputDir(outputDir); + gifRecorder.setRecordingDuration(6); + gifRecorder.setQmlFileName("qtquickcontrols2-checkbox-tristate.qml"); + + gifRecorder.start(); + + QQuickWindow *window = gifRecorder.window(); + QQuickItem *english = window->property("english").value(); + QVERIFY(english); + QQuickItem *norwegian = window->property("norwegian").value(); + QVERIFY(norwegian); + + QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, + english->mapToScene(QPointF(english->width() / 2, english->height() / 2)).toPoint(), 1000); + QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, + norwegian->mapToScene(QPointF(norwegian->width() / 2, norwegian->height() / 2)).toPoint(), 1000); + QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, + norwegian->mapToScene(QPointF(norwegian->width() / 2, norwegian->height() / 2)).toPoint(), 1000); + QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, + english->mapToScene(QPointF(english->width() / 2, english->height() / 2)).toPoint(), 1000); + + gifRecorder.waitForFinish(); +} + QTEST_MAIN(tst_Gifs) #include "tst_gifs.moc" -- cgit v1.2.3 From 38e876032834ab6d02b94a798fe2866a79757719 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 30 Sep 2016 15:41:38 +0200 Subject: Material: fix accent update on theme change Change-Id: I9cb3fd6bdbedc0e7ca472b815502bce48dca00b7 Reviewed-by: Mitch Curtis --- src/imports/controls/material/qquickmaterialstyle.cpp | 4 ++++ tests/auto/qquickmaterialstyle/data/tst_material.qml | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp index ae8c3a11..0ff49732 100644 --- a/src/imports/controls/material/qquickmaterialstyle.cpp +++ b/src/imports/controls/material/qquickmaterialstyle.cpp @@ -479,6 +479,8 @@ void QQuickMaterialStyle::setTheme(Theme theme) propagateTheme(); emit themeChanged(); emit paletteChanged(); + if (!m_customAccent) + emit accentChanged(); if (!m_hasBackground) emit backgroundChanged(); if (!m_hasForeground) @@ -494,6 +496,8 @@ void QQuickMaterialStyle::inheritTheme(Theme theme) propagateTheme(); emit themeChanged(); emit paletteChanged(); + if (!m_customAccent) + emit accentChanged(); if (!m_hasBackground) emit backgroundChanged(); if (!m_hasForeground) diff --git a/tests/auto/qquickmaterialstyle/data/tst_material.qml b/tests/auto/qquickmaterialstyle/data/tst_material.qml index 63edb556..5cfec8d3 100644 --- a/tests/auto/qquickmaterialstyle/data/tst_material.qml +++ b/tests/auto/qquickmaterialstyle/data/tst_material.qml @@ -677,4 +677,19 @@ TestCase { window.destroy() } + + Component { + id: busyIndicator + BusyIndicator { } + } + + function test_shade() { + var control = busyIndicator.createObject(testCase) + + compare(control.contentItem.color.toString(), Material.color(Material.Pink, Material.Shade500)) + control.Material.theme = Material.Dark + compare(control.contentItem.color.toString(), Material.color(Material.Pink, Material.Shade200)) + + control.destroy() + } } -- cgit v1.2.3 From e95dc3b4853c1736aef0ef2cc5248ec0aa46e3ff Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 30 Sep 2016 22:47:34 +0200 Subject: Cancel exit transition when the same tooltip is shown again Task-number: QTBUG-54206 Task-number: QTBUG-54532 Change-Id: I7e4d993e3b1e30d7d7956629604f948dd1c85e32 Reviewed-by: J-P Nurmi --- src/quicktemplates2/qquickpopup.cpp | 7 +++-- src/quicktemplates2/qquicktooltip.cpp | 2 +- tests/auto/controls/data/tst_tooltip.qml | 48 ++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index a3d68266..e4e9cc11 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -770,6 +770,9 @@ QQuickPopupTransitionManager::QQuickPopupTransitionManager(QQuickPopupPrivate *p void QQuickPopupTransitionManager::transitionEnter() { + if (popup->transitionState == QQuickPopupPrivate::ExitTransition) + cancel(); + if (!popup->prepareEnterTransition()) return; @@ -829,7 +832,7 @@ QQuickPopup::~QQuickPopup() void QQuickPopup::open() { Q_D(QQuickPopup); - if (d->visible) + if (d->visible && d->transitionState != QQuickPopupPrivate::ExitTransition) return; if (d->complete) @@ -1767,7 +1770,7 @@ bool QQuickPopup::isVisible() const void QQuickPopup::setVisible(bool visible) { Q_D(QQuickPopup); - if (d->visible == visible) + if (d->visible == visible && d->transitionState != QQuickPopupPrivate::ExitTransition) return; d->visible = visible; diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp index 6b025fe5..b793ada5 100644 --- a/src/quicktemplates2/qquicktooltip.cpp +++ b/src/quicktemplates2/qquicktooltip.cpp @@ -256,7 +256,7 @@ QQuickToolTipAttached *QQuickToolTip::qmlAttachedProperties(QObject *object) void QQuickToolTip::open() { Q_D(QQuickToolTip); - if (d->delay > 0) + if (!d->visible && d->delay > 0) d->startDelay(); else QQuickPopup::open(); diff --git a/tests/auto/controls/data/tst_tooltip.qml b/tests/auto/controls/data/tst_tooltip.qml index b80a2cae..82ad01f1 100644 --- a/tests/auto/controls/data/tst_tooltip.qml +++ b/tests/auto/controls/data/tst_tooltip.qml @@ -188,4 +188,52 @@ TestCase { ignoreWarning(":1:30: QML ToolTip: cannot find any window to open popup in.") object.ToolTip.show("") // don't crash (QTBUG-56243) } + + Component { + id: toolTipWithExitTransition + + ToolTip { + enter: Transition { + NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 100 } + } + exit: Transition { + NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 1000 } + } + } + } + + function test_makeVisibleWhileExitTransitionRunning_data() { + return [ + { tag: "imperative", imperative: true }, + { tag: "declarative", imperative: false } + ] + } + + function test_makeVisibleWhileExitTransitionRunning(data) { + var control = toolTipWithExitTransition.createObject(testCase) + + // Show, hide, and show the tooltip again. Its exit transition should + // start and get cancelled, and then its enter transition should run. + if (data.imperative) + control.open() + else + control.visible = true + tryCompare(control, "opacity", 1) + + if (data.imperative) + control.close() + else + control.visible = false + verify(control.exit.running) + wait(100) // TODO: replace with tryVerify() in 5.8 + verify(control.opacity < 1) + + if (data.imperative) + control.open() + else + control.visible = true + tryCompare(control, "opacity", 1) + + control.destroy() + } } -- cgit v1.2.3 From de0212e51e65b578bc941c1004914a0c33c06da7 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 30 Sep 2016 21:23:01 +0200 Subject: Fix style inheritance When unable to find a parent item style on window change, use the window style as a fallback to avoid a parentless style. Task-number: QTBUG-52631 Change-Id: I5d31dc72075f06f865f01c3ee2411de6a1485677 Reviewed-by: J-P Nurmi --- src/quickcontrols2/qquickstyleattached.cpp | 7 +++++-- tests/auto/qquickmaterialstyle/data/tst_material.qml | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/quickcontrols2/qquickstyleattached.cpp b/src/quickcontrols2/qquickstyleattached.cpp index cdfa902e..e72abde0 100644 --- a/src/quickcontrols2/qquickstyleattached.cpp +++ b/src/quickcontrols2/qquickstyleattached.cpp @@ -241,10 +241,13 @@ void QQuickStyleAttached::parentStyleChange(QQuickStyleAttached *newParent, QQui void QQuickStyleAttached::itemWindowChanged(QQuickWindow *window) { - Q_UNUSED(window); + QQuickStyleAttached *parentStyle = nullptr; QQuickItem *item = qobject_cast(sender()); if (item) - setParentStyle(findParentStyle(metaObject(), item)); + parentStyle = findParentStyle(metaObject(), item); + if (!parentStyle) + parentStyle = attachedStyle(metaObject(), window); + setParentStyle(parentStyle); } void QQuickStyleAttached::itemParentChanged(QQuickItem *item, QQuickItem *parent) diff --git a/tests/auto/qquickmaterialstyle/data/tst_material.qml b/tests/auto/qquickmaterialstyle/data/tst_material.qml index 5cfec8d3..e1e100d7 100644 --- a/tests/auto/qquickmaterialstyle/data/tst_material.qml +++ b/tests/auto/qquickmaterialstyle/data/tst_material.qml @@ -41,6 +41,7 @@ import QtQuick 2.2 import QtQuick.Window 2.2 import QtTest 1.0 +import QtQuick.Templates 2.0 as T import QtQuick.Controls 2.0 import QtQuick.Controls.Material 2.0 @@ -127,6 +128,7 @@ TestCase { visible: true property alias popup: popupInstance property alias label: labelInstance + property alias label2: labelInstance2 Popup { id: popupInstance Label { @@ -136,6 +138,14 @@ TestCase { } Component.onCompleted: open() } + T.Popup { + contentItem: Label { + id: labelInstance2 + text: "test" + color: Material.textSelectionColor + } + Component.onCompleted: open() + } } } @@ -291,16 +301,19 @@ TestCase { var popupObject = popupComponent.createObject(testCase) compare(popupObject.popup.Material.textSelectionColor.toString(), popupObject.Material.textSelectionColor.toString()) compare(popupObject.label.color.toString(), popupObject.Material.textSelectionColor.toString()) + compare(popupObject.label2.color.toString(), popupObject.Material.textSelectionColor.toString()) popupObject.Material[prop] = data.value1 compare(popupObject.Material[prop], data.value1) compare(popupObject.popup.Material.textSelectionColor.toString(), popupObject.Material.textSelectionColor.toString()) compare(popupObject.label.color.toString(), popupObject.Material.textSelectionColor.toString()) + compare(popupObject.label2.color.toString(), popupObject.Material.textSelectionColor.toString()) popupObject.Material[prop] = data.value2 compare(popupObject.Material[prop], data.value2) compare(popupObject.popup.Material.textSelectionColor.toString(), popupObject.Material.textSelectionColor.toString()) compare(popupObject.label.color.toString(), popupObject.Material.textSelectionColor.toString()) + compare(popupObject.label2.color.toString(), popupObject.Material.textSelectionColor.toString()) popupObject.destroy() } @@ -500,11 +513,11 @@ TestCase { compare(control.Material[prop], "#80808080") // unknown - ignoreWarning(Qt.resolvedUrl("tst_material.qml") + ":57:9: QML Button: unknown Material." + prop + " value: 123") + ignoreWarning(Qt.resolvedUrl("tst_material.qml") + ":58:9: QML Button: unknown Material." + prop + " value: 123") control.Material[prop] = 123 - ignoreWarning(Qt.resolvedUrl("tst_material.qml") + ":57:9: QML Button: unknown Material." + prop + " value: foo") + ignoreWarning(Qt.resolvedUrl("tst_material.qml") + ":58:9: QML Button: unknown Material." + prop + " value: foo") control.Material[prop] = "foo" - ignoreWarning(Qt.resolvedUrl("tst_material.qml") + ":57:9: QML Button: unknown Material." + prop + " value: #1") + ignoreWarning(Qt.resolvedUrl("tst_material.qml") + ":58:9: QML Button: unknown Material." + prop + " value: #1") control.Material[prop] = "#1" control.destroy() -- cgit v1.2.3 From 50148c6fa19bb0af40a9ece8b8893ad621780745 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 30 Sep 2016 17:05:40 +0200 Subject: ComboBox: fix unintentional deps between the popup and its content item Do not use an ID to reference the default content item from the outside, because it should be possible to replace the content item. Change-Id: I8a6cc084fcb7eae431e4db7eeacb8fd2ab8c4bf5 Task-number: QTBUG-56297 Reviewed-by: J-P Nurmi --- src/imports/controls/ComboBox.qml | 3 ++- src/imports/controls/material/ComboBox.qml | 4 ++-- src/imports/controls/universal/ComboBox.qml | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml index 01a6d2ab..5bffbb35 100644 --- a/src/imports/controls/ComboBox.qml +++ b/src/imports/controls/ComboBox.qml @@ -105,13 +105,14 @@ T.ComboBox { popup: T.Popup { y: control.height - (control.visualFocus ? 0 : 1) width: control.width - implicitHeight: listview.contentHeight + implicitHeight: contentItem.implicitHeight topMargin: 6 bottomMargin: 6 contentItem: ListView { id: listview clip: true + implicitHeight: contentHeight model: control.popup.visible ? control.delegateModel : null currentIndex: control.highlightedIndex diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml index f13c6922..9d51f13b 100644 --- a/src/imports/controls/material/ComboBox.qml +++ b/src/imports/controls/material/ComboBox.qml @@ -114,7 +114,7 @@ T.ComboBox { popup: T.Popup { width: control.width - implicitHeight: listview.contentHeight + implicitHeight: contentItem.implicitHeight transformOrigin: Item.Top topMargin: 12 bottomMargin: 12 @@ -136,8 +136,8 @@ T.ComboBox { } contentItem: ListView { - id: listview clip: true + implicitHeight: contentHeight model: control.popup.visible ? control.delegateModel : null currentIndex: control.highlightedIndex diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml index a8bf58f8..929232ab 100644 --- a/src/imports/controls/universal/ComboBox.qml +++ b/src/imports/controls/universal/ComboBox.qml @@ -108,7 +108,7 @@ T.ComboBox { popup: T.Popup { width: control.width - implicitHeight: Math.min(396, listview.contentHeight) + implicitHeight: Math.min(396, contentItem.implicitHeight) topMargin: 8 bottomMargin: 8 @@ -116,8 +116,8 @@ T.ComboBox { Universal.accent: control.Universal.accent contentItem: ListView { - id: listview clip: true + implicitHeight: contentHeight model: control.popup.visible ? control.delegateModel : null currentIndex: control.highlightedIndex -- cgit v1.2.3 From da61768e9195593f3ad5b262b71e1b90c53fc681 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 1 Oct 2016 12:07:42 +0200 Subject: Material: fix dark dialog color https://material.google.com/style/color.html#color-themes Task-number: QTBUG-53266 Change-Id: I870d8e4871cae8d4940264c046d6ddf74dbe023f Reviewed-by: J-P Nurmi --- src/imports/controls/material/qquickmaterialstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp index 0ff49732..6c6a0e3e 100644 --- a/src/imports/controls/material/qquickmaterialstyle.cpp +++ b/src/imports/controls/material/qquickmaterialstyle.cpp @@ -391,7 +391,7 @@ static bool globalBackgroundCustom = true; static const QRgb backgroundColorLight = 0xFFFAFAFA; static const QRgb backgroundColorDark = 0xFF303030; static const QRgb dialogColorLight = 0xFFFFFFFF; -static const QRgb dialogColorDark = 0xFF303030; +static const QRgb dialogColorDark = 0xFF424242; static const QRgb primaryTextColorLight = 0xDD000000; static const QRgb primaryTextColorDark = 0xFFFFFFFF; static const QRgb secondaryTextColorLight = 0x89000000; -- cgit v1.2.3 From fda44e6fed0062b8ef91d1cfdb10b1ffa6a3d730 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 2 Oct 2016 10:29:39 +0200 Subject: Make a plain AbstractButton calculate suitable implicit size Just like commit 87b21a57 made Control do it, this applies the same logic to AbstractButton. The simple reasoning is that when customizing both the contentItem and the background, it is much better to use the AbstractButton type that does not have any default building blocks. Previously you would have to supply implicit size calculation as well, but this makes it much more convenient to use. [ChangeLog][Controls][AbstractButton] A plain AbstractButton now calculates its implicit size based on the implicit size of the content item plus paddings, and the implicit size of the background item. Change-Id: Ic380366b25940fbb9f28882c4622d58f4c042a07 Reviewed-by: J-P Nurmi --- src/imports/controls/AbstractButton.qml | 48 +++++++++++++++++++++++++ src/imports/controls/controls.pri | 1 + src/imports/controls/qtquickcontrols2plugin.cpp | 3 +- tests/auto/controls/data/tst_abstractbutton.qml | 36 +++++++++++++++++++ 4 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 src/imports/controls/AbstractButton.qml diff --git a/src/imports/controls/AbstractButton.qml b/src/imports/controls/AbstractButton.qml new file mode 100644 index 00000000..487b452b --- /dev/null +++ b/src/imports/controls/AbstractButton.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Templates 2.0 as T + +T.AbstractButton { + id: control + + implicitWidth: Math.max(background ? background.implicitWidth : 0, + (contentItem ? contentItem.implicitWidth : 0) + leftPadding + rightPadding) + implicitHeight: Math.max(background ? background.implicitHeight : 0, + (contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding) + baselineOffset: contentItem ? contentItem.y + contentItem.baselineOffset : 0 +} diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri index 788bfe27..dcbcf8e1 100644 --- a/src/imports/controls/controls.pri +++ b/src/imports/controls/controls.pri @@ -9,6 +9,7 @@ SOURCES += \ $$PWD/qquickdialring.cpp QML_CONTROLS = \ + AbstractButton.qml \ ApplicationWindow.qml \ BusyIndicator.qml \ Button.qml \ diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp index 541d18d6..153d61f7 100644 --- a/src/imports/controls/qtquickcontrols2plugin.cpp +++ b/src/imports/controls/qtquickcontrols2plugin.cpp @@ -41,7 +41,6 @@ #include #include -#include #include #include #include @@ -82,7 +81,6 @@ QtQuickControls2Plugin::QtQuickControls2Plugin(QObject *parent) : QQuickStylePlu void QtQuickControls2Plugin::registerTypes(const char *uri) { - qmlRegisterType(uri, 2, 0, "AbstractButton"); qmlRegisterType(uri, 2, 0, "ButtonGroup"); qmlRegisterType(); @@ -93,6 +91,7 @@ void QtQuickControls2Plugin::registerTypes(const char *uri) if (!style.isEmpty()) QFileSelectorPrivate::addStatics(QStringList() << style.toLower()); + qmlRegisterType(selector.select(QStringLiteral("AbstractButton.qml")), uri, 2, 0, "AbstractButton"); qmlRegisterType(selector.select(QStringLiteral("ApplicationWindow.qml")), uri, 2, 0, "ApplicationWindow"); qmlRegisterType(selector.select(QStringLiteral("BusyIndicator.qml")), uri, 2, 0, "BusyIndicator"); qmlRegisterType(selector.select(QStringLiteral("Button.qml")), uri, 2, 0, "Button"); diff --git a/tests/auto/controls/data/tst_abstractbutton.qml b/tests/auto/controls/data/tst_abstractbutton.qml index c94653d9..ba5ee94c 100644 --- a/tests/auto/controls/data/tst_abstractbutton.qml +++ b/tests/auto/controls/data/tst_abstractbutton.qml @@ -55,6 +55,11 @@ TestCase { AbstractButton {} } + Component { + id: item + Item { } + } + function test_text() { var control = button.createObject(testCase); verify(control); @@ -67,4 +72,35 @@ TestCase { control.destroy(); } + + function test_baseline() { + var control = button.createObject(testCase, {padding: 6}) + verify(control) + compare(control.baselineOffset, 0) + control.contentItem = item.createObject(control, {baselineOffset: 12}) + compare(control.baselineOffset, 18) + control.destroy() + } + + function test_implicitSize() { + var control = button.createObject(testCase) + verify(control) + + compare(control.implicitWidth, 0) + compare(control.implicitHeight, 0) + + control.contentItem = item.createObject(control, {implicitWidth: 10, implicitHeight: 20}) + compare(control.implicitWidth, 10) + compare(control.implicitHeight, 20) + + control.background = item.createObject(control, {implicitWidth: 20, implicitHeight: 30}) + compare(control.implicitWidth, 20) + compare(control.implicitHeight, 30) + + control.padding = 100 + compare(control.implicitWidth, 210) + compare(control.implicitHeight, 220) + + control.destroy() + } } -- cgit v1.2.3 From 7246e3c1affdd29bbb177578d169213972f46a9e Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 2 Oct 2016 10:44:41 +0200 Subject: qtquickcontrols2plugin.cpp: cleanup includes Change-Id: I5c1b3a911972b61562d8d7e9b1e07cbde0bef78f Reviewed-by: J-P Nurmi --- src/imports/controls/qtquickcontrols2plugin.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp index 153d61f7..8e41a58c 100644 --- a/src/imports/controls/qtquickcontrols2plugin.cpp +++ b/src/imports/controls/qtquickcontrols2plugin.cpp @@ -34,20 +34,12 @@ ** ****************************************************************************/ -#include -#include -#include -#include #include - #include -#include -#include -#include -#include #include #include #include +#include #include "qquickbusyindicatorring_p.h" #include "qquickdialring_p.h" -- cgit v1.2.3 From 30bfa894d977e42d16d0ad88a023681818a11dc8 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 2 Oct 2016 11:59:57 +0200 Subject: Doc: cleanup the mention of 'indicator' in 'Customizing ItemDelegate' The explicit mention 'indicator' in the ItemDelegate customization docs is a remainder from the early days when it still had a check indicator built into. Then at some point we decided to provide separate type of checkable delegates. Change-Id: I710318d3828ffae1ceb0877a67fe128460653bc1 Reviewed-by: J-P Nurmi --- src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc index 852a1e03..f37519de 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc @@ -433,8 +433,8 @@ \section2 Customizing ItemDelegate - ItemDelegate consists of three visual items: \l {Control::background}{background}, - \l {Control::contentItem}{content item} and \l {AbstractButton::indicator}{indicator}. + ItemDelegate consists of two visual items: \l {Control::background}{background} + and \l {Control::contentItem}{content item}. \image qtquickcontrols2-itemdelegate-custom.png -- cgit v1.2.3 From 2069f1cae020113306f150309fb55de1c478ea59 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 2 Oct 2016 12:30:57 +0200 Subject: Fix QQuickControl::setFocusReason() There is a little behavior change in focus handling in Qt Quick after qdeclarative commit e7da97b. The order of QQuickItem::focusOutEvent() and QQuickItem::ItemActiveFocusHasChanged have changed. Now we need to emit visualFocusChanged() in setFocusReason() when losing visual focus to ensure that bindigs to visualFocus get re-evaluated as appropriate. Change-Id: I52e728c7df751a54b36f353415b2666cfedc73ad Reviewed-by: J-P Nurmi --- src/quicktemplates2/qquickcontrol.cpp | 2 +- tests/auto/focus/data/visualFocus.qml | 54 +++++++++++++++++++++++++++++++++++ tests/auto/focus/tst_focus.cpp | 31 ++++++++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 tests/auto/focus/data/visualFocus.qml diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp index 518255dd..d571a2d4 100644 --- a/src/quicktemplates2/qquickcontrol.cpp +++ b/src/quicktemplates2/qquickcontrol.cpp @@ -902,7 +902,7 @@ void QQuickControl::setFocusReason(Qt::FocusReason reason) Qt::FocusReason oldReason = d->focusReason; d->focusReason = reason; emit focusReasonChanged(); - if (d->activeFocus && isKeyFocusReason(oldReason) != isKeyFocusReason(reason)) + if (isKeyFocusReason(oldReason) != isKeyFocusReason(reason)) emit visualFocusChanged(); } diff --git a/tests/auto/focus/data/visualFocus.qml b/tests/auto/focus/data/visualFocus.qml new file mode 100644 index 00000000..0af87652 --- /dev/null +++ b/tests/auto/focus/data/visualFocus.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE: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.5 +import QtQuick.Controls 2.0 + +Column { + width: 400 + height: 400 + Button { + text: "Button" + property bool showFocus: visualFocus + } + TextField { + text: "TextField" + } +} diff --git a/tests/auto/focus/tst_focus.cpp b/tests/auto/focus/tst_focus.cpp index 36bc2d32..3f3b1ae5 100644 --- a/tests/auto/focus/tst_focus.cpp +++ b/tests/auto/focus/tst_focus.cpp @@ -63,6 +63,8 @@ private slots: void reason_data(); void reason(); + + void visualFocus(); }; void tst_focus::initTestCase() @@ -245,6 +247,35 @@ void tst_focus::reason() QCOMPARE(control->property("visualFocus"), QVariant(true)); } +void tst_focus::visualFocus() +{ + QQuickView view; + view.setSource(testFileUrl("visualFocus.qml")); + view.show(); + view.requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(&view)); + + QQuickItem *column = view.rootObject(); + QVERIFY(column); + QCOMPARE(column->childItems().count(), 2); + + QQuickControl *button = qobject_cast(column->childItems().first()); + QVERIFY(button); + + QQuickItem *textfield = column->childItems().last(); + QVERIFY(textfield); + + button->forceActiveFocus(Qt::TabFocusReason); + QVERIFY(button->hasActiveFocus()); + QVERIFY(button->hasVisualFocus()); + QVERIFY(button->property("showFocus").toBool()); + + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, QPoint(textfield->x() + textfield->width() / 2, textfield->y() + textfield->height() / 2)); + QVERIFY(!button->hasActiveFocus()); + QVERIFY(!button->hasVisualFocus()); + QVERIFY(!button->property("showFocus").toBool()); +} + QTEST_MAIN(tst_focus) #include "tst_focus.moc" -- cgit v1.2.3 From eb7bf1825ede649ae35ebec91ef430686ae2c70a Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 2 Oct 2016 13:18:34 +0200 Subject: Popup: don't steal focus on close from another opening popup In the Gallery example, the settings dialog does not get focus (or to be exact, loses it immediately), because the closing menu incorrectly transfers focus back to the tool button that opened the menu. Change-Id: I5328d8e825de9a977619688dc4478e6592db654f Reviewed-by: J-P Nurmi --- src/quicktemplates2/qquickpopup.cpp | 14 +++--- tests/auto/popup/data/activeFocusOnClose3.qml | 68 +++++++++++++++++++++++++++ tests/auto/popup/tst_popup.cpp | 33 +++++++++++++ 3 files changed, 109 insertions(+), 6 deletions(-) create mode 100644 tests/auto/popup/data/activeFocusOnClose3.qml diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index e4e9cc11..e0a1f359 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -248,12 +248,14 @@ void QQuickPopupPrivate::finalizeExitTransition() popupItem->setParentItem(nullptr); popupItem->setVisible(false); - if (hadActiveFocusBeforeExitTransition) { - QQuickApplicationWindow *applicationWindow = qobject_cast(window); - if (applicationWindow) - applicationWindow->contentItem()->setFocus(true); - else if (window) - window->contentItem()->setFocus(true); + if (hadActiveFocusBeforeExitTransition && window) { + if (!qobject_cast(window->activeFocusItem())) { + QQuickApplicationWindow *applicationWindow = qobject_cast(window); + if (applicationWindow) + applicationWindow->contentItem()->setFocus(true); + else + window->contentItem()->setFocus(true); + } } visible = false; diff --git a/tests/auto/popup/data/activeFocusOnClose3.qml b/tests/auto/popup/data/activeFocusOnClose3.qml new file mode 100644 index 00000000..5a1c8231 --- /dev/null +++ b/tests/auto/popup/data/activeFocusOnClose3.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE: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.6 +import QtQuick.Controls 2.0 + +ApplicationWindow { + width: 400 + height: 400 + + property alias popup1: popup1 + property alias popup2: popup2 + + Button { + focus: true + } + + Popup { + id: popup1 + focus: true + enter: Transition { PauseAnimation { duration: 200 } } + exit: Transition { PauseAnimation { duration: 200 } } + } + + Popup { + id: popup2 + focus: true + enter: Transition { PauseAnimation { duration: 100 } } + exit: Transition { PauseAnimation { duration: 100 } } + } +} diff --git a/tests/auto/popup/tst_popup.cpp b/tests/auto/popup/tst_popup.cpp index 6d1e1e3c..af6ccf34 100644 --- a/tests/auto/popup/tst_popup.cpp +++ b/tests/auto/popup/tst_popup.cpp @@ -64,6 +64,7 @@ private slots: void closePolicy(); void activeFocusOnClose1(); void activeFocusOnClose2(); + void activeFocusOnClose3(); void hover_data(); void hover(); void wheel_data(); @@ -454,6 +455,38 @@ void tst_popup::activeFocusOnClose2() QVERIFY(popup1->hasActiveFocus()); } +void tst_popup::activeFocusOnClose3() +{ + // Test that a closing popup that had focus doesn't steal focus from + // another popup that the focus was transferred to. + QQuickApplicationHelper helper(this, QStringLiteral("activeFocusOnClose3.qml")); + QQuickApplicationWindow *window = helper.appWindow; + window->show(); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); + + QQuickPopup *popup1 = helper.appWindow->property("popup1").value(); + QVERIFY(popup1); + + QQuickPopup *popup2 = helper.appWindow->property("popup2").value(); + QVERIFY(popup2); + + popup1->open(); + QVERIFY(popup1->isVisible()); + QTRY_VERIFY(popup1->hasActiveFocus()); + + popup2->open(); + popup1->close(); + + QSignalSpy closedSpy(popup1, SIGNAL(closed())); + QVERIFY(closedSpy.isValid()); + QVERIFY(closedSpy.wait()); + + QVERIFY(!popup1->isVisible()); + QVERIFY(popup2->isVisible()); + QTRY_VERIFY(popup2->hasActiveFocus()); +} + void tst_popup::hover_data() { QTest::addColumn("source"); -- cgit v1.2.3 From bfaa08a335f21e6fdf533969779f806883fe27b0 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 1 Oct 2016 13:07:31 +0200 Subject: Fix QQuickToolTip's delay and visibility The imperative open() and close() methods used to be the only ways to open and close popups, but the visible-property was later made writable to allow declarative visibility bindings. Since then, it is no longer sufficient for QQuickToolTip to overshadow open() and close() in QML, because setting the visible-property would bypass these overshadowed method. There was a bit of duplicate code between setVisible(), open(), and close(). This change moves the logic to one place by changing open() and close() to call setVisible(). Furthermore, setVisible() has been made virtual to make it possible for QQuickToolTip to apply its delay properly. QQuickToolTip needs to control the delay and timeout timers before the effective visibility is applied on the popup. Task-number: QTBUG-55572 Change-Id: I5a109157f9ec5d0db145e710426665a9a8d7e870 Reviewed-by: J-P Nurmi --- src/quicktemplates2/qquickpopup.cpp | 17 ++++------------ src/quicktemplates2/qquickpopup_p.h | 2 +- src/quicktemplates2/qquicktooltip.cpp | 34 +++++++++++++++----------------- src/quicktemplates2/qquicktooltip_p.h | 6 ++---- tests/auto/controls/data/tst_tooltip.qml | 25 ++++++++++++++++++----- 5 files changed, 43 insertions(+), 41 deletions(-) diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index e0a1f359..6a1e1c4f 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -833,12 +833,7 @@ QQuickPopup::~QQuickPopup() */ void QQuickPopup::open() { - Q_D(QQuickPopup); - if (d->visible && d->transitionState != QQuickPopupPrivate::ExitTransition) - return; - - if (d->complete) - d->transitionManager.transitionEnter(); + setVisible(true); } /*! @@ -850,12 +845,7 @@ void QQuickPopup::open() */ void QQuickPopup::close() { - Q_D(QQuickPopup); - if (!d->visible) - return; - - if (d->complete) - d->transitionManager.transitionExit(); + setVisible(false); } /*! @@ -1775,12 +1765,13 @@ void QQuickPopup::setVisible(bool visible) if (d->visible == visible && d->transitionState != QQuickPopupPrivate::ExitTransition) return; - d->visible = visible; if (d->complete) { if (visible) d->transitionManager.transitionEnter(); else d->transitionManager.transitionExit(); + } else { + d->visible = visible; } } diff --git a/src/quicktemplates2/qquickpopup_p.h b/src/quicktemplates2/qquickpopup_p.h index 9ef5c64b..a024c68f 100644 --- a/src/quicktemplates2/qquickpopup_p.h +++ b/src/quicktemplates2/qquickpopup_p.h @@ -233,7 +233,7 @@ public: void resetDim(); bool isVisible() const; - void setVisible(bool visible); + virtual void setVisible(bool visible); qreal opacity() const; void setOpacity(qreal opacity); diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp index b793ada5..a1601ad6 100644 --- a/src/quicktemplates2/qquicktooltip.cpp +++ b/src/quicktemplates2/qquicktooltip.cpp @@ -244,6 +244,20 @@ void QQuickToolTip::setTimeout(int timeout) emit timeoutChanged(); } +void QQuickToolTip::setVisible(bool visible) +{ + Q_D(QQuickToolTip); + if (visible) { + if (!d->visible && d->delay > 0) { + d->startDelay(); + return; + } + } else { + d->stopDelay(); + } + QQuickPopup::setVisible(visible); +} + QQuickToolTipAttached *QQuickToolTip::qmlAttachedProperties(QObject *object) { QQuickItem *item = qobject_cast(object); @@ -253,22 +267,6 @@ QQuickToolTipAttached *QQuickToolTip::qmlAttachedProperties(QObject *object) return new QQuickToolTipAttached(object); } -void QQuickToolTip::open() -{ - Q_D(QQuickToolTip); - if (!d->visible && d->delay > 0) - d->startDelay(); - else - QQuickPopup::open(); -} - -void QQuickToolTip::close() -{ - Q_D(QQuickToolTip); - d->stopDelay(); - QQuickPopup::close(); -} - QFont QQuickToolTip::defaultFont() const { return QQuickControlPrivate::themeFont(QPlatformTheme::TipLabelFont); @@ -295,10 +293,10 @@ void QQuickToolTip::timerEvent(QTimerEvent *event) Q_D(QQuickToolTip); if (event->timerId() == d->timeoutTimer.timerId()) { d->stopTimeout(); - close(); + QQuickPopup::setVisible(false); } else if (event->timerId() == d->delayTimer.timerId()) { d->stopDelay(); - QQuickPopup::open(); + QQuickPopup::setVisible(true); } } diff --git a/src/quicktemplates2/qquicktooltip_p.h b/src/quicktemplates2/qquicktooltip_p.h index e39862bf..730e38d9 100644 --- a/src/quicktemplates2/qquicktooltip_p.h +++ b/src/quicktemplates2/qquicktooltip_p.h @@ -75,11 +75,9 @@ public: int timeout() const; void setTimeout(int timeout); - static QQuickToolTipAttached *qmlAttachedProperties(QObject *object); + void setVisible(bool visible) override; -public Q_SLOTS: - void open(); - void close(); + static QQuickToolTipAttached *qmlAttachedProperties(QObject *object); Q_SIGNALS: void textChanged(); diff --git a/tests/auto/controls/data/tst_tooltip.qml b/tests/auto/controls/data/tst_tooltip.qml index 82ad01f1..c78a7770 100644 --- a/tests/auto/controls/data/tst_tooltip.qml +++ b/tests/auto/controls/data/tst_tooltip.qml @@ -156,8 +156,10 @@ TestCase { function test_delay_data() { return [ - {tag: "0", delay: 0}, - {tag: "100", delay: 100}, + {tag: "imperative:0", delay: 0, imperative: true}, + {tag: "imperative:100", delay: 100, imperative: true}, + {tag: "declarative:0", delay: 0, imperative: false}, + {tag: "declarative:100", delay: 100, imperative: false} ] } @@ -165,18 +167,31 @@ TestCase { var control = toolTip.createObject(testCase, {delay: data.delay}) compare(control.visible, false) - control.open() + if (data.imperative) + control.open() + else + control.visible = true compare(control.visible, data.delay <= 0) tryCompare(control, "visible", true) control.destroy() } - function test_timeout() { + function test_timeout_data() { + return [ + {tag: "imperative", imperative: true}, + {tag: "declarative", imperative: false} + ] + } + + function test_timeout(data) { var control = toolTip.createObject(testCase, {timeout: 100}) compare(control.visible, false) - control.open() + if (data.imperative) + control.open() + else + control.visible = true compare(control.visible, true) tryCompare(control, "visible", false) -- cgit v1.2.3 From 4fb88d0f34e030223c75fc8903ef5d8325b649ed Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 1 Oct 2016 23:02:43 +0200 Subject: Fix ComboBox to scroll to the highlighted item Change-Id: I57fefd8ba47796118e71902c6882e9918d462920 Tasl-number: QTBUG-55030 Reviewed-by: J-P Nurmi --- src/imports/controls/ComboBox.qml | 2 + src/imports/controls/material/ComboBox.qml | 2 + src/imports/controls/universal/ComboBox.qml | 2 + src/quicktemplates2/qquickcombobox.cpp | 15 +++++-- tests/auto/controls/data/tst_combobox.qml | 63 +++++++++++++++++++++++++++-- 5 files changed, 77 insertions(+), 7 deletions(-) diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml index 5bffbb35..09930aad 100644 --- a/src/imports/controls/ComboBox.qml +++ b/src/imports/controls/ComboBox.qml @@ -115,6 +115,8 @@ T.ComboBox { implicitHeight: contentHeight model: control.popup.visible ? control.delegateModel : null currentIndex: control.highlightedIndex + highlightRangeMode: ListView.ApplyRange + highlightMoveDuration: 0 Rectangle { z: 10 diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml index 9d51f13b..05981baa 100644 --- a/src/imports/controls/material/ComboBox.qml +++ b/src/imports/controls/material/ComboBox.qml @@ -140,6 +140,8 @@ T.ComboBox { implicitHeight: contentHeight model: control.popup.visible ? control.delegateModel : null currentIndex: control.highlightedIndex + highlightRangeMode: ListView.ApplyRange + highlightMoveDuration: 0 T.ScrollIndicator.vertical: ScrollIndicator { } } diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml index 929232ab..bb816fc1 100644 --- a/src/imports/controls/universal/ComboBox.qml +++ b/src/imports/controls/universal/ComboBox.qml @@ -120,6 +120,8 @@ T.ComboBox { implicitHeight: contentHeight model: control.popup.visible ? control.delegateModel : null currentIndex: control.highlightedIndex + highlightRangeMode: ListView.ApplyRange + highlightMoveDuration: 0 T.ScrollIndicator.vertical: ScrollIndicator { } } diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index a7450d76..278f8608 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -170,6 +170,7 @@ public: void updateCurrentText(); void incrementCurrentIndex(); void decrementCurrentIndex(); + void updateHighlightedIndex(); void setHighlightedIndex(int index); void createDelegateModel(); @@ -200,19 +201,17 @@ void QQuickComboBoxPrivate::showPopup() { if (popup && !popup->isVisible()) popup->open(); - setHighlightedIndex(currentIndex); } void QQuickComboBoxPrivate::hidePopup(bool accept) { Q_Q(QQuickComboBox); - if (popup && popup->isVisible()) - popup->close(); if (accept) { q->setCurrentIndex(highlightedIndex); emit q->activated(currentIndex); } - setHighlightedIndex(-1); + if (popup && popup->isVisible()) + popup->close(); } void QQuickComboBoxPrivate::togglePopup(bool accept) @@ -303,6 +302,11 @@ void QQuickComboBoxPrivate::decrementCurrentIndex() } } +void QQuickComboBoxPrivate::updateHighlightedIndex() +{ + setHighlightedIndex(popup->isVisible() ? currentIndex : -1); +} + void QQuickComboBoxPrivate::setHighlightedIndex(int index) { Q_Q(QQuickComboBox); @@ -655,10 +659,13 @@ void QQuickComboBox::setPopup(QQuickPopup *popup) if (d->popup == popup) return; + if (d->popup) + QObjectPrivate::disconnect(d->popup, &QQuickPopup::visibleChanged, d, &QQuickComboBoxPrivate::updateHighlightedIndex); d->deleteDelegate(d->popup); if (popup) { QQuickPopupPrivate::get(popup)->allowVerticalFlip = true; popup->setClosePolicy(QQuickPopup::CloseOnEscape | QQuickPopup::CloseOnPressOutsideParent); + QObjectPrivate::connect(popup, &QQuickPopup::visibleChanged, d, &QQuickComboBoxPrivate::updateHighlightedIndex); } d->popup = popup; emit popupChanged(); diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index 29bf62c8..479b1002 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -61,8 +61,18 @@ TestCase { signalName: "highlighted" } + Component { + id: signalSpy + SignalSpy { } + } + Component { id: comboBox + ComboBox { } + } + + Component { + id: emptyBox ComboBox { delegate: ItemDelegate { width: popup.width @@ -130,7 +140,7 @@ TestCase { } function test_objects() { - var control = comboBox.createObject(testCase) + var control = emptyBox.createObject(testCase) verify(control) var items = [ @@ -237,7 +247,7 @@ TestCase { } function test_textRole(data) { - var control = comboBox.createObject(testCase) + var control = emptyBox.createObject(testCase) verify(control) control.model = data.model @@ -442,7 +452,7 @@ TestCase { keyClick(Qt.Key_Space) compare(control.currentIndex, 1) - compare(control.highlightedIndex, -1) + tryCompare(control, "highlightedIndex", -1) control.destroy() } @@ -860,4 +870,51 @@ TestCase { control.destroy() } + + // QTBUG-55030 + function test_highlightRange() { + var control = comboBox.createObject(testCase, {model: 100}) + verify(control) + + control.currentIndex = 50 + compare(control.currentIndex, 50) + compare(control.highlightedIndex, -1) + + var openedSpy = signalSpy.createObject(control, {target: control.popup, signalName: "opened"}) + verify(openedSpy.valid) + + control.popup.open() + compare(control.highlightedIndex, 50) + tryCompare(openedSpy, "count", 1) + + var listview = control.popup.contentItem + verify(listview) + + var first = listview.itemAt(0, listview.contentY) + verify(first) + compare(first.text, "50") + + var closedSpy = signalSpy.createObject(control, {target: control.popup, signalName: "closed"}) + verify(closedSpy.valid) + + control.popup.close() + tryCompare(closedSpy, "count", 1) + compare(control.highlightedIndex, -1) + + control.currentIndex = 99 + compare(control.currentIndex, 99) + compare(control.highlightedIndex, -1) + + control.popup.open() + compare(control.highlightedIndex, 99) + tryCompare(openedSpy, "count", 2) + + var last = listview.itemAt(0, listview.contentY + listview.height - 1) + verify(last) + compare(last.text, "99") + + openedSpy.target = null + closedSpy.target = null + control.destroy() + } } -- cgit v1.2.3 From 84d8f07b6d3133dc10a83f0b64c39a5948334302 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 2 Oct 2016 19:53:14 +0200 Subject: QQuickPopupPrivate: unbreak ubsan build The tst_drawer test uses members of the class, but it was not (autotest-) exported. That's no problem as long as the function called is inline, or a data member is accessed, but in a UBSan build, the typeid of a poly- morphic class is checked on each access, so the typeinfo object must be exported. Fix by autotest-exporting the class and defining the dtor out-of-line to pin the typeinfo and vtabe to a single TU. Change-Id: I1524e63a330dbdb0ae1ceb60263b589734bfd3aa Reviewed-by: J-P Nurmi --- src/quicktemplates2/qquickpopup.cpp | 4 ++++ src/quicktemplates2/qquickpopup_p_p.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index 6a1e1c4f..124b8c5b 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -165,6 +165,10 @@ QQuickPopupPrivate::QQuickPopupPrivate() { } +QQuickPopupPrivate::~QQuickPopupPrivate() +{ +} + void QQuickPopupPrivate::init() { Q_Q(QQuickPopup); diff --git a/src/quicktemplates2/qquickpopup_p_p.h b/src/quicktemplates2/qquickpopup_p_p.h index c9f5e264..c8c83ada 100644 --- a/src/quicktemplates2/qquickpopup_p_p.h +++ b/src/quicktemplates2/qquickpopup_p_p.h @@ -142,12 +142,13 @@ private: QQuickPopupPrivate *m_popup; }; -class QQuickPopupPrivate : public QObjectPrivate, public QQuickItemChangeListener +class Q_AUTOTEST_EXPORT QQuickPopupPrivate : public QObjectPrivate, public QQuickItemChangeListener { Q_DECLARE_PUBLIC(QQuickPopup) public: QQuickPopupPrivate(); + ~QQuickPopupPrivate(); static QQuickPopupPrivate *get(QQuickPopup *popup) { -- cgit v1.2.3 From b6cfb4a1e30598a6176f9bbfdbd1495b37c7f59a Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 1 Oct 2016 20:04:16 +0200 Subject: StackView: allow loading remote URLs Task-number: QTBUG-55749 Change-Id: I369e0113492547f312c8f1b540f5faa506a75a25 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickstackview_p.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/quicktemplates2/qquickstackview_p.cpp b/src/quicktemplates2/qquickstackview_p.cpp index 3709b988..050bfde9 100644 --- a/src/quicktemplates2/qquickstackview_p.cpp +++ b/src/quicktemplates2/qquickstackview_p.cpp @@ -138,6 +138,16 @@ bool QQuickStackElement::load(QQuickStackView *parent) if (!item) { ownItem = true; + if (component->isLoading()) { + QObject::connect(component, &QQmlComponent::statusChanged, [this](QQmlComponent::Status status) { + if (status == QQmlComponent::Ready) + load(view); + else if (status == QQmlComponent::Error) + qWarning() << qPrintable(component->errorString().trimmed()); + }); + return true; + } + QQmlContext *creationContext = component->creationContext(); if (!creationContext) creationContext = qmlContext(parent); -- cgit v1.2.3