From d90bd09499874bb090bfd12a3d59e0fdec4ad6da Mon Sep 17 00:00:00 2001 From: Fawzi Mohamed Date: Tue, 29 Jul 2014 17:48:34 +0200 Subject: [PATCH] qmljs: tests of the import architecture First tests using the new qmljs testing architecture Change-Id: Id88fe53dddbb720c56cd0473e74f476862feb803 Reviewed-by: Thomas Hartmann --- src/libs/qmljs/qmljsmodelmanagerinterface.h | 11 +- tests/auto/qml/codemodel/codemodel.pro | 3 +- tests/auto/qml/codemodel/codemodel.qbs | 2 +- .../GaussianDirectionalBlur.qml | 287 + .../QtGraphicalEffects/Blend.qml | 478 ++ .../QtGraphicalEffects/BrightnessContrast.qml | 207 + .../QtGraphicalEffects/ColorOverlay.qml | 155 + .../QtGraphicalEffects/Colorize.qml | 294 + .../QtGraphicalEffects/ConicalGradient.qml | 342 + .../QtGraphicalEffects/Desaturate.qml | 155 + .../QtGraphicalEffects/DirectionalBlur.qml | 289 + .../QtGraphicalEffects/Displace.qml | 217 + .../QtGraphicalEffects/DropShadow.qml | 403 ++ .../QtGraphicalEffects/FastBlur.qml | 496 ++ .../QtGraphicalEffects/GammaAdjust.qml | 193 + .../QtGraphicalEffects/GaussianBlur.qml | 295 + .../QtGraphicalEffects/Glow.qml | 307 + .../QtGraphicalEffects/HueSaturation.qml | 300 + .../QtGraphicalEffects/InnerShadow.qml | 385 ++ .../QtGraphicalEffects/LevelAdjust.qml | 472 ++ .../QtGraphicalEffects/LinearGradient.qml | 346 + .../QtGraphicalEffects/MaskedBlur.qml | 282 + .../QtGraphicalEffects/OpacityMask.qml | 154 + .../QtGraphicalEffects/RadialBlur.qml | 312 + .../QtGraphicalEffects/RadialGradient.qml | 439 ++ .../QtGraphicalEffects/RectangularGlow.qml | 288 + .../QtGraphicalEffects/RecursiveBlur.qml | 350 + .../QtGraphicalEffects/ThresholdMask.qml | 226 + .../QtGraphicalEffects/ZoomBlur.qml | 302 + .../QtGraphicalEffects/private/FastGlow.qml | 393 ++ .../private/FastInnerShadow.qml | 413 ++ .../private/FastMaskedBlur.qml | 332 + .../private/GaussianDirectionalBlur.qml | 287 + .../private/GaussianGlow.qml | 98 + .../private/GaussianInnerShadow.qml | 155 + .../private/GaussianMaskedBlur.qml | 104 + .../private/SourceProxy.qml | 136 + .../QtGraphicalEffects/Blend.qml | 478 ++ .../QtGraphicalEffects/BrightnessContrast.qml | 207 + .../QtGraphicalEffects/ColorOverlay.qml | 155 + .../QtGraphicalEffects/Colorize.qml | 294 + .../QtGraphicalEffects/ConicalGradient.qml | 342 + .../QtGraphicalEffects/Desaturate.qml | 155 + .../QtGraphicalEffects/DirectionalBlur.qml | 289 + .../QtGraphicalEffects/Displace.qml | 217 + .../QtGraphicalEffects/DropShadow.qml | 403 ++ .../QtGraphicalEffects/FastBlur.qml | 496 ++ .../QtGraphicalEffects/GammaAdjust.qml | 193 + .../QtGraphicalEffects/GaussianBlur.qml | 295 + .../QtGraphicalEffects/Glow.qml | 307 + .../QtGraphicalEffects/HueSaturation.qml | 300 + .../QtGraphicalEffects/InnerShadow.qml | 385 ++ .../QtGraphicalEffects/LevelAdjust.qml | 472 ++ .../QtGraphicalEffects/LinearGradient.qml | 346 + .../QtGraphicalEffects/MaskedBlur.qml | 282 + .../QtGraphicalEffects/OpacityMask.qml | 154 + .../QtGraphicalEffects/RadialBlur.qml | 312 + .../QtGraphicalEffects/RadialGradient.qml | 439 ++ .../QtGraphicalEffects/RectangularGlow.qml | 288 + .../QtGraphicalEffects/RecursiveBlur.qml | 350 + .../QtGraphicalEffects/ThresholdMask.qml | 226 + .../QtGraphicalEffects/ZoomBlur.qml | 302 + .../QtGraphicalEffects/private/FastGlow.qml | 393 ++ .../private/FastInnerShadow.qml | 413 ++ .../private/FastMaskedBlur.qml | 332 + .../private/GaussianDirectionalBlur.qml | 287 + .../private/GaussianGlow.qml | 98 + .../private/GaussianInnerShadow.qml | 155 + .../private/GaussianMaskedBlur.qml | 104 + .../private/SourceProxy.qml | 136 + .../QtGraphicalEffects/qmldir | 25 + .../QtQuick.2/plugins.qmltypes | 5623 +++++++++++++++++ .../004_cppOnly copy/QtQuick.2/qmldir | 4 + .../QtQuick/Controls/ApplicationWindow.qml | 193 + .../QtQuick/Controls/BusyIndicator.qml | 76 + .../QtQuick/Controls/Button.qml | 120 + .../QtQuick/Controls/CheckBox.qml | 184 + .../QtQuick/Controls/ComboBox.qml | 562 ++ .../QtQuick/Controls/GroupBox.qml | 226 + .../QtQuick/Controls/Label.qml | 91 + .../QtQuick/Controls/Menu.qml | 152 + .../QtQuick/Controls/MenuBar.qml | 276 + .../Controls/Private/AbstractCheckable.qml | 149 + .../QtQuick/Controls/Private/BasicButton.qml | 233 + .../Controls/Private/ColumnMenuContent.qml | 160 + .../QtQuick/Controls/Private/Control.qml | 93 + .../QtQuick/Controls/Private/FastGlow.qml | 393 ++ .../QtQuick/Controls/Private/FocusFrame.qml | 68 + .../Controls/Private/MenuContentItem.qml | 234 + .../Controls/Private/MenuContentScroller.qml | 74 + .../Controls/Private/ModalPopupBehavior.qml | 135 + .../QtQuick/Controls/Private/ScrollBar.qml | 234 + .../Controls/Private/ScrollViewHelper.qml | 216 + .../QtQuick/Controls/Private/SourceProxy.qml | 137 + .../QtQuick/Controls/Private/StackView.js | 68 + .../Private/StackViewSlideDelegate.qml | 138 + .../QtQuick/Controls/Private/Style.qml | 59 + .../QtQuick/Controls/Private/TabBar.qml | 308 + .../Controls/Private/TableViewSelection.qml | 197 + .../Controls/Private/TextSingleton.qml | 44 + .../QtQuick/Controls/Private/qmldir | 22 + .../QtQuick/Controls/Private/style.js | 63 + .../QtQuick/Controls/ProgressBar.qml | 155 + .../QtQuick/Controls/RadioButton.qml | 96 + .../QtQuick/Controls/ScrollView.qml | 318 + .../QtQuick/Controls/Slider.qml | 299 + .../QtQuick/Controls/SpinBox.qml | 339 + .../QtQuick/Controls/SplitView.qml | 504 ++ .../QtQuick/Controls/StackView.qml | 963 +++ .../QtQuick/Controls/StackViewDelegate.qml | 69 + .../QtQuick/Controls/StackViewTransition.qml | 60 + .../QtQuick/Controls/StatusBar.qml | 145 + .../Styles/Base/BusyIndicatorStyle.qml | 117 + .../Controls/Styles/Base/ButtonStyle.qml | 177 + .../Controls/Styles/Base/CheckBoxStyle.qml | 196 + .../Controls/Styles/Base/ComboBoxStyle.qml | 233 + .../Controls/Styles/Base/FocusFrameStyle.qml | 51 + .../Controls/Styles/Base/GroupBoxStyle.qml | 148 + .../Controls/Styles/Base/MenuBarStyle.qml | 76 + .../Controls/Styles/Base/MenuStyle.qml | 220 + .../Controls/Styles/Base/ProgressBarStyle.qml | 232 + .../Controls/Styles/Base/RadioButtonStyle.qml | 177 + .../Controls/Styles/Base/ScrollViewStyle.qml | 398 ++ .../Controls/Styles/Base/SliderStyle.qml | 234 + .../Controls/Styles/Base/SpinBoxStyle.qml | 207 + .../Controls/Styles/Base/StatusBarStyle.qml | 114 + .../Controls/Styles/Base/SwitchStyle.qml | 163 + .../Controls/Styles/Base/TabViewStyle.qml | 190 + .../Controls/Styles/Base/TableViewStyle.qml | 142 + .../Controls/Styles/Base/TextAreaStyle.qml | 99 + .../Controls/Styles/Base/TextFieldStyle.qml | 162 + .../Controls/Styles/Base/ToolBarStyle.qml | 110 + .../Controls/Styles/Base/ToolButtonStyle.qml | 110 + .../Styles/Desktop/BusyIndicatorStyle.qml | 42 + .../Controls/Styles/Desktop/ButtonStyle.qml | 62 + .../Controls/Styles/Desktop/CheckBoxStyle.qml | 91 + .../Controls/Styles/Desktop/ComboBoxStyle.qml | 121 + .../Styles/Desktop/FocusFrameStyle.qml | 55 + .../Controls/Styles/Desktop/GroupBoxStyle.qml | 76 + .../Controls/Styles/Desktop/MenuBarStyle.qml | 77 + .../Controls/Styles/Desktop/MenuStyle.qml | 112 + .../Styles/Desktop/ProgressBarStyle.qml | 61 + .../Styles/Desktop/RadioButtonStyle.qml | 94 + .../Styles/Desktop/RowItemSingleton.qml | 46 + .../Styles/Desktop/ScrollViewStyle.qml | 94 + .../Controls/Styles/Desktop/SliderStyle.qml | 66 + .../Controls/Styles/Desktop/SpinBoxStyle.qml | 136 + .../Styles/Desktop/StatusBarStyle.qml | 64 + .../Controls/Styles/Desktop/SwitchStyle.qml | 46 + .../Controls/Styles/Desktop/TabViewStyle.qml | 115 + .../Styles/Desktop/TableViewStyle.qml | 115 + .../Controls/Styles/Desktop/TextAreaStyle.qml | 60 + .../Styles/Desktop/TextFieldStyle.qml | 88 + .../Controls/Styles/Desktop/ToolBarStyle.qml | 65 + .../Styles/Desktop/ToolButtonStyle.qml | 64 + .../QtQuick/Controls/Styles/Desktop/qmldir | 2 + .../QtQuick/Controls/Styles/qmldir | 17 + .../QtQuick/Controls/Switch.qml | 153 + .../QtQuick/Controls/Tab.qml | 74 + .../QtQuick/Controls/TabView.qml | 270 + .../QtQuick/Controls/TableView.qml | 1016 +++ .../QtQuick/Controls/TableViewColumn.qml | 122 + .../QtQuick/Controls/TextArea.qml | 764 +++ .../QtQuick/Controls/TextField.qml | 609 ++ .../QtQuick/Controls/ToolBar.qml | 151 + .../QtQuick/Controls/ToolButton.qml | 68 + .../QtQuick/Controls/plugins.qmltypes | 1889 ++++++ .../QtQuick/Controls/qmldir | 4 + .../Controls/plugins.qmltypes | 1889 ++++++ .../006_loneCompositeAndCpp/Controls/qmldir | 4 + .../QtQuick/Controls/ApplicationWindow.qml | 193 + .../QtQuick/Controls/BusyIndicator.qml | 76 + .../QtQuick/Controls/Button.qml | 120 + .../QtQuick/Controls/CheckBox.qml | 184 + .../QtQuick/Controls/ComboBox.qml | 562 ++ .../QtQuick/Controls/GroupBox.qml | 226 + .../QtQuick/Controls/Label.qml | 91 + .../QtQuick/Controls/Menu.qml | 152 + .../QtQuick/Controls/MenuBar.qml | 276 + .../Controls/Private/AbstractCheckable.qml | 149 + .../QtQuick/Controls/Private/BasicButton.qml | 233 + .../Controls/Private/ColumnMenuContent.qml | 160 + .../QtQuick/Controls/Private/Control.qml | 93 + .../QtQuick/Controls/Private/FastGlow.qml | 393 ++ .../QtQuick/Controls/Private/FocusFrame.qml | 68 + .../Controls/Private/MenuContentItem.qml | 234 + .../Controls/Private/MenuContentScroller.qml | 74 + .../Controls/Private/ModalPopupBehavior.qml | 135 + .../QtQuick/Controls/Private/ScrollBar.qml | 234 + .../Controls/Private/ScrollViewHelper.qml | 216 + .../QtQuick/Controls/Private/SourceProxy.qml | 137 + .../QtQuick/Controls/Private/StackView.js | 68 + .../Private/StackViewSlideDelegate.qml | 138 + .../QtQuick/Controls/Private/Style.qml | 59 + .../QtQuick/Controls/Private/TabBar.qml | 308 + .../Controls/Private/TableViewSelection.qml | 197 + .../Controls/Private/TextSingleton.qml | 44 + .../QtQuick/Controls/Private/qmldir | 22 + .../QtQuick/Controls/Private/style.js | 63 + .../QtQuick/Controls/ProgressBar.qml | 155 + .../QtQuick/Controls/RadioButton.qml | 96 + .../QtQuick/Controls/ScrollView.qml | 318 + .../QtQuick/Controls/Slider.qml | 299 + .../QtQuick/Controls/SpinBox.qml | 339 + .../QtQuick/Controls/SplitView.qml | 504 ++ .../QtQuick/Controls/StackView.qml | 963 +++ .../QtQuick/Controls/StackViewDelegate.qml | 69 + .../QtQuick/Controls/StackViewTransition.qml | 60 + .../QtQuick/Controls/StatusBar.qml | 145 + .../Styles/Base/BusyIndicatorStyle.qml | 117 + .../Controls/Styles/Base/ButtonStyle.qml | 177 + .../Controls/Styles/Base/CheckBoxStyle.qml | 196 + .../Controls/Styles/Base/ComboBoxStyle.qml | 233 + .../Controls/Styles/Base/FocusFrameStyle.qml | 51 + .../Controls/Styles/Base/GroupBoxStyle.qml | 148 + .../Controls/Styles/Base/MenuBarStyle.qml | 76 + .../Controls/Styles/Base/MenuStyle.qml | 220 + .../Controls/Styles/Base/ProgressBarStyle.qml | 232 + .../Controls/Styles/Base/RadioButtonStyle.qml | 177 + .../Controls/Styles/Base/ScrollViewStyle.qml | 398 ++ .../Controls/Styles/Base/SliderStyle.qml | 234 + .../Controls/Styles/Base/SpinBoxStyle.qml | 207 + .../Controls/Styles/Base/StatusBarStyle.qml | 114 + .../Controls/Styles/Base/SwitchStyle.qml | 163 + .../Controls/Styles/Base/TabViewStyle.qml | 190 + .../Controls/Styles/Base/TableViewStyle.qml | 142 + .../Controls/Styles/Base/TextAreaStyle.qml | 99 + .../Controls/Styles/Base/TextFieldStyle.qml | 162 + .../Controls/Styles/Base/ToolBarStyle.qml | 110 + .../Controls/Styles/Base/ToolButtonStyle.qml | 110 + .../Styles/Desktop/BusyIndicatorStyle.qml | 42 + .../Controls/Styles/Desktop/ButtonStyle.qml | 62 + .../Controls/Styles/Desktop/CheckBoxStyle.qml | 91 + .../Controls/Styles/Desktop/ComboBoxStyle.qml | 121 + .../Styles/Desktop/FocusFrameStyle.qml | 55 + .../Controls/Styles/Desktop/GroupBoxStyle.qml | 76 + .../Controls/Styles/Desktop/MenuBarStyle.qml | 77 + .../Controls/Styles/Desktop/MenuStyle.qml | 112 + .../Styles/Desktop/ProgressBarStyle.qml | 61 + .../Styles/Desktop/RadioButtonStyle.qml | 94 + .../Styles/Desktop/RowItemSingleton.qml | 46 + .../Styles/Desktop/ScrollViewStyle.qml | 94 + .../Controls/Styles/Desktop/SliderStyle.qml | 66 + .../Controls/Styles/Desktop/SpinBoxStyle.qml | 136 + .../Styles/Desktop/StatusBarStyle.qml | 64 + .../Controls/Styles/Desktop/SwitchStyle.qml | 46 + .../Controls/Styles/Desktop/TabViewStyle.qml | 115 + .../Styles/Desktop/TableViewStyle.qml | 115 + .../Controls/Styles/Desktop/TextAreaStyle.qml | 60 + .../Styles/Desktop/TextFieldStyle.qml | 88 + .../Controls/Styles/Desktop/ToolBarStyle.qml | 65 + .../Styles/Desktop/ToolButtonStyle.qml | 64 + .../QtQuick/Controls/Styles/Desktop/qmldir | 2 + .../QtQuick/Controls/Styles/qmldir | 17 + .../QtQuick/Controls/Switch.qml | 153 + .../QtQuick/Controls/Tab.qml | 74 + .../QtQuick/Controls/TabView.qml | 270 + .../QtQuick/Controls/TableView.qml | 1016 +++ .../QtQuick/Controls/TableViewColumn.qml | 122 + .../QtQuick/Controls/TextArea.qml | 764 +++ .../QtQuick/Controls/TextField.qml | 609 ++ .../QtQuick/Controls/ToolBar.qml | 151 + .../QtQuick/Controls/ToolButton.qml | 68 + .../QtQuick/Controls/plugins.qmltypes | 1889 ++++++ .../QtQuick/Controls/qmldir | 4 + .../base/QtQuick.2/plugins.qmltypes | 5623 +++++++++++++++++ .../importscheck/base/QtQuick.2/qmldir | 4 + .../codemodel/importscheck/importscheck.pro | 19 + .../codemodel/importscheck/importscheck.qbs | 15 + .../importscheck/tst_importscheck.cpp | 247 + 270 files changed, 69554 insertions(+), 8 deletions(-) create mode 100644 tests/auto/qml/codemodel/importscheck/001_flatQmlOnly/GaussianDirectionalBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Blend.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/BrightnessContrast.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ColorOverlay.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Colorize.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ConicalGradient.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Desaturate.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/DirectionalBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Displace.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/DropShadow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/FastBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/GammaAdjust.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/GaussianBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Glow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/HueSaturation.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/InnerShadow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/LevelAdjust.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/LinearGradient.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/MaskedBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/OpacityMask.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RadialBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RadialGradient.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RectangularGlow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RecursiveBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ThresholdMask.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ZoomBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastGlow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastInnerShadow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastMaskedBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianDirectionalBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianGlow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianInnerShadow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianMaskedBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/SourceProxy.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Blend.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/BrightnessContrast.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ColorOverlay.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Colorize.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ConicalGradient.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Desaturate.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/DirectionalBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Displace.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/DropShadow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/FastBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/GammaAdjust.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/GaussianBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Glow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/HueSaturation.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/InnerShadow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/LevelAdjust.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/LinearGradient.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/MaskedBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/OpacityMask.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RadialBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RadialGradient.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RectangularGlow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RecursiveBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ThresholdMask.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ZoomBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastGlow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastInnerShadow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastMaskedBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianDirectionalBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianGlow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianInnerShadow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianMaskedBlur.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/SourceProxy.qml create mode 100644 tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/qmldir create mode 100644 tests/auto/qml/codemodel/importscheck/004_cppOnly copy/QtQuick.2/plugins.qmltypes create mode 100644 tests/auto/qml/codemodel/importscheck/004_cppOnly copy/QtQuick.2/qmldir create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ApplicationWindow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/BusyIndicator.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Button.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/CheckBox.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ComboBox.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/GroupBox.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Label.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Menu.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/MenuBar.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/AbstractCheckable.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/BasicButton.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ColumnMenuContent.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/Control.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/FastGlow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/FocusFrame.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/MenuContentItem.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/MenuContentScroller.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ModalPopupBehavior.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ScrollBar.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ScrollViewHelper.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/SourceProxy.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/StackView.js create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/StackViewSlideDelegate.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/Style.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TabBar.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TableViewSelection.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TextSingleton.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/qmldir create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/style.js create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ProgressBar.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/RadioButton.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ScrollView.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Slider.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/SpinBox.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/SplitView.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackView.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackViewDelegate.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackViewTransition.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StatusBar.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/BusyIndicatorStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ButtonStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/CheckBoxStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ComboBoxStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/FocusFrameStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/GroupBoxStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/MenuBarStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/MenuStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ProgressBarStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/RadioButtonStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ScrollViewStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SliderStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SpinBoxStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/StatusBarStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SwitchStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TabViewStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TableViewStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TextAreaStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TextFieldStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ToolBarStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ToolButtonStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/BusyIndicatorStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ButtonStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/CheckBoxStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ComboBoxStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/FocusFrameStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/GroupBoxStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/MenuBarStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/MenuStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ProgressBarStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/RadioButtonStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/RowItemSingleton.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ScrollViewStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SliderStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SpinBoxStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/StatusBarStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SwitchStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TabViewStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TextAreaStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TextFieldStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ToolBarStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ToolButtonStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/qmldir create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/qmldir create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Switch.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Tab.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TabView.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TableView.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TableViewColumn.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TextArea.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TextField.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ToolBar.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ToolButton.qml create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/plugins.qmltypes create mode 100644 tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/qmldir create mode 100644 tests/auto/qml/codemodel/importscheck/006_loneCompositeAndCpp/Controls/plugins.qmltypes create mode 100644 tests/auto/qml/codemodel/importscheck/006_loneCompositeAndCpp/Controls/qmldir create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ApplicationWindow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/BusyIndicator.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Button.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/CheckBox.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ComboBox.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/GroupBox.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Label.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Menu.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/MenuBar.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/AbstractCheckable.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/BasicButton.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ColumnMenuContent.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/Control.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/FastGlow.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/FocusFrame.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/MenuContentItem.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/MenuContentScroller.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ModalPopupBehavior.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ScrollBar.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ScrollViewHelper.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/SourceProxy.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/StackView.js create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/StackViewSlideDelegate.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/Style.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TabBar.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TableViewSelection.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TextSingleton.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/qmldir create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/style.js create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ProgressBar.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/RadioButton.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ScrollView.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Slider.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/SpinBox.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/SplitView.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackView.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackViewDelegate.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackViewTransition.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StatusBar.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/BusyIndicatorStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ButtonStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/CheckBoxStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ComboBoxStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/FocusFrameStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/GroupBoxStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/MenuBarStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/MenuStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ProgressBarStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/RadioButtonStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ScrollViewStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SliderStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SpinBoxStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/StatusBarStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SwitchStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TabViewStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TableViewStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TextAreaStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TextFieldStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ToolBarStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ToolButtonStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/BusyIndicatorStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ButtonStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/CheckBoxStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ComboBoxStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/FocusFrameStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/GroupBoxStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/MenuBarStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/MenuStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ProgressBarStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/RadioButtonStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/RowItemSingleton.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ScrollViewStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SliderStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SpinBoxStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/StatusBarStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SwitchStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TabViewStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TextAreaStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TextFieldStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ToolBarStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ToolButtonStyle.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/qmldir create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/qmldir create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Switch.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Tab.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TabView.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TableView.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TableViewColumn.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TextArea.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TextField.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ToolBar.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ToolButton.qml create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/plugins.qmltypes create mode 100644 tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/qmldir create mode 100644 tests/auto/qml/codemodel/importscheck/base/QtQuick.2/plugins.qmltypes create mode 100644 tests/auto/qml/codemodel/importscheck/base/QtQuick.2/qmldir create mode 100644 tests/auto/qml/codemodel/importscheck/importscheck.pro create mode 100644 tests/auto/qml/codemodel/importscheck/importscheck.qbs create mode 100644 tests/auto/qml/codemodel/importscheck/tst_importscheck.cpp diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h index b1cac138371..d440c78dc99 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.h +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h @@ -207,7 +207,11 @@ public: void joinAllThreads(); QmlJS::Document::Ptr ensuredGetDocumentForPath(const QString &filePath); - + static void importScan(QFutureInterface &future, + WorkingCopy workingCopyInternal, + PathsAndLanguages paths, + ModelManagerInterface *modelManager, + bool emitDocChangedOnDisk); public slots: virtual void resetCodeModel(); void removeProjectInfo(ProjectExplorer::Project *project); @@ -243,11 +247,6 @@ protected: ModelManagerInterface *modelManager, QmlJS::Dialect mainLanguage, bool emitDocChangedOnDisk); - static void importScan(QFutureInterface &future, - WorkingCopy workingCopyInternal, - PathsAndLanguages paths, - ModelManagerInterface *modelManager, - bool emitDocChangedOnDisk); static void updateCppQmlTypes(QFutureInterface &interface, ModelManagerInterface *qmlModelManager, CPlusPlus::Snapshot snapshot, diff --git a/tests/auto/qml/codemodel/codemodel.pro b/tests/auto/qml/codemodel/codemodel.pro index dde5bb0bddd..2e42b5cb7c2 100644 --- a/tests/auto/qml/codemodel/codemodel.pro +++ b/tests/auto/qml/codemodel/codemodel.pro @@ -1,3 +1,4 @@ TEMPLATE = subdirs -SUBDIRS += check +SUBDIRS += check \ + importscheck diff --git a/tests/auto/qml/codemodel/codemodel.qbs b/tests/auto/qml/codemodel/codemodel.qbs index 63ad360bfd2..c4d7e9d3cdf 100644 --- a/tests/auto/qml/codemodel/codemodel.qbs +++ b/tests/auto/qml/codemodel/codemodel.qbs @@ -2,5 +2,5 @@ import qbs Project { name: "QML code model autotests" - references: ["check/check.qbs"] + references: ["check/check.qbs", "importscheck/importscheck.qbs"] } diff --git a/tests/auto/qml/codemodel/importscheck/001_flatQmlOnly/GaussianDirectionalBlur.qml b/tests/auto/qml/codemodel/importscheck/001_flatQmlOnly/GaussianDirectionalBlur.qml new file mode 100644 index 00000000000..c2af1f34e31 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/001_flatQmlOnly/GaussianDirectionalBlur.qml @@ -0,0 +1,287 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant source + property real deviation: (radius + 1) / 3.3333 + property real radius: 0.0 + property int maximumRadius: 0 + property real horizontalStep: 0.0 + property real verticalStep: 0.0 + property bool transparentBorder: false + property bool cached: false + + property bool enableColor: false + property color color: "white" + property real spread: 0.0 + + property bool enableMask: false + property variant maskSource + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.maskSource + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: rootItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real deviation: Math.max(0.1, rootItem.deviation) + property real radius: rootItem.radius + property int maxRadius: rootItem.maximumRadius + property bool transparentBorder: rootItem.transparentBorder + property real gaussianSum: 0.0 + property real startIndex: 0.0 + property real deltaFactor: (2 * radius - 1) / (maxRadius * 2 - 1) + property real expandX: transparentBorder && rootItem.horizontalStep > 0 ? maxRadius / width : 0.0 + property real expandY: transparentBorder && rootItem.verticalStep > 0 ? maxRadius / height : 0.0 + property variant gwts: [] + property variant delta: Qt.vector3d(rootItem.horizontalStep * deltaFactor, rootItem.verticalStep * deltaFactor, startIndex); + property variant factor_0_2: Qt.vector3d(gwts[0], gwts[1], gwts[2]); + property variant factor_3_5: Qt.vector3d(gwts[3], gwts[4], gwts[5]); + property variant factor_6_8: Qt.vector3d(gwts[6], gwts[7], gwts[8]); + property variant factor_9_11: Qt.vector3d(gwts[9], gwts[10], gwts[11]); + property variant factor_12_14: Qt.vector3d(gwts[12], gwts[13], gwts[14]); + property variant factor_15_17: Qt.vector3d(gwts[15], gwts[16], gwts[17]); + property variant factor_18_20: Qt.vector3d(gwts[18], gwts[19], gwts[20]); + property variant factor_21_23: Qt.vector3d(gwts[21], gwts[22], gwts[23]); + property variant factor_24_26: Qt.vector3d(gwts[24], gwts[25], gwts[26]); + property variant factor_27_29: Qt.vector3d(gwts[27], gwts[28], gwts[29]); + property variant factor_30_32: Qt.vector3d(gwts[30], gwts[31], gwts[32]); + + property color color: rootItem.color + property real spread: 1.0 - (rootItem.spread * 0.98) + property variant maskSource: maskSourceProxy.output + + anchors.fill: rootItem + + function gausFunc(x){ + //Gaussian function = h(x):=(1/sqrt(2*3.14159*(D^2))) * %e^(-(x^2)/(2*(D^2))); + return (1.0 / Math.sqrt(2 * Math.PI * (Math.pow(shaderItem.deviation, 2)))) * Math.pow(Math.E, -((Math.pow(x, 2)) / (2 * (Math.pow(shaderItem.deviation, 2))))); + } + + function updateGaussianWeights() { + gaussianSum = 0.0; + startIndex = -maxRadius + 0.5 + + var n = new Array(32); + for (var j = 0; j < 32; j++) + n[j] = 0; + + var max = maxRadius * 2 + var delta = (2 * radius - 1) / (max - 1); + for (var i = 0; i < max; i++) { + n[i] = gausFunc(-radius + 0.5 + i * delta); + gaussianSum += n[i]; + } + + gwts = n; + } + + function buildFragmentShader() { + + var shaderSteps = [ + "gl_FragColor += texture2D(source, texCoord) * factor_0_2.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_0_2.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_0_2.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_3_5.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_3_5.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_3_5.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_6_8.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_6_8.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_6_8.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_9_11.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_9_11.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_9_11.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_12_14.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_12_14.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_12_14.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_15_17.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_15_17.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_15_17.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_18_20.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_18_20.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_18_20.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_21_23.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_21_23.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_21_23.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_24_26.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_24_26.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_24_26.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_27_29.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_27_29.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_27_29.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_30_32.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_30_32.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_30_32.z; texCoord += shift;" + ] + + var shader = fragmentShaderBegin + var samples = maxRadius * 2 + if (samples > 32) { + console.log("DirectionalGaussianBlur.qml WARNING: Maximum of blur radius (16) exceeded!") + samples = 32 + } + + for (var i = 0; i < samples; i++) { + shader += shaderSteps[i] + } + + shader += fragmentShaderEnd + + var colorizeSteps = "" + var colorizeUniforms = "" + + var maskSteps = "" + var maskUniforms = "" + + if (enableColor) { + colorizeSteps += "gl_FragColor = mix(vec4(0), color, clamp((gl_FragColor.a - 0.0) / (spread - 0.0), 0.0, 1.0));\n" + colorizeUniforms += "uniform highp vec4 color;\n" + colorizeUniforms += "uniform highp float spread;\n" + } + + if (enableMask) { + maskSteps += "shift *= texture2D(maskSource, qt_TexCoord0).a;\n" + maskUniforms += "uniform sampler2D maskSource;\n" + } + + shader = shader.replace("PLACEHOLDER_COLORIZE_STEPS", colorizeSteps) + shader = shader.replace("PLACEHOLDER_COLORIZE_UNIFORMS", colorizeUniforms) + shader = shader.replace("PLACEHOLDER_MASK_STEPS", maskSteps) + shader = shader.replace("PLACEHOLDER_MASK_UNIFORMS", maskUniforms) + + fragmentShader = shader + } + + onDeviationChanged: updateGaussianWeights() + + onRadiusChanged: updateGaussianWeights() + + onTransparentBorderChanged: { + buildFragmentShader() + updateGaussianWeights() + } + + onMaxRadiusChanged: { + buildFragmentShader() + updateGaussianWeights() + } + + Component.onCompleted: { + buildFragmentShader() + updateGaussianWeights() + } + + property string fragmentShaderBegin: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp vec3 delta; + uniform highp vec3 factor_0_2; + uniform highp vec3 factor_3_5; + uniform highp vec3 factor_6_8; + uniform highp vec3 factor_9_11; + uniform highp vec3 factor_12_14; + uniform highp vec3 factor_15_17; + uniform highp vec3 factor_18_20; + uniform highp vec3 factor_21_23; + uniform highp vec3 factor_24_26; + uniform highp vec3 factor_27_29; + uniform highp vec3 factor_30_32; + uniform highp float gaussianSum; + uniform highp float expandX; + uniform highp float expandY; + PLACEHOLDER_MASK_UNIFORMS + PLACEHOLDER_COLORIZE_UNIFORMS + + void main() { + highp vec2 shift = vec2(delta.x, delta.y); + + PLACEHOLDER_MASK_STEPS + + highp float index = delta.z; + mediump vec2 texCoord = qt_TexCoord0; + texCoord.s = (texCoord.s - expandX) / (1.0 - 2.0 * expandX); + texCoord.t = (texCoord.t - expandY) / (1.0 - 2.0 * expandY); + texCoord += (shift * index); + + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); + " + + property string fragmentShaderEnd: " + + gl_FragColor /= gaussianSum; + + PLACEHOLDER_COLORIZE_STEPS + + gl_FragColor *= qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Blend.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Blend.qml new file mode 100644 index 00000000000..59d8646047e --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Blend.qml @@ -0,0 +1,478 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype Blend + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-blend + \brief Merges two source items by using a blend mode. + + Blend mode can be selected with the \l{Blend::mode}{mode} property. + + \table + \header + \li source + \li foregroundSource + \li Effect applied + \row + \li \image Original_bug.png + \li \image Original_butterfly.png + \li \image Blend_bug_and_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet Blend-example.qml example + +*/ + +Item { + id: rootItem + + /*! + This property defines the source item that is going to be the base when + \l{Blend::foregroundSource}{foregroundSource} is blended over it. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the item that is going to be blended over the + \l{Blend::source}{source}. + + \note It is not supported to let the effect include itself, for + instance by setting foregroundSource to the effect's parent. + */ + property variant foregroundSource + + /*! + This property defines the mode which is used when foregroundSource is + blended over source. Values are case insensitive. + + \table + \header + \li mode + \li description + \row + \li normal + \li The pixel component values from foregroundSource are written + over source by using alpha blending. + \row + \li addition + \li The pixel component values from source and foregroundSource are + added together and written. + \row + \li average + \li The pixel component values from source and foregroundSource are + averaged and written. + \row + \li color + \li The lightness value from source is combined with hue and + saturation from foregroundSource and written. + \row + \li colorBurn + \li The darker pixels from source are darkened more, if both source + and foregroundSource pixels are light the result is light. + \row + \li colorDodge + \li The lighter pixels from source are lightened more, if both + source and foregroundSource pixels are dark the result is dark. + \row + \li darken + \li The darker pixel component value from source and + foregroundSource is written. + \row + \li darkerColor + \li The lower luminance pixel rgb-value from source and + foregroundSource is written. + \row + \li difference + \li The absolute pixel component value difference between source and + foregroundSource is written. + \row + \li divide + \li The pixel component values from source is divided by the value + from foregroundSource and written. + \row + \li exclusion + \li The pixel component value difference with reduced contrast + between source and foregroundSource is written. + \row + \li hardLight + \li The pixel component values from source are lightened or darkened + according to foregroundSource values and written. + \row + \li hue + \li The hue value from foregroundSource is combined with saturation + and lightness from source and written. + \row + \li lighten + \li The lightest pixel component value from source and + foregroundSource is written. + \row + \li lighterColor + \li The higher luminance pixel rgb-value from source and + foregroundSource is written. + \row + \li lightness + \li The lightness value from foregroundSource is combined with hue + and saturation from source and written. + \row + \li multiply + \li The pixel component values from source and foregroundSource are + multiplied together and written. + \row + \li negation + \li The inverted absolute pixel component value difference between + source and foregroundSource is written. + \row + \li saturation + \li The saturation value from foregroundSource is combined with hue + and lightness from source and written. + \row + \li screen + \li The pixel values from source and foregroundSource are negated, + then multiplied, negated again, and written. + \row + \li subtract + \li Pixel value from foregroundSource is subracted from source and + written. + \row + \li softLight + \li The pixel component values from source are lightened or darkened + slightly according to foregroundSource values and written. + + \endtable + + \table + \header + \li Example source + \li Example foregroundSource + \row + \li \image Original_bug.png + \li \image Original_butterfly.png + \endtable + + \table + \header + \li Output examples with different mode values + \li + \li + \row + \li \image Blend_mode1.png + \li \image Blend_mode2.png + \li \image Blend_mode3.png + \row + \li \b { mode: normal } + \li \b { mode: addition } + \li \b { mode: average } + \row + \li \image Blend_mode4.png + \li \image Blend_mode5.png + \li \image Blend_mode6.png + \row + \li \b { mode: color } + \li \b { mode: colorBurn } + \li \b { mode: colorDodge } + \row + \li \image Blend_mode7.png + \li \image Blend_mode8.png + \li \image Blend_mode9.png + \row + \li \b { mode: darken } + \li \b { mode: darkerColor } + \li \b { mode: difference } + \row + \li \image Blend_mode10.png + \li \image Blend_mode11.png + \li \image Blend_mode12.png + \row + \li \b { mode: divide } + \li \b { mode: exclusion } + \li \b { mode: hardlight } + \row + \li \image Blend_mode13.png + \li \image Blend_mode14.png + \li \image Blend_mode15.png + \row + \li \b { mode: hue } + \li \b { mode: lighten } + \li \b { mode: lighterColor } + \row + \li \image Blend_mode16.png + \li \image Blend_mode17.png + \li \image Blend_mode18.png + \row + \li \b { mode: lightness } + \li \b { mode: negation } + \li \b { mode: multiply } + \row + \li \image Blend_mode19.png + \li \image Blend_mode20.png + \li \image Blend_mode21.png + \row + \li \b { mode: saturation } + \li \b { mode: screen } + \li \b { mode: subtract } + \row + \li \image Blend_mode22.png + \row + \li \b { mode: softLight } + \endtable + */ + property string mode: "normal" + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to false. + + */ + property bool cached: false + + SourceProxy { + id: backgroundSourceProxy + input: rootItem.source + } + + SourceProxy { + id: foregroundSourceProxy + input: rootItem.foregroundSource + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant backgroundSource: backgroundSourceProxy.output + property variant foregroundSource: foregroundSourceProxy.output + property string mode: rootItem.mode + anchors.fill: parent + + fragmentShader: fragmentShaderBegin + blendModeNormal + fragmentShaderEnd + + function buildFragmentShader() { + var shader = fragmentShaderBegin + + switch (mode.toLowerCase()) { + case "addition" : shader += blendModeAddition; break; + case "average" : shader += blendModeAverage; break; + case "color" : shader += blendModeColor; break; + case "colorburn" : shader += blendModeColorBurn; break; + case "colordodge" : shader += blendModeColorDodge; break; + case "darken" : shader += blendModeDarken; break; + case "darkercolor" : shader += blendModeDarkerColor; break; + case "difference" : shader += blendModeDifference; break; + case "divide" : shader += blendModeDivide; break; + case "exclusion" : shader += blendModeExclusion; break; + case "hardlight" : shader += blendModeHardLight; break; + case "hue" : shader += blendModeHue; break; + case "lighten" : shader += blendModeLighten; break; + case "lightercolor" : shader += blendModeLighterColor; break; + case "lightness" : shader += blendModeLightness; break; + case "negation" : shader += blendModeNegation; break; + case "normal" : shader += blendModeNormal; break; + case "multiply" : shader += blendModeMultiply; break; + case "saturation" : shader += blendModeSaturation; break; + case "screen" : shader += blendModeScreen; break; + case "subtract" : shader += blendModeSubtract; break; + case "softlight" : shader += blendModeSoftLight; break; + default: shader += "gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);"; break; + } + + shader += fragmentShaderEnd + fragmentShader = shader + + // Workaraound for a bug just to make sure display gets updated when the mode changes. + backgroundSourceChanged() + } + + Component.onCompleted: { + buildFragmentShader() + } + + onModeChanged: { + buildFragmentShader() + } + + property string blendModeAddition: "result.rgb = min(rgb1 + rgb2, 1.0);" + property string blendModeAverage: "result.rgb = 0.5 * (rgb1 + rgb2);" + property string blendModeColor: "result.rgb = HSLtoRGB(vec3(RGBtoHSL(rgb2).xy, RGBtoL(rgb1)));" + property string blendModeColorBurn: "result.rgb = clamp(1.0 - ((1.0 - rgb1) / max(vec3(1.0 / 256.0), rgb2)), vec3(0.0), vec3(1.0));" + property string blendModeColorDodge: "result.rgb = clamp(rgb1 / max(vec3(1.0 / 256.0), (1.0 - rgb2)), vec3(0.0), vec3(1.0));" + property string blendModeDarken: "result.rgb = min(rgb1, rgb2);" + property string blendModeDarkerColor: "result.rgb = 0.3 * rgb1.r + 0.59 * rgb1.g + 0.11 * rgb1.b > 0.3 * rgb2.r + 0.59 * rgb2.g + 0.11 * rgb2.b ? rgb2 : rgb1;" + property string blendModeDifference: "result.rgb = abs(rgb1 - rgb2);" + property string blendModeDivide: "result.rgb = clamp(rgb1 / rgb2, 0.0, 1.0);" + property string blendModeExclusion: "result.rgb = rgb1 + rgb2 - 2.0 * rgb1 * rgb2;" + property string blendModeHardLight: "result.rgb = vec3(channelBlendHardLight(rgb1.r, rgb2.r), channelBlendHardLight(rgb1.g, rgb2.g), channelBlendHardLight(rgb1.b, rgb2.b));" + property string blendModeHue: "result.rgb = HSLtoRGB(vec3(RGBtoHSL(rgb2).x, RGBtoHSL(rgb1).yz));" + property string blendModeLighten: "result.rgb = max(rgb1, rgb2);" + property string blendModeLighterColor: "result.rgb = 0.3 * rgb1.r + 0.59 * rgb1.g + 0.11 * rgb1.b > 0.3 * rgb2.r + 0.59 * rgb2.g + 0.11 * rgb2.b ? rgb1 : rgb2;" + property string blendModeLightness: "result.rgb = HSLtoRGB(vec3(RGBtoHSL(rgb1).xy, RGBtoL(rgb2)));" + property string blendModeMultiply: "result.rgb = rgb1 * rgb2;" + property string blendModeNegation: "result.rgb = 1.0 - abs(1.0 - rgb1 - rgb2);" + property string blendModeNormal: "result.rgb = rgb2; a = max(color1.a, color2.a);" + property string blendModeSaturation: "lowp vec3 hsl1 = RGBtoHSL(rgb1); result.rgb = HSLtoRGB(vec3(hsl1.x, RGBtoHSL(rgb2).y, hsl1.z));" + property string blendModeScreen: "result.rgb = 1.0 - (vec3(1.0) - rgb1) * (vec3(1.0) - rgb2);" + property string blendModeSubtract: "result.rgb = max(rgb1 - rgb2, vec3(0.0));" + property string blendModeSoftLight: "result.rgb = rgb1 * ((1.0 - rgb1) * rgb2 + (1.0 - (1.0 - rgb1) * (1.0 - rgb2)));" + + property string fragmentShaderBegin: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D backgroundSource; + uniform lowp sampler2D foregroundSource; + + highp float RGBtoL(highp vec3 color) { + highp float cmin = min(color.r, min(color.g, color.b)); + highp float cmax = max(color.r, max(color.g, color.b)); + highp float l = (cmin + cmax) / 2.0; + return l; + } + + highp vec3 RGBtoHSL(highp vec3 color) { + highp float cmin = min(color.r, min(color.g, color.b)); + highp float cmax = max(color.r, max(color.g, color.b)); + highp float h = 0.0; + highp float s = 0.0; + highp float l = (cmin + cmax) / 2.0; + highp float diff = cmax - cmin; + + if (diff > 1.0 / 256.0) { + if (l < 0.5) + s = diff / (cmin + cmax); + else + s = diff / (2.0 - (cmin + cmax)); + + if (color.r == cmax) + h = (color.g - color.b) / diff; + else if (color.g == cmax) + h = 2.0 + (color.b - color.r) / diff; + else + h = 4.0 + (color.r - color.g) / diff; + + h /= 6.0; + } + return vec3(h, s, l); + } + + highp float hueToIntensity(highp float v1, highp float v2, highp float h) { + h = fract(h); + if (h < 1.0 / 6.0) + return v1 + (v2 - v1) * 6.0 * h; + else if (h < 1.0 / 2.0) + return v2; + else if (h < 2.0 / 3.0) + return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h); + + return v1; + } + + highp vec3 HSLtoRGB(highp vec3 color) { + highp float h = color.x; + highp float l = color.z; + highp float s = color.y; + + if (s < 1.0 / 256.0) + return vec3(l, l, l); + + highp float v1; + highp float v2; + if (l < 0.5) + v2 = l * (1.0 + s); + else + v2 = (l + s) - (s * l); + + v1 = 2.0 * l - v2; + + highp float d = 1.0 / 3.0; + highp float r = hueToIntensity(v1, v2, h + d); + highp float g = hueToIntensity(v1, v2, h); + highp float b = hueToIntensity(v1, v2, h - d); + return vec3(r, g, b); + } + + lowp float channelBlendHardLight(lowp float c1, lowp float c2) { + return c2 > 0.5 ? (1.0 - (1.0 - 2.0 * (c2 - 0.5)) * (1.0 - c1)) : (2.0 * c1 * c2); + } + + void main() { + lowp vec4 result = vec4(0.0); + lowp vec4 color1 = texture2D(backgroundSource, qt_TexCoord0); + lowp vec4 color2 = texture2D(foregroundSource, qt_TexCoord0); + lowp vec3 rgb1 = color1.rgb / max(1.0/256.0, color1.a); + lowp vec3 rgb2 = color2.rgb / max(1.0/256.0, color2.a); + highp float a = max(color1.a, color1.a * color2.a); + " + + property string fragmentShaderEnd: " + gl_FragColor.rgb = mix(rgb1, result.rgb, color2.a); + gl_FragColor.rbg *= a; + gl_FragColor.a = a; + gl_FragColor *= qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/BrightnessContrast.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/BrightnessContrast.qml new file mode 100644 index 00000000000..db53acbad46 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/BrightnessContrast.qml @@ -0,0 +1,207 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype BrightnessContrast + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-color + \brief Adjusts brightness and contrast. + + This effect adjusts the source item colors. + Brightness adjustment changes the perceived luminance of the source item. + Contrast adjustment increases or decreases the color + and brightness variations. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image BrightnessContrast_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet BrightnessContrast-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that provides the source pixels + for the effect. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines how much the source brightness is increased or + decreased. + + The value ranges from -1.0 to 1.0. By default, the property is set to \c + 0.0 (no change). + + \table + \header + \li Output examples with different brightness values + \li + \li + \row + \li \image BrightnessContrast_brightness1.png + \li \image BrightnessContrast_brightness2.png + \li \image BrightnessContrast_brightness3.png + \row + \li \b { brightness: -0.25 } + \li \b { brightness: 0 } + \li \b { brightness: 0.5 } + \row + \li \l contrast: 0 + \li \l contrast: 0 + \li \l contrast: 0 + \endtable + + */ + property real brightness: 0.0 + + /*! + This property defines how much the source contrast is increased or + decreased. The decrease of the contrast is linear, but the increase is + applied with a non-linear curve to allow very high contrast adjustment at + the high end of the value range. + + \table + \header + \li Contrast adjustment curve + \row + \li \image BrightnessContrast_contrast_graph.png + \endtable + + The value ranges from -1.0 to 1.0. By default, the property is set to \c 0.0 (no change). + + \table + \header + \li Output examples with different contrast values + \li + \li + \row + \li \image BrightnessContrast_contrast1.png + \li \image BrightnessContrast_contrast2.png + \li \image BrightnessContrast_contrast3.png + \row + \li \b { contrast: -0.5 } + \li \b { contrast: 0 } + \li \b { contrast: 0.5 } + \row + \li \l brightness: 0 + \li \l brightness: 0 + \li \l brightness: 0 + \endtable + + */ + property real contrast: 0.0 + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real brightness: rootItem.brightness + property real contrast: rootItem.contrast + + anchors.fill: parent + blending: !rootItem.cached + + fragmentShader: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp float brightness; + uniform highp float contrast; + void main() { + highp vec4 pixelColor = texture2D(source, qt_TexCoord0); + pixelColor.rgb /= max(1.0/256.0, pixelColor.a); + highp float c = 1.0 + contrast; + highp float contrastGainFactor = 1.0 + c * c * c * c * step(0.0, contrast); + pixelColor.rgb = ((pixelColor.rgb - 0.5) * (contrastGainFactor * contrast + 1.0)) + 0.5; + pixelColor.rgb = mix(pixelColor.rgb, vec3(step(0.0, brightness)), abs(brightness)); + gl_FragColor = vec4(pixelColor.rgb * pixelColor.a, pixelColor.a) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ColorOverlay.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ColorOverlay.qml new file mode 100644 index 00000000000..fedc0500df7 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ColorOverlay.qml @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype ColorOverlay + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-color + \brief Alters the colors of the source item by applying an overlay color. + + The effect is similar to what happens when a colorized glass is put on top + of a grayscale image. The color for the overlay is given in the RGBA format. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_butterfly.png + \li \image ColorOverlay_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet ColorOverlay-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that provides the source pixels + for the effect. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the RGBA color value which is used to colorize the + source. + + By default, the property is set to \c "transparent". + + \table + \header + \li Output examples with different color values + \li + \li + \row + \li \image ColorOverlay_color1.png + \li \image ColorOverlay_color2.png + \li \image ColorOverlay_color3.png + \row + \li \b { color: #80ff0000 } + \li \b { color: #8000ff00 } + \li \b { color: #800000ff } + \endtable + + */ + property color color: "transparent" + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property color color: rootItem.color + + anchors.fill: parent + + fragmentShader: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp vec4 color; + void main() { + highp vec4 pixelColor = texture2D(source, qt_TexCoord0); + gl_FragColor = vec4(mix(pixelColor.rgb/max(pixelColor.a, 0.00390625), color.rgb/max(color.a, 0.00390625), color.a) * pixelColor.a, pixelColor.a) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Colorize.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Colorize.qml new file mode 100644 index 00000000000..62e1312940b --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Colorize.qml @@ -0,0 +1,294 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype Colorize + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-color + \brief Sets the color in the HSL color space. + + The effect is similar to what happens when a colorized glass is put on top + of a grayscale image. Colorize uses the hue, saturation, and lightness (HSL) + color space. You can specify a desired value for each property. You can + shift all HSL values with the + \l{QtGraphicalEffects1::HueSaturation}{HueSaturation} effect. + + Alternatively, you can use the + \l{QtGraphicalEffects1::ColorOverlay}{ColorOverlay} effect to colorize the + source item in the RGBA color space. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image Colorize_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet Colorize-example.qml example +*/ +Item { + id: rootItem + + /*! + This property defines the source item that provides the source pixels + for the effect. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the hue value which is used to colorize the + source. + + The value ranges from 0.0 to 1.0. By default, the property is set to \c + 0.0, which produces a slightly red color. + + \table + \header + \li Allowed hue values + \row + \li \image Colorize_hue_scale.png + \endtable + + \table + \header + \li Output examples with different hue values + \li + \li + \row + \li \image Colorize_hue1.png + \li \image Colorize_hue2.png + \li \image Colorize_hue3.png + \row + \li \b { hue: 0.2 } + \li \b { hue: 0.5 } + \li \b { hue: 0.8 } + \row + \li \l saturation: 1 + \li \l saturation: 1 + \li \l saturation: 1 + \row + \li \l lightness: 0 + \li \l lightness: 0 + \li \l lightness: 0 + \endtable + */ + property real hue: 0.0 + + /*! + This property defines the saturation value which is used to colorize the + source. + + The value ranges from 0.0 (desaturated) to 1.0 (saturated). By default, + the property is set to \c 1.0 (saturated). + + \table + \header + \li Output examples with different saturation values + \li + \li + \row + \li \image Colorize_saturation1.png + \li \image Colorize_saturation2.png + \li \image Colorize_saturation3.png + \row + \li \b { saturation: 0 } + \li \b { saturation: 0.5 } + \li \b { saturation: 1 } + \row + \li \l hue: 0 + \li \l hue: 0 + \li \l hue: 0 + \row + \li \l lightness: 0 + \li \l lightness: 0 + \li \l lightness: 0 + \endtable + */ + property real saturation: 1.0 + + /*! + This property defines how much the source lightness value is increased + or decreased. + + Unlike hue and saturation properties, lightness does not set the used + value, but it shifts the existing source pixel lightness value. + + The value ranges from -1.0 (decreased) to 1.0 (increased). By default, + the property is set to \c 0.0 (no change). + + \table + \header + \li Output examples with different lightness values + \li + \li + \row + \li \image Colorize_lightness1.png + \li \image Colorize_lightness2.png + \li \image Colorize_lightness3.png + \row + \li \b { lightness: -0.75 } + \li \b { lightness: 0 } + \li \b { lightness: 0.75 } + \row + \li \l hue: 0 + \li \l hue: 0 + \li \l hue: 0 + \row + \li \l saturation: 1 + \li \l saturation: 1 + \li \l saturation: 1 + \endtable + */ + property real lightness: 0.0 + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real hue: rootItem.hue + property real saturation: rootItem.saturation + property real lightness: rootItem.lightness + + anchors.fill: parent + + fragmentShader: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp float hue; + uniform highp float saturation; + uniform highp float lightness; + + highp float RGBtoL(highp vec3 color) { + highp float cmin = min(color.r, min(color.g, color.b)); + highp float cmax = max(color.r, max(color.g, color.b)); + highp float l = (cmin + cmax) / 2.0; + return l; + } + + highp float hueToIntensity(highp float v1, highp float v2, highp float h) { + h = fract(h); + if (h < 1.0 / 6.0) + return v1 + (v2 - v1) * 6.0 * h; + else if (h < 1.0 / 2.0) + return v2; + else if (h < 2.0 / 3.0) + return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h); + + return v1; + } + + highp vec3 HSLtoRGB(highp vec3 color) { + highp float h = color.x; + highp float l = color.z; + highp float s = color.y; + + if (s < 1.0 / 256.0) + return vec3(l, l, l); + + highp float v1; + highp float v2; + if (l < 0.5) + v2 = l * (1.0 + s); + else + v2 = (l + s) - (s * l); + + v1 = 2.0 * l - v2; + + highp float d = 1.0 / 3.0; + highp float r = hueToIntensity(v1, v2, h + d); + highp float g = hueToIntensity(v1, v2, h); + highp float b = hueToIntensity(v1, v2, h - d); + return vec3(r, g, b); + } + + void main() { + lowp vec4 sample = texture2D(source, qt_TexCoord0); + sample = vec4(sample.rgb / max(1.0/256.0, sample.a), sample.a); + highp float light = RGBtoL(sample.rgb); + highp float c = step(0.0, lightness); + sample.rgb = HSLtoRGB(vec3(hue, saturation, mix(light, c, abs(lightness)))); + gl_FragColor = vec4(sample.rgb * sample.a, sample.a) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ConicalGradient.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ConicalGradient.qml new file mode 100644 index 00000000000..c2492f405ab --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ConicalGradient.qml @@ -0,0 +1,342 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype ConicalGradient + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-gradient + \brief Draws a conical gradient. + + A gradient is defined by two or more colors, which are blended seamlessly. + The colors start from the specified angle and end at 360 degrees larger + angle value. + + \table + \header + \li Effect applied + \row + \li \image ConicalGradient.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet ConicalGradient-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + /*! + This property defines the starting angle where the color at the gradient + position of 0.0 is rendered. Colors at larger position values are + rendered into larger angle values and blended seamlessly. Angle values + increase clockwise. + + \table + \header + \li Output examples with different angle values + \li + \li + \row + \li \image ConicalGradient_angle1.png + \li \image ConicalGradient_angle2.png + \li \image ConicalGradient_angle3.png + \row + \li \b { angle: 0 } + \li \b { angle: 45 } + \li \b { angle: 185 } + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \endtable + + */ + property real angle: 0.0 + + /*! + \qmlproperty real QtGraphicalEffects1::ConicalGradient::horizontalOffset + \qmlproperty real QtGraphicalEffects1::ConicalGradient::verticalOffset + + The horizontalOffset and verticalOffset properties define the offset in + pixels for the center point of the gradient compared to the item center. + + The value ranges from -inf to inf. By default, the properties are set to \c + 0. + + \table + \header + \li Output examples with different horizontalOffset values + \li + \li + \row + \li \image ConicalGradient_horizontalOffset1.png + \li \image ConicalGradient_horizontalOffset2.png + \li \image ConicalGradient_horizontalOffset3.png + \row + \li \b { horizontalOffset: -50 } + \li \b { horizontalOffset: 0 } + \li \b { horizontalOffset: 50 } + \row + \li \l angle: 0 + \li \l angle: 0 + \li \l angle: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \endtable + */ + property real horizontalOffset: 0.0 + property real verticalOffset: 0.0 + + /*! + This property defines the item that is going to be filled with gradient. + Source item gets rendered into an intermediate pixel buffer and the + alpha values from the result are used to determine the gradient's pixels + visibility in the display. The default value for source is undefined and + in that case whole effect area is filled with gradient. + + \table + \header + \li Output examples with different source values + \li + \row + \li \image ConicalGradient_maskSource1.png + \li \image ConicalGradient_maskSource2.png + \row + \li \b { source: undefined } + \li \b { source: } + \row + \li \l angle: 0 + \li \l angle: 0 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \endtable + + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + +/*! + A gradient is defined by two or more colors, which are blended seamlessly. + The colors are specified as a set of GradientStop child items, each of which + defines a position on the gradient (from 0.0 to 1.0), and a color. + The position of each GradientStop is defined by the position property. + The color is defined by the color property. + + \table + \header + \li Output examples with different gradient values + \li + \li + \row + \li \image ConicalGradient_gradient1.png + \li \image ConicalGradient_gradient2.png + \li \image ConicalGradient_gradient3.png + \row + \li \b {gradient:} \code +Gradient { + GradientStop { position: 0.000 + color: Qt.rgba(1, 0, 0, 1) } + GradientStop { position: 0.167; + color: Qt.rgba(1, 1, 0, 1) } + GradientStop { position: 0.333; + color: Qt.rgba(0, 1, 0, 1) } + GradientStop { position: 0.500; + color: Qt.rgba(0, 1, 1, 1) } + GradientStop { position: 0.667; + color: Qt.rgba(0, 0, 1, 1) } + GradientStop { position: 0.833; + color: Qt.rgba(1, 0, 1, 1) } + GradientStop { position: 1.000; + color: Qt.rgba(1, 0, 0, 1) } +} + \endcode + \li \b {gradient:} \code +Gradient { + GradientStop { position: 0.0 + color: "#F0F0F0" + } + GradientStop { position: 0.5 + color: "#000000" + } + GradientStop { position: 1.0 + color: "#F0F0F0" + } +} + \endcode + \li \b {gradient:} \code +Gradient { + GradientStop { position: 0.0 + color: "#00000000" + } + GradientStop { position: 1.0 + color: "#FF000000" + } +} + \endcode + \row + \li \l angle: 0 + \li \l angle: 0 + \li \l angle: 0 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \endtable + +*/ + property Gradient gradient: Gradient { + GradientStop { position: 0.0; color: "white" } + GradientStop { position: 1.0; color: "black" } + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.source + } + + Rectangle { + id: gradientRect + width: 16 + height: 256 + gradient: rootItem.gradient + smooth: true + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + rotation: shaderItem.rotation + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant gradientSource: ShaderEffectSource { + sourceItem: gradientRect + smooth: true + hideSource: true + visible: false + } + property variant maskSource: maskSourceProxy.output + property real startAngle: (rootItem.angle - 90) * Math.PI/180 + property variant center: Qt.point(0.5 + horizontalOffset / width, 0.5 + verticalOffset / height) + + anchors.fill: parent + + fragmentShader: maskSource == undefined ? noMaskShader : maskShader + + onFragmentShaderChanged: startAngleChanged() + + property string noMaskShader: " + varying mediump vec2 qt_TexCoord0; + uniform lowp sampler2D gradientSource; + uniform highp float qt_Opacity; + uniform highp float startAngle; + uniform highp vec2 center; + + void main() { + const highp float PI = 3.14159265; + const highp float PIx2inv = 0.1591549; + highp float a = (atan((center.y - qt_TexCoord0.t), (center.x - qt_TexCoord0.s)) + PI - startAngle) * PIx2inv; + gl_FragColor = texture2D(gradientSource, vec2(0.0, fract(a))) * qt_Opacity; + } + " + + property string maskShader: " + varying mediump vec2 qt_TexCoord0; + uniform lowp sampler2D gradientSource; + uniform lowp sampler2D maskSource; + uniform highp float qt_Opacity; + uniform highp float startAngle; + uniform highp vec2 center; + + void main() { + lowp float maskAlpha = texture2D(maskSource, qt_TexCoord0).a; + const highp float PI = 3.14159265; + const highp float PIx2inv = 0.1591549; + highp float a = (atan((center.y - qt_TexCoord0.t), (center.x - qt_TexCoord0.s)) + PI - startAngle) * PIx2inv; + gl_FragColor = texture2D(gradientSource, vec2(0.0, fract(a))) * maskAlpha * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Desaturate.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Desaturate.qml new file mode 100644 index 00000000000..a05cb59c32e --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Desaturate.qml @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype Desaturate + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-color + \brief Reduces the saturation of the colors. + + Desaturated pixel values are calculated as averages of the original RGB + component values of the source item. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image Desaturate_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet Desaturate-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that provides the source pixels to + the effect. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines how much the source colors are desaturated. + + The value ranges from 0.0 (no change) to 1.0 (desaturated). By default, + the property is set to \c 0.0 (no chnage). + + \table + \header + \li Output examples with different desaturation values + \li + \li + \row + \li \image Desaturate_desaturation1.png + \li \image Desaturate_desaturation2.png + \li \image Desaturate_desaturation3.png + \row + \li \b { desaturation: 0.0 } + \li \b { desaturation: 0.5 } + \li \b { desaturation: 1.0 } + \endtable + */ + property real desaturation: 0.0 + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real desaturation: rootItem.desaturation + + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp float desaturation; + void main(void) { + lowp vec4 textureColor = texture2D(source, qt_TexCoord0.st); + lowp float grayColor = (textureColor.r + textureColor.g + textureColor.b) / 3.0; + gl_FragColor = mix(textureColor, vec4(vec3(grayColor), textureColor.a), desaturation) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/DirectionalBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/DirectionalBlur.qml new file mode 100644 index 00000000000..248e0c5bfc1 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/DirectionalBlur.qml @@ -0,0 +1,289 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype DirectionalBlur + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-motion-blur + \brief Applies blur effect to the specified direction. + + Effect creates perceived impression that the source item appears to be + moving in the direction of the blur. Blur is applied to both sides of + each pixel, therefore setting the direction to 0 and 180 provides the + same result. + + Other available motionblur effects are \l{QtGraphicalEffects1::ZoomBlur}{ZoomBlur} and + \l{QtGraphicalEffects1::RadialBlur}{RadialBlur}. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image DirectionalBlur_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet DirectionalBlur-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be blurred. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the percieved amount of movement for each pixel. + The movement is divided evenly to both sides of each pixel. + + The quality of the blur depends on \l{DirectionalBlur::samples}{samples} + property. If length value is large, more samples are needed to keep the + visual quality at high level. + + The value ranges from 0.0 to inf. + By default the property is set to \c 0.0 (no blur). + + \table + \header + \li Output examples with different length values + \li + \li + \row + \li \image DirectionalBlur_length1.png + \li \image DirectionalBlur_length2.png + \li \image DirectionalBlur_length3.png + \row + \li \b { length: 0.0 } + \li \b { length: 32.0 } + \li \b { length: 48.0 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l angle: 0 + \li \l angle: 0 + \li \l angle: 0 + \endtable + + */ + property real length: 0.0 + + /*! + This property defines how many samples are taken per pixel when blur + calculation is done. Larger value produces better quality, but is slower + to render. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + Allowed values are between 0 and inf (practical maximum depends on GPU). + By default the property is set to \c 0 (no samples). + + */ + property int samples: 0 + + /*! + This property defines the direction for the blur. Blur is applied to + both sides of each pixel, therefore setting the direction to 0 and 180 + produces the same result. + + The value ranges from -180.0 to 180.0. + By default the property is set to \c 0.0. + + \table + \header + \li Output examples with different angle values + \li + \li + \row + \li \image DirectionalBlur_angle1.png + \li \image DirectionalBlur_angle2.png + \li \image DirectionalBlur_angle3.png + \row + \li \b { angle: 0.0 } + \li \b { angle: 45.0 } + \li \b { angle: 90.0 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l length: 32 + \li \l length: 32 + \li \l length: 32 + \endtable + + */ + property real angle: 0.0 + + /*! + This property defines the blur behavior near the edges of the item, + where the pixel blurring is affected by the pixels outside the source + edges. + + If the property is set to \c true, the pixels outside the source are + interpreted to be transparent, which is similar to OpenGL + clamp-to-border extension. The blur is expanded slightly outside the + effect item area. + + If the property is set to \c false, the pixels outside the source are + interpreted to contain the same color as the pixels at the edge of the + item, which is similar to OpenGL clamp-to-edge behavior. The blur does + not expand outside the effect item area. + + By default, the property is set to \c false. + + */ + property bool transparentBorder: false + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real len: rootItem.length + property bool transparentBorder: rootItem.transparentBorder + property real samples: rootItem.samples + property real weight: 1.0 / Math.max(1.0, rootItem.samples) + property variant expandPixels: transparentBorder ? Qt.size(rootItem.samples, rootItem.samples) : Qt.size(0,0) + property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0) + property variant delta: Qt.size(1.0 / rootItem.width * Math.cos((rootItem.angle + 90) * Math.PI/180), 1.0 / rootItem.height * Math.sin((rootItem.angle + 90) * Math.PI/180)) + + x: transparentBorder ? -expandPixels.width - 1: 0 + y: transparentBorder ? -expandPixels.height - 1 : 0 + width: transparentBorder ? parent.width + 2.0 * expandPixels.width + 2 : parent.width + height: transparentBorder ? parent.height + 2.0 * expandPixels.height + 2 : parent.height + + property string fragmentShaderSkeleton: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp float len; + uniform highp float samples; + uniform highp float weight; + uniform highp vec2 expand; + uniform highp vec2 delta; + + void main(void) { + highp vec2 shift = delta * len / max(1.0, samples - 1.0); + mediump vec2 texCoord = qt_TexCoord0; + gl_FragColor = vec4(0.0); + + PLACEHOLDER_EXPAND_STEPS + + texCoord -= shift * max(0.0, samples - 1.0) * 0.5; + + PLACEHOLDER_UNROLLED_LOOP + + gl_FragColor *= weight * qt_Opacity; + } + " + + function buildFragmentShader() { + var shader = fragmentShaderSkeleton + var expandSteps = "" + + if (transparentBorder) { + expandSteps += "texCoord = (texCoord - expand) / (1.0 - 2.0 * expand);" + } + + var unrolledLoop = "gl_FragColor += texture2D(source, texCoord);\n" + + if (rootItem.samples > 1) { + unrolledLoop = "" + for (var i = 0; i < rootItem.samples; i++) + unrolledLoop += "gl_FragColor += texture2D(source, texCoord); texCoord += shift;\n" + } + + shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps) + fragmentShader = shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop) + } + + onFragmentShaderChanged: sourceChanged() + onSamplesChanged: buildFragmentShader() + onTransparentBorderChanged: buildFragmentShader() + Component.onCompleted: buildFragmentShader() + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Displace.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Displace.qml new file mode 100644 index 00000000000..142ae10a033 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Displace.qml @@ -0,0 +1,217 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype Displace + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-distortion + \brief Moves the pixels of the source item according to the given + displacement map. + + \table + \header + \li Source + \li DisplacementSource + \li Effect applied + \row + \li \image Original_bug.png + \li \image Displace_map.png + \li \image Displace_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet Displace-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item for the pixels that are going to + be displaced according to the data from + \l{Displace::displacementSource}{displacementSource}. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the item that is going to be used as the + displacement map. The displacementSource item gets rendered into the + intermediate pixel buffer. The red and green component values from the + result determine the displacement of the pixels from the source item. + + The format for the displacement map is similar to the tangent space + normal maps, which can be created with most 3D-modeling tools. Many + image processing tools include the support for generating normal maps. + Alternatively, the displacement map for this effect can also be a QML + element which is colored appropriately. Like any QML element, it can be + animated. It is recommended that the size of the diplacement map matches + the size of the \l{Displace::source}{source}. + + The displace data is interpreted in the RGBA format. For every pixel: + the red channel stores the x-axis displacement, and the green channel + stores the y-axis displacement. Blue and alpha channels are ignored for + this effect. + + Assuming that red channel value 1.0 is fully red (0.0 having no red at + all), this effect considers pixel component value 0.5 to cause no + displacement at all. Values above 0.5 shift pixels to the left, values + below 0.5 do the shift to the right. In a similar way, green channel + values above 0.5 displace the pixels upwards, and values below 0.5 shift + the pixels downwards. The actual amount of displacement in pixels + depends on the \l displacement property. + + */ + property variant displacementSource + + /*! + This property defines the scale for the displacement. The bigger scale, + the bigger the displacement of the pixels. The value set to 0.0 causes + no displacement. + + The value ranges from -1.0 (inverted maximum shift, according to + displacementSource) to 1.0 (maximum shift, according to + displacementSource). By default, the property is set to \c 0.0 (no + displacement). + + \table + \header + \li Output examples with different displacement values + \li + \li + \row + \li \image Displace_displacement1.png + \li \image Displace_displacement2.png + \li \image Displace_displacement3.png + \row + \li \b { displacement: -0.2 } + \li \b { displacement: 0.0 } + \li \b { displacement: 0.2 } + \endtable + + */ + property real displacement: 0.0 + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + SourceProxy { + id: displacementSourceProxy + input: rootItem.displacementSource + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant displacementSource: displacementSourceProxy.output + property real displacement: rootItem.displacement + property real xPixel: 1.0/width + property real yPixel: 1.0/height + + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform lowp sampler2D displacementSource; + uniform highp float displacement; + uniform highp float xPixel; + uniform highp float yPixel; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main() { + lowp vec4 offset = texture2D(displacementSource, qt_TexCoord0); + offset.xy -= vec2(0.5, 0.5); + offset.xy = offset.xy * step(vec2(1.0/256.0), abs(offset.xy)); + highp vec2 tx = qt_TexCoord0 + (vec2(-offset.x, offset.y) * displacement); + + lowp float e1 = linearstep(0.0, xPixel, tx.x); + lowp float e2 = linearstep(0.0, yPixel, tx.y); + lowp float e3 = 1.0 - linearstep(1.0, 1.0 + xPixel, tx.x); + lowp float e4 = 1.0 - linearstep(1.0, 1.0 + yPixel, tx.y); + + lowp vec4 sample = texture2D(source, tx); + sample.rgb *= e1 * e2 * e3 * e4; + gl_FragColor = sample * qt_Opacity * offset.a; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/DropShadow.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/DropShadow.qml new file mode 100644 index 00000000000..b73e244cbcf --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/DropShadow.qml @@ -0,0 +1,403 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype DropShadow + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-drop-shadow + \brief Generates a colorized and blurred shadow image of the + source and places it behind the original, giving the impression that + source item is raised from the background. + + By default the effect produces a high quality shadow image, thus the + rendering speed of the shadow might not be the highest possible. The + rendering speed is reduced especially if the shadow edges are heavily + softened. + + For use cases that require faster rendering speed and for which the highest + possible visual quality is not necessary, property + \l{DropShadow::fast}{fast} can be set to true. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_butterfly.png + \li \image DropShadow_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet DropShadow-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be used as the + source for the generated shadow. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + Radius defines the softness of the shadow. A larger radius causes the + edges of the shadow to appear more blurry. + + Depending on the radius value, value of the + \l{DropShadow::samples}{samples} should be set to sufficiently large to + ensure the visual quality. + + The value ranges from 0.0 (no blur) to inf. By default, the property is + set to \c 0.0 (no blur). + + \table + \header + \li Output examples with different radius values + \li + \li + \row + \li \image DropShadow_radius1.png + \li \image DropShadow_radius2.png + \li \image DropShadow_radius3.png + \row + \li \b { radius: 0 } + \li \b { radius: 6 } + \li \b { radius: 12 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l color: #000000 + \li \l color: #000000 + \li \l color: #000000 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 20 + \li \l verticalOffset: 20 + \li \l verticalOffset: 20 + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \endtable + + */ + property real radius: 0.0 + + /*! + This property defines how many samples are taken per pixel when edge + softening blur calculation is done. Larger value produces better + quality, but is slower to render. + + Ideally, this value should be twice as large as the highest required + radius value, for example, if the radius is animated between 0.0 and + 4.0, samples should be set to 8. + + The value ranges from 0 to 32. By default, the property is set to \c 0. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + When \l{DropShadow::fast}{fast} property is set to true, this property + has no effect. + + */ + property int samples: 0 + + /*! + This property defines the RGBA color value which is used for the shadow. + + By default, the property is set to \c "black". + + \table + \header + \li Output examples with different color values + \li + \li + \row + \li \image DropShadow_color1.png + \li \image DropShadow_color2.png + \li \image DropShadow_color3.png + \row + \li \b { color: #000000 } + \li \b { color: #0000ff } + \li \b { color: #aa000000 } + \row + \li \l radius: 8 + \li \l radius: 8 + \li \l radius: 8 + \row + \li \l samples: 16 + \li \l samples: 16 + \li \l samples: 16 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 20 + \li \l verticalOffset: 20 + \li \l verticalOffset: 20 + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \endtable + + */ + property color color: "black" + + /*! + \qmlproperty real QtGraphicalEffects1::DropShadow::horizontalOffset + \qmlproperty real QtGraphicalEffects1::DropShadow::verticalOffset + + HorizontalOffset and verticalOffset properties define the offset for the + rendered shadow compared to the DropShadow item position. Often, the + DropShadow item is anchored so that it fills the source element. In this + case, if the HorizontalOffset and verticalOffset properties are set to + 0, the shadow is rendered exactly under the source item. By changing the + offset properties, the shadow can be positioned relatively to the source + item. + + The values range from -inf to inf. By default, the properties are set to + \c 0. + + \table + \header + \li Output examples with different horizontalOffset values + \li + \li + \row + \li \image DropShadow_horizontalOffset1.png + \li \image DropShadow_horizontalOffset2.png + \li \image DropShadow_horizontalOffset3.png + \row + \li \b { horizontalOffset: -20 } + \li \b { horizontalOffset: 0 } + \li \b { horizontalOffset: 20 } + \row + \li \l radius: 4 + \li \l radius: 4 + \li \l radius: 4 + \row + \li \l samples: 8 + \li \l samples: 8 + \li \l samples: 8 + \row + \li \l color: #000000 + \li \l color: #000000 + \li \l color: #000000 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \endtable + + */ + property real horizontalOffset: 0.0 + property real verticalOffset: 0.0 + + /*! + This property defines how large part of the shadow color is strenghtened + near the source edges. + + The value ranges from 0.0 to 1.0. By default, the property is set to \c + 0.5. + + \table + \header + \li Output examples with different spread values + \li + \li + \row + \li \image DropShadow_spread1.png + \li \image DropShadow_spread2.png + \li \image DropShadow_spread3.png + \row + \li \b { spread: 0.0 } + \li \b { spread: 0.5 } + \li \b { spread: 1.0 } + \row + \li \l radius: 8 + \li \l radius: 8 + \li \l radius: 8 + \row + \li \l samples: 16 + \li \l samples: 16 + \li \l samples: 16 + \row + \li \l color: #000000 + \li \l color: #000000 + \li \l color: #000000 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 20 + \li \l verticalOffset: 20 + \li \l verticalOffset: 20 + \endtable + + */ + property real spread: 0.0 + + /*! + This property selects the blurring algorithm that is used to produce the + softness for the effect. Setting this to true enables fast algorithm, + setting value to false produces higher quality result. + + By default, the property is set to \c false. + + \table + \header + \li Output examples with different fast values + \li + \li + \row + \li \image DropShadow_fast1.png + \li \image DropShadow_fast2.png + \row + \li \b { fast: false } + \li \b { fast: true } + \row + \li \l radius: 16 + \li \l radius: 16 + \row + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l color: #000000 + \li \l color: #000000 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 20 + \li \l verticalOffset: 20 + \row + \li \l spread: 0 + \li \l spread: 0 + \endtable + + */ + property bool fast: false + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. Every time the source or effect + properties are changed, the pixels in the cache must be updated. Memory + consumption is increased, because an extra buffer of memory is required + for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + property bool transparentBorder: false + + Loader { + x: rootItem.horizontalOffset + y: rootItem.verticalOffset + width: parent.width + height: parent.height + sourceComponent: rootItem.fast ? fastGlow : gaussianGlow + } + + Component { + id: gaussianGlow + GaussianGlow { + anchors.fill: parent + source: sourceProxy.output + radius: rootItem.radius + maximumRadius: rootItem.samples * 0.5 + color: rootItem.color + cached: rootItem.cached + spread: rootItem.spread + transparentBorder: rootItem.transparentBorder + } + } + + Component { + id: fastGlow + FastGlow { + anchors.fill: parent + source: sourceProxy.output + blur: Math.pow(rootItem.radius / 64.0, 0.4) + color: rootItem.color + cached: rootItem.cached + spread: rootItem.spread + transparentBorder: rootItem.transparentBorder + } + } + + SourceProxy { + id: sourceProxy + input: rootItem.source + sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) + } + ShaderEffect { + anchors.fill: parent + property variant source: sourceProxy.output + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/FastBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/FastBlur.qml new file mode 100644 index 00000000000..ca38ad2fbf3 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/FastBlur.qml @@ -0,0 +1,496 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype FastBlur + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-blur + \brief Applies a fast blur effect to one or more source items. + + FastBlur offers lower blur quality than + \l{QtGraphicalEffects1::GaussianBlur}{GaussianBlur}, but it is faster to + render. The FastBlur effect softens the source content by blurring it with + algorithm which uses the source content downscaling and bilinear filtering. + Use this effect in situations where the source content is rapidly changing + and the highest possible blur quality is not + needed. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image FastBlur_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet FastBlur-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be blurred. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the distance of the neighboring pixels which affect + the blurring of an individual pixel. A larger radius increases the blur + effect. FastBlur algorithm may internally reduce the accuracy of the radius in order to + provide good rendering performance. + + The value ranges from 0.0 (no blur) to inf. Visual quality of the blur is reduced when + radius exceeds value 64. By default, the property is set to \c 0.0 (no blur). + + \table + \header + \li Output examples with different blur values + \li + \li + \row + \li \image FastBlur_radius1.png + \li \image FastBlur_radius2.png + \li \image FastBlur_radius3.png + \row + \li \b { radius: 0 } + \li \b { radius: 32 } + \li \b { radius: 64 } + \endtable + */ + property real radius: 0.0 + + /*! + This property defines the blur behavior near the edges of the item, + where the pixel blurring is affected by the pixels outside the source + edges. + + If the property is set to \c true, the pixels outside the source are + interpreted to be transparent, which is similar to OpenGL + clamp-to-border extension. The blur is expanded slightly outside the + effect item area. + + If the property is set to \c false, the pixels outside the source are + interpreted to contain the same color as the pixels at the edge of the + item, which is similar to OpenGL clamp-to-edge behavior. The blur does + not expand outside the effect item area. + + By default, the property is set to \c false. + + \table + \header + \li Output examples with different transparentBorder values + \li + \li + \row + \li \image FastBlur_transparentBorder1.png + \li \image FastBlur_transparentBorder2.png + \row + \li \b { transparentBorder: false } + \li \b { transparentBorder: true } + \row + \li \l radius: 64 + \li \l radius: 64 + \endtable + */ + property bool transparentBorder: false + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + sourceItem: shaderItem + live: true + hideSource: visible + smooth: rootItem.radius > 0 + } + + /*! \internal */ + property string __internalBlurVertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_Matrix; + uniform highp float yStep; + uniform highp float xStep; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36); + qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep); + qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep); + qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36); + gl_Position = qt_Matrix * qt_Vertex; + } + " + + /*! \internal */ + property string __internalBlurFragmentShader: " + uniform lowp sampler2D source; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) + + texture2D(source, qt_TexCoord1) + + texture2D(source, qt_TexCoord2) + + texture2D(source, qt_TexCoord3)) * 0.25; + gl_FragColor = sourceColor * qt_Opacity; + } + " + + ShaderEffect { + id: level0 + property variant source: sourceProxy.output + anchors.fill: parent + visible: false + smooth: true + } + + ShaderEffectSource { + id: level1 + width: Math.ceil(shaderItem.width / 32) * 32 + height: Math.ceil(shaderItem.height / 32) * 32 + sourceItem: level0 + hideSource: rootItem.visible + sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0, 0, 0, 0) + visible: false + smooth: rootItem.radius > 0 + } + + ShaderEffect { + id: effect1 + property variant source: level1 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level2 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level2 + width: level1.width / 2 + height: level1.height / 2 + sourceItem: effect1 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect2 + property variant source: level2 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level3 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level3 + width: level2.width / 2 + height: level2.height / 2 + sourceItem: effect2 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect3 + property variant source: level3 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level4 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level4 + width: level3.width / 2 + height: level3.height / 2 + sourceItem: effect3 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect4 + property variant source: level4 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level5 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level5 + width: level4.width / 2 + height: level4.height / 2 + sourceItem: effect4 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect5 + property variant source: level5 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level6 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level6 + width: level5.width / 2 + height: level5.height / 2 + sourceItem: effect5 + hideSource: rootItem.visible + visible: false + smooth: true + } + + Item { + id: dummysource + width: 1 + height: 1 + visible: false + } + + ShaderEffectSource { + id: dummy + width: 1 + height: 1 + sourceItem: dummysource + visible: false + smooth: false + live: false + } + + ShaderEffect { + id: shaderItem + + property variant source1: level1 + property variant source2: level2 + property variant source3: level3 + property variant source4: level4 + property variant source5: level5 + property variant source6: level6 + property real lod: Math.sqrt(rootItem.radius / 64.0) * 1.2 - 0.2 + property real weight1 + property real weight2 + property real weight3 + property real weight4 + property real weight5 + property real weight6 + + x: transparentBorder ? -64 : 0 + y: transparentBorder ? -64 : 0 + width: transparentBorder ? parent.width + 128 : parent.width + height: transparentBorder ? parent.height + 128 : parent.height + + function weight(v) { + if (v <= 0.0) + return 1.0 + if (v >= 0.5) + return 0.0 + + return 1.0 - v * 2.0 + } + + function calculateWeights() { + + var w1 = weight(Math.abs(lod - 0.100)) + var w2 = weight(Math.abs(lod - 0.300)) + var w3 = weight(Math.abs(lod - 0.500)) + var w4 = weight(Math.abs(lod - 0.700)) + var w5 = weight(Math.abs(lod - 0.900)) + var w6 = weight(Math.abs(lod - 1.100)) + + var sum = w1 + w2 + w3 + w4 + w5 + w6; + weight1 = w1 / sum; + weight2 = w2 / sum; + weight3 = w3 / sum; + weight4 = w4 / sum; + weight5 = w5 / sum; + weight6 = w6 / sum; + + upateSources() + } + + function upateSources() { + var sources = new Array(); + var weights = new Array(); + + if (weight1 > 0) { + sources.push(level1) + weights.push(weight1) + } + + if (weight2 > 0) { + sources.push(level2) + weights.push(weight2) + } + + if (weight3 > 0) { + sources.push(level3) + weights.push(weight3) + } + + if (weight4 > 0) { + sources.push(level4) + weights.push(weight4) + } + + if (weight5 > 0) { + sources.push(level5) + weights.push(weight5) + } + + if (weight6 > 0) { + sources.push(level6) + weights.push(weight6) + } + + for (var j = sources.length; j < 6; j++) { + sources.push(dummy) + weights.push(0.0) + } + + source1 = sources[0] + source2 = sources[1] + source3 = sources[2] + source4 = sources[3] + source5 = sources[4] + source6 = sources[5] + + weight1 = weights[0] + weight2 = weights[1] + weight3 = weights[2] + weight4 = weights[3] + weight5 = weights[4] + weight6 = weights[5] + } + + Component.onCompleted: calculateWeights() + + onLodChanged: calculateWeights() + + fragmentShader: " + uniform lowp sampler2D source1; + uniform lowp sampler2D source2; + uniform lowp sampler2D source3; + uniform lowp sampler2D source4; + uniform lowp sampler2D source5; + uniform mediump float weight1; + uniform mediump float weight2; + uniform mediump float weight3; + uniform mediump float weight4; + uniform mediump float weight5; + uniform lowp float qt_Opacity; + varying mediump vec2 qt_TexCoord0; + + void main() { + lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1; + sourceColor += texture2D(source2, qt_TexCoord0) * weight2; + sourceColor += texture2D(source3, qt_TexCoord0) * weight3; + sourceColor += texture2D(source4, qt_TexCoord0) * weight4; + sourceColor += texture2D(source5, qt_TexCoord0) * weight5; + gl_FragColor = sourceColor * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/GammaAdjust.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/GammaAdjust.qml new file mode 100644 index 00000000000..7a597dd05e1 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/GammaAdjust.qml @@ -0,0 +1,193 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype GammaAdjust + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-color + \brief Alters the luminance of the source item. + + GammaAdjust is applied to each pixel according to the curve which is + pre-defined as a power-law expression, where the property gamma is used as the + reciprocal scaling exponent. Refer to the property documentation of \l{GammaAdjust::gamma}{gamma} + for more details. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image GammaAdjust_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet GammaAdjust-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item for which the luminance is going to be + adjusted. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the change factor for how the luminance of each pixel + is altered according to the equation: + + \code +luminance = pow(original_luminance, 1.0 / gamma); // The luminance is assumed to be between 0.0 and 1.0 + \endcode + + Setting the gamma values under 1.0 makes the image darker, the values + above 1.0 lighten it. + + The value ranges from 0.0 (darkest) to inf (lightest). By default, the + property is set to \c 1.0 (no change). + + \table + \header + \li Output examples with different gamma values + \li + \li + \row + \li \image GammaAdjust_gamma1.png + \li \image GammaAdjust_gamma2.png + \li \image GammaAdjust_gamma3.png + \row + \li \b { gamma: 0.5 } + \li \b { gamma: 1.0 } + \li \b { gamma: 2.0 } + \endtable + + \table + \header + \li Pixel luminance curves of the above images. + \li + \li + \row + \li \image GammaAdjust_gamma1_graph.png + \li \image GammaAdjust_gamma2_graph.png + \li \image GammaAdjust_gamma3_graph.png + \row + \li Red curve: default gamma (1.0) + \li + \li + \row + \li Yellow curve: effect applied + \li + \li + \row + \li X-axis: pixel original luminance + \li + \li + \row + \li Y-axis: pixel luminance with effect applied + \li + \li + \endtable + + */ + property real gamma: 1.0 + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real gamma: 1.0 / Math.max(rootItem.gamma, 0.0001) + + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp float gamma; + void main(void) { + highp vec4 originalColor = texture2D(source, qt_TexCoord0.st); + originalColor.rgb = originalColor.rgb / max(1.0/256.0, originalColor.a); + highp vec3 adjustedColor = pow(originalColor.rgb, vec3(gamma)); + gl_FragColor = vec4(adjustedColor * originalColor.a, originalColor.a) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/GaussianBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/GaussianBlur.qml new file mode 100644 index 00000000000..4000179ef7e --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/GaussianBlur.qml @@ -0,0 +1,295 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype GaussianBlur + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-blur + \brief Applies a higher quality blur effect. + + GaussianBlur effect softens the image by blurring it with an algorithm that + uses the Gaussian function to calculate the effect. The effect produces + higher quality than \l{QtGraphicalEffects1::FastBlur}{FastBlur}, but is + slower to render. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image GaussianBlur_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet GaussianBlur-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be blurred. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the distance of the neighboring pixels which + affect the blurring of an individual pixel. A larger radius increases + the blur effect. + + Depending on the radius value, value of the + \l{GaussianBlur::samples}{samples} should be set to sufficiently large + to ensure the visual quality. + + The value ranges from 0.0 (no blur) to inf. By default, the property is + set to \c 0.0 (no blur). + + \table + \header + \li Output examples with different radius values + \li + \li + \row + \li \image GaussianBlur_radius1.png + \li \image GaussianBlur_radius2.png + \li \image GaussianBlur_radius3.png + \row + \li \b { radius: 0 } + \li \b { radius: 4 } + \li \b { radius: 8 } + \row + \li \l samples: 16 + \li \l samples: 16 + \li \l samples: 16 + \row + \li \l deviation: 3 + \li \l deviation: 3 + \li \l deviation: 3 + \endtable + + */ + property real radius: 0.0 + + /*! + This property defines how many samples are taken per pixel when blur + calculation is done. Larger value produces better quality, but is slower + to render. + + Ideally, this value should be twice as large as the highest required + radius value, for example, if the radius is animated between 0.0 and + 4.0, samples should be set to 8. + + The value ranges from 0 to 32. By default, the property is set to \c 0. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + */ + property int samples: 0 + + /*! + This property is a parameter to the gaussian function that is used when + calculating neighboring pixel weights for the blurring. A larger + deviation causes image to appear more blurry, but it also reduces the + quality of the blur. A very large deviation value causes the effect to + look a bit similar to what, for exmple, a box blur algorithm produces. A + too small deviation values makes the effect insignificant for the pixels + near the radius. + + \inlineimage GaussianBlur_deviation_graph.png + \caption The image above shows the Gaussian function with two different + deviation values, yellow (1) and cyan (2.7). The y-axis shows the + weights, the x-axis shows the pixel distance. + + The value ranges from 0.0 (no deviation) to inf (maximum deviation). By + default, devaition is binded to radius. When radius increases, deviation + is automatically increased linearly. With the radius value of 8, the + deviation default value becomes approximately 2.7034. This value + produces a compromise between the blur quality and overall blurriness. + + \table + \header + \li Output examples with different deviation values + \li + \li + \row + \li \image GaussianBlur_deviation1.png + \li \image GaussianBlur_deviation2.png + \li \image GaussianBlur_deviation3.png + \row + \li \b { deviation: 1 } + \li \b { deviation: 2 } + \li \b { deviation: 4 } + \row + \li \l radius: 8 + \li \l radius: 8 + \li \l radius: 8 + \row + \li \l samples: 16 + \li \l samples: 16 + \li \l samples: 16 + \endtable + + */ + property real deviation: (radius + 1) / 3.3333 + + /*! + This property defines the blur behavior near the edges of the item, + where the pixel blurring is affected by the pixels outside the source + edges. + + If the property is set to \c true, the pixels outside the source are + interpreted to be transparent, which is similar to OpenGL + clamp-to-border extension. The blur is expanded slightly outside the + effect item area. + + If the property is set to \c false, the pixels outside the source are + interpreted to contain the same color as the pixels at the edge of the + item, which is similar to OpenGL clamp-to-edge behavior. The blur does + not expand outside the effect item area. + + By default, the property is set to \c false. + + \table + \header + \li Output examples with different transparentBorder values + \li + \li + \row + \li \image GaussianBlur_transparentBorder1.png + \li \image GaussianBlur_transparentBorder2.png + \row + \li \b { transparentBorder: false } + \li \b { transparentBorder: true } + \row + \li \l radius: 8 + \li \l radius: 8 + \row + \li \l samples: 16 + \li \l samples: 16 + \row + \li \l deviation: 2.7 + \li \l deviation: 2.7 + \endtable + + */ + property bool transparentBorder: false + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: verticalBlur + visible: rootItem.cached + smooth: true + sourceItem: verticalBlur + live: true + hideSource: visible + } + + GaussianDirectionalBlur { + id: verticalBlur + x: transparentBorder ? -maximumRadius - 1 : 0 + y: transparentBorder ? -maximumRadius - 1 : 0 + width: horizontalBlur.width + height: horizontalBlur.height + + horizontalStep: 0.0 + verticalStep: 1.0 / parent.height + + source: ShaderEffectSource { + id: horizontalBlurSource + sourceItem: horizontalBlur + hideSource: true + visible: false + smooth: true + } + + deviation: rootItem.deviation + radius: rootItem.radius + maximumRadius: rootItem.samples * 0.5 + transparentBorder: rootItem.transparentBorder + } + + GaussianDirectionalBlur { + id: horizontalBlur + width: transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width + height: transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height + + horizontalStep: 1.0 / parent.width + verticalStep: 0.0 + + source: sourceProxy.output + deviation: rootItem.deviation + radius: rootItem.radius + maximumRadius: rootItem.samples / 2.0 + transparentBorder: rootItem.transparentBorder + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Glow.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Glow.qml new file mode 100644 index 00000000000..c5a82c6f1e9 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/Glow.qml @@ -0,0 +1,307 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype Glow + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-glow + \brief Generates a blurred and colorized image of the source and places it + behind the original, giving impression that the source is glowing. + + By default effect produces a high quality glow image, thus the rendering + speed of the effect may not be the highest possible. The rendering speed is + reduced especially if the glow edges are heavily softened. For use cases + that require faster rendering speed and the highest possible visual quality + is not necessary, property \l{Glow::fast}{fast} can be set to true. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_butterfly_black.png + \li \image Glow_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet Glow-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be used as source + for the generated glow. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + Radius defines the softness of the glow. A larger radius causes the + edges of the glow to appear more blurry. + + Depending on the radius value, value of the \l{Glow::samples}{samples} + should be set to sufficiently large to ensure the visual quality. + + The value ranges from 0.0 (no blur) to inf. By default, the property is + set to \c 0.0 (no blur). + + \table + \header + \li Output examples with different radius values + \li + \li + \row + \li \image Glow_radius1.png + \li \image Glow_radius2.png + \li \image Glow_radius3.png + \row + \li \b { radius: 0 } + \li \b { radius: 6 } + \li \b { radius: 12 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l color: #ffffff + \li \l color: #ffffff + \li \l color: #ffffff + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \endtable + */ + property real radius: 0.0 + + /*! + This property defines how many samples are taken per pixel when edge + softening blur calculation is done. Larger value produces better + quality, but is slower to render. + + Ideally, this value should be twice as large as the highest required + radius value, for example, if the radius is animated between 0.0 and + 4.0, samples should be set to 8. + + The value ranges from 0 to 32. By default, the property is set to \c 0. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + When \l fast property is set to true, this property has no effect. + + */ + property int samples: 0 + + /*! + This property defines how large part of the glow color is strenghtened + near the source edges. + + The values range from 0.0 to 1.0. By default, the property is set to \c + 0.5. + + \table + \header + \li Output examples with different spread values + \li + \li + \row + \li \image Glow_spread1.png + \li \image Glow_spread2.png + \li \image Glow_spread3.png + \row + \li \b { spread: 0.0 } + \li \b { spread: 0.5 } + \li \b { spread: 1.0 } + \row + \li \l radius: 8 + \li \l radius: 8 + \li \l radius: 8 + \row + \li \l samples: 16 + \li \l samples: 16 + \li \l samples: 16 + \row + \li \l color: #ffffff + \li \l color: #ffffff + \li \l color: #ffffff + \endtable + */ + property real spread: 0.0 + + /*! + This property defines the RGBA color value which is used for the glow. + + By default, the property is set to \c "white". + + \table + \header + \li Output examples with different color values + \li + \li + \row + \li \image Glow_color1.png + \li \image Glow_color2.png + \li \image Glow_color3.png + \row + \li \b { color: #ffffff } + \li \b { color: #00ff00 } + \li \b { color: #aa00ff00 } + \row + \li \l radius: 8 + \li \l radius: 8 + \li \l radius: 8 + \row + \li \l samples: 16 + \li \l samples: 16 + \li \l samples: 16 + \row + \li \l spread: 0.5 + \li \l spread: 0.5 + \li \l spread: 0.5 + \endtable + + */ + property color color: "white" + + /*! + This property selects the blurring algorithm that is used to produce the + softness for the effect. Setting this to true enables fast algorithm, + setting value to false produces higher quality result. + + By default, the property is set to \c false. + + \table + \header + \li Output examples with different fast values + \li + \li + \row + \li \image Glow_fast1.png + \li \image Glow_fast2.png + \row + \li \b { fast: false } + \li \b { fast: true } + \row + \li \l radius: 16 + \li \l radius: 16 + \row + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l color: #ffffff + \li \l color: #ffffff + \row + \li \l spread: 0.3 + \li \l spread: 0.3 + \endtable + */ + property bool fast: false + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + property bool transparentBorder: false + + Loader { + anchors.fill: parent + sourceComponent: rootItem.fast ? fastGlow : gaussianGlow + } + + Component { + id: gaussianGlow + GaussianGlow { + anchors.fill: parent + source: sourceProxy.output + radius: rootItem.radius + maximumRadius: rootItem.samples * 0.5 + color: rootItem.color + cached: rootItem.cached + spread: rootItem.spread + transparentBorder: rootItem.transparentBorder + } + } + + Component { + id: fastGlow + FastGlow { + anchors.fill: parent + source: sourceProxy.output + blur: Math.pow(rootItem.radius / 64.0, 0.4) + color: rootItem.color + cached: rootItem.cached + spread: rootItem.spread + transparentBorder: rootItem.transparentBorder + } + } + + SourceProxy { + id: sourceProxy + input: rootItem.source + sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) + } + ShaderEffect { + anchors.fill: parent + property variant source: sourceProxy.output + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/HueSaturation.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/HueSaturation.qml new file mode 100644 index 00000000000..fb1d895959b --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/HueSaturation.qml @@ -0,0 +1,300 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype HueSaturation + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-color + \brief Alters the source item colors in the HSL color space. + + HueSaturation is similar to the \l{QtGraphicalEffects1::Colorize}{Colorize} + effect, but the hue and saturation property values are handled differently. + The HueSaturation effect always shifts the hue, saturation, and lightness + from the original, instead of setting them. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image HueSaturation_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet HueSaturation-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that provides the source pixels + for the effect. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source: 0 + + /*! + This property defines the hue value which is added to the source hue + value. + + The value ranges from -1.0 (decrease) to 1.0 (increase). By default, the + property is set to \c 0.0 (no change). + + \table + \header + \li Output examples with different hue values + \li + \li + \row + \li \image HueSaturation_hue1.png + \li \image HueSaturation_hue2.png + \li \image HueSaturation_hue3.png + \row + \li \b { hue: -0.3 } + \li \b { hue: 0.0 } + \li \b { hue: 0.3 } + \row + \li \l saturation: 0 + \li \l saturation: 0 + \li \l saturation: 0 + \row + \li \l lightness: 0 + \li \l lightness: 0 + \li \l lightness: 0 + \endtable + + */ + property real hue: 0.0 + + /*! + This property defines the saturation value value which is added to the + source saturation value. + + The value ranges from -1.0 (decrease) to 1.0 (increase). By default, the + property is set to \c 0.0 (no change). + + \table + \header + \li Output examples with different saturation values + \li + \li + \row + \li \image HueSaturation_saturation1.png + \li \image HueSaturation_saturation2.png + \li \image HueSaturation_saturation3.png + \row + \li \b { saturation: -0.8 } + \li \b { saturation: 0.0 } + \li \b { saturation: 1.0 } + \row + \li \l hue: 0 + \li \l hue: 0 + \li \l hue: 0 + \row + \li \l lightness: 0 + \li \l lightness: 0 + \li \l lightness: 0 + \endtable + + */ + property real saturation: 0.0 + + /*! + This property defines the lightness value which is added to the source + saturation value. + + The value ranges from -1.0 (decrease) to 1.0 (increase). By default, the + property is set to \c 0.0 (no change). + + \table + \header + \li Output examples with different lightness values + \li + \li + \row + \li \image HueSaturation_lightness1.png + \li \image HueSaturation_lightness2.png + \li \image HueSaturation_lightness3.png + \row + \li \b { lightness: -0.5 } + \li \b { lightness: 0.0 } + \li \b { lightness: 0.5 } + \row + \li \l hue: 0 + \li \l hue: 0 + \li \l hue: 0 + \row + \li \l saturation: 0 + \li \l saturation: 0 + \li \l saturation: 0 + \endtable + + */ + property real lightness: 0.0 + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant hsl: Qt.vector3d(rootItem.hue, rootItem.saturation, rootItem.lightness) + + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform highp sampler2D source; + uniform highp vec3 hsl; + + highp vec3 RGBtoHSL(highp vec3 color) { + highp float cmin = min(color.r, min(color.g, color.b)); + highp float cmax = max(color.r, max(color.g, color.b)); + highp float h = 0.0; + highp float s = 0.0; + highp float l = (cmin + cmax) / 2.0; + highp float diff = cmax - cmin; + + if (diff > 1.0 / 256.0) { + if (l < 0.5) + s = diff / (cmin + cmax); + else + s = diff / (2.0 - (cmin + cmax)); + + if (color.r == cmax) + h = (color.g - color.b) / diff; + else if (color.g == cmax) + h = 2.0 + (color.b - color.r) / diff; + else + h = 4.0 + (color.r - color.g) / diff; + + h /= 6.0; + } + return vec3(h, s, l); + } + + highp float hueToIntensity(highp float v1, highp float v2, highp float h) { + h = fract(h); + if (h < 1.0 / 6.0) + return v1 + (v2 - v1) * 6.0 * h; + else if (h < 1.0 / 2.0) + return v2; + else if (h < 2.0 / 3.0) + return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h); + + return v1; + } + + highp vec3 HSLtoRGB(highp vec3 color) { + highp float h = color.x; + highp float l = color.z; + highp float s = color.y; + + if (s < 1.0 / 256.0) + return vec3(l); + + highp float v1; + highp float v2; + if (l < 0.5) + v2 = l * (1.0 + s); + else + v2 = (l + s) - (s * l); + + v1 = 2.0 * l - v2; + + highp float d = 1.0 / 3.0; + highp float r = hueToIntensity(v1, v2, h + d); + highp float g = hueToIntensity(v1, v2, h); + highp float b = hueToIntensity(v1, v2, h - d); + return vec3(r, g, b); + } + + void main() { + lowp vec4 sample = texture2D(source, qt_TexCoord0); + sample = vec4(sample.rgb / max(1.0/256.0, sample.a), sample.a); + sample.rgb = mix(vec3(dot(sample.rgb, vec3(0.2125, 0.7154, 0.0721))), sample.rgb, 1.0 + hsl.y); + sample.xyz = RGBtoHSL(sample.rgb); + sample.rgb = HSLtoRGB(vec3(sample.x + hsl.x, sample.y, sample.z)); + highp float c = step(0.0, hsl.z); + sample.rgb = mix(sample.rgb, vec3(c), abs(hsl.z)); + gl_FragColor = vec4(sample.rgb * sample.a, sample.a) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/InnerShadow.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/InnerShadow.qml new file mode 100644 index 00000000000..5eebc6fa3b0 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/InnerShadow.qml @@ -0,0 +1,385 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype InnerShadow + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-drop-shadow + \brief Generates a colorized and blurred shadow inside the + source. + + By default the effect produces a high quality shadow image, thus the + rendering speed of the shadow might not be the highest possible. The + rendering speed is reduced especially if the shadow edges are heavily + softened. For use cases that require faster rendering speed and for which + the highest possible visual quality is not necessary, property + \l{InnerShadow::fast}{fast} can be set to true. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_butterfly.png + \li \image InnerShadow_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet InnerShadow-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be used as the + source for the generated shadow. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + Radius defines the softness of the shadow. A larger radius causes the + edges of the shadow to appear more blurry. + + Depending on the radius value, value of the + \l{InnerShadow::samples}{samples} should be set to sufficiently large to + ensure the visual quality. + + The value ranges from 0.0 (no blur) to inf. By default, the property is + set to \c 0.0 (no blur). + + \table + \header + \li Output examples with different radius values + \li + \li + \row + \li \image InnerShadow_radius1.png + \li \image InnerShadow_radius2.png + \li \image InnerShadow_radius3.png + \row + \li \b { radius: 0 } + \li \b { radius: 6 } + \li \b { radius: 12 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l color: #000000 + \li \l color: #000000 + \li \l color: #000000 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \endtable + + */ + property real radius: 0.0 + + /*! + This property defines how many samples are taken per pixel when edge + softening blur calculation is done. Larger value produces better + quality, but is slower to render. + + Ideally, this value should be twice as large as the highest required + radius value, for example, if the radius is animated between 0.0 and + 4.0, samples should be set to 8. + + The value ranges from 0 to 32. By default, the property is set to \c 0. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + When \l{InnerShadow::fast}{fast} property is set to true, this property + has no effect. + + */ + property int samples: 0 + + /*! + This property defines how large part of the shadow color is strenghtened + near the source edges. + + The value ranges from 0.0 to 1.0. By default, the property is set to \c + 0.5. + + \table + \header + \li Output examples with different spread values + \li + \li + \row + \li \image InnerShadow_spread1.png + \li \image InnerShadow_spread2.png + \li \image InnerShadow_spread3.png + \row + \li \b { spread: 0.0 } + \li \b { spread: 0.3 } + \li \b { spread: 0.5 } + \row + \li \l radius: 16 + \li \l radius: 16 + \li \l radius: 16 + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l color: #000000 + \li \l color: #000000 + \li \l color: #000000 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \endtable + + */ + property real spread: 0.0 + + /*! + This property defines the RGBA color value which is used for the shadow. + + By default, the property is set to \c "black". + + \table + \header + \li Output examples with different color values + \li + \li + \row + \li \image InnerShadow_color1.png + \li \image InnerShadow_color2.png + \li \image InnerShadow_color3.png + \row + \li \b { color: #000000 } + \li \b { color: #ffffff } + \li \b { color: #ff0000 } + \row + \li \l radius: 16 + \li \l radius: 16 + \li \l radius: 16 + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l spread: 0.2 + \li \l spread: 0.2 + \li \l spread: 0.2 + \endtable + */ + property color color: "black" + + /*! + \qmlproperty real QtGraphicalEffects1::InnerShadow::horizontalOffset + \qmlproperty real QtGraphicalEffects1::InnerShadow::verticalOffset + + HorizontalOffset and verticalOffset properties define the offset for the + rendered shadow compared to the InnerShadow item position. Often, the + InnerShadow item is anchored so that it fills the source element. In + this case, if the HorizontalOffset and verticalOffset properties are set + to 0, the shadow is rendered fully inside the source item. By changing + the offset properties, the shadow can be positioned relatively to the + source item. + + The values range from -inf to inf. By default, the properties are set to + \c 0. + + \table + \header + \li Output examples with different horizontalOffset values + \li + \li + \row + \li \image InnerShadow_horizontalOffset1.png + \li \image InnerShadow_horizontalOffset2.png + \li \image InnerShadow_horizontalOffset3.png + \row + \li \b { horizontalOffset: -20 } + \li \b { horizontalOffset: 0 } + \li \b { horizontalOffset: 20 } + \row + \li \l radius: 16 + \li \l radius: 16 + \li \l radius: 16 + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l color: #000000 + \li \l color: #000000 + \li \l color: #000000 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \endtable + + */ + property real horizontalOffset: 0 + property real verticalOffset: 0 + + /*! + This property selects the blurring algorithm that is used to produce the + softness for the effect. Setting this to true enables fast algorithm, + setting value to false produces higher quality result. + + By default, the property is set to \c false. + + \table + \header + \li Output examples with different fast values + \li + \li + \row + \li \image InnerShadow_fast1.png + \li \image InnerShadow_fast2.png + \row + \li \b { fast: false } + \li \b { fast: true } + \row + \li \l radius: 16 + \li \l radius: 16 + \row + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l color: #000000 + \li \l color: #000000 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l spread: 0.2 + \li \l spread: 0.2 + \endtable + */ + property bool fast: false + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. Every time the source or effect + properties are changed, the pixels in the cache must be updated. Memory + consumption is increased, because an extra buffer of memory is required + for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + Loader { + anchors.fill: parent + sourceComponent: rootItem.fast ? innerShadow : gaussianInnerShadow + } + + Component { + id: gaussianInnerShadow + GaussianInnerShadow { + anchors.fill: parent + source: rootItem.source + radius: rootItem.radius + maximumRadius: rootItem.samples * 0.5 + color: rootItem.color + cached: rootItem.cached + spread: rootItem.spread + horizontalOffset: rootItem.horizontalOffset + verticalOffset: rootItem.verticalOffset + } + } + + Component { + id: innerShadow + FastInnerShadow { + anchors.fill: parent + source: rootItem.source + blur: Math.pow(rootItem.radius / 64.0, 0.4) + color: rootItem.color + cached: rootItem.cached + spread: rootItem.spread + horizontalOffset: rootItem.horizontalOffset + verticalOffset: rootItem.verticalOffset + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/LevelAdjust.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/LevelAdjust.qml new file mode 100644 index 00000000000..5d739fb941c --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/LevelAdjust.qml @@ -0,0 +1,472 @@ +/***************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Add-On Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype LevelAdjust + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-color + \brief Adjusts color levels in the RGBA color space. + + This effect adjusts the source item colors separately for each color + channel. Source item contrast can be adjusted and color balance altered. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_butterfly.png + \li \image LevelAdjust_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet LevelAdjust-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that provides the source pixels + for the effect. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the change factor for how the value of each pixel + color channel is altered according to the equation: + + \code result.rgb = pow(original.rgb, 1.0 / gamma.rgb); \endcode + + Setting the gamma values under QtVector3d(1.0, 1.0, 1.0) makes the image + darker, the values above QtVector3d(1.0, 1.0, 1.0) lighten it. + + The value ranges from QtVector3d(0.0, 0.0, 0.0) (darkest) to inf + (lightest). By default, the property is set to \c QtVector3d(1.0, 1.0, + 1.0) (no change). + + \table + \header + \li Output examples with different gamma values + \li + \li + \row + \li \image LevelAdjust_gamma1.png + \li \image LevelAdjust_gamma2.png + \li \image LevelAdjust_gamma3.png + \row + \li \b { gamma: Qt.vector3d(1.0, 1.0, 1.0) } + \li \b { gamma: Qt.vector3d(1.0, 0.4, 2.0) } + \li \b { gamma: Qt.vector3d(1.0, 0.1, 4.0) } + \row + \li \l minimumInput: #000000 + \li \l minimumInput: #000000 + \li \l minimumInput: #000000 + \row + \li \l maximumInput: #ffffff + \li \l maximumInput: #ffffff + \li \l maximumInput: #ffffff + \row + \li \l minimumOutput: #000000 + \li \l minimumOutput: #000000 + \li \l minimumOutput: #000000 + \row + \li \l maximumOutput: #ffffff + \li \l maximumOutput: #ffffff + \li \l maximumOutput: #ffffff + \endtable + + \table + \header + \li Pixel color channel luminance curves of the above images. + \li + \li + \row + \li \image LevelAdjust_default_curve.png + \li \image LevelAdjust_gamma2_curve.png + \li \image LevelAdjust_gamma3_curve.png + \row + \li X-axis: pixel original luminance + \li + \li + \row + \li Y-axis: color channel luminance with effect applied + \li + \li + \endtable + */ + property variant gamma: Qt.vector3d(1.0, 1.0, 1.0) + + /*! + This property defines the minimum input level for each color channel. It + sets the black-point, all pixels having lower value than this property + are rendered as black (per color channel). Increasing the value darkens + the dark areas. + + The value ranges from "#00000000" to "#ffffffff". By default, the + property is set to \c "#00000000" (no change). + + \table + \header + \li Output examples with different minimumInput values + \li + \li + \row + \li \image LevelAdjust_minimumInput1.png + \li \image LevelAdjust_minimumInput2.png + \li \image LevelAdjust_minimumInput3.png + \row + \li \b { minimumInput: #00000000 } + \li \b { minimumInput: #00000040 } + \li \b { minimumInput: #00000070 } + \row + \li \l maximumInput: #ffffff + \li \l maximumInput: #ffffff + \li \l maximumInput: #ffffff + \row + \li \l minimumOutput: #000000 + \li \l minimumOutput: #000000 + \li \l minimumOutput: #000000 + \row + \li \l maximumOutput: #ffffff + \li \l maximumOutput: #ffffff + \li \l maximumOutput: #ffffff + \row + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \endtable + + \table + \header + \li Pixel color channel luminance curves of the above images. + \li + \li + \row + \li \image LevelAdjust_default_curve.png + \li \image LevelAdjust_minimumInput2_curve.png + \li \image LevelAdjust_minimumInput3_curve.png + \row + \li X-axis: pixel original luminance + \li + \li + \row + \li Y-axis: color channel luminance with effect applied + \li + \li + \endtable + + */ + property color minimumInput: Qt.rgba(0.0, 0.0, 0.0, 0.0) + + /*! + This property defines the maximum input level for each color channel. + It sets the white-point, all pixels having higher value than this + property are rendered as white (per color channel). + Decreasing the value lightens the light areas. + + The value ranges from "#ffffffff" to "#00000000". By default, the + property is set to \c "#ffffffff" (no change). + + \table + \header + \li Output examples with different maximumInput values + \li + \li + \row + \li \image LevelAdjust_maximumInput1.png + \li \image LevelAdjust_maximumInput2.png + \li \image LevelAdjust_maximumInput3.png + \row + \li \b { maximumInput: #FFFFFFFF } + \li \b { maximumInput: #FFFFFF80 } + \li \b { maximumInput: #FFFFFF30 } + \row + \li \l minimumInput: #000000 + \li \l minimumInput: #000000 + \li \l minimumInput: #000000 + \row + \li \l minimumOutput: #000000 + \li \l minimumOutput: #000000 + \li \l minimumOutput: #000000 + \row + \li \l maximumOutput: #ffffff + \li \l maximumOutput: #ffffff + \li \l maximumOutput: #ffffff + \row + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \endtable + + \table + \header + \li Pixel color channel luminance curves of the above images. + \li + \li + \row + \li \image LevelAdjust_default_curve.png + \li \image LevelAdjust_maximumInput2_curve.png + \li \image LevelAdjust_maximumInput3_curve.png + \row + \li X-axis: pixel original luminance + \li + \li + \row + \li Y-axis: color channel luminance with effect applied + \li + \li + \endtable + + */ + property color maximumInput: Qt.rgba(1.0, 1.0, 1.0, 1.0) + + /*! + This property defines the minimum output level for each color channel. + Increasing the value lightens the dark areas, reducing the contrast. + + The value ranges from "#00000000" to "#ffffffff". By default, the + property is set to \c "#00000000" (no change). + + \table + \header + \li Output examples with different minimumOutput values + \li + \li + \row + \li \image LevelAdjust_minimumOutput1.png + \li \image LevelAdjust_minimumOutput2.png + \li \image LevelAdjust_minimumOutput3.png + \row + \li \b { minimumOutput: #00000000 } + \li \b { minimumOutput: #00000070 } + \li \b { minimumOutput: #000000A0 } + \row + \li \l minimumInput: #000000 + \li \l minimumInput: #000000 + \li \l minimumInput: #000000 + \row + \li \l maximumInput: #ffffff + \li \l maximumInput: #ffffff + \li \l maximumInput: #ffffff + \row + \li \l maximumOutput: #ffffff + \li \l maximumOutput: #ffffff + \li \l maximumOutput: #ffffff + \row + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \endtable + + \table + \header + \li Pixel color channel luminance curves of the above images. + \li + \li + \row + \li \image LevelAdjust_default_curve.png + \li \image LevelAdjust_minimumOutput2_curve.png + \li \image LevelAdjust_minimumOutput3_curve.png + \row + \li X-axis: pixel original luminance + \li + \li + \row + \li Y-axis: color channel luminance with effect applied + \li + \li + \endtable + + */ + property color minimumOutput: Qt.rgba(0.0, 0.0, 0.0, 0.0) + + /*! + This property defines the maximum output level for each color channel. + Decreasing the value darkens the light areas, reducing the contrast. + + The value ranges from "#ffffffff" to "#00000000". By default, the + property is set to \c "#ffffffff" (no change). + + \table + \header + \li Output examples with different maximumOutput values + \li + \li + \row + \li \image LevelAdjust_maximumOutput1.png + \li \image LevelAdjust_maximumOutput2.png + \li \image LevelAdjust_maximumOutput3.png + \row + \li \b { maximumOutput: #FFFFFFFF } + \li \b { maximumOutput: #FFFFFF80 } + \li \b { maximumOutput: #FFFFFF30 } + \row + \li \l minimumInput: #000000 + \li \l minimumInput: #000000 + \li \l minimumInput: #000000 + \row + \li \l maximumInput: #ffffff + \li \l maximumInput: #ffffff + \li \l maximumInput: #ffffff + \row + \li \l minimumOutput: #000000 + \li \l minimumOutput: #000000 + \li \l minimumOutput: #000000 + \row + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \endtable + + \table + \header + \li Pixel color channel luminance curves of the above images. + \li + \li + \row + \li \image LevelAdjust_default_curve.png + \li \image LevelAdjust_maximumOutput2_curve.png + \li \image LevelAdjust_maximumOutput3_curve.png + \row + \li X-axis: pixel original luminance + \li + \li + \row + \li Y-axis: color channel luminance with effect applied + \li + \li + \endtable + */ + property color maximumOutput: Qt.rgba(1.0, 1.0, 1.0, 1.0) + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant minimumInputRGB: Qt.vector3d(rootItem.minimumInput.r, rootItem.minimumInput.g, rootItem.minimumInput.b) + property variant maximumInputRGB: Qt.vector3d(rootItem.maximumInput.r, rootItem.maximumInput.g, rootItem.maximumInput.b) + property real minimumInputAlpha: rootItem.minimumInput.a + property real maximumInputAlpha: rootItem.maximumInput.a + property variant minimumOutputRGB: Qt.vector3d(rootItem.minimumOutput.r, rootItem.minimumOutput.g, rootItem.minimumOutput.b) + property variant maximumOutputRGB: Qt.vector3d(rootItem.maximumOutput.r, rootItem.maximumOutput.g, rootItem.maximumOutput.b) + property real minimumOutputAlpha: rootItem.minimumOutput.a + property real maximumOutputAlpha: rootItem.maximumOutput.a + property variant gamma: Qt.vector3d(1.0 / Math.max(rootItem.gamma.x, 0.0001), 1.0 / Math.max(rootItem.gamma.y, 0.0001), 1.0 / Math.max(rootItem.gamma.z, 0.0001)) + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp vec3 minimumInputRGB; + uniform highp vec3 maximumInputRGB; + uniform highp float minimumInputAlpha; + uniform highp float maximumInputAlpha; + uniform highp vec3 minimumOutputRGB; + uniform highp vec3 maximumOutputRGB; + uniform highp float minimumOutputAlpha; + uniform highp float maximumOutputAlpha; + uniform highp vec3 gamma; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main(void) { + highp vec4 textureColor = texture2D(source, qt_TexCoord0.st); + highp vec4 color = vec4(textureColor.rgb / max(1.0/256.0, textureColor.a), textureColor.a); + + color.r = linearstep(minimumInputRGB.r, maximumInputRGB.r, color.r); + color.g = linearstep(minimumInputRGB.g, maximumInputRGB.g, color.g); + color.b = linearstep(minimumInputRGB.b, maximumInputRGB.b, color.b); + color.a = linearstep(minimumInputAlpha, maximumInputAlpha, color.a); + + color.rgb = pow(color.rgb, gamma); + + color.r = minimumOutputRGB.r + color.r * (maximumOutputRGB.r - minimumOutputRGB.r); + color.g = minimumOutputRGB.g + color.g * (maximumOutputRGB.g - minimumOutputRGB.g); + color.b = minimumOutputRGB.b + color.b * (maximumOutputRGB.b - minimumOutputRGB.b); + color.a = minimumOutputAlpha + color.a * (maximumOutputAlpha - minimumOutputAlpha); + + gl_FragColor = vec4(color.rgb * color.a, color.a) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/LinearGradient.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/LinearGradient.qml new file mode 100644 index 00000000000..b5845ea9d8a --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/LinearGradient.qml @@ -0,0 +1,346 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype LinearGradient + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-gradient + \brief Draws a linear gradient. + + A gradient is defined by two or more colors, which are blended seamlessly. + The colors start from the given start point and end to the given end point. + + \table + \header + \li Effect applied + \row + \li \image LinearGradient.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet LinearGradient-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the starting point where the color at gradient + position of 0.0 is rendered. Colors at larger position values are + rendered linearly towards the end point. The point is given in pixels + and the default value is Qt.point(0, 0). Setting the default values for + the start and \l{LinearGradient::end}{end} results in a full height + linear gradient on the y-axis. + + \table + \header + \li Output examples with different start values + \li + \li + \row + \li \image LinearGradient_start1.png + \li \image LinearGradient_start2.png + \li \image LinearGradient_start3.png + \row + \li \b { start: QPoint(0, 0) } + \li \b { start: QPoint(150, 150) } + \li \b { start: QPoint(300, 0) } + \row + \li \l end: QPoint(300, 300) + \li \l end: QPoint(300, 300) + \li \l end: QPoint(300, 300) + \endtable + + */ + property variant start: Qt.point(0, 0) + + /*! + This property defines the ending point where the color at gradient + position of 1.0 is rendered. Colors at smaller position values are + rendered linearly towards the start point. The point is given in pixels + and the default value is Qt.point(0, height). Setting the default values + for the \l{LinearGradient::start}{start} and end results in a full + height linear gradient on the y-axis. + + \table + \header + \li Output examples with different end values + \li + \li + \row + \li \image LinearGradient_end1.png + \li \image LinearGradient_end2.png + \li \image LinearGradient_end3.png + \row + \li \b { end: Qt.point(300, 300) } + \li \b { end: Qt.point(150, 150) } + \li \b { end: Qt.point(300, 0) } + \row + \li \l start: Qt.point(0, 0) + \li \l start: Qt.point(0, 0) + \li \l start: Qt.point(0, 0) + \endtable + + */ + property variant end: Qt.point(0, height) + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + /*! + This property defines the item that is going to be filled with gradient. + Source item gets rendered into an intermediate pixel buffer and the + alpha values from the result are used to determine the gradient's pixels + visibility in the display. The default value for source is undefined and + in that case whole effect area is filled with gradient. + + \table + \header + \li Output examples with different source values + \li + \li + \row + \li \image LinearGradient_maskSource1.png + \li \image LinearGradient_maskSource2.png + \row + \li \b { source: undefined } + \li \b { source: Image { source: images/butterfly.png } } + \row + \li \l start: Qt.point(0, 0) + \li \l start: Qt.point(0, 0) + \row + \li \l end: Qt.point(300, 300) + \li \l end: Qt.point(300, 300) + \endtable + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + + /*! + A gradient is defined by two or more colors, which are blended + seamlessly. The colors are specified as a set of GradientStop child + items, each of which defines a position on the gradient from 0.0 to 1.0 + and a color. The position of each GradientStop is defined by the + position property, and the color is definded by the color property. + + \table + \header + \li Output examples with different gradient values + \li + \li + \row + \li \image LinearGradient_gradient1.png + \li \image LinearGradient_gradient2.png + \li \image LinearGradient_gradient3.png + \row + \li \b {gradient:} \code + Gradient { + GradientStop { position: 0.000 + color: Qt.rgba(1, 0, 0, 1) } + GradientStop { position: 0.167; + color: Qt.rgba(1, 1, 0, 1) } + GradientStop { position: 0.333; + color: Qt.rgba(0, 1, 0, 1) } + GradientStop { position: 0.500; + color: Qt.rgba(0, 1, 1, 1) } + GradientStop { position: 0.667; + color: Qt.rgba(0, 0, 1, 1) } + GradientStop { position: 0.833; + color: Qt.rgba(1, 0, 1, 1) } + GradientStop { position: 1.000; + color: Qt.rgba(1, 0, 0, 1) } + } + \endcode + \li \b {gradient:} \code + Gradient { + GradientStop { position: 0.0 + color: "#F0F0F0" + } + GradientStop { position: 0.5 + color: "#000000" + } + GradientStop { position: 1.0 + color: "#F0F0F0" + } + } + \endcode + \li \b {gradient:} \code + Gradient { + GradientStop { position: 0.0 + color: "#00000000" + } + GradientStop { position: 1.0 + color: "#FF000000" + } + } + \endcode + \row + \li \l start: Qt.point(0, 0) + \li \l start: Qt.point(0, 0) + \li \l start: Qt.point(0, 0) + \row + \li \l end: Qt.point(300, 300) + \li \l end: Qt.point(300, 300) + \li \l end: Qt.point(300, 300) + \endtable + + */ + property Gradient gradient: Gradient { + GradientStop { position: 0.0; color: "white" } + GradientStop { position: 1.0; color: "black" } + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: gradientSource + sourceItem: Rectangle { + width: 16 + height: 256 + gradient: rootItem.gradient + smooth: true + } + smooth: true + hideSource: true + visible: false + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + + anchors.fill: parent + + property variant source: gradientSource + property variant maskSource: maskSourceProxy.output + property variant startPoint: Qt.point(start.x / width, start.y / height) + property real dx: end.x - start.x + property real dy: end.y - start.y + property real l: 1.0 / Math.sqrt(Math.pow(dx / width, 2.0) + Math.pow(dy / height, 2.0)) + property real angle: Math.atan2(dx, dy) + property variant matrixData: Qt.point(Math.sin(angle), Math.cos(angle)) + + vertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_Matrix; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + uniform highp vec2 startPoint; + uniform highp float l; + uniform highp vec2 matrixData; + + void main() { + highp mat2 rot = mat2(matrixData.y, -matrixData.x, + matrixData.x, matrixData.y); + + qt_TexCoord0 = qt_MultiTexCoord0; + + qt_TexCoord1 = qt_MultiTexCoord0 * l; + qt_TexCoord1 -= startPoint * l; + qt_TexCoord1 *= rot; + + gl_Position = qt_Matrix * qt_Vertex; + } + " + + fragmentShader: maskSource == undefined ? noMaskShader : maskShader + + onFragmentShaderChanged: lChanged() + + property string maskShader: " + uniform lowp sampler2D source; + uniform lowp sampler2D maskSource; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + + void main() { + lowp vec4 gradientColor = texture2D(source, qt_TexCoord1); + lowp float maskAlpha = texture2D(maskSource, qt_TexCoord0).a; + gl_FragColor = gradientColor * maskAlpha * qt_Opacity; + } + " + + property string noMaskShader: " + uniform lowp sampler2D source; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord1; + + void main() { + gl_FragColor = texture2D(source, qt_TexCoord1) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/MaskedBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/MaskedBlur.qml new file mode 100644 index 00000000000..4744d9fb988 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/MaskedBlur.qml @@ -0,0 +1,282 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype MaskedBlur + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-blur + \brief Applies a blur effect with a varying intesity. + + MaskedBlur effect softens the image by blurring it. The intensity of the + blur can be controlled for each pixel using maskSource so that some parts of + the source are blurred more than others. By default the effect produces a + high quality result, thus the rendering speed may not be the highest + possible. The rendering speed is reduced especially if the + \l{MaskedBlur::samples}{samples} is large. For use cases that require faster + rendering speed and the highest possible visual quality is not necessary, + property \l{MaskedBlur::fast}{fast} can be set to true. + + \table + \header + \li Source + \li MaskSource + \li Effect applied + \row + \li \image Original_bug.png + \li \image MaskedBlur_mask.png + \li \image MaskedBlur_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet MaskedBlur-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be blurred. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the item that is controlling the final intensity + of the blur. The pixel alpha channel value from maskSource defines the + actual blur radius that is going to be used for blurring the + corresponding source pixel. + + Opaque maskSource pixels produce blur with specified + \l{MaskedBlur::radius}{radius}, while transparent pixels suppress the + blur completely. Semitransparent maskSource pixels produce blur with a + radius that is interpolated according to the pixel transparency level. + */ + property variant maskSource + + /*! + This property defines the distance of the neighboring pixels which + affect the blurring of an individual pixel. A larger radius increases + the blur effect. + + Depending on the radius value, value of the + \l{MaskedBlur::samples}{samples} should be set to sufficiently large to + ensure the visual quality. + + The value ranges from 0.0 (no blur) to inf. By default, the property is + set to \c 0.0 (no blur). + + \table + \header + \li Output examples with different radius values + \li + \li + \row + \li \image MaskedBlur_radius1.png + \li \image MaskedBlur_radius2.png + \li \image MaskedBlur_radius3.png + \row + \li \b { radius: 0 } + \li \b { radius: 8 } + \li \b { radius: 16 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l transparentBorder: false + \li \l transparentBorder: false + \li \l transparentBorder: false + \row + \li \l fast: false + \li \l fast: false + \li \l fast: false + \endtable + + */ + property real radius: 0.0 + + /*! + This property defines how many samples are taken per pixel when blur + calculation is done. Larger value produces better quality, but is slower + to render. + + Ideally, this value should be twice as large as the highest required + radius value, for example, if the radius is animated between 0.0 and + 4.0, samples should be set to 8. + + The value ranges from 0 to 32. By default, the property is set to \c 0. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + When \l{MaskedBlur::fast}{fast} property is set to true, this property + has no effect. + */ + property int samples: 0 + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. Every time the source or effect + properties are changed, the pixels in the cache must be updated. Memory + consumption is increased, because an extra buffer of memory is required + for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + /*! + This property selects the blurring algorithm that is used to produce the + blur. Setting this to true enables fast algorithm, setting value to + false produces higher quality result. + + By default, the property is set to \c false. + + \table + \header + \li Output examples with different fast values + \li + \li + \row + \li \image MaskedBlur_fast1.png + \li \image MaskedBlur_fast2.png + \row + \li \b { fast: false } + \li \b { fast: true } + \row + \li \l radius: 16 + \li \l radius: 16 + \row + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l transparentBorder: false + \li \l transparentBorder: false + \endtable + + */ + property bool fast: false + + /*! + This property defines the blur behavior near the edges of the item, + where the pixel blurring is affected by the pixels outside the source + edges. + + If the property is set to \c true, the pixels outside the source are + interpreted to be transparent, which is similar to OpenGL + clamp-to-border extension. The blur is expanded slightly outside the + effect item area. + + If the property is set to \c false, the pixels outside the source are + interpreted to contain the same color as the pixels at the edge of the + item, which is similar to OpenGL clamp-to-edge behavior. The blur does + not expand outside the effect item area. + + By default, the property is set to \c false. + + \table + \header + \li Output examples with different transparentBorder values + \li + \li + \row + \li \image MaskedBlur_transparentBorder1.png + \li \image MaskedBlur_transparentBorder2.png + \row + \li \b { transparentBorder: false } + \li \b { transparentBorder: true } + \row + \li \l radius: 64 + \li \l radius: 64 + \row + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l fast: true + \li \l fast: true + \endtable + + */ + property bool transparentBorder: false + + Loader { + id: loaderItem + anchors.fill: parent + sourceComponent: rootItem.fast ? fastBlur : gaussianBlur + } + + Component { + id: gaussianBlur + GaussianMaskedBlur { + anchors.fill: parent + source: rootItem.source + maskSource: rootItem.maskSource + radius: rootItem.radius + maximumRadius: rootItem.samples * 0.5 + transparentBorder: rootItem.transparentBorder + cached: rootItem.cached + } + } + + Component { + id: fastBlur + FastMaskedBlur { + anchors.fill: parent + source:rootItem. source + maskSource: rootItem.maskSource + blur: Math.pow(rootItem.radius / 64.0, 0.4) + transparentBorder: rootItem.transparentBorder + cached: rootItem.cached + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/OpacityMask.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/OpacityMask.qml new file mode 100644 index 00000000000..3a6e25ab0dd --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/OpacityMask.qml @@ -0,0 +1,154 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype OpacityMask + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-mask + \brief Masks the source item with another item. + + \table + \header + \li Source + \li MaskSource + \li Effect applied + \row + \li \image Original_bug.png + \li \image OpacityMask_mask.png + \li \image OpacityMask_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet OpacityMask-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be masked. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the item that is going to be used as the mask. The + mask item gets rendered into an intermediate pixel buffer and the alpha + values from the result are used to determine the source item's pixels + visibility in the display. + + \table + \header + \li Original + \li Mask + \li Effect applied + \row + \li \image Original_bug.png + \li \image OpacityMask_mask.png + \li \image OpacityMask_bug.png + \endtable + */ + property variant maskSource + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + \note It is not supported to let the effect include itself, for + instance by setting maskSource to the effect's parent. + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.maskSource + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant maskSource: maskSourceProxy.output + + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform lowp sampler2D maskSource; + void main(void) { + gl_FragColor = texture2D(source, qt_TexCoord0.st) * (texture2D(maskSource, qt_TexCoord0.st).a) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RadialBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RadialBlur.qml new file mode 100644 index 00000000000..26315aab5ca --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RadialBlur.qml @@ -0,0 +1,312 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype RadialBlur + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-motion-blur + \brief Applies directional blur in a circular direction around the items + center point. + + Effect creates perceived impression that the source item appears to be + rotating to the direction of the blur. + + Other available motionblur effects are + \l{QtGraphicalEffects1::ZoomBlur}{ZoomBlur} and + \l{QtGraphicalEffects1::DirectionalBlur}{DirectionalBlur}. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image RadialBlur_bug.png + \endtable + + \section1 Example Usage + + The following example shows how to apply the effect. + \snippet RadialBlur-example.qml example +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be blurred. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the direction for the blur and at the same time + the level of blurring. The larger the angle, the more the result becomes + blurred. The quality of the blur depends on + \l{RadialBlur::samples}{samples} property. If angle value is large, more + samples are needed to keep the visual quality at high level. + + Allowed values are between 0.0 and 360.0. By default the property is set + to \c 0.0. + + \table + \header + \li Output examples with different angle values + \li + \li + \row + \li \image RadialBlur_angle1.png + \li \image RadialBlur_angle2.png + \li \image RadialBlur_angle3.png + \row + \li \b { angle: 0.0 } + \li \b { angle: 15.0 } + \li \b { angle: 30.0 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \endtable + */ + property real angle: 0.0 + + /*! + This property defines how many samples are taken per pixel when blur + calculation is done. Larger value produces better quality, but is slower + to render. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + Allowed values are between 0 and inf (practical maximum depends on GPU). + By default the property is set to \c 0 (no samples). + + */ + property int samples: 0 + + /*! + \qmlproperty real QtGraphicalEffects1::RadialBlur::horizontalOffset + \qmlproperty real QtGraphicalEffects1::RadialBlur::verticalOffset + + These properties define the offset in pixels for the perceived center + point of the rotation. + + Allowed values are between -inf and inf. + By default these properties are set to \c 0. + + \table + \header + \li Output examples with different horizontalOffset values + \li + \li + \row + \li \image RadialBlur_horizontalOffset1.png + \li \image RadialBlur_horizontalOffset2.png + \li \image RadialBlur_horizontalOffset3.png + \row + \li \b { horizontalOffset: 75.0 } + \li \b { horizontalOffset: 0.0 } + \li \b { horizontalOffset: -75.0 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l angle: 20 + \li \l angle: 20 + \li \l angle: 20 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \endtable + */ + property real horizontalOffset: 0.0 + property real verticalOffset: 0.0 + + /*! + This property defines the blur behavior near the edges of the item, + where the pixel blurring is affected by the pixels outside the source + edges. + + If the property is set to \c true, the pixels outside the source are + interpreted to be transparent, which is similar to OpenGL + clamp-to-border extension. The blur is expanded slightly outside the + effect item area. + + If the property is set to \c false, the pixels outside the source are + interpreted to contain the same color as the pixels at the edge of the + item, which is similar to OpenGL clamp-to-edge behavior. The blur does + not expand outside the effect item area. + + By default, the property is set to \c false. + */ + property bool transparentBorder: false + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + sourceRect: shaderItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant center: Qt.point(0.5 + rootItem.horizontalOffset / parent.width, 0.5 + rootItem.verticalOffset / parent.height) + property bool transparentBorder: rootItem.transparentBorder && rootItem.samples > 1 + property int samples: rootItem.samples + property real weight: 1.0 / Math.max(1.0, rootItem.samples) + property real angleSin: Math.sin(rootItem.angle/2 * Math.PI/180) + property real angleCos: Math.cos(rootItem.angle/2 * Math.PI/180) + property real angleSinStep: Math.sin(-rootItem.angle * Math.PI/180 / Math.max(1.0, rootItem.samples - 1)) + property real angleCosStep: Math.cos(-rootItem.angle * Math.PI/180 / Math.max(1.0, rootItem.samples - 1)) + property variant expandPixels: transparentBorder ? Qt.size(0.5 * parent.height, 0.5 * parent.width) : Qt.size(0,0) + property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0) + property variant delta: Qt.size(1.0 / rootItem.width, 1.0 / rootItem.height) + property real w: parent.width + property real h: parent.height + + x: transparentBorder ? -expandPixels.width - 1 : 0 + y: transparentBorder ? -expandPixels.height - 1 : 0 + width: transparentBorder ? parent.width + expandPixels.width * 2.0 + 2 : parent.width + height: transparentBorder ? parent.height + expandPixels.height * 2.0 + 2 : parent.height + + property string fragmentShaderSkeleton: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp float angleSin; + uniform highp float angleCos; + uniform highp float angleSinStep; + uniform highp float angleCosStep; + uniform highp float weight; + uniform highp vec2 expand; + uniform highp vec2 center; + uniform highp vec2 delta; + uniform highp float w; + uniform highp float h; + + void main(void) { + highp mat2 m; + gl_FragColor = vec4(0.0); + mediump vec2 texCoord = qt_TexCoord0; + + PLACEHOLDER_EXPAND_STEPS + + highp vec2 dir = vec2(texCoord.s * w - w * center.x, texCoord.t * h - h * center.y); + m[0] = vec2(angleCos, -angleSin); + m[1] = vec2(angleSin, angleCos); + dir *= m; + + m[0] = vec2(angleCosStep, -angleSinStep); + m[1] = vec2(angleSinStep, angleCosStep); + + PLACEHOLDER_UNROLLED_LOOP + + gl_FragColor *= weight * qt_Opacity; + } + " + + function buildFragmentShader() { + var shader = fragmentShaderSkeleton + var expandSteps = "" + + if (transparentBorder) { + expandSteps += "texCoord = (texCoord - expand) / (1.0 - 2.0 * expand);" + } + + var unrolledLoop = "gl_FragColor += texture2D(source, texCoord);\n" + + if (rootItem.samples > 1) { + unrolledLoop = "" + for (var i = 0; i < rootItem.samples; i++) + unrolledLoop += "gl_FragColor += texture2D(source, center + dir * delta); dir *= m;\n" + } + + shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps) + fragmentShader = shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop) + } + + onFragmentShaderChanged: sourceChanged() + onSamplesChanged: buildFragmentShader() + onTransparentBorderChanged: buildFragmentShader() + Component.onCompleted: buildFragmentShader() + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RadialGradient.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RadialGradient.qml new file mode 100644 index 00000000000..66c2cd6e1e7 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RadialGradient.qml @@ -0,0 +1,439 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype RadialGradient + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-gradient + \brief Draws a radial gradient. + + A gradient is defined by two or more colors, which are blended seamlessly. + The colors start from the middle of the item and end at the borders. + + \table + \header + \li Effect applied + \row + \li \image RadialGradient.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet RadialGradient-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + /*! + The HorizontalOffset and verticalOffset properties define the offset in + pixels for the center point of the gradient compared to the item center. + + The values range from -inf to inf. By default, these properties are set + to \c 0. + + \table + \header + \li Output examples with different horizontalOffset values + \li + \li + \row + \li \image RadialGradient_horizontalOffset1.png + \li \image RadialGradient_horizontalOffset2.png + \li \image RadialGradient_horizontalOffset3.png + \row + \li \b { horizontalOffset: -150 } + \li \b { horizontalOffset: 0 } + \li \b { horizontalOffset: 150 } + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l horizontalRadius: 300 + \li \l horizontalRadius: 300 + \li \l horizontalRadius: 300 + \row + \li \l verticalRadius: 300 + \li \l verticalRadius: 300 + \li \l verticalRadius: 300 + \row + \li \l angle: 0 + \li \l angle: 0 + \li \l angle: 0 + \endtable + + */ + property real horizontalOffset: 0.0 + property real verticalOffset: 0.0 + + /*! + The HorizontalRadius and verticalRadius properties define the shape and + size of the radial gradient. If the radiuses are equal, the shape of the + gradient is a circle. If the horizontal and vertical radiuses differ, + the shape is elliptical. The radiuses are given in pixels. + + The value ranges from -inf to inf. By default, horizontalRadius is bound + to width and verticalRadius is bound to height. + + \table + \header + \li Output examples with different horizontalRadius values + \li + \li + \row + \li \image RadialGradient_horizontalRadius1.png + \li \image RadialGradient_horizontalRadius2.png + \row + \li \b { horizontalRadius: 300 } + \li \b { horizontalRadius: 100 } + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l verticalRadius: 300 + \li \l verticalRadius: 300 + \row + \li \l angle: 0 + \li \l angle: 0 + \row + \li \l gradient: QQuickGradient(0xa05fb10) + \li \l gradient: QQuickGradient(0xa05fb10) + \endtable + + */ + property real horizontalRadius: width + property real verticalRadius: height + + /*! + This property defines the rotation of the gradient around its center + point. The rotation is only visible when the + \l{RadialGradient::horizontalRadius}{horizontalRadius} and + \l{RadialGradient::verticalRadius}{verticalRadius} properties are not + equal. The angle is given in degrees and the default value is \c 0. + + \table + \header + \li Output examples with different angle values + \li + \li + \row + \li \image RadialGradient_angle1.png + \li \image RadialGradient_angle2.png + \li \image RadialGradient_angle3.png + \row + \li \b { angle: 0 } + \li \b { angle: 45 } + \li \b { angle: 90 } + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l horizontalRadius: 100 + \li \l horizontalRadius: 100 + \li \l horizontalRadius: 100 + \row + \li \l verticalRadius: 300 + \li \l verticalRadius: 300 + \li \l verticalRadius: 300 + \endtable + */ + property real angle: 0.0 + + /*! + This property defines the item that is going to be filled with gradient. + Source item gets rendered into an intermediate pixel buffer and the + alpha values from the result are used to determine the gradient's pixels + visibility in the display. The default value for source is undefined and + in that case whole effect area is filled with gradient. + + \table + \header + \li Output examples with different source values + \li + \li + \row + \li \image RadialGradient_maskSource1.png + \li \image RadialGradient_maskSource2.png + \row + \li \b { source: undefined } + \li \b { source: Image { source: images/butterfly.png } } + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l horizontalRadius: 300 + \li \l horizontalRadius: 300 + \row + \li \l verticalRadius: 300 + \li \l verticalRadius: 300 + \row + \li \l angle: 0 + \li \l angle: 0 + \endtable + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + A gradient is defined by two or more colors, which are blended + seamlessly. The colors are specified as a set of GradientStop child + items, each of which defines a position on the gradient from 0.0 to 1.0 + and a color. The position of each GradientStop is defined by setting the + position property. The color is defined by setting the color property. + + \table + \header + \li Output examples with different gradient values + \li + \li + \row + \li \image RadialGradient_gradient1.png + \li \image RadialGradient_gradient2.png + \li \image RadialGradient_gradient3.png + \row + \li \b {gradient:} \code + Gradient { + GradientStop { position: 0.000 + color: Qt.rgba(1, 0, 0, 1) } + GradientStop { position: 0.167; + color: Qt.rgba(1, 1, 0, 1) } + GradientStop { position: 0.333; + color: Qt.rgba(0, 1, 0, 1) } + GradientStop { position: 0.500; + color: Qt.rgba(0, 1, 1, 1) } + GradientStop { position: 0.667; + color: Qt.rgba(0, 0, 1, 1) } + GradientStop { position: 0.833; + color: Qt.rgba(1, 0, 1, 1) } + GradientStop { position: 1.000; + color: Qt.rgba(1, 0, 0, 1) } + } + \endcode + \li \b {gradient:} \code + Gradient { + GradientStop { position: 0.0 + color: "#F0F0F0" + } + GradientStop { position: 0.5 + color: "#000000" + } + GradientStop { position: 1.0 + color: "#F0F0F0" + } + } + \endcode + \li \b {gradient:} + \code + Gradient { + GradientStop { position: 0.0 + color: "#00000000" + } + GradientStop { position: 1.0 + color: "#FF000000" + } + } + \endcode + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l horizontalRadius: 300 + \li \l horizontalRadius: 300 + \li \l horizontalRadius: 300 + \row + \li \l verticalRadius: 300 + \li \l verticalRadius: 300 + \li \l verticalRadius: 300 + \row + \li \l angle: 0 + \li \l angle: 0 + \li \l angle: 0 + \endtable + */ + property Gradient gradient: Gradient { + GradientStop { position: 0.0; color: "white" } + GradientStop { position: 1.0; color: "black" } + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: gradientSource + sourceItem: Rectangle { + width: 16 + height: 256 + gradient: rootItem.gradient + smooth: true + } + smooth: true + hideSource: true + visible: false + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant gradientImage: gradientSource + property variant maskSource: maskSourceProxy.output + property variant center: Qt.point(0.5 + rootItem.horizontalOffset / width, 0.5 + rootItem.verticalOffset / height) + property real horizontalRatio: rootItem.horizontalRadius > 0 ? width / (2 * rootItem.horizontalRadius) : width * 16384 + property real verticalRatio: rootItem.verticalRadius > 0 ? height / (2 * rootItem.verticalRadius) : height * 16384 + property real angle: -rootItem.angle / 360 * 2 * Math.PI + property variant matrixData: Qt.point(Math.sin(angle), Math.cos(angle)) + + anchors.fill: parent + + vertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_Matrix; + uniform highp vec2 matrixData; + uniform highp float horizontalRatio; + uniform highp float verticalRatio; + uniform highp vec2 center; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 centerPoint; + + void main() { + highp vec2 ratio = vec2(horizontalRatio, verticalRatio); + + // Rotation matrix + highp mat2 rot = mat2(matrixData.y, -matrixData.x, + matrixData.x, matrixData.y); + + qt_TexCoord0 = qt_MultiTexCoord0; + + qt_TexCoord1 = qt_MultiTexCoord0; + qt_TexCoord1 -= center; + qt_TexCoord1 *= rot; + qt_TexCoord1 += center; + qt_TexCoord1 *= ratio; + + centerPoint = center * ratio; + + gl_Position = qt_Matrix * qt_Vertex; + } + " + + fragmentShader: maskSource == undefined ? noMaskShader : maskShader + + onFragmentShaderChanged: horizontalRatioChanged() + + property string maskShader: " + uniform lowp sampler2D gradientImage; + uniform lowp sampler2D maskSource; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 centerPoint; + + void main() { + lowp vec4 gradientColor = texture2D(gradientImage, vec2(0.0, 2.0 * distance(qt_TexCoord1, centerPoint))); + lowp float maskAlpha = texture2D(maskSource, qt_TexCoord0).a; + gl_FragColor = gradientColor * maskAlpha * qt_Opacity; + } + " + + property string noMaskShader: " + uniform lowp sampler2D gradientImage; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord1; + varying highp vec2 centerPoint; + + void main() { + lowp vec4 gradientColor = texture2D(gradientImage, vec2(0.0, 2.0 * distance(qt_TexCoord1, centerPoint))); + gl_FragColor = gradientColor * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RectangularGlow.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RectangularGlow.qml new file mode 100644 index 00000000000..df0d52ff72f --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RectangularGlow.qml @@ -0,0 +1,288 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype RectangularGlow + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-glow + \brief Generates a blurred and colorized rectangle, which gives + the impression that the source is glowing. + + This effect is intended to have good performance. The shape of the glow is + limited to a rectangle with a custom corner radius. For situations where + custom shapes are required, consider \l {QtGraphicalEffects1::Glow} {Glow} + effect. + + \table + \header + \li Effect applied + \row + \li \image RectangularGlow_applied.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet RectangularGlow-example.qml example +*/ +Item { + id: rootItem + + /*! + This property defines how many pixels outside the item area are reached + by the glow. + + The value ranges from 0.0 (no glow) to inf (infinite glow). By default, + the property is set to \c 0.0. + + \table + \header + \li Output examples with different glowRadius values + \li + \li + \row + \li \image RectangularGlow_glowRadius1.png + \li \image RectangularGlow_glowRadius2.png + \li \image RectangularGlow_glowRadius3.png + \row + \li \b { glowRadius: 10 } + \li \b { glowRadius: 20 } + \li \b { glowRadius: 40 } + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \row + \li \l color: #ffffff + \li \l color: #ffffff + \li \l color: #ffffff + \row + \li \l cornerRadius: 25 + \li \l cornerRadius: 25 + \li \l cornerRadius: 25 + \endtable + + */ + property real glowRadius: 0.0 + + /*! + This property defines how large part of the glow color is strenghtened + near the source edges. + + The value ranges from 0.0 (no strenght increase) to 1.0 (maximum + strenght increase). By default, the property is set to \c 0.0. + + \table + \header + \li Output examples with different spread values + \li + \li + \row + \li \image RectangularGlow_spread1.png + \li \image RectangularGlow_spread2.png + \li \image RectangularGlow_spread3.png + \row + \li \b { spread: 0.0 } + \li \b { spread: 0.5 } + \li \b { spread: 1.0 } + \row + \li \l glowRadius: 20 + \li \l glowRadius: 20 + \li \l glowRadius: 20 + \row + \li \l color: #ffffff + \li \l color: #ffffff + \li \l color: #ffffff + \row + \li \l cornerRadius: 25 + \li \l cornerRadius: 25 + \li \l cornerRadius: 25 + \endtable + */ + property real spread: 0.0 + + /*! + This property defines the RGBA color value which is used for the glow. + + By default, the property is set to \c "white". + + \table + \header + \li Output examples with different color values + \li + \li + \row + \li \image RectangularGlow_color1.png + \li \image RectangularGlow_color2.png + \li \image RectangularGlow_color3.png + \row + \li \b { color: #ffffff } + \li \b { color: #55ff55 } + \li \b { color: #5555ff } + \row + \li \l glowRadius: 20 + \li \l glowRadius: 20 + \li \l glowRadius: 20 + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \row + \li \l cornerRadius: 25 + \li \l cornerRadius: 25 + \li \l cornerRadius: 25 + \endtable + */ + property color color: "white" + + /*! + This property defines the corner radius that is used to draw a glow with + rounded corners. + + The value ranges from 0.0 to half of the effective width or height of + the glow, whichever is smaller. This can be calculated with: \c{ + min(width, height) / 2.0 + glowRadius} + + By default, the property is bound to glowRadius property. The glow + behaves as if the rectangle was blurred when adjusting the glowRadius + property. + + \table + \header + \li Output examples with different cornerRadius values + \li + \li + \row + \li \image RectangularGlow_cornerRadius1.png + \li \image RectangularGlow_cornerRadius2.png + \li \image RectangularGlow_cornerRadius3.png + \row + \li \b { cornerRadius: 0 } + \li \b { cornerRadius: 25 } + \li \b { cornerRadius: 50 } + \row + \li \l glowRadius: 20 + \li \l glowRadius: 20 + \li \l glowRadius: 20 + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \row + \li \l color: #ffffff + \li \l color: #ffffff + \li \l color: #ffffff + \endtable + */ + property real cornerRadius: glowRadius + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + + x: (parent.width - width) / 2.0 + y: (parent.height - height) / 2.0 + width: parent.width + rootItem.glowRadius * 2 + cornerRadius * 2 + height: parent.height + rootItem.glowRadius * 2 + cornerRadius * 2 + + function clampedCornerRadius() { + var maxCornerRadius = Math.min(rootItem.width, rootItem.height) / 2 + glowRadius; + return Math.max(0, Math.min(rootItem.cornerRadius, maxCornerRadius)) + } + + property color color: rootItem.color + property real inverseSpread: 1.0 - rootItem.spread + property real relativeSizeX: ((inverseSpread * inverseSpread) * rootItem.glowRadius + cornerRadius * 2.0) / width + property real relativeSizeY: relativeSizeX * (width / height) + property real spread: rootItem.spread / 2.0 + property real cornerRadius: clampedCornerRadius() + + fragmentShader: " + uniform highp float qt_Opacity; + uniform mediump float relativeSizeX; + uniform mediump float relativeSizeY; + uniform mediump float spread; + uniform lowp vec4 color; + varying highp vec2 qt_TexCoord0; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main() { + lowp float alpha = + smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) * + smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y)); + + highp float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha); + gl_FragColor = color * qt_Opacity * spreadMultiplier * spreadMultiplier; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RecursiveBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RecursiveBlur.qml new file mode 100644 index 00000000000..fa59281291d --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/RecursiveBlur.qml @@ -0,0 +1,350 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype RecursiveBlur + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-blur + \brief Blurs repeatedly, providing a strong blur effect. + + The RecursiveBlur effect softens the image by blurring it with an algorithm + that uses a recursive feedback loop to blur the source multiple times. The + effect may give more blurry results than + \l{QtGraphicalEffects1::GaussianBlur}{GaussianBlur} or + \l{QtGraphicalEffects1::FastBlur}{FastBlur}, but the result is produced + asynchronously and takes more time. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image RecursiveBlur_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet RecursiveBlur-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be blurred. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the distance of neighboring pixels which influence + the blurring of individual pixels. A larger radius provides better + quality, but is slower to render. + + \b Note: The radius value in this effect is not intended to be changed + or animated frequently. The correct way to use it is to set the correct + value and keep it unchanged for the whole duration of the iterative blur + sequence. + + The value ranges from (no blur) to 16.0 (maximum blur step). By default, + the property is set to \c 0.0 (no blur). + + \table + \header + \li Output examples with different radius values + \li + \li + \row + \li \image RecursiveBlur_radius1.png + \li \image RecursiveBlur_radius2.png + \li \image RecursiveBlur_radius3.png + \row + \li \b { radius: 2.5 } + \li \b { radius: 4.5 } + \li \b { radius: 7.5 } + \row + \li \l loops: 20 + \li \l loops: 20 + \li \l loops: 20 + \endtable + + */ + property real radius: 0.0 + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + /*! + This property defines the blur behavior near the edges of the item, + where the pixel blurring is affected by the pixels outside the source + edges. + + If the property is set to \c true, the pixels outside the source are + interpreted to be transparent, which is similar to OpenGL + clamp-to-border extension. The blur is expanded slightly outside the + effect item area. + + If the property is set to \c false, the pixels outside the source are + interpreted to contain the same color as the pixels at the edge of the + item, which is similar to OpenGL clamp-to-edge behavior. The blur does + not expand outside the effect item area. + + By default, the property is set to \c false. + + \table + \header + \li Output examples with different transparentBorder values + \li + \li + \row + \li \image RecursiveBlur_transparentBorder1.png + \li \image RecursiveBlur_transparentBorder2.png + \row + \li \b { transparentBorder: false } + \li \b { transparentBorder: true } + \row + \li \l loops: 20 + \li \l loops: 20 + \row + \li \l radius: 7.5 + \li \l radius: 7.5 + \endtable + */ + property bool transparentBorder: false + + /*! + This property defines the amount of blur iterations that are going to be + performed for the source. When the property changes, the iterative + blurring process starts. If the value is decreased or if the value + changes from zero to non-zero, a snapshot is taken from the source. The + snapshot is used as a starting point for the process. + + The iteration loop tries to run as fast as possible. The speed might be + limited by the VSYNC or the time needed for one blur step, or both. + Sometimes it may be desirable to perform the blurring with a slower + pace. In that case, it may be convenient to control the property with + Animation which increases the value. + + The value ranges from 0 to inf. By default, the property is set to \c 0. + + \table + \header + \li Output examples with different loops values + \li + \li + \row + \li \image RecursiveBlur_loops1.png + \li \image RecursiveBlur_loops2.png + \li \image RecursiveBlur_loops3.png + \row + \li \b { loops: 4 } + \li \b { loops: 20 } + \li \b { loops: 70 } + \row + \li \l radius: 7.5 + \li \l radius: 7.5 + \li \l radius: 7.5 + \endtable + + */ + property int loops: 0 + + /*! + This property holds the progress of asynchronous source blurring + process, from 0.0 (nothing blurred) to 1.0 (finished). + */ + property real progress: loops > 0.0 ? Math.min(1.0, recursionTimer.counter / loops) : 0.0 + + onLoopsChanged: recursiveSource.scheduleUpdate() + onSourceChanged: recursionTimer.reset() + onRadiusChanged: recursionTimer.reset() + onTransparentBorderChanged: recursionTimer.reset() + + SourceProxy { + id: sourceProxy + input: rootItem.source + sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2, parent.height + 2) : Qt.rect(0, 0, 0, 0) + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: verticalBlur + smooth: true + visible: rootItem.cached + hideSource: visible + live: true + sourceItem: inputItem.visible ? inputItem : verticalBlur + } + + Item { + id: recursionTimer + property int counter: 0 + + function reset() { + counter = 0 + recursiveSource.scheduleUpdate() + } + + function nextFrame() { + if (loops < counter) + recursionTimer.counter = 0 + + if (counter > 0) + recursiveSource.sourceItem = verticalBlur + else + recursiveSource.sourceItem = inputItem + + if (counter < loops) { + recursiveSource.scheduleUpdate() + counter++ + } + } + } + + ShaderEffect { + id: inputItem + property variant source: sourceProxy.output + property real expandX: rootItem.transparentBorder ? (horizontalBlur.maximumRadius) / horizontalBlur.width : 0.0 + property real expandY: rootItem.transparentBorder ? (horizontalBlur.maximumRadius) / horizontalBlur.height : 0.0 + + anchors.fill: verticalBlur + visible: !verticalBlur.visible + + vertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_Matrix; + uniform highp float expandX; + uniform highp float expandY; + varying highp vec2 qt_TexCoord0; + + void main() { + mediump vec2 texCoord = qt_MultiTexCoord0; + texCoord.s = (texCoord.s - expandX) / (1.0 - 2.0 * expandX); + texCoord.t = (texCoord.t - expandY) / (1.0 - 2.0 * expandY); + qt_TexCoord0 = texCoord; + gl_Position = qt_Matrix * qt_Vertex; + } + " + + fragmentShader: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + void main() { + gl_FragColor = texture2D(source, qt_TexCoord0) * qt_Opacity; + } + " + } + + ShaderEffectSource { + id: recursiveSource + visible: false + smooth: true + hideSource: false + live: false + sourceItem: inputItem + recursive: true + onSourceItemChanged: scheduleUpdate() + onScheduledUpdateCompleted: recursionTimer.nextFrame() + } + + GaussianDirectionalBlur { + id: verticalBlur + x: rootItem.transparentBorder ? -horizontalBlur.maximumRadius - 1 : 0 + y: rootItem.transparentBorder ? -horizontalBlur.maximumRadius - 1 : 0 + width: horizontalBlur.width + 2 + height: horizontalBlur.height + 2 + + horizontalStep: 0.0 + verticalStep: 1.0 / parent.height + + source: ShaderEffectSource { + sourceItem: horizontalBlur + hideSource: true + visible: false + smooth: true + } + + deviation: (radius + 1) / 2.3333 + radius: rootItem.radius + maximumRadius: Math.ceil(rootItem.radius) + transparentBorder: false + visible: loops > 0 + } + + GaussianDirectionalBlur { + id: horizontalBlur + width: rootItem.transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width + height: rootItem.transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height + + horizontalStep: 1.0 / parent.width + verticalStep: 0.0 + + source: recursiveSource + deviation: (radius + 1) / 2.3333 + radius: rootItem.radius + maximumRadius: Math.ceil(rootItem.radius) + transparentBorder: false + visible: false + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ThresholdMask.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ThresholdMask.qml new file mode 100644 index 00000000000..e789a492934 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ThresholdMask.qml @@ -0,0 +1,226 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype ThresholdMask + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-mask + \brief Masks the source item with another item and applies a threshold + value. + + The masking behavior can be controlled with the \l threshold value for the + mask pixels. + + \table + \header + \li Source + \li MaskSource + \li Effect applied + \row + \li \image Original_bug.png + \li \image ThresholdMask_mask.png + \li \image ThresholdMask_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet ThresholdMask-example.qml example +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be masked. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the item that is going to be used as the mask. + Mask item gets rendered into an intermediate pixel buffer and the alpha + values from the result are used to determine the source item's pixels + visibility in the display. + + \table + \header + \li Original + \li Mask + \li Effect applied + \row + \li \image Original_bug.png + \li \image ThresholdMask_mask.png + \li \image ThresholdMask_bug.png + \endtable + + \note It is not supported to let the effect include itself, for + instance by setting maskSource to the effect's parent. + */ + property variant maskSource + + /*! + This property defines a threshold value for the mask pixels. The mask + pixels that have an alpha value below this property are used to + completely mask away the corresponding pixels from the source item. The + mask pixels that have a higher alpha value are used to alphablend the + source item to the display. + + The value ranges from 0.0 (alpha value 0) to 1.0 (alpha value 255). By + default, the property is set to \c 0.0. + + \table + \header + \li Output examples with different threshold values + \li + \li + \row + \li \image ThresholdMask_threshold1.png + \li \image ThresholdMask_threshold2.png + \li \image ThresholdMask_threshold3.png + \row + \li \b { threshold: 0.0 } + \li \b { threshold: 0.5 } + \li \b { threshold: 0.7 } + \row + \li \l spread: 0.2 + \li \l spread: 0.2 + \li \l spread: 0.2 + \endtable + */ + property real threshold: 0.0 + + /*! + This property defines the smoothness of the mask edges near the + \l{ThresholdMask::threshold}{threshold} alpha value. Setting spread to + 0.0 uses mask normally with the specified threshold. Setting higher + spread values softens the transition from the transparent mask pixels + towards opaque mask pixels by adding interpolated values between them. + + The value ranges from 0.0 (sharp mask edge) to 1.0 (smooth mask edge). + By default, the property is set to \c 0.0. + + \table + \header + \li Output examples with different spread values + \li + \li + \row + \li \image ThresholdMask_spread1.png + \li \image ThresholdMask_spread2.png + \li \image ThresholdMask_spread3.png + \row + \li \b { spread: 0.0 } + \li \b { spread: 0.2 } + \li \b { spread: 0.8 } + \row + \li \l threshold: 0.4 + \li \l threshold: 0.4 + \li \l threshold: 0.4 + \endtable + + */ + property real spread: 0.0 + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.maskSource + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant maskSource: maskSourceProxy.output + property real threshold: rootItem.threshold + property real spread: rootItem.spread + + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform lowp sampler2D maskSource; + uniform highp float threshold; + uniform highp float spread; + void main(void) { + lowp vec4 colorFragment = texture2D(source, qt_TexCoord0.st); + lowp vec4 maskFragment = texture2D(maskSource, qt_TexCoord0.st); + gl_FragColor = colorFragment * smoothstep(threshold * (1.0 + spread) - spread, threshold * (1.0 + spread), maskFragment.a) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ZoomBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ZoomBlur.qml new file mode 100644 index 00000000000..74a59401238 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/ZoomBlur.qml @@ -0,0 +1,302 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype ZoomBlur + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-motion-blur + \brief Applies directional blur effect towards source items center point. + + Effect creates perceived impression that the source item appears to be + moving towards the center point in Z-direction or that the camera appears + to be zooming rapidly. Other available motion blur effects are + \l{QtGraphicalEffects1::DirectionalBlur}{DirectionalBlur} + and \l{QtGraphicalEffects1::RadialBlur}{RadialBlur}. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image ZoomBlur_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet ZoomBlur-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be blurred. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the maximum perceived amount of movement for each + pixel. The amount is smaller near the center and reaches the specified + value at the edges. + + The quality of the blur depends on \l{ZoomBlur::samples}{samples} + property. If length value is large, more samples are needed to keep the + visual quality at high level. + + The value ranges from 0.0 to inf. By default the property is set to \c + 0.0 (no blur). + + \table + \header + \li Output examples with different length values + \li + \li + \row + \li \image ZoomBlur_length1.png + \li \image ZoomBlur_length2.png + \li \image ZoomBlur_length3.png + \row + \li \b { length: 0.0 } + \li \b { length: 32.0 } + \li \b { length: 48.0 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \endtable + + */ + property real length: 0.0 + + /*! + This property defines how many samples are taken per pixel when blur + calculation is done. Larger value produces better quality, but is slower + to render. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + Allowed values are between 0 and inf (practical maximum depends on GPU). + By default the property is set to \c 0 (no samples). + + */ + property int samples: 0 + + /*! + \qmlproperty real QtGraphicalEffects1::ZoomBlur::horizontalOffset + \qmlproperty real QtGraphicalEffects1::ZoomBlur::verticalOffset + + These properties define an offset in pixels for the blur direction + center point. + + The values range from -inf to inf. By default these properties are set + to \c 0. + + \table + \header + \li Output examples with different horizontalOffset values + \li + \li + \row + \li \image ZoomBlur_horizontalOffset1.png + \li \image ZoomBlur_horizontalOffset2.png + \li \image ZoomBlur_horizontalOffset3.png + \row + \li \b { horizontalOffset: 100.0 } + \li \b { horizontalOffset: 0.0 } + \li \b { horizontalOffset: -100.0 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l length: 32 + \li \l length: 32 + \li \l length: 32 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \endtable + */ + property real horizontalOffset: 0.0 + property real verticalOffset: 0.0 + + /*! + This property defines the blur behavior near the edges of the item, + where the pixel blurring is affected by the pixels outside the source + edges. + + If the property is set to \c true, the pixels outside the source are + interpreted to be transparent, which is similar to OpenGL + clamp-to-border extension. The blur is expanded slightly outside the + effect item area. + + If the property is set to \c false, the pixels outside the source are + interpreted to contain the same color as the pixels at the edge of the + item, which is similar to OpenGL clamp-to-edge behavior. The blur does + not expand outside the effect item area. + + By default, the property is set to \c false. + + */ + property bool transparentBorder: false + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant center: Qt.point(0.5 + rootItem.horizontalOffset / width, 0.5 + rootItem.verticalOffset / height) + property real len: rootItem.length + property bool transparentBorder: rootItem.transparentBorder + property real samples: rootItem.samples + property real weight: 1.0 / Math.max(1.0, rootItem.samples) + property variant expandPixels: transparentBorder ? Qt.size(rootItem.samples, rootItem.samples) : Qt.size(0,0) + property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0) + property variant delta: Qt.size(1.0 / rootItem.width, 1.0 / rootItem.height) + + x: transparentBorder ? -expandPixels.width - 1 : 0 + y: transparentBorder ? -expandPixels.height - 1 : 0 + width: transparentBorder ? parent.width + 2.0 * expandPixels.width + 2 : parent.width + height: transparentBorder ? parent.height + 2.0 * expandPixels.height + 2 : parent.height + + property string fragmentShaderSkeleton: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp float len; + uniform highp float weight; + uniform highp float samples; + uniform highp vec2 center; + uniform highp vec2 expand; + uniform highp vec2 delta; + + void main(void) { + mediump vec2 texCoord = qt_TexCoord0; + mediump vec2 centerCoord = center; + + PLACEHOLDER_EXPAND_STEPS + + highp vec2 dir = vec2(centerCoord.x - texCoord.s, centerCoord.y - texCoord.t); + dir /= max(1.0, length(dir) * 2.0); + highp vec2 shift = delta * len * dir * 2.0 / max(1.0, samples - 1.0); + gl_FragColor = vec4(0.0); + + PLACEHOLDER_UNROLLED_LOOP + + gl_FragColor *= weight * qt_Opacity; + } + " + + function buildFragmentShader() { + var shader = fragmentShaderSkeleton + var expandSteps = "" + + if (transparentBorder) { + expandSteps += "centerCoord = (centerCoord - expand) / (1.0 - 2.0 * expand);" + expandSteps += "texCoord = (texCoord - expand) / (1.0 - 2.0 * expand);" + } + + var unrolledLoop = "gl_FragColor += texture2D(source, texCoord);\n" + + if (rootItem.samples > 1) { + unrolledLoop = "" + for (var i = 0; i < rootItem.samples; i++) + unrolledLoop += "gl_FragColor += texture2D(source, texCoord); texCoord += shift;\n" + } + + shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps) + fragmentShader = shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop) + } + + onFragmentShaderChanged: sourceChanged() + onSamplesChanged: buildFragmentShader() + onTransparentBorderChanged: buildFragmentShader() + Component.onCompleted: buildFragmentShader() + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastGlow.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastGlow.qml new file mode 100644 index 00000000000..f4bd2c74219 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastGlow.qml @@ -0,0 +1,393 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant source + property real spread: 0.0 + property real blur: 0.0 + property color color: "white" + property bool transparentBorder: false + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + property string __internalBlurVertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_Matrix; + uniform highp float yStep; + uniform highp float xStep; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36); + qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep); + qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep); + qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36); + gl_Position = qt_Matrix * qt_Vertex; + } + " + + property string __internalBlurFragmentShader: " + uniform lowp sampler2D source; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) + + texture2D(source, qt_TexCoord1) + + texture2D(source, qt_TexCoord2) + + texture2D(source, qt_TexCoord3)) * 0.25; + gl_FragColor = sourceColor * qt_Opacity; + } + " + + ShaderEffect { + id: level0 + property variant source: sourceProxy.output + anchors.fill: parent + visible: false + smooth: true + } + + ShaderEffectSource { + id: level1 + width: Math.ceil(shaderItem.width / 32) * 32 + height: Math.ceil(shaderItem.height / 32) * 32 + sourceItem: level0 + hideSource: rootItem.visible + sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0,0,0,0) + smooth: true + visible: false + } + + ShaderEffect { + id: effect1 + property variant source: level1 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level2 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level2 + width: level1.width / 2 + height: level1.height / 2 + sourceItem: effect1 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect2 + property variant source: level2 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level3 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level3 + width: level2.width / 2 + height: level2.height / 2 + sourceItem: effect2 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect3 + property variant source: level3 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level4 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level4 + width: level3.width / 2 + height: level3.height / 2 + sourceItem: effect3 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect4 + property variant source: level4 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level5 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level5 + width: level4.width / 2 + height: level4.height / 2 + sourceItem: effect4 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect5 + property variant source: level5 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level6 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level6 + width: level5.width / 2 + height: level5.height / 2 + sourceItem: effect5 + hideSource: rootItem.visible + visible: false + smooth: true + } + + Item { + id: dummysource + width: 1 + height: 1 + visible: false + } + + ShaderEffectSource { + id: dummy + width: 1 + height: 1 + sourceItem: dummysource + visible: false + smooth: false + live: false + } + + ShaderEffect { + id: shaderItem + x: transparentBorder ? -64 : 0 + y: transparentBorder ? -64 : 0 + width: transparentBorder ? parent.width + 128 : parent.width + height: transparentBorder ? parent.height + 128 : parent.height + + property variant source1: level1 + property variant source2: level2 + property variant source3: level3 + property variant source4: level4 + property variant source5: level5 + property variant source6: level6 + property real lod: rootItem.blur + + property real weight1; + property real weight2; + property real weight3; + property real weight4; + property real weight5; + property real weight6; + + property real spread: 1.0 - (rootItem.spread * 0.98) + property alias color: rootItem.color + + function weight(v) { + if (v <= 0.0) + return 1 + if (v >= 0.5) + return 0 + + return 1.0 - v / 0.5 + } + + function calculateWeights() { + + var w1 = weight(Math.abs(lod - 0.100)) + var w2 = weight(Math.abs(lod - 0.300)) + var w3 = weight(Math.abs(lod - 0.500)) + var w4 = weight(Math.abs(lod - 0.700)) + var w5 = weight(Math.abs(lod - 0.900)) + var w6 = weight(Math.abs(lod - 1.100)) + + var sum = w1 + w2 + w3 + w4 + w5 + w6; + weight1 = w1 / sum; + weight2 = w2 / sum; + weight3 = w3 / sum; + weight4 = w4 / sum; + weight5 = w5 / sum; + weight6 = w6 / sum; + + upateSources() + } + + function upateSources() { + var sources = new Array(); + var weights = new Array(); + + if (weight1 > 0) { + sources.push(level1) + weights.push(weight1) + } + + if (weight2 > 0) { + sources.push(level2) + weights.push(weight2) + } + + if (weight3 > 0) { + sources.push(level3) + weights.push(weight3) + } + + if (weight4 > 0) { + sources.push(level4) + weights.push(weight4) + } + + if (weight5 > 0) { + sources.push(level5) + weights.push(weight5) + } + + if (weight6 > 0) { + sources.push(level6) + weights.push(weight6) + } + + for (var j = sources.length; j < 6; j++) { + sources.push(dummy) + weights.push(0.0) + } + + source1 = sources[0] + source2 = sources[1] + source3 = sources[2] + source4 = sources[3] + source5 = sources[4] + source6 = sources[5] + + weight1 = weights[0] + weight2 = weights[1] + weight3 = weights[2] + weight4 = weights[3] + weight5 = weights[4] + weight6 = weights[5] + } + + Component.onCompleted: calculateWeights() + + onLodChanged: calculateWeights() + + fragmentShader: " + uniform lowp sampler2D source1; + uniform lowp sampler2D source2; + uniform lowp sampler2D source3; + uniform lowp sampler2D source4; + uniform lowp sampler2D source5; + uniform mediump float weight1; + uniform mediump float weight2; + uniform mediump float weight3; + uniform mediump float weight4; + uniform mediump float weight5; + uniform highp vec4 color; + uniform highp float spread; + uniform lowp float qt_Opacity; + varying mediump vec2 qt_TexCoord0; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main() { + lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1; + sourceColor += texture2D(source2, qt_TexCoord0) * weight2; + sourceColor += texture2D(source3, qt_TexCoord0) * weight3; + sourceColor += texture2D(source4, qt_TexCoord0) * weight4; + sourceColor += texture2D(source5, qt_TexCoord0) * weight5; + sourceColor = mix(vec4(0), color, linearstep(0.0, spread, sourceColor.a)); + gl_FragColor = sourceColor * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastInnerShadow.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastInnerShadow.qml new file mode 100644 index 00000000000..95e645a939b --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastInnerShadow.qml @@ -0,0 +1,413 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant source + property real blur: 0.0 + property real horizontalOffset: 0 + property real verticalOffset: 0 + property real spread: 0.0 + property color color: "black" + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + property string __internalBlurVertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_Matrix; + uniform highp float yStep; + uniform highp float xStep; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36); + qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep); + qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep); + qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36); + gl_Position = qt_Matrix * qt_Vertex; + } + " + + property string __internalBlurFragmentShader: " + uniform lowp sampler2D source; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) + + texture2D(source, qt_TexCoord1) + + texture2D(source, qt_TexCoord2) + + texture2D(source, qt_TexCoord3)) * 0.25; + gl_FragColor = sourceColor * qt_Opacity; + } + " + + ShaderEffect { + id: level0 + property variant source: sourceProxy.output + property real horizontalOffset: rootItem.horizontalOffset / rootItem.width + property real verticalOffset: rootItem.verticalOffset / rootItem.width + property color color: rootItem.color + + anchors.fill: parent + visible: false + smooth: true + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform lowp float qt_Opacity; + uniform highp sampler2D source; + uniform lowp vec4 color; + uniform highp float horizontalOffset; + uniform highp float verticalOffset; + + void main(void) { + highp vec2 pos = qt_TexCoord0 - vec2(horizontalOffset, verticalOffset); + lowp float ea = step(0.0, pos.x) * step(0.0, pos.y) * step(pos.x, 1.0) * step(pos.y, 1.0); + lowp float eb = 1.0 - ea; + gl_FragColor = (eb * color + ea * color * (1.0 - texture2D(source, pos).a)) * qt_Opacity; + } + " + } + + ShaderEffectSource { + id: level1 + width: Math.ceil(shaderItem.width / 32) * 32 + height: Math.ceil(shaderItem.height / 32) * 32 + sourceItem: level0 + hideSource: rootItem.visible + smooth: true + visible: false + } + + ShaderEffect { + id: effect1 + property variant source: level1 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level2 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level2 + width: level1.width / 2 + height: level1.height / 2 + sourceItem: effect1 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect2 + property variant source: level2 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level3 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level3 + width: level2.width / 2 + height: level2.height / 2 + sourceItem: effect2 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect3 + property variant source: level3 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level4 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level4 + width: level3.width / 2 + height: level3.height / 2 + sourceItem: effect3 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect4 + property variant source: level4 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level5 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level5 + width: level4.width / 2 + height: level4.height / 2 + sourceItem: effect4 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect5 + property variant source: level5 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level6 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level6 + width: level5.width / 2 + height: level5.height / 2 + sourceItem: effect5 + hideSource: rootItem.visible + visible: false + smooth: true + } + + Item { + id: dummysource + width: 1 + height: 1 + visible: false + } + + ShaderEffectSource { + id: dummy + width: 1 + height: 1 + sourceItem: dummysource + visible: false + smooth: false + live: false + } + + ShaderEffect { + id: shaderItem + width: parent.width + height: parent.height + + property variant original: sourceProxy.output + property variant source1: level1 + property variant source2: level2 + property variant source3: level3 + property variant source4: level4 + property variant source5: level5 + property variant source6: level6 + property real lod: rootItem.blur + + property real weight1; + property real weight2; + property real weight3; + property real weight4; + property real weight5; + property real weight6; + + property real spread: 1.0 - (rootItem.spread * 0.98) + property color color: rootItem.color + + function weight(v) { + if (v <= 0.0) + return 1 + if (v >= 0.5) + return 0 + + return 1.0 - v / 0.5 + } + + function calculateWeights() { + + var w1 = weight(Math.abs(lod - 0.100)) + var w2 = weight(Math.abs(lod - 0.300)) + var w3 = weight(Math.abs(lod - 0.500)) + var w4 = weight(Math.abs(lod - 0.700)) + var w5 = weight(Math.abs(lod - 0.900)) + var w6 = weight(Math.abs(lod - 1.100)) + + var sum = w1 + w2 + w3 + w4 + w5 + w6; + weight1 = w1 / sum; + weight2 = w2 / sum; + weight3 = w3 / sum; + weight4 = w4 / sum; + weight5 = w5 / sum; + weight6 = w6 / sum; + + upateSources() + } + + function upateSources() { + var sources = new Array(); + var weights = new Array(); + + if (weight1 > 0) { + sources.push(level1) + weights.push(weight1) + } + + if (weight2 > 0) { + sources.push(level2) + weights.push(weight2) + } + + if (weight3 > 0) { + sources.push(level3) + weights.push(weight3) + } + + if (weight4 > 0) { + sources.push(level4) + weights.push(weight4) + } + + if (weight5 > 0) { + sources.push(level5) + weights.push(weight5) + } + + if (weight6 > 0) { + sources.push(level6) + weights.push(weight6) + } + + for (var j = sources.length; j < 6; j++) { + sources.push(dummy) + weights.push(0.0) + } + + source1 = sources[0] + source2 = sources[1] + source3 = sources[2] + source4 = sources[3] + source5 = sources[4] + source6 = sources[5] + + weight1 = weights[0] + weight2 = weights[1] + weight3 = weights[2] + weight4 = weights[3] + weight5 = weights[4] + weight6 = weights[5] + } + + Component.onCompleted: calculateWeights() + + onLodChanged: calculateWeights() + + fragmentShader: " + uniform lowp sampler2D original; + uniform lowp sampler2D source1; + uniform lowp sampler2D source2; + uniform lowp sampler2D source3; + uniform lowp sampler2D source4; + uniform lowp sampler2D source5; + uniform mediump float weight1; + uniform mediump float weight2; + uniform mediump float weight3; + uniform mediump float weight4; + uniform mediump float weight5; + uniform highp vec4 color; + uniform highp float spread; + uniform lowp float qt_Opacity; + varying mediump vec2 qt_TexCoord0; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main() { + lowp vec4 shadowColor = texture2D(source1, qt_TexCoord0) * weight1; + shadowColor += texture2D(source2, qt_TexCoord0) * weight2; + shadowColor += texture2D(source3, qt_TexCoord0) * weight3; + shadowColor += texture2D(source4, qt_TexCoord0) * weight4; + shadowColor += texture2D(source5, qt_TexCoord0) * weight5; + lowp vec4 originalColor = texture2D(original, qt_TexCoord0); + shadowColor.rgb = mix(originalColor.rgb, color.rgb * originalColor.a, linearstep(0.0, spread, shadowColor.a)); + gl_FragColor = vec4(shadowColor.rgb, originalColor.a) * originalColor.a * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastMaskedBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastMaskedBlur.qml new file mode 100644 index 00000000000..ae49a6e9bb0 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/FastMaskedBlur.qml @@ -0,0 +1,332 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant source + property variant maskSource + property real blur: 0.0 + property bool transparentBorder: false + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.maskSource + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + sourceItem: shaderItem + live: true + hideSource: visible + smooth: rootItem.blur > 0 + } + + property string __internalBlurVertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_Matrix; + uniform highp float yStep; + uniform highp float xStep; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36); + qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep); + qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep); + qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36); + gl_Position = qt_Matrix * qt_Vertex; + } + " + + property string __internalBlurFragmentShader: " + uniform lowp sampler2D source; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) + + texture2D(source, qt_TexCoord1) + + texture2D(source, qt_TexCoord2) + + texture2D(source, qt_TexCoord3)) * 0.25; + gl_FragColor = sourceColor * qt_Opacity; + } + " + + ShaderEffect { + id: mask0 + property variant source: maskSourceProxy.output + anchors.fill: parent + visible: false + smooth: true + } + + ShaderEffectSource { + id: masklevel1 + width: Math.ceil(shaderItem.width / 32) * 32 + height: Math.ceil(shaderItem.height / 32) * 32 + sourceItem: mask0 + hideSource: rootItem.visible + sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0, 0, 0, 0) + visible: false + smooth: rootItem.blur > 0 + } + + ShaderEffect { + id: level0 + property variant source: sourceProxy.output + anchors.fill: parent + visible: false + smooth: true + } + + ShaderEffectSource { + id: level1 + width: Math.ceil(shaderItem.width / 32) * 32 + height: Math.ceil(shaderItem.height / 32) * 32 + sourceItem: level0 + hideSource: rootItem.visible + sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0, 0, 0, 0) + visible: false + smooth: rootItem.blur > 0 + } + + ShaderEffect { + id: effect1 + property variant source: level1 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level2 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level2 + width: level1.width / 2 + height: level1.height / 2 + sourceItem: effect1 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect2 + property variant source: level2 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level3 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level3 + width: level2.width / 2 + height: level2.height / 2 + sourceItem: effect2 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect3 + property variant source: level3 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level4 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level4 + width: level3.width / 2 + height: level3.height / 2 + sourceItem: effect3 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect4 + property variant source: level4 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level5 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level5 + width: level4.width / 2 + height: level4.height / 2 + sourceItem: effect4 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect5 + property variant source: level5 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level6 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level6 + width: level5.width / 2 + height: level5.height / 2 + sourceItem: effect5 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: shaderItem + property variant mask: masklevel1 + property variant source1: level1 + property variant source2: level2 + property variant source3: level3 + property variant source4: level4 + property variant source5: level5 + property variant source6: level6 + property real lod: Math.sqrt(rootItem.blur) * 1.2 - 0.2 + property real weight1 + property real weight2 + property real weight3 + property real weight4 + property real weight5 + property real weight6 + + x: transparentBorder ? -64 : 0 + y: transparentBorder ? -64 : 0 + width: transparentBorder ? parent.width + 128 : parent.width + height: transparentBorder ? parent.height + 128 : parent.height + + fragmentShader: " + uniform lowp sampler2D mask; + uniform lowp sampler2D source1; + uniform lowp sampler2D source2; + uniform lowp sampler2D source3; + uniform lowp sampler2D source4; + uniform lowp sampler2D source5; + uniform lowp sampler2D source6; + uniform lowp float lod; + uniform lowp float qt_Opacity; + varying mediump vec2 qt_TexCoord0; + + mediump float weight(mediump float v) { + if (v <= 0.0) + return 1.0; + + if (v >= 0.5) + return 0.0; + + return 1.0 - v * 2.0; + } + + void main() { + + lowp vec4 maskColor = texture2D(mask, qt_TexCoord0); + mediump float l = lod * maskColor.a; + + mediump float w1 = weight(abs(l - 0.100)); + mediump float w2 = weight(abs(l - 0.300)); + mediump float w3 = weight(abs(l - 0.500)); + mediump float w4 = weight(abs(l - 0.700)); + mediump float w5 = weight(abs(l - 0.900)); + mediump float w6 = weight(abs(l - 1.100)); + + mediump float sum = w1 + w2 + w3 + w4 + w5 + w6; + mediump float weight1 = w1 / sum; + mediump float weight2 = w2 / sum; + mediump float weight3 = w3 / sum; + mediump float weight4 = w4 / sum; + mediump float weight5 = w5 / sum; + mediump float weight6 = w6 / sum; + + lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1; + sourceColor += texture2D(source2, qt_TexCoord0) * weight2; + sourceColor += texture2D(source3, qt_TexCoord0) * weight3; + sourceColor += texture2D(source4, qt_TexCoord0) * weight4; + sourceColor += texture2D(source5, qt_TexCoord0) * weight5; + sourceColor += texture2D(source6, qt_TexCoord0) * weight6; + + gl_FragColor = sourceColor * qt_Opacity; + + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianDirectionalBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianDirectionalBlur.qml new file mode 100644 index 00000000000..c2af1f34e31 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianDirectionalBlur.qml @@ -0,0 +1,287 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant source + property real deviation: (radius + 1) / 3.3333 + property real radius: 0.0 + property int maximumRadius: 0 + property real horizontalStep: 0.0 + property real verticalStep: 0.0 + property bool transparentBorder: false + property bool cached: false + + property bool enableColor: false + property color color: "white" + property real spread: 0.0 + + property bool enableMask: false + property variant maskSource + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.maskSource + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: rootItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real deviation: Math.max(0.1, rootItem.deviation) + property real radius: rootItem.radius + property int maxRadius: rootItem.maximumRadius + property bool transparentBorder: rootItem.transparentBorder + property real gaussianSum: 0.0 + property real startIndex: 0.0 + property real deltaFactor: (2 * radius - 1) / (maxRadius * 2 - 1) + property real expandX: transparentBorder && rootItem.horizontalStep > 0 ? maxRadius / width : 0.0 + property real expandY: transparentBorder && rootItem.verticalStep > 0 ? maxRadius / height : 0.0 + property variant gwts: [] + property variant delta: Qt.vector3d(rootItem.horizontalStep * deltaFactor, rootItem.verticalStep * deltaFactor, startIndex); + property variant factor_0_2: Qt.vector3d(gwts[0], gwts[1], gwts[2]); + property variant factor_3_5: Qt.vector3d(gwts[3], gwts[4], gwts[5]); + property variant factor_6_8: Qt.vector3d(gwts[6], gwts[7], gwts[8]); + property variant factor_9_11: Qt.vector3d(gwts[9], gwts[10], gwts[11]); + property variant factor_12_14: Qt.vector3d(gwts[12], gwts[13], gwts[14]); + property variant factor_15_17: Qt.vector3d(gwts[15], gwts[16], gwts[17]); + property variant factor_18_20: Qt.vector3d(gwts[18], gwts[19], gwts[20]); + property variant factor_21_23: Qt.vector3d(gwts[21], gwts[22], gwts[23]); + property variant factor_24_26: Qt.vector3d(gwts[24], gwts[25], gwts[26]); + property variant factor_27_29: Qt.vector3d(gwts[27], gwts[28], gwts[29]); + property variant factor_30_32: Qt.vector3d(gwts[30], gwts[31], gwts[32]); + + property color color: rootItem.color + property real spread: 1.0 - (rootItem.spread * 0.98) + property variant maskSource: maskSourceProxy.output + + anchors.fill: rootItem + + function gausFunc(x){ + //Gaussian function = h(x):=(1/sqrt(2*3.14159*(D^2))) * %e^(-(x^2)/(2*(D^2))); + return (1.0 / Math.sqrt(2 * Math.PI * (Math.pow(shaderItem.deviation, 2)))) * Math.pow(Math.E, -((Math.pow(x, 2)) / (2 * (Math.pow(shaderItem.deviation, 2))))); + } + + function updateGaussianWeights() { + gaussianSum = 0.0; + startIndex = -maxRadius + 0.5 + + var n = new Array(32); + for (var j = 0; j < 32; j++) + n[j] = 0; + + var max = maxRadius * 2 + var delta = (2 * radius - 1) / (max - 1); + for (var i = 0; i < max; i++) { + n[i] = gausFunc(-radius + 0.5 + i * delta); + gaussianSum += n[i]; + } + + gwts = n; + } + + function buildFragmentShader() { + + var shaderSteps = [ + "gl_FragColor += texture2D(source, texCoord) * factor_0_2.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_0_2.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_0_2.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_3_5.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_3_5.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_3_5.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_6_8.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_6_8.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_6_8.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_9_11.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_9_11.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_9_11.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_12_14.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_12_14.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_12_14.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_15_17.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_15_17.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_15_17.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_18_20.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_18_20.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_18_20.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_21_23.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_21_23.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_21_23.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_24_26.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_24_26.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_24_26.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_27_29.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_27_29.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_27_29.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_30_32.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_30_32.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_30_32.z; texCoord += shift;" + ] + + var shader = fragmentShaderBegin + var samples = maxRadius * 2 + if (samples > 32) { + console.log("DirectionalGaussianBlur.qml WARNING: Maximum of blur radius (16) exceeded!") + samples = 32 + } + + for (var i = 0; i < samples; i++) { + shader += shaderSteps[i] + } + + shader += fragmentShaderEnd + + var colorizeSteps = "" + var colorizeUniforms = "" + + var maskSteps = "" + var maskUniforms = "" + + if (enableColor) { + colorizeSteps += "gl_FragColor = mix(vec4(0), color, clamp((gl_FragColor.a - 0.0) / (spread - 0.0), 0.0, 1.0));\n" + colorizeUniforms += "uniform highp vec4 color;\n" + colorizeUniforms += "uniform highp float spread;\n" + } + + if (enableMask) { + maskSteps += "shift *= texture2D(maskSource, qt_TexCoord0).a;\n" + maskUniforms += "uniform sampler2D maskSource;\n" + } + + shader = shader.replace("PLACEHOLDER_COLORIZE_STEPS", colorizeSteps) + shader = shader.replace("PLACEHOLDER_COLORIZE_UNIFORMS", colorizeUniforms) + shader = shader.replace("PLACEHOLDER_MASK_STEPS", maskSteps) + shader = shader.replace("PLACEHOLDER_MASK_UNIFORMS", maskUniforms) + + fragmentShader = shader + } + + onDeviationChanged: updateGaussianWeights() + + onRadiusChanged: updateGaussianWeights() + + onTransparentBorderChanged: { + buildFragmentShader() + updateGaussianWeights() + } + + onMaxRadiusChanged: { + buildFragmentShader() + updateGaussianWeights() + } + + Component.onCompleted: { + buildFragmentShader() + updateGaussianWeights() + } + + property string fragmentShaderBegin: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp vec3 delta; + uniform highp vec3 factor_0_2; + uniform highp vec3 factor_3_5; + uniform highp vec3 factor_6_8; + uniform highp vec3 factor_9_11; + uniform highp vec3 factor_12_14; + uniform highp vec3 factor_15_17; + uniform highp vec3 factor_18_20; + uniform highp vec3 factor_21_23; + uniform highp vec3 factor_24_26; + uniform highp vec3 factor_27_29; + uniform highp vec3 factor_30_32; + uniform highp float gaussianSum; + uniform highp float expandX; + uniform highp float expandY; + PLACEHOLDER_MASK_UNIFORMS + PLACEHOLDER_COLORIZE_UNIFORMS + + void main() { + highp vec2 shift = vec2(delta.x, delta.y); + + PLACEHOLDER_MASK_STEPS + + highp float index = delta.z; + mediump vec2 texCoord = qt_TexCoord0; + texCoord.s = (texCoord.s - expandX) / (1.0 - 2.0 * expandX); + texCoord.t = (texCoord.t - expandY) / (1.0 - 2.0 * expandY); + texCoord += (shift * index); + + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); + " + + property string fragmentShaderEnd: " + + gl_FragColor /= gaussianSum; + + PLACEHOLDER_COLORIZE_STEPS + + gl_FragColor *= qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianGlow.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianGlow.qml new file mode 100644 index 00000000000..c7458561a5d --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianGlow.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant source + property real radius: 0.0 + property int maximumRadius: 0 + property real spread: 0.0 + property color color: "white" + property bool cached: false + property bool transparentBorder: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + GaussianDirectionalBlur { + id: shaderItem + x: transparentBorder ? -maximumRadius - 1 : 0 + y: transparentBorder ? -maximumRadius - 1 : 0 + width: horizontalBlur.width + height: horizontalBlur.height + horizontalStep: 0.0 + verticalStep: 1.0 / parent.height + source: horizontalBlur + radius: rootItem.radius + maximumRadius: rootItem.maximumRadius + transparentBorder: rootItem.transparentBorder + enableColor: true + color: rootItem.color + spread: rootItem.spread + } + + GaussianDirectionalBlur { + id: horizontalBlur + width: transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width + height: transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height + horizontalStep: 1.0 / parent.width + verticalStep: 0.0 + source: sourceProxy.output + radius: rootItem.radius + maximumRadius: rootItem.maximumRadius + transparentBorder: rootItem.transparentBorder + visible: false + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianInnerShadow.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianInnerShadow.qml new file mode 100644 index 00000000000..7621c6b05a4 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianInnerShadow.qml @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant source + property real radius: 0.0 + property int maximumRadius: 0 + property real horizontalOffset: 0 + property real verticalOffset: 0 + property real spread: 0 + property color color: "black" + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect{ + id: shadowItem + anchors.fill: parent + + property variant original: sourceProxy.output + property color color: rootItem.color + property real horizontalOffset: rootItem.horizontalOffset / rootItem.width + property real verticalOffset: rootItem.verticalOffset / rootItem.height + + visible: false + fragmentShader: " + uniform highp sampler2D original; + uniform lowp float qt_Opacity; + uniform lowp vec4 color; + uniform highp float horizontalOffset; + uniform highp float verticalOffset; + varying highp vec2 qt_TexCoord0; + + void main(void) { + highp vec2 pos = qt_TexCoord0 - vec2(horizontalOffset, verticalOffset); + lowp float ea = step(0.0, pos.x) * step(0.0, pos.y) * step(pos.x, 1.0) * step(pos.y, 1.0); + lowp float eb = 1.0 - ea; + gl_FragColor = eb * color + ea * color * (1.0 - texture2D(original, pos).a) * qt_Opacity; + } + " + } + + GaussianDirectionalBlur { + id: blurItem + anchors.fill: parent + horizontalStep: 0.0 + verticalStep: 1.0 / parent.height + source: horizontalBlur + radius: rootItem.radius + maximumRadius: rootItem.maximumRadius + visible: false + } + + GaussianDirectionalBlur { + id: horizontalBlur + width: transparentBorder ? parent.width + 2 * maximumRadius : parent.width + height: parent.height + horizontalStep: 1.0 / parent.width + verticalStep: 0.0 + source: shadowItem + radius: rootItem.radius + maximumRadius: rootItem.maximumRadius + visible: false + } + + ShaderEffectSource { + id: blurredSource + sourceItem: blurItem + live: true + smooth: true + } + + ShaderEffect { + id: shaderItem + anchors.fill: parent + + property variant original: sourceProxy.output + property variant shadow: blurredSource + property real spread: 1.0 - (rootItem.spread * 0.98) + property color color: rootItem.color + + fragmentShader: " + uniform highp sampler2D original; + uniform highp sampler2D shadow; + uniform lowp float qt_Opacity; + uniform highp float spread; + uniform lowp vec4 color; + varying highp vec2 qt_TexCoord0; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main(void) { + lowp vec4 originalColor = texture2D(original, qt_TexCoord0); + lowp vec4 shadowColor = texture2D(shadow, qt_TexCoord0); + shadowColor.rgb = mix(originalColor.rgb, color.rgb * originalColor.a, linearstep(0.0, spread, shadowColor.a)); + gl_FragColor = vec4(shadowColor.rgb, originalColor.a) * originalColor.a * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianMaskedBlur.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianMaskedBlur.qml new file mode 100644 index 00000000000..02009209c60 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/GaussianMaskedBlur.qml @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant source + property variant maskSource + property real radius: 0.0 + property int maximumRadius: 0 + property bool cached: false + property bool transparentBorder: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.maskSource + sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: blur + visible: rootItem.cached + smooth: true + sourceItem: blur + live: true + hideSource: visible + } + + GaussianDirectionalBlur { + id: blur + x: transparentBorder ? -maximumRadius - 1: 0 + y: transparentBorder ? -maximumRadius - 1: 0 + width: horizontalBlur.width + height: horizontalBlur.height + horizontalStep: 0.0 + verticalStep: 1.0 / parent.height + source: horizontalBlur + enableMask: true + maskSource: maskSourceProxy.output + radius: rootItem.radius + maximumRadius: rootItem.maximumRadius + transparentBorder: rootItem.transparentBorder + } + + GaussianDirectionalBlur { + id: horizontalBlur + width: transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width + height: transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height + horizontalStep: 1.0 / parent.width + verticalStep: 0.0 + source: sourceProxy.output + enableMask: true + maskSource: maskSourceProxy.output + radius: rootItem.radius + maximumRadius: rootItem.maximumRadius + transparentBorder: rootItem.transparentBorder + visible: false + } +} diff --git a/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/SourceProxy.qml b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/SourceProxy.qml new file mode 100644 index 00000000000..2561d70e45c --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/002_nestedQmlOnly/QtGraphicalEffects/private/SourceProxy.qml @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant input + property variant output + property variant sourceRect + visible: false + + Component.onCompleted: evaluateInput() + + onInputChanged: evaluateInput() + + onSourceRectChanged: evaluateInput() + + function evaluateInput() { + if (input == undefined) { + output = input + } + else if (sourceRect != undefined && sourceRect != Qt.rect(0, 0, 0, 0) && !isQQuickShaderEffectSource(input)) { + proxySource.sourceItem = input + output = proxySource + proxySource.sourceRect = sourceRect + } + else if (isQQuickItemLayerEnabled(input)) { + output = input + } + else if ((isQQuickImage(input) && !hasTileMode(input) && !hasChildren(input))) { + output = input + } + else if (isQQuickShaderEffectSource(input)) { + output = input + } + else { + proxySource.sourceItem = input + output = proxySource + proxySource.sourceRect = Qt.rect(0, 0, 0, 0) + } + } + + function isQQuickItemLayerEnabled(item) { + if (item.hasOwnProperty("layer")) { + var l = item["layer"] + if (l.hasOwnProperty("enabled") && l["enabled"].toString() == "true") + return true + } + return false + } + + function isQQuickImage(item) { + var imageProperties = [ "fillMode", "progress", "asynchronous", "sourceSize", "status", "smooth" ] + return hasProperties(item, imageProperties) + } + + function isQQuickShaderEffectSource(item) { + var shaderEffectSourceProperties = [ "hideSource", "format", "sourceItem", "mipmap", "wrapMode", "live", "recursive", "sourceRect" ] + return hasProperties(item, shaderEffectSourceProperties) + } + + function hasProperties(item, properties) { + var counter = 0 + for (var j = 0; j < properties.length; j++) { + if (item.hasOwnProperty(properties [j])) + counter++ + } + return properties.length == counter + } + + function hasChildren(item) { + if (item.hasOwnProperty("childrenRect")) { + if (item["childrenRect"].toString() != "QRectF(0, 0, 0, 0)") + return true + else + return false + } + return false + } + + function hasTileMode(item) { + if (item.hasOwnProperty("fillMode")) { + if (item["fillMode"].toString() != "0") + return true + else + return false + } + return false + } + + ShaderEffectSource { + id: proxySource + live: rootItem.input != rootItem.output + hideSource: false + smooth: true + visible: false + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Blend.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Blend.qml new file mode 100644 index 00000000000..59d8646047e --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Blend.qml @@ -0,0 +1,478 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype Blend + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-blend + \brief Merges two source items by using a blend mode. + + Blend mode can be selected with the \l{Blend::mode}{mode} property. + + \table + \header + \li source + \li foregroundSource + \li Effect applied + \row + \li \image Original_bug.png + \li \image Original_butterfly.png + \li \image Blend_bug_and_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet Blend-example.qml example + +*/ + +Item { + id: rootItem + + /*! + This property defines the source item that is going to be the base when + \l{Blend::foregroundSource}{foregroundSource} is blended over it. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the item that is going to be blended over the + \l{Blend::source}{source}. + + \note It is not supported to let the effect include itself, for + instance by setting foregroundSource to the effect's parent. + */ + property variant foregroundSource + + /*! + This property defines the mode which is used when foregroundSource is + blended over source. Values are case insensitive. + + \table + \header + \li mode + \li description + \row + \li normal + \li The pixel component values from foregroundSource are written + over source by using alpha blending. + \row + \li addition + \li The pixel component values from source and foregroundSource are + added together and written. + \row + \li average + \li The pixel component values from source and foregroundSource are + averaged and written. + \row + \li color + \li The lightness value from source is combined with hue and + saturation from foregroundSource and written. + \row + \li colorBurn + \li The darker pixels from source are darkened more, if both source + and foregroundSource pixels are light the result is light. + \row + \li colorDodge + \li The lighter pixels from source are lightened more, if both + source and foregroundSource pixels are dark the result is dark. + \row + \li darken + \li The darker pixel component value from source and + foregroundSource is written. + \row + \li darkerColor + \li The lower luminance pixel rgb-value from source and + foregroundSource is written. + \row + \li difference + \li The absolute pixel component value difference between source and + foregroundSource is written. + \row + \li divide + \li The pixel component values from source is divided by the value + from foregroundSource and written. + \row + \li exclusion + \li The pixel component value difference with reduced contrast + between source and foregroundSource is written. + \row + \li hardLight + \li The pixel component values from source are lightened or darkened + according to foregroundSource values and written. + \row + \li hue + \li The hue value from foregroundSource is combined with saturation + and lightness from source and written. + \row + \li lighten + \li The lightest pixel component value from source and + foregroundSource is written. + \row + \li lighterColor + \li The higher luminance pixel rgb-value from source and + foregroundSource is written. + \row + \li lightness + \li The lightness value from foregroundSource is combined with hue + and saturation from source and written. + \row + \li multiply + \li The pixel component values from source and foregroundSource are + multiplied together and written. + \row + \li negation + \li The inverted absolute pixel component value difference between + source and foregroundSource is written. + \row + \li saturation + \li The saturation value from foregroundSource is combined with hue + and lightness from source and written. + \row + \li screen + \li The pixel values from source and foregroundSource are negated, + then multiplied, negated again, and written. + \row + \li subtract + \li Pixel value from foregroundSource is subracted from source and + written. + \row + \li softLight + \li The pixel component values from source are lightened or darkened + slightly according to foregroundSource values and written. + + \endtable + + \table + \header + \li Example source + \li Example foregroundSource + \row + \li \image Original_bug.png + \li \image Original_butterfly.png + \endtable + + \table + \header + \li Output examples with different mode values + \li + \li + \row + \li \image Blend_mode1.png + \li \image Blend_mode2.png + \li \image Blend_mode3.png + \row + \li \b { mode: normal } + \li \b { mode: addition } + \li \b { mode: average } + \row + \li \image Blend_mode4.png + \li \image Blend_mode5.png + \li \image Blend_mode6.png + \row + \li \b { mode: color } + \li \b { mode: colorBurn } + \li \b { mode: colorDodge } + \row + \li \image Blend_mode7.png + \li \image Blend_mode8.png + \li \image Blend_mode9.png + \row + \li \b { mode: darken } + \li \b { mode: darkerColor } + \li \b { mode: difference } + \row + \li \image Blend_mode10.png + \li \image Blend_mode11.png + \li \image Blend_mode12.png + \row + \li \b { mode: divide } + \li \b { mode: exclusion } + \li \b { mode: hardlight } + \row + \li \image Blend_mode13.png + \li \image Blend_mode14.png + \li \image Blend_mode15.png + \row + \li \b { mode: hue } + \li \b { mode: lighten } + \li \b { mode: lighterColor } + \row + \li \image Blend_mode16.png + \li \image Blend_mode17.png + \li \image Blend_mode18.png + \row + \li \b { mode: lightness } + \li \b { mode: negation } + \li \b { mode: multiply } + \row + \li \image Blend_mode19.png + \li \image Blend_mode20.png + \li \image Blend_mode21.png + \row + \li \b { mode: saturation } + \li \b { mode: screen } + \li \b { mode: subtract } + \row + \li \image Blend_mode22.png + \row + \li \b { mode: softLight } + \endtable + */ + property string mode: "normal" + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in the + cache must be updated. Memory consumption is increased, because an extra + buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to false. + + */ + property bool cached: false + + SourceProxy { + id: backgroundSourceProxy + input: rootItem.source + } + + SourceProxy { + id: foregroundSourceProxy + input: rootItem.foregroundSource + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant backgroundSource: backgroundSourceProxy.output + property variant foregroundSource: foregroundSourceProxy.output + property string mode: rootItem.mode + anchors.fill: parent + + fragmentShader: fragmentShaderBegin + blendModeNormal + fragmentShaderEnd + + function buildFragmentShader() { + var shader = fragmentShaderBegin + + switch (mode.toLowerCase()) { + case "addition" : shader += blendModeAddition; break; + case "average" : shader += blendModeAverage; break; + case "color" : shader += blendModeColor; break; + case "colorburn" : shader += blendModeColorBurn; break; + case "colordodge" : shader += blendModeColorDodge; break; + case "darken" : shader += blendModeDarken; break; + case "darkercolor" : shader += blendModeDarkerColor; break; + case "difference" : shader += blendModeDifference; break; + case "divide" : shader += blendModeDivide; break; + case "exclusion" : shader += blendModeExclusion; break; + case "hardlight" : shader += blendModeHardLight; break; + case "hue" : shader += blendModeHue; break; + case "lighten" : shader += blendModeLighten; break; + case "lightercolor" : shader += blendModeLighterColor; break; + case "lightness" : shader += blendModeLightness; break; + case "negation" : shader += blendModeNegation; break; + case "normal" : shader += blendModeNormal; break; + case "multiply" : shader += blendModeMultiply; break; + case "saturation" : shader += blendModeSaturation; break; + case "screen" : shader += blendModeScreen; break; + case "subtract" : shader += blendModeSubtract; break; + case "softlight" : shader += blendModeSoftLight; break; + default: shader += "gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);"; break; + } + + shader += fragmentShaderEnd + fragmentShader = shader + + // Workaraound for a bug just to make sure display gets updated when the mode changes. + backgroundSourceChanged() + } + + Component.onCompleted: { + buildFragmentShader() + } + + onModeChanged: { + buildFragmentShader() + } + + property string blendModeAddition: "result.rgb = min(rgb1 + rgb2, 1.0);" + property string blendModeAverage: "result.rgb = 0.5 * (rgb1 + rgb2);" + property string blendModeColor: "result.rgb = HSLtoRGB(vec3(RGBtoHSL(rgb2).xy, RGBtoL(rgb1)));" + property string blendModeColorBurn: "result.rgb = clamp(1.0 - ((1.0 - rgb1) / max(vec3(1.0 / 256.0), rgb2)), vec3(0.0), vec3(1.0));" + property string blendModeColorDodge: "result.rgb = clamp(rgb1 / max(vec3(1.0 / 256.0), (1.0 - rgb2)), vec3(0.0), vec3(1.0));" + property string blendModeDarken: "result.rgb = min(rgb1, rgb2);" + property string blendModeDarkerColor: "result.rgb = 0.3 * rgb1.r + 0.59 * rgb1.g + 0.11 * rgb1.b > 0.3 * rgb2.r + 0.59 * rgb2.g + 0.11 * rgb2.b ? rgb2 : rgb1;" + property string blendModeDifference: "result.rgb = abs(rgb1 - rgb2);" + property string blendModeDivide: "result.rgb = clamp(rgb1 / rgb2, 0.0, 1.0);" + property string blendModeExclusion: "result.rgb = rgb1 + rgb2 - 2.0 * rgb1 * rgb2;" + property string blendModeHardLight: "result.rgb = vec3(channelBlendHardLight(rgb1.r, rgb2.r), channelBlendHardLight(rgb1.g, rgb2.g), channelBlendHardLight(rgb1.b, rgb2.b));" + property string blendModeHue: "result.rgb = HSLtoRGB(vec3(RGBtoHSL(rgb2).x, RGBtoHSL(rgb1).yz));" + property string blendModeLighten: "result.rgb = max(rgb1, rgb2);" + property string blendModeLighterColor: "result.rgb = 0.3 * rgb1.r + 0.59 * rgb1.g + 0.11 * rgb1.b > 0.3 * rgb2.r + 0.59 * rgb2.g + 0.11 * rgb2.b ? rgb1 : rgb2;" + property string blendModeLightness: "result.rgb = HSLtoRGB(vec3(RGBtoHSL(rgb1).xy, RGBtoL(rgb2)));" + property string blendModeMultiply: "result.rgb = rgb1 * rgb2;" + property string blendModeNegation: "result.rgb = 1.0 - abs(1.0 - rgb1 - rgb2);" + property string blendModeNormal: "result.rgb = rgb2; a = max(color1.a, color2.a);" + property string blendModeSaturation: "lowp vec3 hsl1 = RGBtoHSL(rgb1); result.rgb = HSLtoRGB(vec3(hsl1.x, RGBtoHSL(rgb2).y, hsl1.z));" + property string blendModeScreen: "result.rgb = 1.0 - (vec3(1.0) - rgb1) * (vec3(1.0) - rgb2);" + property string blendModeSubtract: "result.rgb = max(rgb1 - rgb2, vec3(0.0));" + property string blendModeSoftLight: "result.rgb = rgb1 * ((1.0 - rgb1) * rgb2 + (1.0 - (1.0 - rgb1) * (1.0 - rgb2)));" + + property string fragmentShaderBegin: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D backgroundSource; + uniform lowp sampler2D foregroundSource; + + highp float RGBtoL(highp vec3 color) { + highp float cmin = min(color.r, min(color.g, color.b)); + highp float cmax = max(color.r, max(color.g, color.b)); + highp float l = (cmin + cmax) / 2.0; + return l; + } + + highp vec3 RGBtoHSL(highp vec3 color) { + highp float cmin = min(color.r, min(color.g, color.b)); + highp float cmax = max(color.r, max(color.g, color.b)); + highp float h = 0.0; + highp float s = 0.0; + highp float l = (cmin + cmax) / 2.0; + highp float diff = cmax - cmin; + + if (diff > 1.0 / 256.0) { + if (l < 0.5) + s = diff / (cmin + cmax); + else + s = diff / (2.0 - (cmin + cmax)); + + if (color.r == cmax) + h = (color.g - color.b) / diff; + else if (color.g == cmax) + h = 2.0 + (color.b - color.r) / diff; + else + h = 4.0 + (color.r - color.g) / diff; + + h /= 6.0; + } + return vec3(h, s, l); + } + + highp float hueToIntensity(highp float v1, highp float v2, highp float h) { + h = fract(h); + if (h < 1.0 / 6.0) + return v1 + (v2 - v1) * 6.0 * h; + else if (h < 1.0 / 2.0) + return v2; + else if (h < 2.0 / 3.0) + return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h); + + return v1; + } + + highp vec3 HSLtoRGB(highp vec3 color) { + highp float h = color.x; + highp float l = color.z; + highp float s = color.y; + + if (s < 1.0 / 256.0) + return vec3(l, l, l); + + highp float v1; + highp float v2; + if (l < 0.5) + v2 = l * (1.0 + s); + else + v2 = (l + s) - (s * l); + + v1 = 2.0 * l - v2; + + highp float d = 1.0 / 3.0; + highp float r = hueToIntensity(v1, v2, h + d); + highp float g = hueToIntensity(v1, v2, h); + highp float b = hueToIntensity(v1, v2, h - d); + return vec3(r, g, b); + } + + lowp float channelBlendHardLight(lowp float c1, lowp float c2) { + return c2 > 0.5 ? (1.0 - (1.0 - 2.0 * (c2 - 0.5)) * (1.0 - c1)) : (2.0 * c1 * c2); + } + + void main() { + lowp vec4 result = vec4(0.0); + lowp vec4 color1 = texture2D(backgroundSource, qt_TexCoord0); + lowp vec4 color2 = texture2D(foregroundSource, qt_TexCoord0); + lowp vec3 rgb1 = color1.rgb / max(1.0/256.0, color1.a); + lowp vec3 rgb2 = color2.rgb / max(1.0/256.0, color2.a); + highp float a = max(color1.a, color1.a * color2.a); + " + + property string fragmentShaderEnd: " + gl_FragColor.rgb = mix(rgb1, result.rgb, color2.a); + gl_FragColor.rbg *= a; + gl_FragColor.a = a; + gl_FragColor *= qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/BrightnessContrast.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/BrightnessContrast.qml new file mode 100644 index 00000000000..db53acbad46 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/BrightnessContrast.qml @@ -0,0 +1,207 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype BrightnessContrast + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-color + \brief Adjusts brightness and contrast. + + This effect adjusts the source item colors. + Brightness adjustment changes the perceived luminance of the source item. + Contrast adjustment increases or decreases the color + and brightness variations. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image BrightnessContrast_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet BrightnessContrast-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that provides the source pixels + for the effect. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines how much the source brightness is increased or + decreased. + + The value ranges from -1.0 to 1.0. By default, the property is set to \c + 0.0 (no change). + + \table + \header + \li Output examples with different brightness values + \li + \li + \row + \li \image BrightnessContrast_brightness1.png + \li \image BrightnessContrast_brightness2.png + \li \image BrightnessContrast_brightness3.png + \row + \li \b { brightness: -0.25 } + \li \b { brightness: 0 } + \li \b { brightness: 0.5 } + \row + \li \l contrast: 0 + \li \l contrast: 0 + \li \l contrast: 0 + \endtable + + */ + property real brightness: 0.0 + + /*! + This property defines how much the source contrast is increased or + decreased. The decrease of the contrast is linear, but the increase is + applied with a non-linear curve to allow very high contrast adjustment at + the high end of the value range. + + \table + \header + \li Contrast adjustment curve + \row + \li \image BrightnessContrast_contrast_graph.png + \endtable + + The value ranges from -1.0 to 1.0. By default, the property is set to \c 0.0 (no change). + + \table + \header + \li Output examples with different contrast values + \li + \li + \row + \li \image BrightnessContrast_contrast1.png + \li \image BrightnessContrast_contrast2.png + \li \image BrightnessContrast_contrast3.png + \row + \li \b { contrast: -0.5 } + \li \b { contrast: 0 } + \li \b { contrast: 0.5 } + \row + \li \l brightness: 0 + \li \l brightness: 0 + \li \l brightness: 0 + \endtable + + */ + property real contrast: 0.0 + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real brightness: rootItem.brightness + property real contrast: rootItem.contrast + + anchors.fill: parent + blending: !rootItem.cached + + fragmentShader: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp float brightness; + uniform highp float contrast; + void main() { + highp vec4 pixelColor = texture2D(source, qt_TexCoord0); + pixelColor.rgb /= max(1.0/256.0, pixelColor.a); + highp float c = 1.0 + contrast; + highp float contrastGainFactor = 1.0 + c * c * c * c * step(0.0, contrast); + pixelColor.rgb = ((pixelColor.rgb - 0.5) * (contrastGainFactor * contrast + 1.0)) + 0.5; + pixelColor.rgb = mix(pixelColor.rgb, vec3(step(0.0, brightness)), abs(brightness)); + gl_FragColor = vec4(pixelColor.rgb * pixelColor.a, pixelColor.a) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ColorOverlay.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ColorOverlay.qml new file mode 100644 index 00000000000..fedc0500df7 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ColorOverlay.qml @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype ColorOverlay + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-color + \brief Alters the colors of the source item by applying an overlay color. + + The effect is similar to what happens when a colorized glass is put on top + of a grayscale image. The color for the overlay is given in the RGBA format. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_butterfly.png + \li \image ColorOverlay_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet ColorOverlay-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that provides the source pixels + for the effect. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the RGBA color value which is used to colorize the + source. + + By default, the property is set to \c "transparent". + + \table + \header + \li Output examples with different color values + \li + \li + \row + \li \image ColorOverlay_color1.png + \li \image ColorOverlay_color2.png + \li \image ColorOverlay_color3.png + \row + \li \b { color: #80ff0000 } + \li \b { color: #8000ff00 } + \li \b { color: #800000ff } + \endtable + + */ + property color color: "transparent" + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property color color: rootItem.color + + anchors.fill: parent + + fragmentShader: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp vec4 color; + void main() { + highp vec4 pixelColor = texture2D(source, qt_TexCoord0); + gl_FragColor = vec4(mix(pixelColor.rgb/max(pixelColor.a, 0.00390625), color.rgb/max(color.a, 0.00390625), color.a) * pixelColor.a, pixelColor.a) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Colorize.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Colorize.qml new file mode 100644 index 00000000000..62e1312940b --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Colorize.qml @@ -0,0 +1,294 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype Colorize + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-color + \brief Sets the color in the HSL color space. + + The effect is similar to what happens when a colorized glass is put on top + of a grayscale image. Colorize uses the hue, saturation, and lightness (HSL) + color space. You can specify a desired value for each property. You can + shift all HSL values with the + \l{QtGraphicalEffects1::HueSaturation}{HueSaturation} effect. + + Alternatively, you can use the + \l{QtGraphicalEffects1::ColorOverlay}{ColorOverlay} effect to colorize the + source item in the RGBA color space. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image Colorize_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet Colorize-example.qml example +*/ +Item { + id: rootItem + + /*! + This property defines the source item that provides the source pixels + for the effect. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the hue value which is used to colorize the + source. + + The value ranges from 0.0 to 1.0. By default, the property is set to \c + 0.0, which produces a slightly red color. + + \table + \header + \li Allowed hue values + \row + \li \image Colorize_hue_scale.png + \endtable + + \table + \header + \li Output examples with different hue values + \li + \li + \row + \li \image Colorize_hue1.png + \li \image Colorize_hue2.png + \li \image Colorize_hue3.png + \row + \li \b { hue: 0.2 } + \li \b { hue: 0.5 } + \li \b { hue: 0.8 } + \row + \li \l saturation: 1 + \li \l saturation: 1 + \li \l saturation: 1 + \row + \li \l lightness: 0 + \li \l lightness: 0 + \li \l lightness: 0 + \endtable + */ + property real hue: 0.0 + + /*! + This property defines the saturation value which is used to colorize the + source. + + The value ranges from 0.0 (desaturated) to 1.0 (saturated). By default, + the property is set to \c 1.0 (saturated). + + \table + \header + \li Output examples with different saturation values + \li + \li + \row + \li \image Colorize_saturation1.png + \li \image Colorize_saturation2.png + \li \image Colorize_saturation3.png + \row + \li \b { saturation: 0 } + \li \b { saturation: 0.5 } + \li \b { saturation: 1 } + \row + \li \l hue: 0 + \li \l hue: 0 + \li \l hue: 0 + \row + \li \l lightness: 0 + \li \l lightness: 0 + \li \l lightness: 0 + \endtable + */ + property real saturation: 1.0 + + /*! + This property defines how much the source lightness value is increased + or decreased. + + Unlike hue and saturation properties, lightness does not set the used + value, but it shifts the existing source pixel lightness value. + + The value ranges from -1.0 (decreased) to 1.0 (increased). By default, + the property is set to \c 0.0 (no change). + + \table + \header + \li Output examples with different lightness values + \li + \li + \row + \li \image Colorize_lightness1.png + \li \image Colorize_lightness2.png + \li \image Colorize_lightness3.png + \row + \li \b { lightness: -0.75 } + \li \b { lightness: 0 } + \li \b { lightness: 0.75 } + \row + \li \l hue: 0 + \li \l hue: 0 + \li \l hue: 0 + \row + \li \l saturation: 1 + \li \l saturation: 1 + \li \l saturation: 1 + \endtable + */ + property real lightness: 0.0 + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real hue: rootItem.hue + property real saturation: rootItem.saturation + property real lightness: rootItem.lightness + + anchors.fill: parent + + fragmentShader: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp float hue; + uniform highp float saturation; + uniform highp float lightness; + + highp float RGBtoL(highp vec3 color) { + highp float cmin = min(color.r, min(color.g, color.b)); + highp float cmax = max(color.r, max(color.g, color.b)); + highp float l = (cmin + cmax) / 2.0; + return l; + } + + highp float hueToIntensity(highp float v1, highp float v2, highp float h) { + h = fract(h); + if (h < 1.0 / 6.0) + return v1 + (v2 - v1) * 6.0 * h; + else if (h < 1.0 / 2.0) + return v2; + else if (h < 2.0 / 3.0) + return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h); + + return v1; + } + + highp vec3 HSLtoRGB(highp vec3 color) { + highp float h = color.x; + highp float l = color.z; + highp float s = color.y; + + if (s < 1.0 / 256.0) + return vec3(l, l, l); + + highp float v1; + highp float v2; + if (l < 0.5) + v2 = l * (1.0 + s); + else + v2 = (l + s) - (s * l); + + v1 = 2.0 * l - v2; + + highp float d = 1.0 / 3.0; + highp float r = hueToIntensity(v1, v2, h + d); + highp float g = hueToIntensity(v1, v2, h); + highp float b = hueToIntensity(v1, v2, h - d); + return vec3(r, g, b); + } + + void main() { + lowp vec4 sample = texture2D(source, qt_TexCoord0); + sample = vec4(sample.rgb / max(1.0/256.0, sample.a), sample.a); + highp float light = RGBtoL(sample.rgb); + highp float c = step(0.0, lightness); + sample.rgb = HSLtoRGB(vec3(hue, saturation, mix(light, c, abs(lightness)))); + gl_FragColor = vec4(sample.rgb * sample.a, sample.a) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ConicalGradient.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ConicalGradient.qml new file mode 100644 index 00000000000..c2492f405ab --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ConicalGradient.qml @@ -0,0 +1,342 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype ConicalGradient + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-gradient + \brief Draws a conical gradient. + + A gradient is defined by two or more colors, which are blended seamlessly. + The colors start from the specified angle and end at 360 degrees larger + angle value. + + \table + \header + \li Effect applied + \row + \li \image ConicalGradient.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet ConicalGradient-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + /*! + This property defines the starting angle where the color at the gradient + position of 0.0 is rendered. Colors at larger position values are + rendered into larger angle values and blended seamlessly. Angle values + increase clockwise. + + \table + \header + \li Output examples with different angle values + \li + \li + \row + \li \image ConicalGradient_angle1.png + \li \image ConicalGradient_angle2.png + \li \image ConicalGradient_angle3.png + \row + \li \b { angle: 0 } + \li \b { angle: 45 } + \li \b { angle: 185 } + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \endtable + + */ + property real angle: 0.0 + + /*! + \qmlproperty real QtGraphicalEffects1::ConicalGradient::horizontalOffset + \qmlproperty real QtGraphicalEffects1::ConicalGradient::verticalOffset + + The horizontalOffset and verticalOffset properties define the offset in + pixels for the center point of the gradient compared to the item center. + + The value ranges from -inf to inf. By default, the properties are set to \c + 0. + + \table + \header + \li Output examples with different horizontalOffset values + \li + \li + \row + \li \image ConicalGradient_horizontalOffset1.png + \li \image ConicalGradient_horizontalOffset2.png + \li \image ConicalGradient_horizontalOffset3.png + \row + \li \b { horizontalOffset: -50 } + \li \b { horizontalOffset: 0 } + \li \b { horizontalOffset: 50 } + \row + \li \l angle: 0 + \li \l angle: 0 + \li \l angle: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \endtable + */ + property real horizontalOffset: 0.0 + property real verticalOffset: 0.0 + + /*! + This property defines the item that is going to be filled with gradient. + Source item gets rendered into an intermediate pixel buffer and the + alpha values from the result are used to determine the gradient's pixels + visibility in the display. The default value for source is undefined and + in that case whole effect area is filled with gradient. + + \table + \header + \li Output examples with different source values + \li + \row + \li \image ConicalGradient_maskSource1.png + \li \image ConicalGradient_maskSource2.png + \row + \li \b { source: undefined } + \li \b { source: } + \row + \li \l angle: 0 + \li \l angle: 0 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \endtable + + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + +/*! + A gradient is defined by two or more colors, which are blended seamlessly. + The colors are specified as a set of GradientStop child items, each of which + defines a position on the gradient (from 0.0 to 1.0), and a color. + The position of each GradientStop is defined by the position property. + The color is defined by the color property. + + \table + \header + \li Output examples with different gradient values + \li + \li + \row + \li \image ConicalGradient_gradient1.png + \li \image ConicalGradient_gradient2.png + \li \image ConicalGradient_gradient3.png + \row + \li \b {gradient:} \code +Gradient { + GradientStop { position: 0.000 + color: Qt.rgba(1, 0, 0, 1) } + GradientStop { position: 0.167; + color: Qt.rgba(1, 1, 0, 1) } + GradientStop { position: 0.333; + color: Qt.rgba(0, 1, 0, 1) } + GradientStop { position: 0.500; + color: Qt.rgba(0, 1, 1, 1) } + GradientStop { position: 0.667; + color: Qt.rgba(0, 0, 1, 1) } + GradientStop { position: 0.833; + color: Qt.rgba(1, 0, 1, 1) } + GradientStop { position: 1.000; + color: Qt.rgba(1, 0, 0, 1) } +} + \endcode + \li \b {gradient:} \code +Gradient { + GradientStop { position: 0.0 + color: "#F0F0F0" + } + GradientStop { position: 0.5 + color: "#000000" + } + GradientStop { position: 1.0 + color: "#F0F0F0" + } +} + \endcode + \li \b {gradient:} \code +Gradient { + GradientStop { position: 0.0 + color: "#00000000" + } + GradientStop { position: 1.0 + color: "#FF000000" + } +} + \endcode + \row + \li \l angle: 0 + \li \l angle: 0 + \li \l angle: 0 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \endtable + +*/ + property Gradient gradient: Gradient { + GradientStop { position: 0.0; color: "white" } + GradientStop { position: 1.0; color: "black" } + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.source + } + + Rectangle { + id: gradientRect + width: 16 + height: 256 + gradient: rootItem.gradient + smooth: true + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + rotation: shaderItem.rotation + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant gradientSource: ShaderEffectSource { + sourceItem: gradientRect + smooth: true + hideSource: true + visible: false + } + property variant maskSource: maskSourceProxy.output + property real startAngle: (rootItem.angle - 90) * Math.PI/180 + property variant center: Qt.point(0.5 + horizontalOffset / width, 0.5 + verticalOffset / height) + + anchors.fill: parent + + fragmentShader: maskSource == undefined ? noMaskShader : maskShader + + onFragmentShaderChanged: startAngleChanged() + + property string noMaskShader: " + varying mediump vec2 qt_TexCoord0; + uniform lowp sampler2D gradientSource; + uniform highp float qt_Opacity; + uniform highp float startAngle; + uniform highp vec2 center; + + void main() { + const highp float PI = 3.14159265; + const highp float PIx2inv = 0.1591549; + highp float a = (atan((center.y - qt_TexCoord0.t), (center.x - qt_TexCoord0.s)) + PI - startAngle) * PIx2inv; + gl_FragColor = texture2D(gradientSource, vec2(0.0, fract(a))) * qt_Opacity; + } + " + + property string maskShader: " + varying mediump vec2 qt_TexCoord0; + uniform lowp sampler2D gradientSource; + uniform lowp sampler2D maskSource; + uniform highp float qt_Opacity; + uniform highp float startAngle; + uniform highp vec2 center; + + void main() { + lowp float maskAlpha = texture2D(maskSource, qt_TexCoord0).a; + const highp float PI = 3.14159265; + const highp float PIx2inv = 0.1591549; + highp float a = (atan((center.y - qt_TexCoord0.t), (center.x - qt_TexCoord0.s)) + PI - startAngle) * PIx2inv; + gl_FragColor = texture2D(gradientSource, vec2(0.0, fract(a))) * maskAlpha * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Desaturate.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Desaturate.qml new file mode 100644 index 00000000000..a05cb59c32e --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Desaturate.qml @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype Desaturate + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-color + \brief Reduces the saturation of the colors. + + Desaturated pixel values are calculated as averages of the original RGB + component values of the source item. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image Desaturate_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet Desaturate-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that provides the source pixels to + the effect. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines how much the source colors are desaturated. + + The value ranges from 0.0 (no change) to 1.0 (desaturated). By default, + the property is set to \c 0.0 (no chnage). + + \table + \header + \li Output examples with different desaturation values + \li + \li + \row + \li \image Desaturate_desaturation1.png + \li \image Desaturate_desaturation2.png + \li \image Desaturate_desaturation3.png + \row + \li \b { desaturation: 0.0 } + \li \b { desaturation: 0.5 } + \li \b { desaturation: 1.0 } + \endtable + */ + property real desaturation: 0.0 + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real desaturation: rootItem.desaturation + + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp float desaturation; + void main(void) { + lowp vec4 textureColor = texture2D(source, qt_TexCoord0.st); + lowp float grayColor = (textureColor.r + textureColor.g + textureColor.b) / 3.0; + gl_FragColor = mix(textureColor, vec4(vec3(grayColor), textureColor.a), desaturation) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/DirectionalBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/DirectionalBlur.qml new file mode 100644 index 00000000000..248e0c5bfc1 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/DirectionalBlur.qml @@ -0,0 +1,289 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype DirectionalBlur + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-motion-blur + \brief Applies blur effect to the specified direction. + + Effect creates perceived impression that the source item appears to be + moving in the direction of the blur. Blur is applied to both sides of + each pixel, therefore setting the direction to 0 and 180 provides the + same result. + + Other available motionblur effects are \l{QtGraphicalEffects1::ZoomBlur}{ZoomBlur} and + \l{QtGraphicalEffects1::RadialBlur}{RadialBlur}. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image DirectionalBlur_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet DirectionalBlur-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be blurred. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the percieved amount of movement for each pixel. + The movement is divided evenly to both sides of each pixel. + + The quality of the blur depends on \l{DirectionalBlur::samples}{samples} + property. If length value is large, more samples are needed to keep the + visual quality at high level. + + The value ranges from 0.0 to inf. + By default the property is set to \c 0.0 (no blur). + + \table + \header + \li Output examples with different length values + \li + \li + \row + \li \image DirectionalBlur_length1.png + \li \image DirectionalBlur_length2.png + \li \image DirectionalBlur_length3.png + \row + \li \b { length: 0.0 } + \li \b { length: 32.0 } + \li \b { length: 48.0 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l angle: 0 + \li \l angle: 0 + \li \l angle: 0 + \endtable + + */ + property real length: 0.0 + + /*! + This property defines how many samples are taken per pixel when blur + calculation is done. Larger value produces better quality, but is slower + to render. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + Allowed values are between 0 and inf (practical maximum depends on GPU). + By default the property is set to \c 0 (no samples). + + */ + property int samples: 0 + + /*! + This property defines the direction for the blur. Blur is applied to + both sides of each pixel, therefore setting the direction to 0 and 180 + produces the same result. + + The value ranges from -180.0 to 180.0. + By default the property is set to \c 0.0. + + \table + \header + \li Output examples with different angle values + \li + \li + \row + \li \image DirectionalBlur_angle1.png + \li \image DirectionalBlur_angle2.png + \li \image DirectionalBlur_angle3.png + \row + \li \b { angle: 0.0 } + \li \b { angle: 45.0 } + \li \b { angle: 90.0 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l length: 32 + \li \l length: 32 + \li \l length: 32 + \endtable + + */ + property real angle: 0.0 + + /*! + This property defines the blur behavior near the edges of the item, + where the pixel blurring is affected by the pixels outside the source + edges. + + If the property is set to \c true, the pixels outside the source are + interpreted to be transparent, which is similar to OpenGL + clamp-to-border extension. The blur is expanded slightly outside the + effect item area. + + If the property is set to \c false, the pixels outside the source are + interpreted to contain the same color as the pixels at the edge of the + item, which is similar to OpenGL clamp-to-edge behavior. The blur does + not expand outside the effect item area. + + By default, the property is set to \c false. + + */ + property bool transparentBorder: false + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real len: rootItem.length + property bool transparentBorder: rootItem.transparentBorder + property real samples: rootItem.samples + property real weight: 1.0 / Math.max(1.0, rootItem.samples) + property variant expandPixels: transparentBorder ? Qt.size(rootItem.samples, rootItem.samples) : Qt.size(0,0) + property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0) + property variant delta: Qt.size(1.0 / rootItem.width * Math.cos((rootItem.angle + 90) * Math.PI/180), 1.0 / rootItem.height * Math.sin((rootItem.angle + 90) * Math.PI/180)) + + x: transparentBorder ? -expandPixels.width - 1: 0 + y: transparentBorder ? -expandPixels.height - 1 : 0 + width: transparentBorder ? parent.width + 2.0 * expandPixels.width + 2 : parent.width + height: transparentBorder ? parent.height + 2.0 * expandPixels.height + 2 : parent.height + + property string fragmentShaderSkeleton: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp float len; + uniform highp float samples; + uniform highp float weight; + uniform highp vec2 expand; + uniform highp vec2 delta; + + void main(void) { + highp vec2 shift = delta * len / max(1.0, samples - 1.0); + mediump vec2 texCoord = qt_TexCoord0; + gl_FragColor = vec4(0.0); + + PLACEHOLDER_EXPAND_STEPS + + texCoord -= shift * max(0.0, samples - 1.0) * 0.5; + + PLACEHOLDER_UNROLLED_LOOP + + gl_FragColor *= weight * qt_Opacity; + } + " + + function buildFragmentShader() { + var shader = fragmentShaderSkeleton + var expandSteps = "" + + if (transparentBorder) { + expandSteps += "texCoord = (texCoord - expand) / (1.0 - 2.0 * expand);" + } + + var unrolledLoop = "gl_FragColor += texture2D(source, texCoord);\n" + + if (rootItem.samples > 1) { + unrolledLoop = "" + for (var i = 0; i < rootItem.samples; i++) + unrolledLoop += "gl_FragColor += texture2D(source, texCoord); texCoord += shift;\n" + } + + shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps) + fragmentShader = shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop) + } + + onFragmentShaderChanged: sourceChanged() + onSamplesChanged: buildFragmentShader() + onTransparentBorderChanged: buildFragmentShader() + Component.onCompleted: buildFragmentShader() + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Displace.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Displace.qml new file mode 100644 index 00000000000..142ae10a033 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Displace.qml @@ -0,0 +1,217 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype Displace + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-distortion + \brief Moves the pixels of the source item according to the given + displacement map. + + \table + \header + \li Source + \li DisplacementSource + \li Effect applied + \row + \li \image Original_bug.png + \li \image Displace_map.png + \li \image Displace_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet Displace-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item for the pixels that are going to + be displaced according to the data from + \l{Displace::displacementSource}{displacementSource}. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the item that is going to be used as the + displacement map. The displacementSource item gets rendered into the + intermediate pixel buffer. The red and green component values from the + result determine the displacement of the pixels from the source item. + + The format for the displacement map is similar to the tangent space + normal maps, which can be created with most 3D-modeling tools. Many + image processing tools include the support for generating normal maps. + Alternatively, the displacement map for this effect can also be a QML + element which is colored appropriately. Like any QML element, it can be + animated. It is recommended that the size of the diplacement map matches + the size of the \l{Displace::source}{source}. + + The displace data is interpreted in the RGBA format. For every pixel: + the red channel stores the x-axis displacement, and the green channel + stores the y-axis displacement. Blue and alpha channels are ignored for + this effect. + + Assuming that red channel value 1.0 is fully red (0.0 having no red at + all), this effect considers pixel component value 0.5 to cause no + displacement at all. Values above 0.5 shift pixels to the left, values + below 0.5 do the shift to the right. In a similar way, green channel + values above 0.5 displace the pixels upwards, and values below 0.5 shift + the pixels downwards. The actual amount of displacement in pixels + depends on the \l displacement property. + + */ + property variant displacementSource + + /*! + This property defines the scale for the displacement. The bigger scale, + the bigger the displacement of the pixels. The value set to 0.0 causes + no displacement. + + The value ranges from -1.0 (inverted maximum shift, according to + displacementSource) to 1.0 (maximum shift, according to + displacementSource). By default, the property is set to \c 0.0 (no + displacement). + + \table + \header + \li Output examples with different displacement values + \li + \li + \row + \li \image Displace_displacement1.png + \li \image Displace_displacement2.png + \li \image Displace_displacement3.png + \row + \li \b { displacement: -0.2 } + \li \b { displacement: 0.0 } + \li \b { displacement: 0.2 } + \endtable + + */ + property real displacement: 0.0 + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + SourceProxy { + id: displacementSourceProxy + input: rootItem.displacementSource + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant displacementSource: displacementSourceProxy.output + property real displacement: rootItem.displacement + property real xPixel: 1.0/width + property real yPixel: 1.0/height + + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform lowp sampler2D displacementSource; + uniform highp float displacement; + uniform highp float xPixel; + uniform highp float yPixel; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main() { + lowp vec4 offset = texture2D(displacementSource, qt_TexCoord0); + offset.xy -= vec2(0.5, 0.5); + offset.xy = offset.xy * step(vec2(1.0/256.0), abs(offset.xy)); + highp vec2 tx = qt_TexCoord0 + (vec2(-offset.x, offset.y) * displacement); + + lowp float e1 = linearstep(0.0, xPixel, tx.x); + lowp float e2 = linearstep(0.0, yPixel, tx.y); + lowp float e3 = 1.0 - linearstep(1.0, 1.0 + xPixel, tx.x); + lowp float e4 = 1.0 - linearstep(1.0, 1.0 + yPixel, tx.y); + + lowp vec4 sample = texture2D(source, tx); + sample.rgb *= e1 * e2 * e3 * e4; + gl_FragColor = sample * qt_Opacity * offset.a; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/DropShadow.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/DropShadow.qml new file mode 100644 index 00000000000..b73e244cbcf --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/DropShadow.qml @@ -0,0 +1,403 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype DropShadow + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-drop-shadow + \brief Generates a colorized and blurred shadow image of the + source and places it behind the original, giving the impression that + source item is raised from the background. + + By default the effect produces a high quality shadow image, thus the + rendering speed of the shadow might not be the highest possible. The + rendering speed is reduced especially if the shadow edges are heavily + softened. + + For use cases that require faster rendering speed and for which the highest + possible visual quality is not necessary, property + \l{DropShadow::fast}{fast} can be set to true. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_butterfly.png + \li \image DropShadow_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet DropShadow-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be used as the + source for the generated shadow. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + Radius defines the softness of the shadow. A larger radius causes the + edges of the shadow to appear more blurry. + + Depending on the radius value, value of the + \l{DropShadow::samples}{samples} should be set to sufficiently large to + ensure the visual quality. + + The value ranges from 0.0 (no blur) to inf. By default, the property is + set to \c 0.0 (no blur). + + \table + \header + \li Output examples with different radius values + \li + \li + \row + \li \image DropShadow_radius1.png + \li \image DropShadow_radius2.png + \li \image DropShadow_radius3.png + \row + \li \b { radius: 0 } + \li \b { radius: 6 } + \li \b { radius: 12 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l color: #000000 + \li \l color: #000000 + \li \l color: #000000 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 20 + \li \l verticalOffset: 20 + \li \l verticalOffset: 20 + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \endtable + + */ + property real radius: 0.0 + + /*! + This property defines how many samples are taken per pixel when edge + softening blur calculation is done. Larger value produces better + quality, but is slower to render. + + Ideally, this value should be twice as large as the highest required + radius value, for example, if the radius is animated between 0.0 and + 4.0, samples should be set to 8. + + The value ranges from 0 to 32. By default, the property is set to \c 0. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + When \l{DropShadow::fast}{fast} property is set to true, this property + has no effect. + + */ + property int samples: 0 + + /*! + This property defines the RGBA color value which is used for the shadow. + + By default, the property is set to \c "black". + + \table + \header + \li Output examples with different color values + \li + \li + \row + \li \image DropShadow_color1.png + \li \image DropShadow_color2.png + \li \image DropShadow_color3.png + \row + \li \b { color: #000000 } + \li \b { color: #0000ff } + \li \b { color: #aa000000 } + \row + \li \l radius: 8 + \li \l radius: 8 + \li \l radius: 8 + \row + \li \l samples: 16 + \li \l samples: 16 + \li \l samples: 16 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 20 + \li \l verticalOffset: 20 + \li \l verticalOffset: 20 + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \endtable + + */ + property color color: "black" + + /*! + \qmlproperty real QtGraphicalEffects1::DropShadow::horizontalOffset + \qmlproperty real QtGraphicalEffects1::DropShadow::verticalOffset + + HorizontalOffset and verticalOffset properties define the offset for the + rendered shadow compared to the DropShadow item position. Often, the + DropShadow item is anchored so that it fills the source element. In this + case, if the HorizontalOffset and verticalOffset properties are set to + 0, the shadow is rendered exactly under the source item. By changing the + offset properties, the shadow can be positioned relatively to the source + item. + + The values range from -inf to inf. By default, the properties are set to + \c 0. + + \table + \header + \li Output examples with different horizontalOffset values + \li + \li + \row + \li \image DropShadow_horizontalOffset1.png + \li \image DropShadow_horizontalOffset2.png + \li \image DropShadow_horizontalOffset3.png + \row + \li \b { horizontalOffset: -20 } + \li \b { horizontalOffset: 0 } + \li \b { horizontalOffset: 20 } + \row + \li \l radius: 4 + \li \l radius: 4 + \li \l radius: 4 + \row + \li \l samples: 8 + \li \l samples: 8 + \li \l samples: 8 + \row + \li \l color: #000000 + \li \l color: #000000 + \li \l color: #000000 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \endtable + + */ + property real horizontalOffset: 0.0 + property real verticalOffset: 0.0 + + /*! + This property defines how large part of the shadow color is strenghtened + near the source edges. + + The value ranges from 0.0 to 1.0. By default, the property is set to \c + 0.5. + + \table + \header + \li Output examples with different spread values + \li + \li + \row + \li \image DropShadow_spread1.png + \li \image DropShadow_spread2.png + \li \image DropShadow_spread3.png + \row + \li \b { spread: 0.0 } + \li \b { spread: 0.5 } + \li \b { spread: 1.0 } + \row + \li \l radius: 8 + \li \l radius: 8 + \li \l radius: 8 + \row + \li \l samples: 16 + \li \l samples: 16 + \li \l samples: 16 + \row + \li \l color: #000000 + \li \l color: #000000 + \li \l color: #000000 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 20 + \li \l verticalOffset: 20 + \li \l verticalOffset: 20 + \endtable + + */ + property real spread: 0.0 + + /*! + This property selects the blurring algorithm that is used to produce the + softness for the effect. Setting this to true enables fast algorithm, + setting value to false produces higher quality result. + + By default, the property is set to \c false. + + \table + \header + \li Output examples with different fast values + \li + \li + \row + \li \image DropShadow_fast1.png + \li \image DropShadow_fast2.png + \row + \li \b { fast: false } + \li \b { fast: true } + \row + \li \l radius: 16 + \li \l radius: 16 + \row + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l color: #000000 + \li \l color: #000000 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 20 + \li \l verticalOffset: 20 + \row + \li \l spread: 0 + \li \l spread: 0 + \endtable + + */ + property bool fast: false + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. Every time the source or effect + properties are changed, the pixels in the cache must be updated. Memory + consumption is increased, because an extra buffer of memory is required + for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + property bool transparentBorder: false + + Loader { + x: rootItem.horizontalOffset + y: rootItem.verticalOffset + width: parent.width + height: parent.height + sourceComponent: rootItem.fast ? fastGlow : gaussianGlow + } + + Component { + id: gaussianGlow + GaussianGlow { + anchors.fill: parent + source: sourceProxy.output + radius: rootItem.radius + maximumRadius: rootItem.samples * 0.5 + color: rootItem.color + cached: rootItem.cached + spread: rootItem.spread + transparentBorder: rootItem.transparentBorder + } + } + + Component { + id: fastGlow + FastGlow { + anchors.fill: parent + source: sourceProxy.output + blur: Math.pow(rootItem.radius / 64.0, 0.4) + color: rootItem.color + cached: rootItem.cached + spread: rootItem.spread + transparentBorder: rootItem.transparentBorder + } + } + + SourceProxy { + id: sourceProxy + input: rootItem.source + sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) + } + ShaderEffect { + anchors.fill: parent + property variant source: sourceProxy.output + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/FastBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/FastBlur.qml new file mode 100644 index 00000000000..ca38ad2fbf3 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/FastBlur.qml @@ -0,0 +1,496 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype FastBlur + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-blur + \brief Applies a fast blur effect to one or more source items. + + FastBlur offers lower blur quality than + \l{QtGraphicalEffects1::GaussianBlur}{GaussianBlur}, but it is faster to + render. The FastBlur effect softens the source content by blurring it with + algorithm which uses the source content downscaling and bilinear filtering. + Use this effect in situations where the source content is rapidly changing + and the highest possible blur quality is not + needed. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image FastBlur_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet FastBlur-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be blurred. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the distance of the neighboring pixels which affect + the blurring of an individual pixel. A larger radius increases the blur + effect. FastBlur algorithm may internally reduce the accuracy of the radius in order to + provide good rendering performance. + + The value ranges from 0.0 (no blur) to inf. Visual quality of the blur is reduced when + radius exceeds value 64. By default, the property is set to \c 0.0 (no blur). + + \table + \header + \li Output examples with different blur values + \li + \li + \row + \li \image FastBlur_radius1.png + \li \image FastBlur_radius2.png + \li \image FastBlur_radius3.png + \row + \li \b { radius: 0 } + \li \b { radius: 32 } + \li \b { radius: 64 } + \endtable + */ + property real radius: 0.0 + + /*! + This property defines the blur behavior near the edges of the item, + where the pixel blurring is affected by the pixels outside the source + edges. + + If the property is set to \c true, the pixels outside the source are + interpreted to be transparent, which is similar to OpenGL + clamp-to-border extension. The blur is expanded slightly outside the + effect item area. + + If the property is set to \c false, the pixels outside the source are + interpreted to contain the same color as the pixels at the edge of the + item, which is similar to OpenGL clamp-to-edge behavior. The blur does + not expand outside the effect item area. + + By default, the property is set to \c false. + + \table + \header + \li Output examples with different transparentBorder values + \li + \li + \row + \li \image FastBlur_transparentBorder1.png + \li \image FastBlur_transparentBorder2.png + \row + \li \b { transparentBorder: false } + \li \b { transparentBorder: true } + \row + \li \l radius: 64 + \li \l radius: 64 + \endtable + */ + property bool transparentBorder: false + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + sourceItem: shaderItem + live: true + hideSource: visible + smooth: rootItem.radius > 0 + } + + /*! \internal */ + property string __internalBlurVertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_Matrix; + uniform highp float yStep; + uniform highp float xStep; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36); + qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep); + qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep); + qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36); + gl_Position = qt_Matrix * qt_Vertex; + } + " + + /*! \internal */ + property string __internalBlurFragmentShader: " + uniform lowp sampler2D source; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) + + texture2D(source, qt_TexCoord1) + + texture2D(source, qt_TexCoord2) + + texture2D(source, qt_TexCoord3)) * 0.25; + gl_FragColor = sourceColor * qt_Opacity; + } + " + + ShaderEffect { + id: level0 + property variant source: sourceProxy.output + anchors.fill: parent + visible: false + smooth: true + } + + ShaderEffectSource { + id: level1 + width: Math.ceil(shaderItem.width / 32) * 32 + height: Math.ceil(shaderItem.height / 32) * 32 + sourceItem: level0 + hideSource: rootItem.visible + sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0, 0, 0, 0) + visible: false + smooth: rootItem.radius > 0 + } + + ShaderEffect { + id: effect1 + property variant source: level1 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level2 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level2 + width: level1.width / 2 + height: level1.height / 2 + sourceItem: effect1 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect2 + property variant source: level2 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level3 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level3 + width: level2.width / 2 + height: level2.height / 2 + sourceItem: effect2 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect3 + property variant source: level3 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level4 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level4 + width: level3.width / 2 + height: level3.height / 2 + sourceItem: effect3 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect4 + property variant source: level4 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level5 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level5 + width: level4.width / 2 + height: level4.height / 2 + sourceItem: effect4 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect5 + property variant source: level5 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level6 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level6 + width: level5.width / 2 + height: level5.height / 2 + sourceItem: effect5 + hideSource: rootItem.visible + visible: false + smooth: true + } + + Item { + id: dummysource + width: 1 + height: 1 + visible: false + } + + ShaderEffectSource { + id: dummy + width: 1 + height: 1 + sourceItem: dummysource + visible: false + smooth: false + live: false + } + + ShaderEffect { + id: shaderItem + + property variant source1: level1 + property variant source2: level2 + property variant source3: level3 + property variant source4: level4 + property variant source5: level5 + property variant source6: level6 + property real lod: Math.sqrt(rootItem.radius / 64.0) * 1.2 - 0.2 + property real weight1 + property real weight2 + property real weight3 + property real weight4 + property real weight5 + property real weight6 + + x: transparentBorder ? -64 : 0 + y: transparentBorder ? -64 : 0 + width: transparentBorder ? parent.width + 128 : parent.width + height: transparentBorder ? parent.height + 128 : parent.height + + function weight(v) { + if (v <= 0.0) + return 1.0 + if (v >= 0.5) + return 0.0 + + return 1.0 - v * 2.0 + } + + function calculateWeights() { + + var w1 = weight(Math.abs(lod - 0.100)) + var w2 = weight(Math.abs(lod - 0.300)) + var w3 = weight(Math.abs(lod - 0.500)) + var w4 = weight(Math.abs(lod - 0.700)) + var w5 = weight(Math.abs(lod - 0.900)) + var w6 = weight(Math.abs(lod - 1.100)) + + var sum = w1 + w2 + w3 + w4 + w5 + w6; + weight1 = w1 / sum; + weight2 = w2 / sum; + weight3 = w3 / sum; + weight4 = w4 / sum; + weight5 = w5 / sum; + weight6 = w6 / sum; + + upateSources() + } + + function upateSources() { + var sources = new Array(); + var weights = new Array(); + + if (weight1 > 0) { + sources.push(level1) + weights.push(weight1) + } + + if (weight2 > 0) { + sources.push(level2) + weights.push(weight2) + } + + if (weight3 > 0) { + sources.push(level3) + weights.push(weight3) + } + + if (weight4 > 0) { + sources.push(level4) + weights.push(weight4) + } + + if (weight5 > 0) { + sources.push(level5) + weights.push(weight5) + } + + if (weight6 > 0) { + sources.push(level6) + weights.push(weight6) + } + + for (var j = sources.length; j < 6; j++) { + sources.push(dummy) + weights.push(0.0) + } + + source1 = sources[0] + source2 = sources[1] + source3 = sources[2] + source4 = sources[3] + source5 = sources[4] + source6 = sources[5] + + weight1 = weights[0] + weight2 = weights[1] + weight3 = weights[2] + weight4 = weights[3] + weight5 = weights[4] + weight6 = weights[5] + } + + Component.onCompleted: calculateWeights() + + onLodChanged: calculateWeights() + + fragmentShader: " + uniform lowp sampler2D source1; + uniform lowp sampler2D source2; + uniform lowp sampler2D source3; + uniform lowp sampler2D source4; + uniform lowp sampler2D source5; + uniform mediump float weight1; + uniform mediump float weight2; + uniform mediump float weight3; + uniform mediump float weight4; + uniform mediump float weight5; + uniform lowp float qt_Opacity; + varying mediump vec2 qt_TexCoord0; + + void main() { + lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1; + sourceColor += texture2D(source2, qt_TexCoord0) * weight2; + sourceColor += texture2D(source3, qt_TexCoord0) * weight3; + sourceColor += texture2D(source4, qt_TexCoord0) * weight4; + sourceColor += texture2D(source5, qt_TexCoord0) * weight5; + gl_FragColor = sourceColor * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/GammaAdjust.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/GammaAdjust.qml new file mode 100644 index 00000000000..7a597dd05e1 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/GammaAdjust.qml @@ -0,0 +1,193 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype GammaAdjust + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-color + \brief Alters the luminance of the source item. + + GammaAdjust is applied to each pixel according to the curve which is + pre-defined as a power-law expression, where the property gamma is used as the + reciprocal scaling exponent. Refer to the property documentation of \l{GammaAdjust::gamma}{gamma} + for more details. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image GammaAdjust_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet GammaAdjust-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item for which the luminance is going to be + adjusted. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the change factor for how the luminance of each pixel + is altered according to the equation: + + \code +luminance = pow(original_luminance, 1.0 / gamma); // The luminance is assumed to be between 0.0 and 1.0 + \endcode + + Setting the gamma values under 1.0 makes the image darker, the values + above 1.0 lighten it. + + The value ranges from 0.0 (darkest) to inf (lightest). By default, the + property is set to \c 1.0 (no change). + + \table + \header + \li Output examples with different gamma values + \li + \li + \row + \li \image GammaAdjust_gamma1.png + \li \image GammaAdjust_gamma2.png + \li \image GammaAdjust_gamma3.png + \row + \li \b { gamma: 0.5 } + \li \b { gamma: 1.0 } + \li \b { gamma: 2.0 } + \endtable + + \table + \header + \li Pixel luminance curves of the above images. + \li + \li + \row + \li \image GammaAdjust_gamma1_graph.png + \li \image GammaAdjust_gamma2_graph.png + \li \image GammaAdjust_gamma3_graph.png + \row + \li Red curve: default gamma (1.0) + \li + \li + \row + \li Yellow curve: effect applied + \li + \li + \row + \li X-axis: pixel original luminance + \li + \li + \row + \li Y-axis: pixel luminance with effect applied + \li + \li + \endtable + + */ + property real gamma: 1.0 + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real gamma: 1.0 / Math.max(rootItem.gamma, 0.0001) + + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp float gamma; + void main(void) { + highp vec4 originalColor = texture2D(source, qt_TexCoord0.st); + originalColor.rgb = originalColor.rgb / max(1.0/256.0, originalColor.a); + highp vec3 adjustedColor = pow(originalColor.rgb, vec3(gamma)); + gl_FragColor = vec4(adjustedColor * originalColor.a, originalColor.a) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/GaussianBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/GaussianBlur.qml new file mode 100644 index 00000000000..4000179ef7e --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/GaussianBlur.qml @@ -0,0 +1,295 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype GaussianBlur + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-blur + \brief Applies a higher quality blur effect. + + GaussianBlur effect softens the image by blurring it with an algorithm that + uses the Gaussian function to calculate the effect. The effect produces + higher quality than \l{QtGraphicalEffects1::FastBlur}{FastBlur}, but is + slower to render. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image GaussianBlur_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet GaussianBlur-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be blurred. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the distance of the neighboring pixels which + affect the blurring of an individual pixel. A larger radius increases + the blur effect. + + Depending on the radius value, value of the + \l{GaussianBlur::samples}{samples} should be set to sufficiently large + to ensure the visual quality. + + The value ranges from 0.0 (no blur) to inf. By default, the property is + set to \c 0.0 (no blur). + + \table + \header + \li Output examples with different radius values + \li + \li + \row + \li \image GaussianBlur_radius1.png + \li \image GaussianBlur_radius2.png + \li \image GaussianBlur_radius3.png + \row + \li \b { radius: 0 } + \li \b { radius: 4 } + \li \b { radius: 8 } + \row + \li \l samples: 16 + \li \l samples: 16 + \li \l samples: 16 + \row + \li \l deviation: 3 + \li \l deviation: 3 + \li \l deviation: 3 + \endtable + + */ + property real radius: 0.0 + + /*! + This property defines how many samples are taken per pixel when blur + calculation is done. Larger value produces better quality, but is slower + to render. + + Ideally, this value should be twice as large as the highest required + radius value, for example, if the radius is animated between 0.0 and + 4.0, samples should be set to 8. + + The value ranges from 0 to 32. By default, the property is set to \c 0. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + */ + property int samples: 0 + + /*! + This property is a parameter to the gaussian function that is used when + calculating neighboring pixel weights for the blurring. A larger + deviation causes image to appear more blurry, but it also reduces the + quality of the blur. A very large deviation value causes the effect to + look a bit similar to what, for exmple, a box blur algorithm produces. A + too small deviation values makes the effect insignificant for the pixels + near the radius. + + \inlineimage GaussianBlur_deviation_graph.png + \caption The image above shows the Gaussian function with two different + deviation values, yellow (1) and cyan (2.7). The y-axis shows the + weights, the x-axis shows the pixel distance. + + The value ranges from 0.0 (no deviation) to inf (maximum deviation). By + default, devaition is binded to radius. When radius increases, deviation + is automatically increased linearly. With the radius value of 8, the + deviation default value becomes approximately 2.7034. This value + produces a compromise between the blur quality and overall blurriness. + + \table + \header + \li Output examples with different deviation values + \li + \li + \row + \li \image GaussianBlur_deviation1.png + \li \image GaussianBlur_deviation2.png + \li \image GaussianBlur_deviation3.png + \row + \li \b { deviation: 1 } + \li \b { deviation: 2 } + \li \b { deviation: 4 } + \row + \li \l radius: 8 + \li \l radius: 8 + \li \l radius: 8 + \row + \li \l samples: 16 + \li \l samples: 16 + \li \l samples: 16 + \endtable + + */ + property real deviation: (radius + 1) / 3.3333 + + /*! + This property defines the blur behavior near the edges of the item, + where the pixel blurring is affected by the pixels outside the source + edges. + + If the property is set to \c true, the pixels outside the source are + interpreted to be transparent, which is similar to OpenGL + clamp-to-border extension. The blur is expanded slightly outside the + effect item area. + + If the property is set to \c false, the pixels outside the source are + interpreted to contain the same color as the pixels at the edge of the + item, which is similar to OpenGL clamp-to-edge behavior. The blur does + not expand outside the effect item area. + + By default, the property is set to \c false. + + \table + \header + \li Output examples with different transparentBorder values + \li + \li + \row + \li \image GaussianBlur_transparentBorder1.png + \li \image GaussianBlur_transparentBorder2.png + \row + \li \b { transparentBorder: false } + \li \b { transparentBorder: true } + \row + \li \l radius: 8 + \li \l radius: 8 + \row + \li \l samples: 16 + \li \l samples: 16 + \row + \li \l deviation: 2.7 + \li \l deviation: 2.7 + \endtable + + */ + property bool transparentBorder: false + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: verticalBlur + visible: rootItem.cached + smooth: true + sourceItem: verticalBlur + live: true + hideSource: visible + } + + GaussianDirectionalBlur { + id: verticalBlur + x: transparentBorder ? -maximumRadius - 1 : 0 + y: transparentBorder ? -maximumRadius - 1 : 0 + width: horizontalBlur.width + height: horizontalBlur.height + + horizontalStep: 0.0 + verticalStep: 1.0 / parent.height + + source: ShaderEffectSource { + id: horizontalBlurSource + sourceItem: horizontalBlur + hideSource: true + visible: false + smooth: true + } + + deviation: rootItem.deviation + radius: rootItem.radius + maximumRadius: rootItem.samples * 0.5 + transparentBorder: rootItem.transparentBorder + } + + GaussianDirectionalBlur { + id: horizontalBlur + width: transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width + height: transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height + + horizontalStep: 1.0 / parent.width + verticalStep: 0.0 + + source: sourceProxy.output + deviation: rootItem.deviation + radius: rootItem.radius + maximumRadius: rootItem.samples / 2.0 + transparentBorder: rootItem.transparentBorder + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Glow.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Glow.qml new file mode 100644 index 00000000000..c5a82c6f1e9 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/Glow.qml @@ -0,0 +1,307 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype Glow + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-glow + \brief Generates a blurred and colorized image of the source and places it + behind the original, giving impression that the source is glowing. + + By default effect produces a high quality glow image, thus the rendering + speed of the effect may not be the highest possible. The rendering speed is + reduced especially if the glow edges are heavily softened. For use cases + that require faster rendering speed and the highest possible visual quality + is not necessary, property \l{Glow::fast}{fast} can be set to true. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_butterfly_black.png + \li \image Glow_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet Glow-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be used as source + for the generated glow. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + Radius defines the softness of the glow. A larger radius causes the + edges of the glow to appear more blurry. + + Depending on the radius value, value of the \l{Glow::samples}{samples} + should be set to sufficiently large to ensure the visual quality. + + The value ranges from 0.0 (no blur) to inf. By default, the property is + set to \c 0.0 (no blur). + + \table + \header + \li Output examples with different radius values + \li + \li + \row + \li \image Glow_radius1.png + \li \image Glow_radius2.png + \li \image Glow_radius3.png + \row + \li \b { radius: 0 } + \li \b { radius: 6 } + \li \b { radius: 12 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l color: #ffffff + \li \l color: #ffffff + \li \l color: #ffffff + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \endtable + */ + property real radius: 0.0 + + /*! + This property defines how many samples are taken per pixel when edge + softening blur calculation is done. Larger value produces better + quality, but is slower to render. + + Ideally, this value should be twice as large as the highest required + radius value, for example, if the radius is animated between 0.0 and + 4.0, samples should be set to 8. + + The value ranges from 0 to 32. By default, the property is set to \c 0. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + When \l fast property is set to true, this property has no effect. + + */ + property int samples: 0 + + /*! + This property defines how large part of the glow color is strenghtened + near the source edges. + + The values range from 0.0 to 1.0. By default, the property is set to \c + 0.5. + + \table + \header + \li Output examples with different spread values + \li + \li + \row + \li \image Glow_spread1.png + \li \image Glow_spread2.png + \li \image Glow_spread3.png + \row + \li \b { spread: 0.0 } + \li \b { spread: 0.5 } + \li \b { spread: 1.0 } + \row + \li \l radius: 8 + \li \l radius: 8 + \li \l radius: 8 + \row + \li \l samples: 16 + \li \l samples: 16 + \li \l samples: 16 + \row + \li \l color: #ffffff + \li \l color: #ffffff + \li \l color: #ffffff + \endtable + */ + property real spread: 0.0 + + /*! + This property defines the RGBA color value which is used for the glow. + + By default, the property is set to \c "white". + + \table + \header + \li Output examples with different color values + \li + \li + \row + \li \image Glow_color1.png + \li \image Glow_color2.png + \li \image Glow_color3.png + \row + \li \b { color: #ffffff } + \li \b { color: #00ff00 } + \li \b { color: #aa00ff00 } + \row + \li \l radius: 8 + \li \l radius: 8 + \li \l radius: 8 + \row + \li \l samples: 16 + \li \l samples: 16 + \li \l samples: 16 + \row + \li \l spread: 0.5 + \li \l spread: 0.5 + \li \l spread: 0.5 + \endtable + + */ + property color color: "white" + + /*! + This property selects the blurring algorithm that is used to produce the + softness for the effect. Setting this to true enables fast algorithm, + setting value to false produces higher quality result. + + By default, the property is set to \c false. + + \table + \header + \li Output examples with different fast values + \li + \li + \row + \li \image Glow_fast1.png + \li \image Glow_fast2.png + \row + \li \b { fast: false } + \li \b { fast: true } + \row + \li \l radius: 16 + \li \l radius: 16 + \row + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l color: #ffffff + \li \l color: #ffffff + \row + \li \l spread: 0.3 + \li \l spread: 0.3 + \endtable + */ + property bool fast: false + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + property bool transparentBorder: false + + Loader { + anchors.fill: parent + sourceComponent: rootItem.fast ? fastGlow : gaussianGlow + } + + Component { + id: gaussianGlow + GaussianGlow { + anchors.fill: parent + source: sourceProxy.output + radius: rootItem.radius + maximumRadius: rootItem.samples * 0.5 + color: rootItem.color + cached: rootItem.cached + spread: rootItem.spread + transparentBorder: rootItem.transparentBorder + } + } + + Component { + id: fastGlow + FastGlow { + anchors.fill: parent + source: sourceProxy.output + blur: Math.pow(rootItem.radius / 64.0, 0.4) + color: rootItem.color + cached: rootItem.cached + spread: rootItem.spread + transparentBorder: rootItem.transparentBorder + } + } + + SourceProxy { + id: sourceProxy + input: rootItem.source + sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) + } + ShaderEffect { + anchors.fill: parent + property variant source: sourceProxy.output + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/HueSaturation.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/HueSaturation.qml new file mode 100644 index 00000000000..fb1d895959b --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/HueSaturation.qml @@ -0,0 +1,300 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype HueSaturation + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-color + \brief Alters the source item colors in the HSL color space. + + HueSaturation is similar to the \l{QtGraphicalEffects1::Colorize}{Colorize} + effect, but the hue and saturation property values are handled differently. + The HueSaturation effect always shifts the hue, saturation, and lightness + from the original, instead of setting them. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image HueSaturation_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet HueSaturation-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that provides the source pixels + for the effect. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source: 0 + + /*! + This property defines the hue value which is added to the source hue + value. + + The value ranges from -1.0 (decrease) to 1.0 (increase). By default, the + property is set to \c 0.0 (no change). + + \table + \header + \li Output examples with different hue values + \li + \li + \row + \li \image HueSaturation_hue1.png + \li \image HueSaturation_hue2.png + \li \image HueSaturation_hue3.png + \row + \li \b { hue: -0.3 } + \li \b { hue: 0.0 } + \li \b { hue: 0.3 } + \row + \li \l saturation: 0 + \li \l saturation: 0 + \li \l saturation: 0 + \row + \li \l lightness: 0 + \li \l lightness: 0 + \li \l lightness: 0 + \endtable + + */ + property real hue: 0.0 + + /*! + This property defines the saturation value value which is added to the + source saturation value. + + The value ranges from -1.0 (decrease) to 1.0 (increase). By default, the + property is set to \c 0.0 (no change). + + \table + \header + \li Output examples with different saturation values + \li + \li + \row + \li \image HueSaturation_saturation1.png + \li \image HueSaturation_saturation2.png + \li \image HueSaturation_saturation3.png + \row + \li \b { saturation: -0.8 } + \li \b { saturation: 0.0 } + \li \b { saturation: 1.0 } + \row + \li \l hue: 0 + \li \l hue: 0 + \li \l hue: 0 + \row + \li \l lightness: 0 + \li \l lightness: 0 + \li \l lightness: 0 + \endtable + + */ + property real saturation: 0.0 + + /*! + This property defines the lightness value which is added to the source + saturation value. + + The value ranges from -1.0 (decrease) to 1.0 (increase). By default, the + property is set to \c 0.0 (no change). + + \table + \header + \li Output examples with different lightness values + \li + \li + \row + \li \image HueSaturation_lightness1.png + \li \image HueSaturation_lightness2.png + \li \image HueSaturation_lightness3.png + \row + \li \b { lightness: -0.5 } + \li \b { lightness: 0.0 } + \li \b { lightness: 0.5 } + \row + \li \l hue: 0 + \li \l hue: 0 + \li \l hue: 0 + \row + \li \l saturation: 0 + \li \l saturation: 0 + \li \l saturation: 0 + \endtable + + */ + property real lightness: 0.0 + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant hsl: Qt.vector3d(rootItem.hue, rootItem.saturation, rootItem.lightness) + + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform highp sampler2D source; + uniform highp vec3 hsl; + + highp vec3 RGBtoHSL(highp vec3 color) { + highp float cmin = min(color.r, min(color.g, color.b)); + highp float cmax = max(color.r, max(color.g, color.b)); + highp float h = 0.0; + highp float s = 0.0; + highp float l = (cmin + cmax) / 2.0; + highp float diff = cmax - cmin; + + if (diff > 1.0 / 256.0) { + if (l < 0.5) + s = diff / (cmin + cmax); + else + s = diff / (2.0 - (cmin + cmax)); + + if (color.r == cmax) + h = (color.g - color.b) / diff; + else if (color.g == cmax) + h = 2.0 + (color.b - color.r) / diff; + else + h = 4.0 + (color.r - color.g) / diff; + + h /= 6.0; + } + return vec3(h, s, l); + } + + highp float hueToIntensity(highp float v1, highp float v2, highp float h) { + h = fract(h); + if (h < 1.0 / 6.0) + return v1 + (v2 - v1) * 6.0 * h; + else if (h < 1.0 / 2.0) + return v2; + else if (h < 2.0 / 3.0) + return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h); + + return v1; + } + + highp vec3 HSLtoRGB(highp vec3 color) { + highp float h = color.x; + highp float l = color.z; + highp float s = color.y; + + if (s < 1.0 / 256.0) + return vec3(l); + + highp float v1; + highp float v2; + if (l < 0.5) + v2 = l * (1.0 + s); + else + v2 = (l + s) - (s * l); + + v1 = 2.0 * l - v2; + + highp float d = 1.0 / 3.0; + highp float r = hueToIntensity(v1, v2, h + d); + highp float g = hueToIntensity(v1, v2, h); + highp float b = hueToIntensity(v1, v2, h - d); + return vec3(r, g, b); + } + + void main() { + lowp vec4 sample = texture2D(source, qt_TexCoord0); + sample = vec4(sample.rgb / max(1.0/256.0, sample.a), sample.a); + sample.rgb = mix(vec3(dot(sample.rgb, vec3(0.2125, 0.7154, 0.0721))), sample.rgb, 1.0 + hsl.y); + sample.xyz = RGBtoHSL(sample.rgb); + sample.rgb = HSLtoRGB(vec3(sample.x + hsl.x, sample.y, sample.z)); + highp float c = step(0.0, hsl.z); + sample.rgb = mix(sample.rgb, vec3(c), abs(hsl.z)); + gl_FragColor = vec4(sample.rgb * sample.a, sample.a) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/InnerShadow.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/InnerShadow.qml new file mode 100644 index 00000000000..5eebc6fa3b0 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/InnerShadow.qml @@ -0,0 +1,385 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype InnerShadow + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-drop-shadow + \brief Generates a colorized and blurred shadow inside the + source. + + By default the effect produces a high quality shadow image, thus the + rendering speed of the shadow might not be the highest possible. The + rendering speed is reduced especially if the shadow edges are heavily + softened. For use cases that require faster rendering speed and for which + the highest possible visual quality is not necessary, property + \l{InnerShadow::fast}{fast} can be set to true. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_butterfly.png + \li \image InnerShadow_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet InnerShadow-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be used as the + source for the generated shadow. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + Radius defines the softness of the shadow. A larger radius causes the + edges of the shadow to appear more blurry. + + Depending on the radius value, value of the + \l{InnerShadow::samples}{samples} should be set to sufficiently large to + ensure the visual quality. + + The value ranges from 0.0 (no blur) to inf. By default, the property is + set to \c 0.0 (no blur). + + \table + \header + \li Output examples with different radius values + \li + \li + \row + \li \image InnerShadow_radius1.png + \li \image InnerShadow_radius2.png + \li \image InnerShadow_radius3.png + \row + \li \b { radius: 0 } + \li \b { radius: 6 } + \li \b { radius: 12 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l color: #000000 + \li \l color: #000000 + \li \l color: #000000 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \endtable + + */ + property real radius: 0.0 + + /*! + This property defines how many samples are taken per pixel when edge + softening blur calculation is done. Larger value produces better + quality, but is slower to render. + + Ideally, this value should be twice as large as the highest required + radius value, for example, if the radius is animated between 0.0 and + 4.0, samples should be set to 8. + + The value ranges from 0 to 32. By default, the property is set to \c 0. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + When \l{InnerShadow::fast}{fast} property is set to true, this property + has no effect. + + */ + property int samples: 0 + + /*! + This property defines how large part of the shadow color is strenghtened + near the source edges. + + The value ranges from 0.0 to 1.0. By default, the property is set to \c + 0.5. + + \table + \header + \li Output examples with different spread values + \li + \li + \row + \li \image InnerShadow_spread1.png + \li \image InnerShadow_spread2.png + \li \image InnerShadow_spread3.png + \row + \li \b { spread: 0.0 } + \li \b { spread: 0.3 } + \li \b { spread: 0.5 } + \row + \li \l radius: 16 + \li \l radius: 16 + \li \l radius: 16 + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l color: #000000 + \li \l color: #000000 + \li \l color: #000000 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \endtable + + */ + property real spread: 0.0 + + /*! + This property defines the RGBA color value which is used for the shadow. + + By default, the property is set to \c "black". + + \table + \header + \li Output examples with different color values + \li + \li + \row + \li \image InnerShadow_color1.png + \li \image InnerShadow_color2.png + \li \image InnerShadow_color3.png + \row + \li \b { color: #000000 } + \li \b { color: #ffffff } + \li \b { color: #ff0000 } + \row + \li \l radius: 16 + \li \l radius: 16 + \li \l radius: 16 + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l spread: 0.2 + \li \l spread: 0.2 + \li \l spread: 0.2 + \endtable + */ + property color color: "black" + + /*! + \qmlproperty real QtGraphicalEffects1::InnerShadow::horizontalOffset + \qmlproperty real QtGraphicalEffects1::InnerShadow::verticalOffset + + HorizontalOffset and verticalOffset properties define the offset for the + rendered shadow compared to the InnerShadow item position. Often, the + InnerShadow item is anchored so that it fills the source element. In + this case, if the HorizontalOffset and verticalOffset properties are set + to 0, the shadow is rendered fully inside the source item. By changing + the offset properties, the shadow can be positioned relatively to the + source item. + + The values range from -inf to inf. By default, the properties are set to + \c 0. + + \table + \header + \li Output examples with different horizontalOffset values + \li + \li + \row + \li \image InnerShadow_horizontalOffset1.png + \li \image InnerShadow_horizontalOffset2.png + \li \image InnerShadow_horizontalOffset3.png + \row + \li \b { horizontalOffset: -20 } + \li \b { horizontalOffset: 0 } + \li \b { horizontalOffset: 20 } + \row + \li \l radius: 16 + \li \l radius: 16 + \li \l radius: 16 + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l color: #000000 + \li \l color: #000000 + \li \l color: #000000 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \endtable + + */ + property real horizontalOffset: 0 + property real verticalOffset: 0 + + /*! + This property selects the blurring algorithm that is used to produce the + softness for the effect. Setting this to true enables fast algorithm, + setting value to false produces higher quality result. + + By default, the property is set to \c false. + + \table + \header + \li Output examples with different fast values + \li + \li + \row + \li \image InnerShadow_fast1.png + \li \image InnerShadow_fast2.png + \row + \li \b { fast: false } + \li \b { fast: true } + \row + \li \l radius: 16 + \li \l radius: 16 + \row + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l color: #000000 + \li \l color: #000000 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l spread: 0.2 + \li \l spread: 0.2 + \endtable + */ + property bool fast: false + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. Every time the source or effect + properties are changed, the pixels in the cache must be updated. Memory + consumption is increased, because an extra buffer of memory is required + for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + Loader { + anchors.fill: parent + sourceComponent: rootItem.fast ? innerShadow : gaussianInnerShadow + } + + Component { + id: gaussianInnerShadow + GaussianInnerShadow { + anchors.fill: parent + source: rootItem.source + radius: rootItem.radius + maximumRadius: rootItem.samples * 0.5 + color: rootItem.color + cached: rootItem.cached + spread: rootItem.spread + horizontalOffset: rootItem.horizontalOffset + verticalOffset: rootItem.verticalOffset + } + } + + Component { + id: innerShadow + FastInnerShadow { + anchors.fill: parent + source: rootItem.source + blur: Math.pow(rootItem.radius / 64.0, 0.4) + color: rootItem.color + cached: rootItem.cached + spread: rootItem.spread + horizontalOffset: rootItem.horizontalOffset + verticalOffset: rootItem.verticalOffset + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/LevelAdjust.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/LevelAdjust.qml new file mode 100644 index 00000000000..5d739fb941c --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/LevelAdjust.qml @@ -0,0 +1,472 @@ +/***************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Add-On Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype LevelAdjust + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-color + \brief Adjusts color levels in the RGBA color space. + + This effect adjusts the source item colors separately for each color + channel. Source item contrast can be adjusted and color balance altered. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_butterfly.png + \li \image LevelAdjust_butterfly.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet LevelAdjust-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that provides the source pixels + for the effect. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the change factor for how the value of each pixel + color channel is altered according to the equation: + + \code result.rgb = pow(original.rgb, 1.0 / gamma.rgb); \endcode + + Setting the gamma values under QtVector3d(1.0, 1.0, 1.0) makes the image + darker, the values above QtVector3d(1.0, 1.0, 1.0) lighten it. + + The value ranges from QtVector3d(0.0, 0.0, 0.0) (darkest) to inf + (lightest). By default, the property is set to \c QtVector3d(1.0, 1.0, + 1.0) (no change). + + \table + \header + \li Output examples with different gamma values + \li + \li + \row + \li \image LevelAdjust_gamma1.png + \li \image LevelAdjust_gamma2.png + \li \image LevelAdjust_gamma3.png + \row + \li \b { gamma: Qt.vector3d(1.0, 1.0, 1.0) } + \li \b { gamma: Qt.vector3d(1.0, 0.4, 2.0) } + \li \b { gamma: Qt.vector3d(1.0, 0.1, 4.0) } + \row + \li \l minimumInput: #000000 + \li \l minimumInput: #000000 + \li \l minimumInput: #000000 + \row + \li \l maximumInput: #ffffff + \li \l maximumInput: #ffffff + \li \l maximumInput: #ffffff + \row + \li \l minimumOutput: #000000 + \li \l minimumOutput: #000000 + \li \l minimumOutput: #000000 + \row + \li \l maximumOutput: #ffffff + \li \l maximumOutput: #ffffff + \li \l maximumOutput: #ffffff + \endtable + + \table + \header + \li Pixel color channel luminance curves of the above images. + \li + \li + \row + \li \image LevelAdjust_default_curve.png + \li \image LevelAdjust_gamma2_curve.png + \li \image LevelAdjust_gamma3_curve.png + \row + \li X-axis: pixel original luminance + \li + \li + \row + \li Y-axis: color channel luminance with effect applied + \li + \li + \endtable + */ + property variant gamma: Qt.vector3d(1.0, 1.0, 1.0) + + /*! + This property defines the minimum input level for each color channel. It + sets the black-point, all pixels having lower value than this property + are rendered as black (per color channel). Increasing the value darkens + the dark areas. + + The value ranges from "#00000000" to "#ffffffff". By default, the + property is set to \c "#00000000" (no change). + + \table + \header + \li Output examples with different minimumInput values + \li + \li + \row + \li \image LevelAdjust_minimumInput1.png + \li \image LevelAdjust_minimumInput2.png + \li \image LevelAdjust_minimumInput3.png + \row + \li \b { minimumInput: #00000000 } + \li \b { minimumInput: #00000040 } + \li \b { minimumInput: #00000070 } + \row + \li \l maximumInput: #ffffff + \li \l maximumInput: #ffffff + \li \l maximumInput: #ffffff + \row + \li \l minimumOutput: #000000 + \li \l minimumOutput: #000000 + \li \l minimumOutput: #000000 + \row + \li \l maximumOutput: #ffffff + \li \l maximumOutput: #ffffff + \li \l maximumOutput: #ffffff + \row + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \endtable + + \table + \header + \li Pixel color channel luminance curves of the above images. + \li + \li + \row + \li \image LevelAdjust_default_curve.png + \li \image LevelAdjust_minimumInput2_curve.png + \li \image LevelAdjust_minimumInput3_curve.png + \row + \li X-axis: pixel original luminance + \li + \li + \row + \li Y-axis: color channel luminance with effect applied + \li + \li + \endtable + + */ + property color minimumInput: Qt.rgba(0.0, 0.0, 0.0, 0.0) + + /*! + This property defines the maximum input level for each color channel. + It sets the white-point, all pixels having higher value than this + property are rendered as white (per color channel). + Decreasing the value lightens the light areas. + + The value ranges from "#ffffffff" to "#00000000". By default, the + property is set to \c "#ffffffff" (no change). + + \table + \header + \li Output examples with different maximumInput values + \li + \li + \row + \li \image LevelAdjust_maximumInput1.png + \li \image LevelAdjust_maximumInput2.png + \li \image LevelAdjust_maximumInput3.png + \row + \li \b { maximumInput: #FFFFFFFF } + \li \b { maximumInput: #FFFFFF80 } + \li \b { maximumInput: #FFFFFF30 } + \row + \li \l minimumInput: #000000 + \li \l minimumInput: #000000 + \li \l minimumInput: #000000 + \row + \li \l minimumOutput: #000000 + \li \l minimumOutput: #000000 + \li \l minimumOutput: #000000 + \row + \li \l maximumOutput: #ffffff + \li \l maximumOutput: #ffffff + \li \l maximumOutput: #ffffff + \row + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \endtable + + \table + \header + \li Pixel color channel luminance curves of the above images. + \li + \li + \row + \li \image LevelAdjust_default_curve.png + \li \image LevelAdjust_maximumInput2_curve.png + \li \image LevelAdjust_maximumInput3_curve.png + \row + \li X-axis: pixel original luminance + \li + \li + \row + \li Y-axis: color channel luminance with effect applied + \li + \li + \endtable + + */ + property color maximumInput: Qt.rgba(1.0, 1.0, 1.0, 1.0) + + /*! + This property defines the minimum output level for each color channel. + Increasing the value lightens the dark areas, reducing the contrast. + + The value ranges from "#00000000" to "#ffffffff". By default, the + property is set to \c "#00000000" (no change). + + \table + \header + \li Output examples with different minimumOutput values + \li + \li + \row + \li \image LevelAdjust_minimumOutput1.png + \li \image LevelAdjust_minimumOutput2.png + \li \image LevelAdjust_minimumOutput3.png + \row + \li \b { minimumOutput: #00000000 } + \li \b { minimumOutput: #00000070 } + \li \b { minimumOutput: #000000A0 } + \row + \li \l minimumInput: #000000 + \li \l minimumInput: #000000 + \li \l minimumInput: #000000 + \row + \li \l maximumInput: #ffffff + \li \l maximumInput: #ffffff + \li \l maximumInput: #ffffff + \row + \li \l maximumOutput: #ffffff + \li \l maximumOutput: #ffffff + \li \l maximumOutput: #ffffff + \row + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \endtable + + \table + \header + \li Pixel color channel luminance curves of the above images. + \li + \li + \row + \li \image LevelAdjust_default_curve.png + \li \image LevelAdjust_minimumOutput2_curve.png + \li \image LevelAdjust_minimumOutput3_curve.png + \row + \li X-axis: pixel original luminance + \li + \li + \row + \li Y-axis: color channel luminance with effect applied + \li + \li + \endtable + + */ + property color minimumOutput: Qt.rgba(0.0, 0.0, 0.0, 0.0) + + /*! + This property defines the maximum output level for each color channel. + Decreasing the value darkens the light areas, reducing the contrast. + + The value ranges from "#ffffffff" to "#00000000". By default, the + property is set to \c "#ffffffff" (no change). + + \table + \header + \li Output examples with different maximumOutput values + \li + \li + \row + \li \image LevelAdjust_maximumOutput1.png + \li \image LevelAdjust_maximumOutput2.png + \li \image LevelAdjust_maximumOutput3.png + \row + \li \b { maximumOutput: #FFFFFFFF } + \li \b { maximumOutput: #FFFFFF80 } + \li \b { maximumOutput: #FFFFFF30 } + \row + \li \l minimumInput: #000000 + \li \l minimumInput: #000000 + \li \l minimumInput: #000000 + \row + \li \l maximumInput: #ffffff + \li \l maximumInput: #ffffff + \li \l maximumInput: #ffffff + \row + \li \l minimumOutput: #000000 + \li \l minimumOutput: #000000 + \li \l minimumOutput: #000000 + \row + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \li \l gamma: Qt.vector3d(1.0, 1.0, 1.0) + \endtable + + \table + \header + \li Pixel color channel luminance curves of the above images. + \li + \li + \row + \li \image LevelAdjust_default_curve.png + \li \image LevelAdjust_maximumOutput2_curve.png + \li \image LevelAdjust_maximumOutput3_curve.png + \row + \li X-axis: pixel original luminance + \li + \li + \row + \li Y-axis: color channel luminance with effect applied + \li + \li + \endtable + */ + property color maximumOutput: Qt.rgba(1.0, 1.0, 1.0, 1.0) + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant minimumInputRGB: Qt.vector3d(rootItem.minimumInput.r, rootItem.minimumInput.g, rootItem.minimumInput.b) + property variant maximumInputRGB: Qt.vector3d(rootItem.maximumInput.r, rootItem.maximumInput.g, rootItem.maximumInput.b) + property real minimumInputAlpha: rootItem.minimumInput.a + property real maximumInputAlpha: rootItem.maximumInput.a + property variant minimumOutputRGB: Qt.vector3d(rootItem.minimumOutput.r, rootItem.minimumOutput.g, rootItem.minimumOutput.b) + property variant maximumOutputRGB: Qt.vector3d(rootItem.maximumOutput.r, rootItem.maximumOutput.g, rootItem.maximumOutput.b) + property real minimumOutputAlpha: rootItem.minimumOutput.a + property real maximumOutputAlpha: rootItem.maximumOutput.a + property variant gamma: Qt.vector3d(1.0 / Math.max(rootItem.gamma.x, 0.0001), 1.0 / Math.max(rootItem.gamma.y, 0.0001), 1.0 / Math.max(rootItem.gamma.z, 0.0001)) + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp vec3 minimumInputRGB; + uniform highp vec3 maximumInputRGB; + uniform highp float minimumInputAlpha; + uniform highp float maximumInputAlpha; + uniform highp vec3 minimumOutputRGB; + uniform highp vec3 maximumOutputRGB; + uniform highp float minimumOutputAlpha; + uniform highp float maximumOutputAlpha; + uniform highp vec3 gamma; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main(void) { + highp vec4 textureColor = texture2D(source, qt_TexCoord0.st); + highp vec4 color = vec4(textureColor.rgb / max(1.0/256.0, textureColor.a), textureColor.a); + + color.r = linearstep(minimumInputRGB.r, maximumInputRGB.r, color.r); + color.g = linearstep(minimumInputRGB.g, maximumInputRGB.g, color.g); + color.b = linearstep(minimumInputRGB.b, maximumInputRGB.b, color.b); + color.a = linearstep(minimumInputAlpha, maximumInputAlpha, color.a); + + color.rgb = pow(color.rgb, gamma); + + color.r = minimumOutputRGB.r + color.r * (maximumOutputRGB.r - minimumOutputRGB.r); + color.g = minimumOutputRGB.g + color.g * (maximumOutputRGB.g - minimumOutputRGB.g); + color.b = minimumOutputRGB.b + color.b * (maximumOutputRGB.b - minimumOutputRGB.b); + color.a = minimumOutputAlpha + color.a * (maximumOutputAlpha - minimumOutputAlpha); + + gl_FragColor = vec4(color.rgb * color.a, color.a) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/LinearGradient.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/LinearGradient.qml new file mode 100644 index 00000000000..b5845ea9d8a --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/LinearGradient.qml @@ -0,0 +1,346 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype LinearGradient + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-gradient + \brief Draws a linear gradient. + + A gradient is defined by two or more colors, which are blended seamlessly. + The colors start from the given start point and end to the given end point. + + \table + \header + \li Effect applied + \row + \li \image LinearGradient.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet LinearGradient-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the starting point where the color at gradient + position of 0.0 is rendered. Colors at larger position values are + rendered linearly towards the end point. The point is given in pixels + and the default value is Qt.point(0, 0). Setting the default values for + the start and \l{LinearGradient::end}{end} results in a full height + linear gradient on the y-axis. + + \table + \header + \li Output examples with different start values + \li + \li + \row + \li \image LinearGradient_start1.png + \li \image LinearGradient_start2.png + \li \image LinearGradient_start3.png + \row + \li \b { start: QPoint(0, 0) } + \li \b { start: QPoint(150, 150) } + \li \b { start: QPoint(300, 0) } + \row + \li \l end: QPoint(300, 300) + \li \l end: QPoint(300, 300) + \li \l end: QPoint(300, 300) + \endtable + + */ + property variant start: Qt.point(0, 0) + + /*! + This property defines the ending point where the color at gradient + position of 1.0 is rendered. Colors at smaller position values are + rendered linearly towards the start point. The point is given in pixels + and the default value is Qt.point(0, height). Setting the default values + for the \l{LinearGradient::start}{start} and end results in a full + height linear gradient on the y-axis. + + \table + \header + \li Output examples with different end values + \li + \li + \row + \li \image LinearGradient_end1.png + \li \image LinearGradient_end2.png + \li \image LinearGradient_end3.png + \row + \li \b { end: Qt.point(300, 300) } + \li \b { end: Qt.point(150, 150) } + \li \b { end: Qt.point(300, 0) } + \row + \li \l start: Qt.point(0, 0) + \li \l start: Qt.point(0, 0) + \li \l start: Qt.point(0, 0) + \endtable + + */ + property variant end: Qt.point(0, height) + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + /*! + This property defines the item that is going to be filled with gradient. + Source item gets rendered into an intermediate pixel buffer and the + alpha values from the result are used to determine the gradient's pixels + visibility in the display. The default value for source is undefined and + in that case whole effect area is filled with gradient. + + \table + \header + \li Output examples with different source values + \li + \li + \row + \li \image LinearGradient_maskSource1.png + \li \image LinearGradient_maskSource2.png + \row + \li \b { source: undefined } + \li \b { source: Image { source: images/butterfly.png } } + \row + \li \l start: Qt.point(0, 0) + \li \l start: Qt.point(0, 0) + \row + \li \l end: Qt.point(300, 300) + \li \l end: Qt.point(300, 300) + \endtable + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + + /*! + A gradient is defined by two or more colors, which are blended + seamlessly. The colors are specified as a set of GradientStop child + items, each of which defines a position on the gradient from 0.0 to 1.0 + and a color. The position of each GradientStop is defined by the + position property, and the color is definded by the color property. + + \table + \header + \li Output examples with different gradient values + \li + \li + \row + \li \image LinearGradient_gradient1.png + \li \image LinearGradient_gradient2.png + \li \image LinearGradient_gradient3.png + \row + \li \b {gradient:} \code + Gradient { + GradientStop { position: 0.000 + color: Qt.rgba(1, 0, 0, 1) } + GradientStop { position: 0.167; + color: Qt.rgba(1, 1, 0, 1) } + GradientStop { position: 0.333; + color: Qt.rgba(0, 1, 0, 1) } + GradientStop { position: 0.500; + color: Qt.rgba(0, 1, 1, 1) } + GradientStop { position: 0.667; + color: Qt.rgba(0, 0, 1, 1) } + GradientStop { position: 0.833; + color: Qt.rgba(1, 0, 1, 1) } + GradientStop { position: 1.000; + color: Qt.rgba(1, 0, 0, 1) } + } + \endcode + \li \b {gradient:} \code + Gradient { + GradientStop { position: 0.0 + color: "#F0F0F0" + } + GradientStop { position: 0.5 + color: "#000000" + } + GradientStop { position: 1.0 + color: "#F0F0F0" + } + } + \endcode + \li \b {gradient:} \code + Gradient { + GradientStop { position: 0.0 + color: "#00000000" + } + GradientStop { position: 1.0 + color: "#FF000000" + } + } + \endcode + \row + \li \l start: Qt.point(0, 0) + \li \l start: Qt.point(0, 0) + \li \l start: Qt.point(0, 0) + \row + \li \l end: Qt.point(300, 300) + \li \l end: Qt.point(300, 300) + \li \l end: Qt.point(300, 300) + \endtable + + */ + property Gradient gradient: Gradient { + GradientStop { position: 0.0; color: "white" } + GradientStop { position: 1.0; color: "black" } + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: gradientSource + sourceItem: Rectangle { + width: 16 + height: 256 + gradient: rootItem.gradient + smooth: true + } + smooth: true + hideSource: true + visible: false + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + + anchors.fill: parent + + property variant source: gradientSource + property variant maskSource: maskSourceProxy.output + property variant startPoint: Qt.point(start.x / width, start.y / height) + property real dx: end.x - start.x + property real dy: end.y - start.y + property real l: 1.0 / Math.sqrt(Math.pow(dx / width, 2.0) + Math.pow(dy / height, 2.0)) + property real angle: Math.atan2(dx, dy) + property variant matrixData: Qt.point(Math.sin(angle), Math.cos(angle)) + + vertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_Matrix; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + uniform highp vec2 startPoint; + uniform highp float l; + uniform highp vec2 matrixData; + + void main() { + highp mat2 rot = mat2(matrixData.y, -matrixData.x, + matrixData.x, matrixData.y); + + qt_TexCoord0 = qt_MultiTexCoord0; + + qt_TexCoord1 = qt_MultiTexCoord0 * l; + qt_TexCoord1 -= startPoint * l; + qt_TexCoord1 *= rot; + + gl_Position = qt_Matrix * qt_Vertex; + } + " + + fragmentShader: maskSource == undefined ? noMaskShader : maskShader + + onFragmentShaderChanged: lChanged() + + property string maskShader: " + uniform lowp sampler2D source; + uniform lowp sampler2D maskSource; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + + void main() { + lowp vec4 gradientColor = texture2D(source, qt_TexCoord1); + lowp float maskAlpha = texture2D(maskSource, qt_TexCoord0).a; + gl_FragColor = gradientColor * maskAlpha * qt_Opacity; + } + " + + property string noMaskShader: " + uniform lowp sampler2D source; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord1; + + void main() { + gl_FragColor = texture2D(source, qt_TexCoord1) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/MaskedBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/MaskedBlur.qml new file mode 100644 index 00000000000..4744d9fb988 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/MaskedBlur.qml @@ -0,0 +1,282 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype MaskedBlur + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-blur + \brief Applies a blur effect with a varying intesity. + + MaskedBlur effect softens the image by blurring it. The intensity of the + blur can be controlled for each pixel using maskSource so that some parts of + the source are blurred more than others. By default the effect produces a + high quality result, thus the rendering speed may not be the highest + possible. The rendering speed is reduced especially if the + \l{MaskedBlur::samples}{samples} is large. For use cases that require faster + rendering speed and the highest possible visual quality is not necessary, + property \l{MaskedBlur::fast}{fast} can be set to true. + + \table + \header + \li Source + \li MaskSource + \li Effect applied + \row + \li \image Original_bug.png + \li \image MaskedBlur_mask.png + \li \image MaskedBlur_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet MaskedBlur-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be blurred. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the item that is controlling the final intensity + of the blur. The pixel alpha channel value from maskSource defines the + actual blur radius that is going to be used for blurring the + corresponding source pixel. + + Opaque maskSource pixels produce blur with specified + \l{MaskedBlur::radius}{radius}, while transparent pixels suppress the + blur completely. Semitransparent maskSource pixels produce blur with a + radius that is interpolated according to the pixel transparency level. + */ + property variant maskSource + + /*! + This property defines the distance of the neighboring pixels which + affect the blurring of an individual pixel. A larger radius increases + the blur effect. + + Depending on the radius value, value of the + \l{MaskedBlur::samples}{samples} should be set to sufficiently large to + ensure the visual quality. + + The value ranges from 0.0 (no blur) to inf. By default, the property is + set to \c 0.0 (no blur). + + \table + \header + \li Output examples with different radius values + \li + \li + \row + \li \image MaskedBlur_radius1.png + \li \image MaskedBlur_radius2.png + \li \image MaskedBlur_radius3.png + \row + \li \b { radius: 0 } + \li \b { radius: 8 } + \li \b { radius: 16 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l transparentBorder: false + \li \l transparentBorder: false + \li \l transparentBorder: false + \row + \li \l fast: false + \li \l fast: false + \li \l fast: false + \endtable + + */ + property real radius: 0.0 + + /*! + This property defines how many samples are taken per pixel when blur + calculation is done. Larger value produces better quality, but is slower + to render. + + Ideally, this value should be twice as large as the highest required + radius value, for example, if the radius is animated between 0.0 and + 4.0, samples should be set to 8. + + The value ranges from 0 to 32. By default, the property is set to \c 0. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + When \l{MaskedBlur::fast}{fast} property is set to true, this property + has no effect. + */ + property int samples: 0 + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. Every time the source or effect + properties are changed, the pixels in the cache must be updated. Memory + consumption is increased, because an extra buffer of memory is required + for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + /*! + This property selects the blurring algorithm that is used to produce the + blur. Setting this to true enables fast algorithm, setting value to + false produces higher quality result. + + By default, the property is set to \c false. + + \table + \header + \li Output examples with different fast values + \li + \li + \row + \li \image MaskedBlur_fast1.png + \li \image MaskedBlur_fast2.png + \row + \li \b { fast: false } + \li \b { fast: true } + \row + \li \l radius: 16 + \li \l radius: 16 + \row + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l transparentBorder: false + \li \l transparentBorder: false + \endtable + + */ + property bool fast: false + + /*! + This property defines the blur behavior near the edges of the item, + where the pixel blurring is affected by the pixels outside the source + edges. + + If the property is set to \c true, the pixels outside the source are + interpreted to be transparent, which is similar to OpenGL + clamp-to-border extension. The blur is expanded slightly outside the + effect item area. + + If the property is set to \c false, the pixels outside the source are + interpreted to contain the same color as the pixels at the edge of the + item, which is similar to OpenGL clamp-to-edge behavior. The blur does + not expand outside the effect item area. + + By default, the property is set to \c false. + + \table + \header + \li Output examples with different transparentBorder values + \li + \li + \row + \li \image MaskedBlur_transparentBorder1.png + \li \image MaskedBlur_transparentBorder2.png + \row + \li \b { transparentBorder: false } + \li \b { transparentBorder: true } + \row + \li \l radius: 64 + \li \l radius: 64 + \row + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l fast: true + \li \l fast: true + \endtable + + */ + property bool transparentBorder: false + + Loader { + id: loaderItem + anchors.fill: parent + sourceComponent: rootItem.fast ? fastBlur : gaussianBlur + } + + Component { + id: gaussianBlur + GaussianMaskedBlur { + anchors.fill: parent + source: rootItem.source + maskSource: rootItem.maskSource + radius: rootItem.radius + maximumRadius: rootItem.samples * 0.5 + transparentBorder: rootItem.transparentBorder + cached: rootItem.cached + } + } + + Component { + id: fastBlur + FastMaskedBlur { + anchors.fill: parent + source:rootItem. source + maskSource: rootItem.maskSource + blur: Math.pow(rootItem.radius / 64.0, 0.4) + transparentBorder: rootItem.transparentBorder + cached: rootItem.cached + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/OpacityMask.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/OpacityMask.qml new file mode 100644 index 00000000000..3a6e25ab0dd --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/OpacityMask.qml @@ -0,0 +1,154 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype OpacityMask + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-mask + \brief Masks the source item with another item. + + \table + \header + \li Source + \li MaskSource + \li Effect applied + \row + \li \image Original_bug.png + \li \image OpacityMask_mask.png + \li \image OpacityMask_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet OpacityMask-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be masked. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the item that is going to be used as the mask. The + mask item gets rendered into an intermediate pixel buffer and the alpha + values from the result are used to determine the source item's pixels + visibility in the display. + + \table + \header + \li Original + \li Mask + \li Effect applied + \row + \li \image Original_bug.png + \li \image OpacityMask_mask.png + \li \image OpacityMask_bug.png + \endtable + */ + property variant maskSource + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + \note It is not supported to let the effect include itself, for + instance by setting maskSource to the effect's parent. + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.maskSource + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant maskSource: maskSourceProxy.output + + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform lowp sampler2D maskSource; + void main(void) { + gl_FragColor = texture2D(source, qt_TexCoord0.st) * (texture2D(maskSource, qt_TexCoord0.st).a) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RadialBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RadialBlur.qml new file mode 100644 index 00000000000..26315aab5ca --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RadialBlur.qml @@ -0,0 +1,312 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype RadialBlur + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-motion-blur + \brief Applies directional blur in a circular direction around the items + center point. + + Effect creates perceived impression that the source item appears to be + rotating to the direction of the blur. + + Other available motionblur effects are + \l{QtGraphicalEffects1::ZoomBlur}{ZoomBlur} and + \l{QtGraphicalEffects1::DirectionalBlur}{DirectionalBlur}. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image RadialBlur_bug.png + \endtable + + \section1 Example Usage + + The following example shows how to apply the effect. + \snippet RadialBlur-example.qml example +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be blurred. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the direction for the blur and at the same time + the level of blurring. The larger the angle, the more the result becomes + blurred. The quality of the blur depends on + \l{RadialBlur::samples}{samples} property. If angle value is large, more + samples are needed to keep the visual quality at high level. + + Allowed values are between 0.0 and 360.0. By default the property is set + to \c 0.0. + + \table + \header + \li Output examples with different angle values + \li + \li + \row + \li \image RadialBlur_angle1.png + \li \image RadialBlur_angle2.png + \li \image RadialBlur_angle3.png + \row + \li \b { angle: 0.0 } + \li \b { angle: 15.0 } + \li \b { angle: 30.0 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \endtable + */ + property real angle: 0.0 + + /*! + This property defines how many samples are taken per pixel when blur + calculation is done. Larger value produces better quality, but is slower + to render. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + Allowed values are between 0 and inf (practical maximum depends on GPU). + By default the property is set to \c 0 (no samples). + + */ + property int samples: 0 + + /*! + \qmlproperty real QtGraphicalEffects1::RadialBlur::horizontalOffset + \qmlproperty real QtGraphicalEffects1::RadialBlur::verticalOffset + + These properties define the offset in pixels for the perceived center + point of the rotation. + + Allowed values are between -inf and inf. + By default these properties are set to \c 0. + + \table + \header + \li Output examples with different horizontalOffset values + \li + \li + \row + \li \image RadialBlur_horizontalOffset1.png + \li \image RadialBlur_horizontalOffset2.png + \li \image RadialBlur_horizontalOffset3.png + \row + \li \b { horizontalOffset: 75.0 } + \li \b { horizontalOffset: 0.0 } + \li \b { horizontalOffset: -75.0 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l angle: 20 + \li \l angle: 20 + \li \l angle: 20 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \endtable + */ + property real horizontalOffset: 0.0 + property real verticalOffset: 0.0 + + /*! + This property defines the blur behavior near the edges of the item, + where the pixel blurring is affected by the pixels outside the source + edges. + + If the property is set to \c true, the pixels outside the source are + interpreted to be transparent, which is similar to OpenGL + clamp-to-border extension. The blur is expanded slightly outside the + effect item area. + + If the property is set to \c false, the pixels outside the source are + interpreted to contain the same color as the pixels at the edge of the + item, which is similar to OpenGL clamp-to-edge behavior. The blur does + not expand outside the effect item area. + + By default, the property is set to \c false. + */ + property bool transparentBorder: false + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + sourceRect: shaderItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant center: Qt.point(0.5 + rootItem.horizontalOffset / parent.width, 0.5 + rootItem.verticalOffset / parent.height) + property bool transparentBorder: rootItem.transparentBorder && rootItem.samples > 1 + property int samples: rootItem.samples + property real weight: 1.0 / Math.max(1.0, rootItem.samples) + property real angleSin: Math.sin(rootItem.angle/2 * Math.PI/180) + property real angleCos: Math.cos(rootItem.angle/2 * Math.PI/180) + property real angleSinStep: Math.sin(-rootItem.angle * Math.PI/180 / Math.max(1.0, rootItem.samples - 1)) + property real angleCosStep: Math.cos(-rootItem.angle * Math.PI/180 / Math.max(1.0, rootItem.samples - 1)) + property variant expandPixels: transparentBorder ? Qt.size(0.5 * parent.height, 0.5 * parent.width) : Qt.size(0,0) + property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0) + property variant delta: Qt.size(1.0 / rootItem.width, 1.0 / rootItem.height) + property real w: parent.width + property real h: parent.height + + x: transparentBorder ? -expandPixels.width - 1 : 0 + y: transparentBorder ? -expandPixels.height - 1 : 0 + width: transparentBorder ? parent.width + expandPixels.width * 2.0 + 2 : parent.width + height: transparentBorder ? parent.height + expandPixels.height * 2.0 + 2 : parent.height + + property string fragmentShaderSkeleton: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp float angleSin; + uniform highp float angleCos; + uniform highp float angleSinStep; + uniform highp float angleCosStep; + uniform highp float weight; + uniform highp vec2 expand; + uniform highp vec2 center; + uniform highp vec2 delta; + uniform highp float w; + uniform highp float h; + + void main(void) { + highp mat2 m; + gl_FragColor = vec4(0.0); + mediump vec2 texCoord = qt_TexCoord0; + + PLACEHOLDER_EXPAND_STEPS + + highp vec2 dir = vec2(texCoord.s * w - w * center.x, texCoord.t * h - h * center.y); + m[0] = vec2(angleCos, -angleSin); + m[1] = vec2(angleSin, angleCos); + dir *= m; + + m[0] = vec2(angleCosStep, -angleSinStep); + m[1] = vec2(angleSinStep, angleCosStep); + + PLACEHOLDER_UNROLLED_LOOP + + gl_FragColor *= weight * qt_Opacity; + } + " + + function buildFragmentShader() { + var shader = fragmentShaderSkeleton + var expandSteps = "" + + if (transparentBorder) { + expandSteps += "texCoord = (texCoord - expand) / (1.0 - 2.0 * expand);" + } + + var unrolledLoop = "gl_FragColor += texture2D(source, texCoord);\n" + + if (rootItem.samples > 1) { + unrolledLoop = "" + for (var i = 0; i < rootItem.samples; i++) + unrolledLoop += "gl_FragColor += texture2D(source, center + dir * delta); dir *= m;\n" + } + + shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps) + fragmentShader = shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop) + } + + onFragmentShaderChanged: sourceChanged() + onSamplesChanged: buildFragmentShader() + onTransparentBorderChanged: buildFragmentShader() + Component.onCompleted: buildFragmentShader() + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RadialGradient.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RadialGradient.qml new file mode 100644 index 00000000000..66c2cd6e1e7 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RadialGradient.qml @@ -0,0 +1,439 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype RadialGradient + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-gradient + \brief Draws a radial gradient. + + A gradient is defined by two or more colors, which are blended seamlessly. + The colors start from the middle of the item and end at the borders. + + \table + \header + \li Effect applied + \row + \li \image RadialGradient.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet RadialGradient-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + /*! + The HorizontalOffset and verticalOffset properties define the offset in + pixels for the center point of the gradient compared to the item center. + + The values range from -inf to inf. By default, these properties are set + to \c 0. + + \table + \header + \li Output examples with different horizontalOffset values + \li + \li + \row + \li \image RadialGradient_horizontalOffset1.png + \li \image RadialGradient_horizontalOffset2.png + \li \image RadialGradient_horizontalOffset3.png + \row + \li \b { horizontalOffset: -150 } + \li \b { horizontalOffset: 0 } + \li \b { horizontalOffset: 150 } + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l horizontalRadius: 300 + \li \l horizontalRadius: 300 + \li \l horizontalRadius: 300 + \row + \li \l verticalRadius: 300 + \li \l verticalRadius: 300 + \li \l verticalRadius: 300 + \row + \li \l angle: 0 + \li \l angle: 0 + \li \l angle: 0 + \endtable + + */ + property real horizontalOffset: 0.0 + property real verticalOffset: 0.0 + + /*! + The HorizontalRadius and verticalRadius properties define the shape and + size of the radial gradient. If the radiuses are equal, the shape of the + gradient is a circle. If the horizontal and vertical radiuses differ, + the shape is elliptical. The radiuses are given in pixels. + + The value ranges from -inf to inf. By default, horizontalRadius is bound + to width and verticalRadius is bound to height. + + \table + \header + \li Output examples with different horizontalRadius values + \li + \li + \row + \li \image RadialGradient_horizontalRadius1.png + \li \image RadialGradient_horizontalRadius2.png + \row + \li \b { horizontalRadius: 300 } + \li \b { horizontalRadius: 100 } + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l verticalRadius: 300 + \li \l verticalRadius: 300 + \row + \li \l angle: 0 + \li \l angle: 0 + \row + \li \l gradient: QQuickGradient(0xa05fb10) + \li \l gradient: QQuickGradient(0xa05fb10) + \endtable + + */ + property real horizontalRadius: width + property real verticalRadius: height + + /*! + This property defines the rotation of the gradient around its center + point. The rotation is only visible when the + \l{RadialGradient::horizontalRadius}{horizontalRadius} and + \l{RadialGradient::verticalRadius}{verticalRadius} properties are not + equal. The angle is given in degrees and the default value is \c 0. + + \table + \header + \li Output examples with different angle values + \li + \li + \row + \li \image RadialGradient_angle1.png + \li \image RadialGradient_angle2.png + \li \image RadialGradient_angle3.png + \row + \li \b { angle: 0 } + \li \b { angle: 45 } + \li \b { angle: 90 } + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l horizontalRadius: 100 + \li \l horizontalRadius: 100 + \li \l horizontalRadius: 100 + \row + \li \l verticalRadius: 300 + \li \l verticalRadius: 300 + \li \l verticalRadius: 300 + \endtable + */ + property real angle: 0.0 + + /*! + This property defines the item that is going to be filled with gradient. + Source item gets rendered into an intermediate pixel buffer and the + alpha values from the result are used to determine the gradient's pixels + visibility in the display. The default value for source is undefined and + in that case whole effect area is filled with gradient. + + \table + \header + \li Output examples with different source values + \li + \li + \row + \li \image RadialGradient_maskSource1.png + \li \image RadialGradient_maskSource2.png + \row + \li \b { source: undefined } + \li \b { source: Image { source: images/butterfly.png } } + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l horizontalRadius: 300 + \li \l horizontalRadius: 300 + \row + \li \l verticalRadius: 300 + \li \l verticalRadius: 300 + \row + \li \l angle: 0 + \li \l angle: 0 + \endtable + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + A gradient is defined by two or more colors, which are blended + seamlessly. The colors are specified as a set of GradientStop child + items, each of which defines a position on the gradient from 0.0 to 1.0 + and a color. The position of each GradientStop is defined by setting the + position property. The color is defined by setting the color property. + + \table + \header + \li Output examples with different gradient values + \li + \li + \row + \li \image RadialGradient_gradient1.png + \li \image RadialGradient_gradient2.png + \li \image RadialGradient_gradient3.png + \row + \li \b {gradient:} \code + Gradient { + GradientStop { position: 0.000 + color: Qt.rgba(1, 0, 0, 1) } + GradientStop { position: 0.167; + color: Qt.rgba(1, 1, 0, 1) } + GradientStop { position: 0.333; + color: Qt.rgba(0, 1, 0, 1) } + GradientStop { position: 0.500; + color: Qt.rgba(0, 1, 1, 1) } + GradientStop { position: 0.667; + color: Qt.rgba(0, 0, 1, 1) } + GradientStop { position: 0.833; + color: Qt.rgba(1, 0, 1, 1) } + GradientStop { position: 1.000; + color: Qt.rgba(1, 0, 0, 1) } + } + \endcode + \li \b {gradient:} \code + Gradient { + GradientStop { position: 0.0 + color: "#F0F0F0" + } + GradientStop { position: 0.5 + color: "#000000" + } + GradientStop { position: 1.0 + color: "#F0F0F0" + } + } + \endcode + \li \b {gradient:} + \code + Gradient { + GradientStop { position: 0.0 + color: "#00000000" + } + GradientStop { position: 1.0 + color: "#FF000000" + } + } + \endcode + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \row + \li \l horizontalRadius: 300 + \li \l horizontalRadius: 300 + \li \l horizontalRadius: 300 + \row + \li \l verticalRadius: 300 + \li \l verticalRadius: 300 + \li \l verticalRadius: 300 + \row + \li \l angle: 0 + \li \l angle: 0 + \li \l angle: 0 + \endtable + */ + property Gradient gradient: Gradient { + GradientStop { position: 0.0; color: "white" } + GradientStop { position: 1.0; color: "black" } + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: gradientSource + sourceItem: Rectangle { + width: 16 + height: 256 + gradient: rootItem.gradient + smooth: true + } + smooth: true + hideSource: true + visible: false + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant gradientImage: gradientSource + property variant maskSource: maskSourceProxy.output + property variant center: Qt.point(0.5 + rootItem.horizontalOffset / width, 0.5 + rootItem.verticalOffset / height) + property real horizontalRatio: rootItem.horizontalRadius > 0 ? width / (2 * rootItem.horizontalRadius) : width * 16384 + property real verticalRatio: rootItem.verticalRadius > 0 ? height / (2 * rootItem.verticalRadius) : height * 16384 + property real angle: -rootItem.angle / 360 * 2 * Math.PI + property variant matrixData: Qt.point(Math.sin(angle), Math.cos(angle)) + + anchors.fill: parent + + vertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_Matrix; + uniform highp vec2 matrixData; + uniform highp float horizontalRatio; + uniform highp float verticalRatio; + uniform highp vec2 center; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 centerPoint; + + void main() { + highp vec2 ratio = vec2(horizontalRatio, verticalRatio); + + // Rotation matrix + highp mat2 rot = mat2(matrixData.y, -matrixData.x, + matrixData.x, matrixData.y); + + qt_TexCoord0 = qt_MultiTexCoord0; + + qt_TexCoord1 = qt_MultiTexCoord0; + qt_TexCoord1 -= center; + qt_TexCoord1 *= rot; + qt_TexCoord1 += center; + qt_TexCoord1 *= ratio; + + centerPoint = center * ratio; + + gl_Position = qt_Matrix * qt_Vertex; + } + " + + fragmentShader: maskSource == undefined ? noMaskShader : maskShader + + onFragmentShaderChanged: horizontalRatioChanged() + + property string maskShader: " + uniform lowp sampler2D gradientImage; + uniform lowp sampler2D maskSource; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 centerPoint; + + void main() { + lowp vec4 gradientColor = texture2D(gradientImage, vec2(0.0, 2.0 * distance(qt_TexCoord1, centerPoint))); + lowp float maskAlpha = texture2D(maskSource, qt_TexCoord0).a; + gl_FragColor = gradientColor * maskAlpha * qt_Opacity; + } + " + + property string noMaskShader: " + uniform lowp sampler2D gradientImage; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord1; + varying highp vec2 centerPoint; + + void main() { + lowp vec4 gradientColor = texture2D(gradientImage, vec2(0.0, 2.0 * distance(qt_TexCoord1, centerPoint))); + gl_FragColor = gradientColor * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RectangularGlow.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RectangularGlow.qml new file mode 100644 index 00000000000..df0d52ff72f --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RectangularGlow.qml @@ -0,0 +1,288 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype RectangularGlow + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-glow + \brief Generates a blurred and colorized rectangle, which gives + the impression that the source is glowing. + + This effect is intended to have good performance. The shape of the glow is + limited to a rectangle with a custom corner radius. For situations where + custom shapes are required, consider \l {QtGraphicalEffects1::Glow} {Glow} + effect. + + \table + \header + \li Effect applied + \row + \li \image RectangularGlow_applied.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet RectangularGlow-example.qml example +*/ +Item { + id: rootItem + + /*! + This property defines how many pixels outside the item area are reached + by the glow. + + The value ranges from 0.0 (no glow) to inf (infinite glow). By default, + the property is set to \c 0.0. + + \table + \header + \li Output examples with different glowRadius values + \li + \li + \row + \li \image RectangularGlow_glowRadius1.png + \li \image RectangularGlow_glowRadius2.png + \li \image RectangularGlow_glowRadius3.png + \row + \li \b { glowRadius: 10 } + \li \b { glowRadius: 20 } + \li \b { glowRadius: 40 } + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \row + \li \l color: #ffffff + \li \l color: #ffffff + \li \l color: #ffffff + \row + \li \l cornerRadius: 25 + \li \l cornerRadius: 25 + \li \l cornerRadius: 25 + \endtable + + */ + property real glowRadius: 0.0 + + /*! + This property defines how large part of the glow color is strenghtened + near the source edges. + + The value ranges from 0.0 (no strenght increase) to 1.0 (maximum + strenght increase). By default, the property is set to \c 0.0. + + \table + \header + \li Output examples with different spread values + \li + \li + \row + \li \image RectangularGlow_spread1.png + \li \image RectangularGlow_spread2.png + \li \image RectangularGlow_spread3.png + \row + \li \b { spread: 0.0 } + \li \b { spread: 0.5 } + \li \b { spread: 1.0 } + \row + \li \l glowRadius: 20 + \li \l glowRadius: 20 + \li \l glowRadius: 20 + \row + \li \l color: #ffffff + \li \l color: #ffffff + \li \l color: #ffffff + \row + \li \l cornerRadius: 25 + \li \l cornerRadius: 25 + \li \l cornerRadius: 25 + \endtable + */ + property real spread: 0.0 + + /*! + This property defines the RGBA color value which is used for the glow. + + By default, the property is set to \c "white". + + \table + \header + \li Output examples with different color values + \li + \li + \row + \li \image RectangularGlow_color1.png + \li \image RectangularGlow_color2.png + \li \image RectangularGlow_color3.png + \row + \li \b { color: #ffffff } + \li \b { color: #55ff55 } + \li \b { color: #5555ff } + \row + \li \l glowRadius: 20 + \li \l glowRadius: 20 + \li \l glowRadius: 20 + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \row + \li \l cornerRadius: 25 + \li \l cornerRadius: 25 + \li \l cornerRadius: 25 + \endtable + */ + property color color: "white" + + /*! + This property defines the corner radius that is used to draw a glow with + rounded corners. + + The value ranges from 0.0 to half of the effective width or height of + the glow, whichever is smaller. This can be calculated with: \c{ + min(width, height) / 2.0 + glowRadius} + + By default, the property is bound to glowRadius property. The glow + behaves as if the rectangle was blurred when adjusting the glowRadius + property. + + \table + \header + \li Output examples with different cornerRadius values + \li + \li + \row + \li \image RectangularGlow_cornerRadius1.png + \li \image RectangularGlow_cornerRadius2.png + \li \image RectangularGlow_cornerRadius3.png + \row + \li \b { cornerRadius: 0 } + \li \b { cornerRadius: 25 } + \li \b { cornerRadius: 50 } + \row + \li \l glowRadius: 20 + \li \l glowRadius: 20 + \li \l glowRadius: 20 + \row + \li \l spread: 0 + \li \l spread: 0 + \li \l spread: 0 + \row + \li \l color: #ffffff + \li \l color: #ffffff + \li \l color: #ffffff + \endtable + */ + property real cornerRadius: glowRadius + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + + x: (parent.width - width) / 2.0 + y: (parent.height - height) / 2.0 + width: parent.width + rootItem.glowRadius * 2 + cornerRadius * 2 + height: parent.height + rootItem.glowRadius * 2 + cornerRadius * 2 + + function clampedCornerRadius() { + var maxCornerRadius = Math.min(rootItem.width, rootItem.height) / 2 + glowRadius; + return Math.max(0, Math.min(rootItem.cornerRadius, maxCornerRadius)) + } + + property color color: rootItem.color + property real inverseSpread: 1.0 - rootItem.spread + property real relativeSizeX: ((inverseSpread * inverseSpread) * rootItem.glowRadius + cornerRadius * 2.0) / width + property real relativeSizeY: relativeSizeX * (width / height) + property real spread: rootItem.spread / 2.0 + property real cornerRadius: clampedCornerRadius() + + fragmentShader: " + uniform highp float qt_Opacity; + uniform mediump float relativeSizeX; + uniform mediump float relativeSizeY; + uniform mediump float spread; + uniform lowp vec4 color; + varying highp vec2 qt_TexCoord0; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main() { + lowp float alpha = + smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) * + smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y)); + + highp float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha); + gl_FragColor = color * qt_Opacity * spreadMultiplier * spreadMultiplier; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RecursiveBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RecursiveBlur.qml new file mode 100644 index 00000000000..fa59281291d --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/RecursiveBlur.qml @@ -0,0 +1,350 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype RecursiveBlur + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-blur + \brief Blurs repeatedly, providing a strong blur effect. + + The RecursiveBlur effect softens the image by blurring it with an algorithm + that uses a recursive feedback loop to blur the source multiple times. The + effect may give more blurry results than + \l{QtGraphicalEffects1::GaussianBlur}{GaussianBlur} or + \l{QtGraphicalEffects1::FastBlur}{FastBlur}, but the result is produced + asynchronously and takes more time. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image RecursiveBlur_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet RecursiveBlur-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be blurred. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the distance of neighboring pixels which influence + the blurring of individual pixels. A larger radius provides better + quality, but is slower to render. + + \b Note: The radius value in this effect is not intended to be changed + or animated frequently. The correct way to use it is to set the correct + value and keep it unchanged for the whole duration of the iterative blur + sequence. + + The value ranges from (no blur) to 16.0 (maximum blur step). By default, + the property is set to \c 0.0 (no blur). + + \table + \header + \li Output examples with different radius values + \li + \li + \row + \li \image RecursiveBlur_radius1.png + \li \image RecursiveBlur_radius2.png + \li \image RecursiveBlur_radius3.png + \row + \li \b { radius: 2.5 } + \li \b { radius: 4.5 } + \li \b { radius: 7.5 } + \row + \li \l loops: 20 + \li \l loops: 20 + \li \l loops: 20 + \endtable + + */ + property real radius: 0.0 + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + + */ + property bool cached: false + + /*! + This property defines the blur behavior near the edges of the item, + where the pixel blurring is affected by the pixels outside the source + edges. + + If the property is set to \c true, the pixels outside the source are + interpreted to be transparent, which is similar to OpenGL + clamp-to-border extension. The blur is expanded slightly outside the + effect item area. + + If the property is set to \c false, the pixels outside the source are + interpreted to contain the same color as the pixels at the edge of the + item, which is similar to OpenGL clamp-to-edge behavior. The blur does + not expand outside the effect item area. + + By default, the property is set to \c false. + + \table + \header + \li Output examples with different transparentBorder values + \li + \li + \row + \li \image RecursiveBlur_transparentBorder1.png + \li \image RecursiveBlur_transparentBorder2.png + \row + \li \b { transparentBorder: false } + \li \b { transparentBorder: true } + \row + \li \l loops: 20 + \li \l loops: 20 + \row + \li \l radius: 7.5 + \li \l radius: 7.5 + \endtable + */ + property bool transparentBorder: false + + /*! + This property defines the amount of blur iterations that are going to be + performed for the source. When the property changes, the iterative + blurring process starts. If the value is decreased or if the value + changes from zero to non-zero, a snapshot is taken from the source. The + snapshot is used as a starting point for the process. + + The iteration loop tries to run as fast as possible. The speed might be + limited by the VSYNC or the time needed for one blur step, or both. + Sometimes it may be desirable to perform the blurring with a slower + pace. In that case, it may be convenient to control the property with + Animation which increases the value. + + The value ranges from 0 to inf. By default, the property is set to \c 0. + + \table + \header + \li Output examples with different loops values + \li + \li + \row + \li \image RecursiveBlur_loops1.png + \li \image RecursiveBlur_loops2.png + \li \image RecursiveBlur_loops3.png + \row + \li \b { loops: 4 } + \li \b { loops: 20 } + \li \b { loops: 70 } + \row + \li \l radius: 7.5 + \li \l radius: 7.5 + \li \l radius: 7.5 + \endtable + + */ + property int loops: 0 + + /*! + This property holds the progress of asynchronous source blurring + process, from 0.0 (nothing blurred) to 1.0 (finished). + */ + property real progress: loops > 0.0 ? Math.min(1.0, recursionTimer.counter / loops) : 0.0 + + onLoopsChanged: recursiveSource.scheduleUpdate() + onSourceChanged: recursionTimer.reset() + onRadiusChanged: recursionTimer.reset() + onTransparentBorderChanged: recursionTimer.reset() + + SourceProxy { + id: sourceProxy + input: rootItem.source + sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2, parent.height + 2) : Qt.rect(0, 0, 0, 0) + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: verticalBlur + smooth: true + visible: rootItem.cached + hideSource: visible + live: true + sourceItem: inputItem.visible ? inputItem : verticalBlur + } + + Item { + id: recursionTimer + property int counter: 0 + + function reset() { + counter = 0 + recursiveSource.scheduleUpdate() + } + + function nextFrame() { + if (loops < counter) + recursionTimer.counter = 0 + + if (counter > 0) + recursiveSource.sourceItem = verticalBlur + else + recursiveSource.sourceItem = inputItem + + if (counter < loops) { + recursiveSource.scheduleUpdate() + counter++ + } + } + } + + ShaderEffect { + id: inputItem + property variant source: sourceProxy.output + property real expandX: rootItem.transparentBorder ? (horizontalBlur.maximumRadius) / horizontalBlur.width : 0.0 + property real expandY: rootItem.transparentBorder ? (horizontalBlur.maximumRadius) / horizontalBlur.height : 0.0 + + anchors.fill: verticalBlur + visible: !verticalBlur.visible + + vertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_Matrix; + uniform highp float expandX; + uniform highp float expandY; + varying highp vec2 qt_TexCoord0; + + void main() { + mediump vec2 texCoord = qt_MultiTexCoord0; + texCoord.s = (texCoord.s - expandX) / (1.0 - 2.0 * expandX); + texCoord.t = (texCoord.t - expandY) / (1.0 - 2.0 * expandY); + qt_TexCoord0 = texCoord; + gl_Position = qt_Matrix * qt_Vertex; + } + " + + fragmentShader: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + void main() { + gl_FragColor = texture2D(source, qt_TexCoord0) * qt_Opacity; + } + " + } + + ShaderEffectSource { + id: recursiveSource + visible: false + smooth: true + hideSource: false + live: false + sourceItem: inputItem + recursive: true + onSourceItemChanged: scheduleUpdate() + onScheduledUpdateCompleted: recursionTimer.nextFrame() + } + + GaussianDirectionalBlur { + id: verticalBlur + x: rootItem.transparentBorder ? -horizontalBlur.maximumRadius - 1 : 0 + y: rootItem.transparentBorder ? -horizontalBlur.maximumRadius - 1 : 0 + width: horizontalBlur.width + 2 + height: horizontalBlur.height + 2 + + horizontalStep: 0.0 + verticalStep: 1.0 / parent.height + + source: ShaderEffectSource { + sourceItem: horizontalBlur + hideSource: true + visible: false + smooth: true + } + + deviation: (radius + 1) / 2.3333 + radius: rootItem.radius + maximumRadius: Math.ceil(rootItem.radius) + transparentBorder: false + visible: loops > 0 + } + + GaussianDirectionalBlur { + id: horizontalBlur + width: rootItem.transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width + height: rootItem.transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height + + horizontalStep: 1.0 / parent.width + verticalStep: 0.0 + + source: recursiveSource + deviation: (radius + 1) / 2.3333 + radius: rootItem.radius + maximumRadius: Math.ceil(rootItem.radius) + transparentBorder: false + visible: false + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ThresholdMask.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ThresholdMask.qml new file mode 100644 index 00000000000..e789a492934 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ThresholdMask.qml @@ -0,0 +1,226 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype ThresholdMask + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-mask + \brief Masks the source item with another item and applies a threshold + value. + + The masking behavior can be controlled with the \l threshold value for the + mask pixels. + + \table + \header + \li Source + \li MaskSource + \li Effect applied + \row + \li \image Original_bug.png + \li \image ThresholdMask_mask.png + \li \image ThresholdMask_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet ThresholdMask-example.qml example +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be masked. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the item that is going to be used as the mask. + Mask item gets rendered into an intermediate pixel buffer and the alpha + values from the result are used to determine the source item's pixels + visibility in the display. + + \table + \header + \li Original + \li Mask + \li Effect applied + \row + \li \image Original_bug.png + \li \image ThresholdMask_mask.png + \li \image ThresholdMask_bug.png + \endtable + + \note It is not supported to let the effect include itself, for + instance by setting maskSource to the effect's parent. + */ + property variant maskSource + + /*! + This property defines a threshold value for the mask pixels. The mask + pixels that have an alpha value below this property are used to + completely mask away the corresponding pixels from the source item. The + mask pixels that have a higher alpha value are used to alphablend the + source item to the display. + + The value ranges from 0.0 (alpha value 0) to 1.0 (alpha value 255). By + default, the property is set to \c 0.0. + + \table + \header + \li Output examples with different threshold values + \li + \li + \row + \li \image ThresholdMask_threshold1.png + \li \image ThresholdMask_threshold2.png + \li \image ThresholdMask_threshold3.png + \row + \li \b { threshold: 0.0 } + \li \b { threshold: 0.5 } + \li \b { threshold: 0.7 } + \row + \li \l spread: 0.2 + \li \l spread: 0.2 + \li \l spread: 0.2 + \endtable + */ + property real threshold: 0.0 + + /*! + This property defines the smoothness of the mask edges near the + \l{ThresholdMask::threshold}{threshold} alpha value. Setting spread to + 0.0 uses mask normally with the specified threshold. Setting higher + spread values softens the transition from the transparent mask pixels + towards opaque mask pixels by adding interpolated values between them. + + The value ranges from 0.0 (sharp mask edge) to 1.0 (smooth mask edge). + By default, the property is set to \c 0.0. + + \table + \header + \li Output examples with different spread values + \li + \li + \row + \li \image ThresholdMask_spread1.png + \li \image ThresholdMask_spread2.png + \li \image ThresholdMask_spread3.png + \row + \li \b { spread: 0.0 } + \li \b { spread: 0.2 } + \li \b { spread: 0.8 } + \row + \li \l threshold: 0.4 + \li \l threshold: 0.4 + \li \l threshold: 0.4 + \endtable + + */ + property real spread: 0.0 + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.maskSource + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: parent + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant maskSource: maskSourceProxy.output + property real threshold: rootItem.threshold + property real spread: rootItem.spread + + anchors.fill: parent + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform lowp sampler2D maskSource; + uniform highp float threshold; + uniform highp float spread; + void main(void) { + lowp vec4 colorFragment = texture2D(source, qt_TexCoord0.st); + lowp vec4 maskFragment = texture2D(maskSource, qt_TexCoord0.st); + gl_FragColor = colorFragment * smoothstep(threshold * (1.0 + spread) - spread, threshold * (1.0 + spread), maskFragment.a) * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ZoomBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ZoomBlur.qml new file mode 100644 index 00000000000..74a59401238 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/ZoomBlur.qml @@ -0,0 +1,302 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 +import "private" + +/*! + \qmltype ZoomBlur + \inqmlmodule QtGraphicalEffects 1.0 + \since QtGraphicalEffects 1.0 + \inherits QtQuick2::Item + \ingroup qtgraphicaleffects-motion-blur + \brief Applies directional blur effect towards source items center point. + + Effect creates perceived impression that the source item appears to be + moving towards the center point in Z-direction or that the camera appears + to be zooming rapidly. Other available motion blur effects are + \l{QtGraphicalEffects1::DirectionalBlur}{DirectionalBlur} + and \l{QtGraphicalEffects1::RadialBlur}{RadialBlur}. + + \table + \header + \li Source + \li Effect applied + \row + \li \image Original_bug.png + \li \image ZoomBlur_bug.png + \endtable + + \section1 Example + + The following example shows how to apply the effect. + \snippet ZoomBlur-example.qml example + +*/ +Item { + id: rootItem + + /*! + This property defines the source item that is going to be blurred. + + \note It is not supported to let the effect include itself, for + instance by setting source to the effect's parent. + */ + property variant source + + /*! + This property defines the maximum perceived amount of movement for each + pixel. The amount is smaller near the center and reaches the specified + value at the edges. + + The quality of the blur depends on \l{ZoomBlur::samples}{samples} + property. If length value is large, more samples are needed to keep the + visual quality at high level. + + The value ranges from 0.0 to inf. By default the property is set to \c + 0.0 (no blur). + + \table + \header + \li Output examples with different length values + \li + \li + \row + \li \image ZoomBlur_length1.png + \li \image ZoomBlur_length2.png + \li \image ZoomBlur_length3.png + \row + \li \b { length: 0.0 } + \li \b { length: 32.0 } + \li \b { length: 48.0 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \li \l horizontalOffset: 0 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \endtable + + */ + property real length: 0.0 + + /*! + This property defines how many samples are taken per pixel when blur + calculation is done. Larger value produces better quality, but is slower + to render. + + This property is not intended to be animated. Changing this property may + cause the underlying OpenGL shaders to be recompiled. + + Allowed values are between 0 and inf (practical maximum depends on GPU). + By default the property is set to \c 0 (no samples). + + */ + property int samples: 0 + + /*! + \qmlproperty real QtGraphicalEffects1::ZoomBlur::horizontalOffset + \qmlproperty real QtGraphicalEffects1::ZoomBlur::verticalOffset + + These properties define an offset in pixels for the blur direction + center point. + + The values range from -inf to inf. By default these properties are set + to \c 0. + + \table + \header + \li Output examples with different horizontalOffset values + \li + \li + \row + \li \image ZoomBlur_horizontalOffset1.png + \li \image ZoomBlur_horizontalOffset2.png + \li \image ZoomBlur_horizontalOffset3.png + \row + \li \b { horizontalOffset: 100.0 } + \li \b { horizontalOffset: 0.0 } + \li \b { horizontalOffset: -100.0 } + \row + \li \l samples: 24 + \li \l samples: 24 + \li \l samples: 24 + \row + \li \l length: 32 + \li \l length: 32 + \li \l length: 32 + \row + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \li \l verticalOffset: 0 + \endtable + */ + property real horizontalOffset: 0.0 + property real verticalOffset: 0.0 + + /*! + This property defines the blur behavior near the edges of the item, + where the pixel blurring is affected by the pixels outside the source + edges. + + If the property is set to \c true, the pixels outside the source are + interpreted to be transparent, which is similar to OpenGL + clamp-to-border extension. The blur is expanded slightly outside the + effect item area. + + If the property is set to \c false, the pixels outside the source are + interpreted to contain the same color as the pixels at the edge of the + item, which is similar to OpenGL clamp-to-edge behavior. The blur does + not expand outside the effect item area. + + By default, the property is set to \c false. + + */ + property bool transparentBorder: false + + /*! + This property allows the effect output pixels to be cached in order to + improve the rendering performance. + + Every time the source or effect properties are changed, the pixels in + the cache must be updated. Memory consumption is increased, because an + extra buffer of memory is required for storing the effect output. + + It is recommended to disable the cache when the source or the effect + properties are animated. + + By default, the property is set to \c false. + */ + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property variant center: Qt.point(0.5 + rootItem.horizontalOffset / width, 0.5 + rootItem.verticalOffset / height) + property real len: rootItem.length + property bool transparentBorder: rootItem.transparentBorder + property real samples: rootItem.samples + property real weight: 1.0 / Math.max(1.0, rootItem.samples) + property variant expandPixels: transparentBorder ? Qt.size(rootItem.samples, rootItem.samples) : Qt.size(0,0) + property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0) + property variant delta: Qt.size(1.0 / rootItem.width, 1.0 / rootItem.height) + + x: transparentBorder ? -expandPixels.width - 1 : 0 + y: transparentBorder ? -expandPixels.height - 1 : 0 + width: transparentBorder ? parent.width + 2.0 * expandPixels.width + 2 : parent.width + height: transparentBorder ? parent.height + 2.0 * expandPixels.height + 2 : parent.height + + property string fragmentShaderSkeleton: " + varying highp vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp float len; + uniform highp float weight; + uniform highp float samples; + uniform highp vec2 center; + uniform highp vec2 expand; + uniform highp vec2 delta; + + void main(void) { + mediump vec2 texCoord = qt_TexCoord0; + mediump vec2 centerCoord = center; + + PLACEHOLDER_EXPAND_STEPS + + highp vec2 dir = vec2(centerCoord.x - texCoord.s, centerCoord.y - texCoord.t); + dir /= max(1.0, length(dir) * 2.0); + highp vec2 shift = delta * len * dir * 2.0 / max(1.0, samples - 1.0); + gl_FragColor = vec4(0.0); + + PLACEHOLDER_UNROLLED_LOOP + + gl_FragColor *= weight * qt_Opacity; + } + " + + function buildFragmentShader() { + var shader = fragmentShaderSkeleton + var expandSteps = "" + + if (transparentBorder) { + expandSteps += "centerCoord = (centerCoord - expand) / (1.0 - 2.0 * expand);" + expandSteps += "texCoord = (texCoord - expand) / (1.0 - 2.0 * expand);" + } + + var unrolledLoop = "gl_FragColor += texture2D(source, texCoord);\n" + + if (rootItem.samples > 1) { + unrolledLoop = "" + for (var i = 0; i < rootItem.samples; i++) + unrolledLoop += "gl_FragColor += texture2D(source, texCoord); texCoord += shift;\n" + } + + shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps) + fragmentShader = shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop) + } + + onFragmentShaderChanged: sourceChanged() + onSamplesChanged: buildFragmentShader() + onTransparentBorderChanged: buildFragmentShader() + Component.onCompleted: buildFragmentShader() + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastGlow.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastGlow.qml new file mode 100644 index 00000000000..f4bd2c74219 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastGlow.qml @@ -0,0 +1,393 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant source + property real spread: 0.0 + property real blur: 0.0 + property color color: "white" + property bool transparentBorder: false + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + property string __internalBlurVertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_Matrix; + uniform highp float yStep; + uniform highp float xStep; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36); + qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep); + qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep); + qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36); + gl_Position = qt_Matrix * qt_Vertex; + } + " + + property string __internalBlurFragmentShader: " + uniform lowp sampler2D source; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) + + texture2D(source, qt_TexCoord1) + + texture2D(source, qt_TexCoord2) + + texture2D(source, qt_TexCoord3)) * 0.25; + gl_FragColor = sourceColor * qt_Opacity; + } + " + + ShaderEffect { + id: level0 + property variant source: sourceProxy.output + anchors.fill: parent + visible: false + smooth: true + } + + ShaderEffectSource { + id: level1 + width: Math.ceil(shaderItem.width / 32) * 32 + height: Math.ceil(shaderItem.height / 32) * 32 + sourceItem: level0 + hideSource: rootItem.visible + sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0,0,0,0) + smooth: true + visible: false + } + + ShaderEffect { + id: effect1 + property variant source: level1 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level2 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level2 + width: level1.width / 2 + height: level1.height / 2 + sourceItem: effect1 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect2 + property variant source: level2 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level3 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level3 + width: level2.width / 2 + height: level2.height / 2 + sourceItem: effect2 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect3 + property variant source: level3 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level4 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level4 + width: level3.width / 2 + height: level3.height / 2 + sourceItem: effect3 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect4 + property variant source: level4 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level5 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level5 + width: level4.width / 2 + height: level4.height / 2 + sourceItem: effect4 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect5 + property variant source: level5 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level6 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level6 + width: level5.width / 2 + height: level5.height / 2 + sourceItem: effect5 + hideSource: rootItem.visible + visible: false + smooth: true + } + + Item { + id: dummysource + width: 1 + height: 1 + visible: false + } + + ShaderEffectSource { + id: dummy + width: 1 + height: 1 + sourceItem: dummysource + visible: false + smooth: false + live: false + } + + ShaderEffect { + id: shaderItem + x: transparentBorder ? -64 : 0 + y: transparentBorder ? -64 : 0 + width: transparentBorder ? parent.width + 128 : parent.width + height: transparentBorder ? parent.height + 128 : parent.height + + property variant source1: level1 + property variant source2: level2 + property variant source3: level3 + property variant source4: level4 + property variant source5: level5 + property variant source6: level6 + property real lod: rootItem.blur + + property real weight1; + property real weight2; + property real weight3; + property real weight4; + property real weight5; + property real weight6; + + property real spread: 1.0 - (rootItem.spread * 0.98) + property alias color: rootItem.color + + function weight(v) { + if (v <= 0.0) + return 1 + if (v >= 0.5) + return 0 + + return 1.0 - v / 0.5 + } + + function calculateWeights() { + + var w1 = weight(Math.abs(lod - 0.100)) + var w2 = weight(Math.abs(lod - 0.300)) + var w3 = weight(Math.abs(lod - 0.500)) + var w4 = weight(Math.abs(lod - 0.700)) + var w5 = weight(Math.abs(lod - 0.900)) + var w6 = weight(Math.abs(lod - 1.100)) + + var sum = w1 + w2 + w3 + w4 + w5 + w6; + weight1 = w1 / sum; + weight2 = w2 / sum; + weight3 = w3 / sum; + weight4 = w4 / sum; + weight5 = w5 / sum; + weight6 = w6 / sum; + + upateSources() + } + + function upateSources() { + var sources = new Array(); + var weights = new Array(); + + if (weight1 > 0) { + sources.push(level1) + weights.push(weight1) + } + + if (weight2 > 0) { + sources.push(level2) + weights.push(weight2) + } + + if (weight3 > 0) { + sources.push(level3) + weights.push(weight3) + } + + if (weight4 > 0) { + sources.push(level4) + weights.push(weight4) + } + + if (weight5 > 0) { + sources.push(level5) + weights.push(weight5) + } + + if (weight6 > 0) { + sources.push(level6) + weights.push(weight6) + } + + for (var j = sources.length; j < 6; j++) { + sources.push(dummy) + weights.push(0.0) + } + + source1 = sources[0] + source2 = sources[1] + source3 = sources[2] + source4 = sources[3] + source5 = sources[4] + source6 = sources[5] + + weight1 = weights[0] + weight2 = weights[1] + weight3 = weights[2] + weight4 = weights[3] + weight5 = weights[4] + weight6 = weights[5] + } + + Component.onCompleted: calculateWeights() + + onLodChanged: calculateWeights() + + fragmentShader: " + uniform lowp sampler2D source1; + uniform lowp sampler2D source2; + uniform lowp sampler2D source3; + uniform lowp sampler2D source4; + uniform lowp sampler2D source5; + uniform mediump float weight1; + uniform mediump float weight2; + uniform mediump float weight3; + uniform mediump float weight4; + uniform mediump float weight5; + uniform highp vec4 color; + uniform highp float spread; + uniform lowp float qt_Opacity; + varying mediump vec2 qt_TexCoord0; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main() { + lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1; + sourceColor += texture2D(source2, qt_TexCoord0) * weight2; + sourceColor += texture2D(source3, qt_TexCoord0) * weight3; + sourceColor += texture2D(source4, qt_TexCoord0) * weight4; + sourceColor += texture2D(source5, qt_TexCoord0) * weight5; + sourceColor = mix(vec4(0), color, linearstep(0.0, spread, sourceColor.a)); + gl_FragColor = sourceColor * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastInnerShadow.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastInnerShadow.qml new file mode 100644 index 00000000000..95e645a939b --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastInnerShadow.qml @@ -0,0 +1,413 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant source + property real blur: 0.0 + property real horizontalOffset: 0 + property real verticalOffset: 0 + property real spread: 0.0 + property color color: "black" + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + property string __internalBlurVertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_Matrix; + uniform highp float yStep; + uniform highp float xStep; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36); + qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep); + qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep); + qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36); + gl_Position = qt_Matrix * qt_Vertex; + } + " + + property string __internalBlurFragmentShader: " + uniform lowp sampler2D source; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) + + texture2D(source, qt_TexCoord1) + + texture2D(source, qt_TexCoord2) + + texture2D(source, qt_TexCoord3)) * 0.25; + gl_FragColor = sourceColor * qt_Opacity; + } + " + + ShaderEffect { + id: level0 + property variant source: sourceProxy.output + property real horizontalOffset: rootItem.horizontalOffset / rootItem.width + property real verticalOffset: rootItem.verticalOffset / rootItem.width + property color color: rootItem.color + + anchors.fill: parent + visible: false + smooth: true + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform lowp float qt_Opacity; + uniform highp sampler2D source; + uniform lowp vec4 color; + uniform highp float horizontalOffset; + uniform highp float verticalOffset; + + void main(void) { + highp vec2 pos = qt_TexCoord0 - vec2(horizontalOffset, verticalOffset); + lowp float ea = step(0.0, pos.x) * step(0.0, pos.y) * step(pos.x, 1.0) * step(pos.y, 1.0); + lowp float eb = 1.0 - ea; + gl_FragColor = (eb * color + ea * color * (1.0 - texture2D(source, pos).a)) * qt_Opacity; + } + " + } + + ShaderEffectSource { + id: level1 + width: Math.ceil(shaderItem.width / 32) * 32 + height: Math.ceil(shaderItem.height / 32) * 32 + sourceItem: level0 + hideSource: rootItem.visible + smooth: true + visible: false + } + + ShaderEffect { + id: effect1 + property variant source: level1 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level2 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level2 + width: level1.width / 2 + height: level1.height / 2 + sourceItem: effect1 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect2 + property variant source: level2 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level3 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level3 + width: level2.width / 2 + height: level2.height / 2 + sourceItem: effect2 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect3 + property variant source: level3 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level4 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level4 + width: level3.width / 2 + height: level3.height / 2 + sourceItem: effect3 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect4 + property variant source: level4 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level5 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level5 + width: level4.width / 2 + height: level4.height / 2 + sourceItem: effect4 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect5 + property variant source: level5 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level6 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level6 + width: level5.width / 2 + height: level5.height / 2 + sourceItem: effect5 + hideSource: rootItem.visible + visible: false + smooth: true + } + + Item { + id: dummysource + width: 1 + height: 1 + visible: false + } + + ShaderEffectSource { + id: dummy + width: 1 + height: 1 + sourceItem: dummysource + visible: false + smooth: false + live: false + } + + ShaderEffect { + id: shaderItem + width: parent.width + height: parent.height + + property variant original: sourceProxy.output + property variant source1: level1 + property variant source2: level2 + property variant source3: level3 + property variant source4: level4 + property variant source5: level5 + property variant source6: level6 + property real lod: rootItem.blur + + property real weight1; + property real weight2; + property real weight3; + property real weight4; + property real weight5; + property real weight6; + + property real spread: 1.0 - (rootItem.spread * 0.98) + property color color: rootItem.color + + function weight(v) { + if (v <= 0.0) + return 1 + if (v >= 0.5) + return 0 + + return 1.0 - v / 0.5 + } + + function calculateWeights() { + + var w1 = weight(Math.abs(lod - 0.100)) + var w2 = weight(Math.abs(lod - 0.300)) + var w3 = weight(Math.abs(lod - 0.500)) + var w4 = weight(Math.abs(lod - 0.700)) + var w5 = weight(Math.abs(lod - 0.900)) + var w6 = weight(Math.abs(lod - 1.100)) + + var sum = w1 + w2 + w3 + w4 + w5 + w6; + weight1 = w1 / sum; + weight2 = w2 / sum; + weight3 = w3 / sum; + weight4 = w4 / sum; + weight5 = w5 / sum; + weight6 = w6 / sum; + + upateSources() + } + + function upateSources() { + var sources = new Array(); + var weights = new Array(); + + if (weight1 > 0) { + sources.push(level1) + weights.push(weight1) + } + + if (weight2 > 0) { + sources.push(level2) + weights.push(weight2) + } + + if (weight3 > 0) { + sources.push(level3) + weights.push(weight3) + } + + if (weight4 > 0) { + sources.push(level4) + weights.push(weight4) + } + + if (weight5 > 0) { + sources.push(level5) + weights.push(weight5) + } + + if (weight6 > 0) { + sources.push(level6) + weights.push(weight6) + } + + for (var j = sources.length; j < 6; j++) { + sources.push(dummy) + weights.push(0.0) + } + + source1 = sources[0] + source2 = sources[1] + source3 = sources[2] + source4 = sources[3] + source5 = sources[4] + source6 = sources[5] + + weight1 = weights[0] + weight2 = weights[1] + weight3 = weights[2] + weight4 = weights[3] + weight5 = weights[4] + weight6 = weights[5] + } + + Component.onCompleted: calculateWeights() + + onLodChanged: calculateWeights() + + fragmentShader: " + uniform lowp sampler2D original; + uniform lowp sampler2D source1; + uniform lowp sampler2D source2; + uniform lowp sampler2D source3; + uniform lowp sampler2D source4; + uniform lowp sampler2D source5; + uniform mediump float weight1; + uniform mediump float weight2; + uniform mediump float weight3; + uniform mediump float weight4; + uniform mediump float weight5; + uniform highp vec4 color; + uniform highp float spread; + uniform lowp float qt_Opacity; + varying mediump vec2 qt_TexCoord0; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main() { + lowp vec4 shadowColor = texture2D(source1, qt_TexCoord0) * weight1; + shadowColor += texture2D(source2, qt_TexCoord0) * weight2; + shadowColor += texture2D(source3, qt_TexCoord0) * weight3; + shadowColor += texture2D(source4, qt_TexCoord0) * weight4; + shadowColor += texture2D(source5, qt_TexCoord0) * weight5; + lowp vec4 originalColor = texture2D(original, qt_TexCoord0); + shadowColor.rgb = mix(originalColor.rgb, color.rgb * originalColor.a, linearstep(0.0, spread, shadowColor.a)); + gl_FragColor = vec4(shadowColor.rgb, originalColor.a) * originalColor.a * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastMaskedBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastMaskedBlur.qml new file mode 100644 index 00000000000..ae49a6e9bb0 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/FastMaskedBlur.qml @@ -0,0 +1,332 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant source + property variant maskSource + property real blur: 0.0 + property bool transparentBorder: false + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.maskSource + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + sourceItem: shaderItem + live: true + hideSource: visible + smooth: rootItem.blur > 0 + } + + property string __internalBlurVertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_Matrix; + uniform highp float yStep; + uniform highp float xStep; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36); + qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep); + qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep); + qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36); + gl_Position = qt_Matrix * qt_Vertex; + } + " + + property string __internalBlurFragmentShader: " + uniform lowp sampler2D source; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) + + texture2D(source, qt_TexCoord1) + + texture2D(source, qt_TexCoord2) + + texture2D(source, qt_TexCoord3)) * 0.25; + gl_FragColor = sourceColor * qt_Opacity; + } + " + + ShaderEffect { + id: mask0 + property variant source: maskSourceProxy.output + anchors.fill: parent + visible: false + smooth: true + } + + ShaderEffectSource { + id: masklevel1 + width: Math.ceil(shaderItem.width / 32) * 32 + height: Math.ceil(shaderItem.height / 32) * 32 + sourceItem: mask0 + hideSource: rootItem.visible + sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0, 0, 0, 0) + visible: false + smooth: rootItem.blur > 0 + } + + ShaderEffect { + id: level0 + property variant source: sourceProxy.output + anchors.fill: parent + visible: false + smooth: true + } + + ShaderEffectSource { + id: level1 + width: Math.ceil(shaderItem.width / 32) * 32 + height: Math.ceil(shaderItem.height / 32) * 32 + sourceItem: level0 + hideSource: rootItem.visible + sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0, 0, 0, 0) + visible: false + smooth: rootItem.blur > 0 + } + + ShaderEffect { + id: effect1 + property variant source: level1 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level2 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level2 + width: level1.width / 2 + height: level1.height / 2 + sourceItem: effect1 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect2 + property variant source: level2 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level3 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level3 + width: level2.width / 2 + height: level2.height / 2 + sourceItem: effect2 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect3 + property variant source: level3 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level4 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level4 + width: level3.width / 2 + height: level3.height / 2 + sourceItem: effect3 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect4 + property variant source: level4 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level5 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level5 + width: level4.width / 2 + height: level4.height / 2 + sourceItem: effect4 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect5 + property variant source: level5 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level6 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level6 + width: level5.width / 2 + height: level5.height / 2 + sourceItem: effect5 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: shaderItem + property variant mask: masklevel1 + property variant source1: level1 + property variant source2: level2 + property variant source3: level3 + property variant source4: level4 + property variant source5: level5 + property variant source6: level6 + property real lod: Math.sqrt(rootItem.blur) * 1.2 - 0.2 + property real weight1 + property real weight2 + property real weight3 + property real weight4 + property real weight5 + property real weight6 + + x: transparentBorder ? -64 : 0 + y: transparentBorder ? -64 : 0 + width: transparentBorder ? parent.width + 128 : parent.width + height: transparentBorder ? parent.height + 128 : parent.height + + fragmentShader: " + uniform lowp sampler2D mask; + uniform lowp sampler2D source1; + uniform lowp sampler2D source2; + uniform lowp sampler2D source3; + uniform lowp sampler2D source4; + uniform lowp sampler2D source5; + uniform lowp sampler2D source6; + uniform lowp float lod; + uniform lowp float qt_Opacity; + varying mediump vec2 qt_TexCoord0; + + mediump float weight(mediump float v) { + if (v <= 0.0) + return 1.0; + + if (v >= 0.5) + return 0.0; + + return 1.0 - v * 2.0; + } + + void main() { + + lowp vec4 maskColor = texture2D(mask, qt_TexCoord0); + mediump float l = lod * maskColor.a; + + mediump float w1 = weight(abs(l - 0.100)); + mediump float w2 = weight(abs(l - 0.300)); + mediump float w3 = weight(abs(l - 0.500)); + mediump float w4 = weight(abs(l - 0.700)); + mediump float w5 = weight(abs(l - 0.900)); + mediump float w6 = weight(abs(l - 1.100)); + + mediump float sum = w1 + w2 + w3 + w4 + w5 + w6; + mediump float weight1 = w1 / sum; + mediump float weight2 = w2 / sum; + mediump float weight3 = w3 / sum; + mediump float weight4 = w4 / sum; + mediump float weight5 = w5 / sum; + mediump float weight6 = w6 / sum; + + lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1; + sourceColor += texture2D(source2, qt_TexCoord0) * weight2; + sourceColor += texture2D(source3, qt_TexCoord0) * weight3; + sourceColor += texture2D(source4, qt_TexCoord0) * weight4; + sourceColor += texture2D(source5, qt_TexCoord0) * weight5; + sourceColor += texture2D(source6, qt_TexCoord0) * weight6; + + gl_FragColor = sourceColor * qt_Opacity; + + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianDirectionalBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianDirectionalBlur.qml new file mode 100644 index 00000000000..c2af1f34e31 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianDirectionalBlur.qml @@ -0,0 +1,287 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant source + property real deviation: (radius + 1) / 3.3333 + property real radius: 0.0 + property int maximumRadius: 0 + property real horizontalStep: 0.0 + property real verticalStep: 0.0 + property bool transparentBorder: false + property bool cached: false + + property bool enableColor: false + property color color: "white" + property real spread: 0.0 + + property bool enableMask: false + property variant maskSource + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.maskSource + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: rootItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect { + id: shaderItem + property variant source: sourceProxy.output + property real deviation: Math.max(0.1, rootItem.deviation) + property real radius: rootItem.radius + property int maxRadius: rootItem.maximumRadius + property bool transparentBorder: rootItem.transparentBorder + property real gaussianSum: 0.0 + property real startIndex: 0.0 + property real deltaFactor: (2 * radius - 1) / (maxRadius * 2 - 1) + property real expandX: transparentBorder && rootItem.horizontalStep > 0 ? maxRadius / width : 0.0 + property real expandY: transparentBorder && rootItem.verticalStep > 0 ? maxRadius / height : 0.0 + property variant gwts: [] + property variant delta: Qt.vector3d(rootItem.horizontalStep * deltaFactor, rootItem.verticalStep * deltaFactor, startIndex); + property variant factor_0_2: Qt.vector3d(gwts[0], gwts[1], gwts[2]); + property variant factor_3_5: Qt.vector3d(gwts[3], gwts[4], gwts[5]); + property variant factor_6_8: Qt.vector3d(gwts[6], gwts[7], gwts[8]); + property variant factor_9_11: Qt.vector3d(gwts[9], gwts[10], gwts[11]); + property variant factor_12_14: Qt.vector3d(gwts[12], gwts[13], gwts[14]); + property variant factor_15_17: Qt.vector3d(gwts[15], gwts[16], gwts[17]); + property variant factor_18_20: Qt.vector3d(gwts[18], gwts[19], gwts[20]); + property variant factor_21_23: Qt.vector3d(gwts[21], gwts[22], gwts[23]); + property variant factor_24_26: Qt.vector3d(gwts[24], gwts[25], gwts[26]); + property variant factor_27_29: Qt.vector3d(gwts[27], gwts[28], gwts[29]); + property variant factor_30_32: Qt.vector3d(gwts[30], gwts[31], gwts[32]); + + property color color: rootItem.color + property real spread: 1.0 - (rootItem.spread * 0.98) + property variant maskSource: maskSourceProxy.output + + anchors.fill: rootItem + + function gausFunc(x){ + //Gaussian function = h(x):=(1/sqrt(2*3.14159*(D^2))) * %e^(-(x^2)/(2*(D^2))); + return (1.0 / Math.sqrt(2 * Math.PI * (Math.pow(shaderItem.deviation, 2)))) * Math.pow(Math.E, -((Math.pow(x, 2)) / (2 * (Math.pow(shaderItem.deviation, 2))))); + } + + function updateGaussianWeights() { + gaussianSum = 0.0; + startIndex = -maxRadius + 0.5 + + var n = new Array(32); + for (var j = 0; j < 32; j++) + n[j] = 0; + + var max = maxRadius * 2 + var delta = (2 * radius - 1) / (max - 1); + for (var i = 0; i < max; i++) { + n[i] = gausFunc(-radius + 0.5 + i * delta); + gaussianSum += n[i]; + } + + gwts = n; + } + + function buildFragmentShader() { + + var shaderSteps = [ + "gl_FragColor += texture2D(source, texCoord) * factor_0_2.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_0_2.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_0_2.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_3_5.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_3_5.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_3_5.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_6_8.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_6_8.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_6_8.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_9_11.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_9_11.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_9_11.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_12_14.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_12_14.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_12_14.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_15_17.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_15_17.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_15_17.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_18_20.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_18_20.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_18_20.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_21_23.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_21_23.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_21_23.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_24_26.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_24_26.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_24_26.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_27_29.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_27_29.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_27_29.z; texCoord += shift;", + + "gl_FragColor += texture2D(source, texCoord) * factor_30_32.x; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_30_32.y; texCoord += shift;", + "gl_FragColor += texture2D(source, texCoord) * factor_30_32.z; texCoord += shift;" + ] + + var shader = fragmentShaderBegin + var samples = maxRadius * 2 + if (samples > 32) { + console.log("DirectionalGaussianBlur.qml WARNING: Maximum of blur radius (16) exceeded!") + samples = 32 + } + + for (var i = 0; i < samples; i++) { + shader += shaderSteps[i] + } + + shader += fragmentShaderEnd + + var colorizeSteps = "" + var colorizeUniforms = "" + + var maskSteps = "" + var maskUniforms = "" + + if (enableColor) { + colorizeSteps += "gl_FragColor = mix(vec4(0), color, clamp((gl_FragColor.a - 0.0) / (spread - 0.0), 0.0, 1.0));\n" + colorizeUniforms += "uniform highp vec4 color;\n" + colorizeUniforms += "uniform highp float spread;\n" + } + + if (enableMask) { + maskSteps += "shift *= texture2D(maskSource, qt_TexCoord0).a;\n" + maskUniforms += "uniform sampler2D maskSource;\n" + } + + shader = shader.replace("PLACEHOLDER_COLORIZE_STEPS", colorizeSteps) + shader = shader.replace("PLACEHOLDER_COLORIZE_UNIFORMS", colorizeUniforms) + shader = shader.replace("PLACEHOLDER_MASK_STEPS", maskSteps) + shader = shader.replace("PLACEHOLDER_MASK_UNIFORMS", maskUniforms) + + fragmentShader = shader + } + + onDeviationChanged: updateGaussianWeights() + + onRadiusChanged: updateGaussianWeights() + + onTransparentBorderChanged: { + buildFragmentShader() + updateGaussianWeights() + } + + onMaxRadiusChanged: { + buildFragmentShader() + updateGaussianWeights() + } + + Component.onCompleted: { + buildFragmentShader() + updateGaussianWeights() + } + + property string fragmentShaderBegin: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp vec3 delta; + uniform highp vec3 factor_0_2; + uniform highp vec3 factor_3_5; + uniform highp vec3 factor_6_8; + uniform highp vec3 factor_9_11; + uniform highp vec3 factor_12_14; + uniform highp vec3 factor_15_17; + uniform highp vec3 factor_18_20; + uniform highp vec3 factor_21_23; + uniform highp vec3 factor_24_26; + uniform highp vec3 factor_27_29; + uniform highp vec3 factor_30_32; + uniform highp float gaussianSum; + uniform highp float expandX; + uniform highp float expandY; + PLACEHOLDER_MASK_UNIFORMS + PLACEHOLDER_COLORIZE_UNIFORMS + + void main() { + highp vec2 shift = vec2(delta.x, delta.y); + + PLACEHOLDER_MASK_STEPS + + highp float index = delta.z; + mediump vec2 texCoord = qt_TexCoord0; + texCoord.s = (texCoord.s - expandX) / (1.0 - 2.0 * expandX); + texCoord.t = (texCoord.t - expandY) / (1.0 - 2.0 * expandY); + texCoord += (shift * index); + + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); + " + + property string fragmentShaderEnd: " + + gl_FragColor /= gaussianSum; + + PLACEHOLDER_COLORIZE_STEPS + + gl_FragColor *= qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianGlow.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianGlow.qml new file mode 100644 index 00000000000..c7458561a5d --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianGlow.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant source + property real radius: 0.0 + property int maximumRadius: 0 + property real spread: 0.0 + property color color: "white" + property bool cached: false + property bool transparentBorder: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + GaussianDirectionalBlur { + id: shaderItem + x: transparentBorder ? -maximumRadius - 1 : 0 + y: transparentBorder ? -maximumRadius - 1 : 0 + width: horizontalBlur.width + height: horizontalBlur.height + horizontalStep: 0.0 + verticalStep: 1.0 / parent.height + source: horizontalBlur + radius: rootItem.radius + maximumRadius: rootItem.maximumRadius + transparentBorder: rootItem.transparentBorder + enableColor: true + color: rootItem.color + spread: rootItem.spread + } + + GaussianDirectionalBlur { + id: horizontalBlur + width: transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width + height: transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height + horizontalStep: 1.0 / parent.width + verticalStep: 0.0 + source: sourceProxy.output + radius: rootItem.radius + maximumRadius: rootItem.maximumRadius + transparentBorder: rootItem.transparentBorder + visible: false + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianInnerShadow.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianInnerShadow.qml new file mode 100644 index 00000000000..7621c6b05a4 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianInnerShadow.qml @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant source + property real radius: 0.0 + property int maximumRadius: 0 + property real horizontalOffset: 0 + property real verticalOffset: 0 + property real spread: 0 + property color color: "black" + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + ShaderEffect{ + id: shadowItem + anchors.fill: parent + + property variant original: sourceProxy.output + property color color: rootItem.color + property real horizontalOffset: rootItem.horizontalOffset / rootItem.width + property real verticalOffset: rootItem.verticalOffset / rootItem.height + + visible: false + fragmentShader: " + uniform highp sampler2D original; + uniform lowp float qt_Opacity; + uniform lowp vec4 color; + uniform highp float horizontalOffset; + uniform highp float verticalOffset; + varying highp vec2 qt_TexCoord0; + + void main(void) { + highp vec2 pos = qt_TexCoord0 - vec2(horizontalOffset, verticalOffset); + lowp float ea = step(0.0, pos.x) * step(0.0, pos.y) * step(pos.x, 1.0) * step(pos.y, 1.0); + lowp float eb = 1.0 - ea; + gl_FragColor = eb * color + ea * color * (1.0 - texture2D(original, pos).a) * qt_Opacity; + } + " + } + + GaussianDirectionalBlur { + id: blurItem + anchors.fill: parent + horizontalStep: 0.0 + verticalStep: 1.0 / parent.height + source: horizontalBlur + radius: rootItem.radius + maximumRadius: rootItem.maximumRadius + visible: false + } + + GaussianDirectionalBlur { + id: horizontalBlur + width: transparentBorder ? parent.width + 2 * maximumRadius : parent.width + height: parent.height + horizontalStep: 1.0 / parent.width + verticalStep: 0.0 + source: shadowItem + radius: rootItem.radius + maximumRadius: rootItem.maximumRadius + visible: false + } + + ShaderEffectSource { + id: blurredSource + sourceItem: blurItem + live: true + smooth: true + } + + ShaderEffect { + id: shaderItem + anchors.fill: parent + + property variant original: sourceProxy.output + property variant shadow: blurredSource + property real spread: 1.0 - (rootItem.spread * 0.98) + property color color: rootItem.color + + fragmentShader: " + uniform highp sampler2D original; + uniform highp sampler2D shadow; + uniform lowp float qt_Opacity; + uniform highp float spread; + uniform lowp vec4 color; + varying highp vec2 qt_TexCoord0; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main(void) { + lowp vec4 originalColor = texture2D(original, qt_TexCoord0); + lowp vec4 shadowColor = texture2D(shadow, qt_TexCoord0); + shadowColor.rgb = mix(originalColor.rgb, color.rgb * originalColor.a, linearstep(0.0, spread, shadowColor.a)); + gl_FragColor = vec4(shadowColor.rgb, originalColor.a) * originalColor.a * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianMaskedBlur.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianMaskedBlur.qml new file mode 100644 index 00000000000..02009209c60 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/GaussianMaskedBlur.qml @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant source + property variant maskSource + property real radius: 0.0 + property int maximumRadius: 0 + property bool cached: false + property bool transparentBorder: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) + } + + SourceProxy { + id: maskSourceProxy + input: rootItem.maskSource + sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0) + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: blur + visible: rootItem.cached + smooth: true + sourceItem: blur + live: true + hideSource: visible + } + + GaussianDirectionalBlur { + id: blur + x: transparentBorder ? -maximumRadius - 1: 0 + y: transparentBorder ? -maximumRadius - 1: 0 + width: horizontalBlur.width + height: horizontalBlur.height + horizontalStep: 0.0 + verticalStep: 1.0 / parent.height + source: horizontalBlur + enableMask: true + maskSource: maskSourceProxy.output + radius: rootItem.radius + maximumRadius: rootItem.maximumRadius + transparentBorder: rootItem.transparentBorder + } + + GaussianDirectionalBlur { + id: horizontalBlur + width: transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width + height: transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height + horizontalStep: 1.0 / parent.width + verticalStep: 0.0 + source: sourceProxy.output + enableMask: true + maskSource: maskSourceProxy.output + radius: rootItem.radius + maximumRadius: rootItem.maximumRadius + transparentBorder: rootItem.transparentBorder + visible: false + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/SourceProxy.qml b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/SourceProxy.qml new file mode 100644 index 00000000000..2561d70e45c --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/private/SourceProxy.qml @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant input + property variant output + property variant sourceRect + visible: false + + Component.onCompleted: evaluateInput() + + onInputChanged: evaluateInput() + + onSourceRectChanged: evaluateInput() + + function evaluateInput() { + if (input == undefined) { + output = input + } + else if (sourceRect != undefined && sourceRect != Qt.rect(0, 0, 0, 0) && !isQQuickShaderEffectSource(input)) { + proxySource.sourceItem = input + output = proxySource + proxySource.sourceRect = sourceRect + } + else if (isQQuickItemLayerEnabled(input)) { + output = input + } + else if ((isQQuickImage(input) && !hasTileMode(input) && !hasChildren(input))) { + output = input + } + else if (isQQuickShaderEffectSource(input)) { + output = input + } + else { + proxySource.sourceItem = input + output = proxySource + proxySource.sourceRect = Qt.rect(0, 0, 0, 0) + } + } + + function isQQuickItemLayerEnabled(item) { + if (item.hasOwnProperty("layer")) { + var l = item["layer"] + if (l.hasOwnProperty("enabled") && l["enabled"].toString() == "true") + return true + } + return false + } + + function isQQuickImage(item) { + var imageProperties = [ "fillMode", "progress", "asynchronous", "sourceSize", "status", "smooth" ] + return hasProperties(item, imageProperties) + } + + function isQQuickShaderEffectSource(item) { + var shaderEffectSourceProperties = [ "hideSource", "format", "sourceItem", "mipmap", "wrapMode", "live", "recursive", "sourceRect" ] + return hasProperties(item, shaderEffectSourceProperties) + } + + function hasProperties(item, properties) { + var counter = 0 + for (var j = 0; j < properties.length; j++) { + if (item.hasOwnProperty(properties [j])) + counter++ + } + return properties.length == counter + } + + function hasChildren(item) { + if (item.hasOwnProperty("childrenRect")) { + if (item["childrenRect"].toString() != "QRectF(0, 0, 0, 0)") + return true + else + return false + } + return false + } + + function hasTileMode(item) { + if (item.hasOwnProperty("fillMode")) { + if (item["fillMode"].toString() != "0") + return true + else + return false + } + return false + } + + ShaderEffectSource { + id: proxySource + live: rootItem.input != rootItem.output + hideSource: false + smooth: true + visible: false + } +} diff --git a/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/qmldir b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/qmldir new file mode 100644 index 00000000000..1377291f739 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/003_packageQmlOnly/QtGraphicalEffects/qmldir @@ -0,0 +1,25 @@ +Blend 1.0 Blend.qml +BrightnessContrast 1.0 BrightnessContrast.qml +Colorize 1.0 Colorize.qml +ColorOverlay 1.0 ColorOverlay.qml +ConicalGradient 1.0 ConicalGradient.qml +Desaturate 1.0 Desaturate.qml +DirectionalBlur 1.0 DirectionalBlur.qml +Displace 1.0 Displace.qml +DropShadow 1.0 DropShadow.qml +FastBlur 1.0 FastBlur.qml +GammaAdjust 1.0 GammaAdjust.qml +GaussianBlur 1.0 GaussianBlur.qml +Glow 1.0 Glow.qml +HueSaturation 1.0 HueSaturation.qml +InnerShadow 1.0 InnerShadow.qml +LevelAdjust 1.0 LevelAdjust.qml +LinearGradient 1.0 LinearGradient.qml +MaskedBlur 1.0 MaskedBlur.qml +OpacityMask 1.0 OpacityMask.qml +RadialBlur 1.0 RadialBlur.qml +RadialGradient 1.0 RadialGradient.qml +RecursiveBlur 1.0 RecursiveBlur.qml +RectangularGlow 1.0 RectangularGlow.qml +ThresholdMask 1.0 ThresholdMask.qml +ZoomBlur 1.0 ZoomBlur.qml diff --git a/tests/auto/qml/codemodel/importscheck/004_cppOnly copy/QtQuick.2/plugins.qmltypes b/tests/auto/qml/codemodel/importscheck/004_cppOnly copy/QtQuick.2/plugins.qmltypes new file mode 100644 index 00000000000..cadef103707 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/004_cppOnly copy/QtQuick.2/plugins.qmltypes @@ -0,0 +1,5623 @@ +import QtQuick.tooling 1.1 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. +// +// This file was auto-generated by: +// 'qmlplugindump -nonrelocatable -builtins' + +Module { + Component { + name: "QAbstractItemModel" + prototype: "QObject" + Enum { + name: "LayoutChangeHint" + values: { + "NoLayoutChangeHint": 0, + "VerticalSortHint": 1, + "HorizontalSortHint": 2 + } + } + Signal { + name: "dataChanged" + Parameter { name: "topLeft"; type: "QModelIndex" } + Parameter { name: "bottomRight"; type: "QModelIndex" } + Parameter { name: "roles"; type: "QVector" } + } + Signal { + name: "dataChanged" + Parameter { name: "topLeft"; type: "QModelIndex" } + Parameter { name: "bottomRight"; type: "QModelIndex" } + } + Signal { + name: "headerDataChanged" + Parameter { name: "orientation"; type: "Qt::Orientation" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "layoutChanged" + Parameter { name: "parents"; type: "QList" } + Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } + } + Signal { + name: "layoutChanged" + Parameter { name: "parents"; type: "QList" } + } + Signal { name: "layoutChanged" } + Signal { + name: "layoutAboutToBeChanged" + Parameter { name: "parents"; type: "QList" } + Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } + } + Signal { + name: "layoutAboutToBeChanged" + Parameter { name: "parents"; type: "QList" } + } + Signal { name: "layoutAboutToBeChanged" } + Signal { + name: "rowsAboutToBeInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsAboutToBeRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsAboutToBeInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsAboutToBeRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { name: "modelAboutToBeReset" } + Signal { name: "modelReset" } + Signal { + name: "rowsAboutToBeMoved" + Parameter { name: "sourceParent"; type: "QModelIndex" } + Parameter { name: "sourceStart"; type: "int" } + Parameter { name: "sourceEnd"; type: "int" } + Parameter { name: "destinationParent"; type: "QModelIndex" } + Parameter { name: "destinationRow"; type: "int" } + } + Signal { + name: "rowsMoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + Parameter { name: "destination"; type: "QModelIndex" } + Parameter { name: "row"; type: "int" } + } + Signal { + name: "columnsAboutToBeMoved" + Parameter { name: "sourceParent"; type: "QModelIndex" } + Parameter { name: "sourceStart"; type: "int" } + Parameter { name: "sourceEnd"; type: "int" } + Parameter { name: "destinationParent"; type: "QModelIndex" } + Parameter { name: "destinationColumn"; type: "int" } + } + Signal { + name: "columnsMoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + Parameter { name: "destination"; type: "QModelIndex" } + Parameter { name: "column"; type: "int" } + } + Method { name: "submit"; type: "bool" } + Method { name: "revert" } + } + Component { name: "QAbstractListModel"; prototype: "QAbstractItemModel" } + Component { + name: "QDoubleValidator" + prototype: "QValidator" + Enum { + name: "Notation" + values: { + "StandardNotation": 0, + "ScientificNotation": 1 + } + } + Property { name: "bottom"; type: "double" } + Property { name: "top"; type: "double" } + Property { name: "decimals"; type: "int" } + Property { name: "notation"; type: "Notation" } + Signal { + name: "bottomChanged" + Parameter { name: "bottom"; type: "double" } + } + Signal { + name: "topChanged" + Parameter { name: "top"; type: "double" } + } + Signal { + name: "decimalsChanged" + Parameter { name: "decimals"; type: "int" } + } + Signal { + name: "notationChanged" + Parameter { name: "notation"; type: "QDoubleValidator::Notation" } + } + } + Component { + name: "QInputMethod" + prototype: "QObject" + exports: ["QtQuick/InputMethod 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Action" + values: { + "Click": 0, + "ContextMenu": 1 + } + } + Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true } + Property { name: "keyboardRectangle"; type: "QRectF"; isReadonly: true } + Property { name: "visible"; type: "bool"; isReadonly: true } + Property { name: "animating"; type: "bool"; isReadonly: true } + Property { name: "locale"; type: "QLocale"; isReadonly: true } + Property { name: "inputDirection"; type: "Qt::LayoutDirection"; isReadonly: true } + Signal { + name: "inputDirectionChanged" + Parameter { name: "newDirection"; type: "Qt::LayoutDirection" } + } + Method { name: "show" } + Method { name: "hide" } + Method { + name: "update" + Parameter { name: "queries"; type: "Qt::InputMethodQueries" } + } + Method { name: "reset" } + Method { name: "commit" } + Method { + name: "invokeAction" + Parameter { name: "a"; type: "Action" } + Parameter { name: "cursorPosition"; type: "int" } + } + } + Component { + name: "QIntValidator" + prototype: "QValidator" + Property { name: "bottom"; type: "int" } + Property { name: "top"; type: "int" } + Signal { + name: "bottomChanged" + Parameter { name: "bottom"; type: "int" } + } + Signal { + name: "topChanged" + Parameter { name: "top"; type: "int" } + } + } + Component { + name: "QKeySequence" + exports: ["QtQuick/StandardKey 2.2"] + exportMetaObjectRevisions: [2] + Enum { + name: "StandardKey" + values: { + "UnknownKey": 0, + "HelpContents": 1, + "WhatsThis": 2, + "Open": 3, + "Close": 4, + "Save": 5, + "New": 6, + "Delete": 7, + "Cut": 8, + "Copy": 9, + "Paste": 10, + "Undo": 11, + "Redo": 12, + "Back": 13, + "Forward": 14, + "Refresh": 15, + "ZoomIn": 16, + "ZoomOut": 17, + "Print": 18, + "AddTab": 19, + "NextChild": 20, + "PreviousChild": 21, + "Find": 22, + "FindNext": 23, + "FindPrevious": 24, + "Replace": 25, + "SelectAll": 26, + "Bold": 27, + "Italic": 28, + "Underline": 29, + "MoveToNextChar": 30, + "MoveToPreviousChar": 31, + "MoveToNextWord": 32, + "MoveToPreviousWord": 33, + "MoveToNextLine": 34, + "MoveToPreviousLine": 35, + "MoveToNextPage": 36, + "MoveToPreviousPage": 37, + "MoveToStartOfLine": 38, + "MoveToEndOfLine": 39, + "MoveToStartOfBlock": 40, + "MoveToEndOfBlock": 41, + "MoveToStartOfDocument": 42, + "MoveToEndOfDocument": 43, + "SelectNextChar": 44, + "SelectPreviousChar": 45, + "SelectNextWord": 46, + "SelectPreviousWord": 47, + "SelectNextLine": 48, + "SelectPreviousLine": 49, + "SelectNextPage": 50, + "SelectPreviousPage": 51, + "SelectStartOfLine": 52, + "SelectEndOfLine": 53, + "SelectStartOfBlock": 54, + "SelectEndOfBlock": 55, + "SelectStartOfDocument": 56, + "SelectEndOfDocument": 57, + "DeleteStartOfWord": 58, + "DeleteEndOfWord": 59, + "DeleteEndOfLine": 60, + "InsertParagraphSeparator": 61, + "InsertLineSeparator": 62, + "SaveAs": 63, + "Preferences": 64, + "Quit": 65, + "FullScreen": 66, + "Deselect": 67, + "DeleteCompleteLine": 68 + } + } + } + Component { + name: "QObject" + exports: ["QtQml/QtObject 2.0", "QtQuick/QtObject 2.0"] + exportMetaObjectRevisions: [0, 0] + Property { name: "objectName"; type: "string" } + Signal { + name: "objectNameChanged" + Parameter { name: "objectName"; type: "string" } + } + Method { name: "toString" } + Method { name: "destroy" } + Method { + name: "destroy" + Parameter { name: "delay"; type: "int" } + } + } + Component { + name: "QQmlApplication" + prototype: "QObject" + Property { name: "arguments"; type: "QStringList"; isReadonly: true } + Property { name: "name"; type: "string" } + Property { name: "version"; type: "string" } + Property { name: "organization"; type: "string" } + Property { name: "domain"; type: "string" } + Signal { name: "aboutToQuit" } + Method { + name: "setName" + Parameter { name: "arg"; type: "string" } + } + Method { + name: "setVersion" + Parameter { name: "arg"; type: "string" } + } + Method { + name: "setOrganization" + Parameter { name: "arg"; type: "string" } + } + Method { + name: "setDomain" + Parameter { name: "arg"; type: "string" } + } + } + Component { + name: "QQmlBind" + prototype: "QObject" + exports: ["QtQml/Binding 2.0", "QtQuick/Binding 2.0"] + exportMetaObjectRevisions: [0, 0] + Property { name: "target"; type: "QObject"; isPointer: true } + Property { name: "property"; type: "string" } + Property { name: "value"; type: "QVariant" } + Property { name: "when"; type: "bool" } + } + Component { + name: "QQmlComponent" + prototype: "QObject" + exports: [ + "QML/Component 1.0", + "QtQml/Component 2.0", + "QtQuick/Component 2.0" + ] + exportMetaObjectRevisions: [0, 0, 0] + attachedType: "QQmlComponentAttached" + Enum { + name: "CompilationMode" + values: { + "PreferSynchronous": 0, + "Asynchronous": 1 + } + } + Enum { + name: "Status" + values: { + "Null": 0, + "Ready": 1, + "Loading": 2, + "Error": 3 + } + } + Property { name: "progress"; type: "double"; isReadonly: true } + Property { name: "status"; type: "Status"; isReadonly: true } + Property { name: "url"; type: "QUrl"; isReadonly: true } + Signal { + name: "statusChanged" + Parameter { type: "QQmlComponent::Status" } + } + Signal { + name: "progressChanged" + Parameter { type: "double" } + } + Method { + name: "loadUrl" + Parameter { name: "url"; type: "QUrl" } + } + Method { + name: "loadUrl" + Parameter { name: "url"; type: "QUrl" } + Parameter { name: "mode"; type: "CompilationMode" } + } + Method { + name: "setData" + Parameter { type: "QByteArray" } + Parameter { name: "baseUrl"; type: "QUrl" } + } + Method { name: "errorString"; type: "string" } + } + Component { + name: "QQmlComponentAttached" + prototype: "QObject" + Signal { name: "completed" } + Signal { name: "destruction" } + } + Component { + name: "QQmlConnections" + prototype: "QObject" + exports: ["QtQml/Connections 2.0", "QtQuick/Connections 2.0"] + exportMetaObjectRevisions: [0, 0] + Property { name: "target"; type: "QObject"; isPointer: true } + Property { name: "ignoreUnknownSignals"; type: "bool" } + } + Component { + name: "QQmlDelegateModel" + defaultProperty: "delegate" + prototype: "QQmlInstanceModel" + exports: ["QtQuick/VisualDataModel 2.0"] + exportMetaObjectRevisions: [0] + attachedType: "QQmlDelegateModelAttached" + Property { name: "model"; type: "QVariant" } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "filterOnGroup"; type: "string" } + Property { name: "items"; type: "QQmlDelegateModelGroup"; isReadonly: true; isPointer: true } + Property { + name: "persistedItems" + type: "QQmlDelegateModelGroup" + isReadonly: true + isPointer: true + } + Property { name: "groups"; type: "QQmlDelegateModelGroup"; isList: true; isReadonly: true } + Property { name: "parts"; type: "QObject"; isReadonly: true; isPointer: true } + Property { name: "rootIndex"; type: "QVariant" } + Signal { name: "filterGroupChanged" } + Signal { name: "defaultGroupsChanged" } + Method { + name: "modelIndex" + type: "QVariant" + Parameter { name: "idx"; type: "int" } + } + Method { name: "parentModelIndex"; type: "QVariant" } + } + Component { + name: "QQmlDelegateModelAttached" + prototype: "QObject" + Property { name: "model"; type: "QQmlDelegateModel"; isReadonly: true; isPointer: true } + Property { name: "groups"; type: "QStringList" } + Property { name: "isUnresolved"; type: "bool"; isReadonly: true } + Signal { name: "unresolvedChanged" } + } + Component { + name: "QQmlDelegateModelGroup" + prototype: "QObject" + exports: ["QtQuick/VisualDataGroup 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "name"; type: "string" } + Property { name: "includeByDefault"; type: "bool" } + Signal { name: "defaultIncludeChanged" } + Signal { + name: "changed" + Parameter { name: "removed"; type: "QQmlV4Handle" } + Parameter { name: "inserted"; type: "QQmlV4Handle" } + } + Method { + name: "insert" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "create" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "resolve" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "remove" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "addGroups" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "removeGroups" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "setGroups" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "move" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "get" + type: "QQmlV4Handle" + Parameter { name: "index"; type: "int" } + } + } + Component { name: "QQmlDelegateModelParts"; prototype: "QObject" } + Component { + name: "QQmlEasingValueType" + prototype: "QQmlValueType" + exports: ["QtQuick/Easing 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Type" + values: { + "Linear": 0, + "InQuad": 1, + "OutQuad": 2, + "InOutQuad": 3, + "OutInQuad": 4, + "InCubic": 5, + "OutCubic": 6, + "InOutCubic": 7, + "OutInCubic": 8, + "InQuart": 9, + "OutQuart": 10, + "InOutQuart": 11, + "OutInQuart": 12, + "InQuint": 13, + "OutQuint": 14, + "InOutQuint": 15, + "OutInQuint": 16, + "InSine": 17, + "OutSine": 18, + "InOutSine": 19, + "OutInSine": 20, + "InExpo": 21, + "OutExpo": 22, + "InOutExpo": 23, + "OutInExpo": 24, + "InCirc": 25, + "OutCirc": 26, + "InOutCirc": 27, + "OutInCirc": 28, + "InElastic": 29, + "OutElastic": 30, + "InOutElastic": 31, + "OutInElastic": 32, + "InBack": 33, + "OutBack": 34, + "InOutBack": 35, + "OutInBack": 36, + "InBounce": 37, + "OutBounce": 38, + "InOutBounce": 39, + "OutInBounce": 40, + "InCurve": 41, + "OutCurve": 42, + "SineCurve": 43, + "CosineCurve": 44, + "Bezier": 45 + } + } + Property { name: "type"; type: "Type" } + Property { name: "amplitude"; type: "double" } + Property { name: "overshoot"; type: "double" } + Property { name: "period"; type: "double" } + Property { name: "bezierCurve"; type: "QVariantList" } + } + Component { + name: "QQmlInstanceModel" + prototype: "QObject" + Property { name: "count"; type: "int"; isReadonly: true } + Signal { + name: "modelUpdated" + Parameter { name: "changeSet"; type: "QQmlChangeSet" } + Parameter { name: "reset"; type: "bool" } + } + Signal { + name: "createdItem" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "initItem" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "destroyingItem" + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + } + Component { + name: "QQmlInstantiator" + defaultProperty: "delegate" + prototype: "QObject" + exports: ["QtQml/Instantiator 2.1", "QtQuick/Instantiator 2.1"] + exportMetaObjectRevisions: [0, 0] + Property { name: "active"; type: "bool" } + Property { name: "asynchronous"; type: "bool" } + Property { name: "model"; type: "QVariant" } + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "object"; type: "QObject"; isReadonly: true; isPointer: true } + Signal { + name: "objectAdded" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "objectRemoved" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Method { + name: "objectAt" + type: "QObject*" + Parameter { name: "index"; type: "int" } + } + } + Component { + name: "QQmlListElement" + prototype: "QObject" + exports: ["QtQuick/ListElement 2.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQmlListModel" + prototype: "QAbstractListModel" + exports: ["QtQuick/ListModel 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "dynamicRoles"; type: "bool" } + Method { name: "clear" } + Method { + name: "remove" + Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "append" + Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "insert" + Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "get" + type: "QQmlV4Handle" + Parameter { name: "index"; type: "int" } + } + Method { + name: "set" + Parameter { name: "index"; type: "int" } + Parameter { type: "QQmlV4Handle" } + } + Method { + name: "setProperty" + Parameter { name: "index"; type: "int" } + Parameter { name: "property"; type: "string" } + Parameter { name: "value"; type: "QVariant" } + } + Method { + name: "move" + Parameter { name: "from"; type: "int" } + Parameter { name: "to"; type: "int" } + Parameter { name: "count"; type: "int" } + } + Method { name: "sync" } + } + Component { + name: "QQmlLocale" + exports: ["QtQml/Locale 2.2", "QtQuick/Locale 2.0"] + exportMetaObjectRevisions: [0, 0] + Enum { + name: "MeasurementSystem" + values: { + "MetricSystem": 0, + "ImperialSystem": 1, + "ImperialUSSystem": 1, + "ImperialUKSystem": 2 + } + } + Enum { + name: "FormatType" + values: { + "LongFormat": 0, + "ShortFormat": 1, + "NarrowFormat": 2 + } + } + Enum { + name: "CurrencySymbolFormat" + values: { + "CurrencyIsoCode": 0, + "CurrencySymbol": 1, + "CurrencyDisplayName": 2 + } + } + Enum { + name: "DayOfWeek" + values: { + "Sunday": 0, + "Monday": 1, + "Tuesday": 2, + "Wednesday": 3, + "Thursday": 4, + "Friday": 5, + "Saturday": 6 + } + } + } + Component { + name: "QQmlObjectModel" + defaultProperty: "children" + prototype: "QQmlInstanceModel" + exports: ["QtQuick/VisualItemModel 2.0"] + exportMetaObjectRevisions: [0] + attachedType: "QQmlObjectModelAttached" + Property { name: "children"; type: "QObject"; isList: true; isReadonly: true } + } + Component { + name: "QQmlObjectModelAttached" + prototype: "QObject" + Property { name: "index"; type: "int"; isReadonly: true } + } + Component { + name: "QQmlTimer" + prototype: "QObject" + exports: ["QtQml/Timer 2.0", "QtQuick/Timer 2.0"] + exportMetaObjectRevisions: [0, 0] + Property { name: "interval"; type: "int" } + Property { name: "running"; type: "bool" } + Property { name: "repeat"; type: "bool" } + Property { name: "triggeredOnStart"; type: "bool" } + Property { name: "parent"; type: "QObject"; isReadonly: true; isPointer: true } + Signal { name: "triggered" } + Method { name: "start" } + Method { name: "stop" } + Method { name: "restart" } + } + Component { name: "QQmlValueType"; prototype: "QObject" } + Component { + name: "QQuickAbstractAnimation" + prototype: "QObject" + exports: ["QtQuick/Animation 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Loops" + values: { + "Infinite": -2 + } + } + Property { name: "running"; type: "bool" } + Property { name: "paused"; type: "bool" } + Property { name: "alwaysRunToEnd"; type: "bool" } + Property { name: "loops"; type: "int" } + Signal { name: "started" } + Signal { name: "stopped" } + Signal { + name: "runningChanged" + Parameter { type: "bool" } + } + Signal { + name: "pausedChanged" + Parameter { type: "bool" } + } + Signal { + name: "alwaysRunToEndChanged" + Parameter { type: "bool" } + } + Signal { + name: "loopCountChanged" + Parameter { type: "int" } + } + Method { name: "restart" } + Method { name: "start" } + Method { name: "pause" } + Method { name: "resume" } + Method { name: "stop" } + Method { name: "complete" } + } + Component { + name: "QQuickAccessibleAttached" + prototype: "QObject" + exports: ["QtQuick/Accessible 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "role"; type: "QAccessible::Role" } + Property { name: "name"; type: "string" } + Property { name: "description"; type: "string" } + Method { name: "valueChanged" } + Method { name: "cursorPositionChanged" } + } + Component { + name: "QQuickAnchorAnimation" + prototype: "QQuickAbstractAnimation" + exports: ["QtQuick/AnchorAnimation 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "targets"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "duration"; type: "int" } + Property { name: "easing"; type: "QEasingCurve" } + Signal { + name: "durationChanged" + Parameter { type: "int" } + } + Signal { + name: "easingChanged" + Parameter { type: "QEasingCurve" } + } + } + Component { + name: "QQuickAnchorChanges" + prototype: "QQuickStateOperation" + exports: ["QtQuick/AnchorChanges 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "target"; type: "QQuickItem"; isPointer: true } + Property { name: "anchors"; type: "QQuickAnchorSet"; isReadonly: true; isPointer: true } + } + Component { + name: "QQuickAnchorSet" + prototype: "QObject" + Property { name: "left"; type: "QQmlScriptString" } + Property { name: "right"; type: "QQmlScriptString" } + Property { name: "horizontalCenter"; type: "QQmlScriptString" } + Property { name: "top"; type: "QQmlScriptString" } + Property { name: "bottom"; type: "QQmlScriptString" } + Property { name: "verticalCenter"; type: "QQmlScriptString" } + Property { name: "baseline"; type: "QQmlScriptString" } + } + Component { + name: "QQuickAnchors" + prototype: "QObject" + Property { name: "left"; type: "QQuickAnchorLine" } + Property { name: "right"; type: "QQuickAnchorLine" } + Property { name: "horizontalCenter"; type: "QQuickAnchorLine" } + Property { name: "top"; type: "QQuickAnchorLine" } + Property { name: "bottom"; type: "QQuickAnchorLine" } + Property { name: "verticalCenter"; type: "QQuickAnchorLine" } + Property { name: "baseline"; type: "QQuickAnchorLine" } + Property { name: "margins"; type: "double" } + Property { name: "leftMargin"; type: "double" } + Property { name: "rightMargin"; type: "double" } + Property { name: "horizontalCenterOffset"; type: "double" } + Property { name: "topMargin"; type: "double" } + Property { name: "bottomMargin"; type: "double" } + Property { name: "verticalCenterOffset"; type: "double" } + Property { name: "baselineOffset"; type: "double" } + Property { name: "fill"; type: "QQuickItem"; isPointer: true } + Property { name: "centerIn"; type: "QQuickItem"; isPointer: true } + Property { name: "alignWhenCentered"; type: "bool" } + Signal { name: "centerAlignedChanged" } + } + Component { + name: "QQuickAnimatedImage" + defaultProperty: "data" + prototype: "QQuickImage" + exports: ["QtQuick/AnimatedImage 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "playing"; type: "bool" } + Property { name: "paused"; type: "bool" } + Property { name: "currentFrame"; type: "int" } + Property { name: "frameCount"; type: "int"; isReadonly: true } + Property { name: "sourceSize"; type: "QSize"; isReadonly: true } + Signal { name: "frameChanged" } + } + Component { + name: "QQuickAnimatedSprite" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/AnimatedSprite 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "LoopParameters" + values: { + "Infinite": -1 + } + } + Property { name: "running"; type: "bool" } + Property { name: "interpolate"; type: "bool" } + Property { name: "source"; type: "QUrl" } + Property { name: "reverse"; type: "bool" } + Property { name: "frameSync"; type: "bool" } + Property { name: "frameCount"; type: "int" } + Property { name: "frameHeight"; type: "int" } + Property { name: "frameWidth"; type: "int" } + Property { name: "frameX"; type: "int" } + Property { name: "frameY"; type: "int" } + Property { name: "frameRate"; type: "double" } + Property { name: "frameDuration"; type: "int" } + Property { name: "loops"; type: "int" } + Property { name: "paused"; type: "bool" } + Property { name: "currentFrame"; type: "int" } + Signal { + name: "pausedChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "runningChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "interpolateChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "sourceChanged" + Parameter { name: "arg"; type: "QUrl" } + } + Signal { + name: "reverseChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "frameSyncChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "frameCountChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameHeightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameWidthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameXChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameYChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameRateChanged" + Parameter { name: "arg"; type: "double" } + } + Signal { + name: "frameDurationChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "loopsChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "currentFrameChanged" + Parameter { name: "arg"; type: "int" } + } + Method { name: "start" } + Method { name: "stop" } + Method { name: "restart" } + Method { + name: "advance" + Parameter { name: "frames"; type: "int" } + } + Method { name: "advance" } + Method { name: "pause" } + Method { name: "resume" } + Method { + name: "setRunning" + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "setPaused" + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "setInterpolate" + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "setSource" + Parameter { name: "arg"; type: "QUrl" } + } + Method { + name: "setReverse" + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "setFrameSync" + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "setFrameCount" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameHeight" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameWidth" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameX" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameY" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameRate" + Parameter { name: "arg"; type: "double" } + } + Method { + name: "setFrameDuration" + Parameter { name: "arg"; type: "int" } + } + Method { name: "resetFrameRate" } + Method { name: "resetFrameDuration" } + Method { + name: "setLoops" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setCurrentFrame" + Parameter { name: "arg"; type: "int" } + } + } + Component { + name: "QQuickAnimationController" + defaultProperty: "animation" + prototype: "QObject" + exports: ["QtQuick/AnimationController 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "progress"; type: "double" } + Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true } + Method { name: "reload" } + Method { name: "completeToBeginning" } + Method { name: "completeToEnd" } + } + Component { + name: "QQuickAnimationGroup" + defaultProperty: "animations" + prototype: "QQuickAbstractAnimation" + Property { name: "animations"; type: "QQuickAbstractAnimation"; isList: true; isReadonly: true } + } + Component { + name: "QQuickAnimator" + prototype: "QQuickAbstractAnimation" + exports: ["QtQuick/Animator 2.2"] + exportMetaObjectRevisions: [0] + Property { name: "target"; type: "QQuickItem"; isPointer: true } + Property { name: "easing"; type: "QEasingCurve" } + Property { name: "duration"; type: "int" } + Property { name: "to"; type: "double" } + Property { name: "from"; type: "double" } + Signal { + name: "targetItemChanged" + Parameter { type: "QQuickItem"; isPointer: true } + } + Signal { + name: "durationChanged" + Parameter { name: "duration"; type: "int" } + } + Signal { + name: "easingChanged" + Parameter { name: "curve"; type: "QEasingCurve" } + } + Signal { + name: "toChanged" + Parameter { name: "to"; type: "double" } + } + Signal { + name: "fromChanged" + Parameter { name: "from"; type: "double" } + } + } + Component { + name: "QQuickApplication" + prototype: "QQmlApplication" + exports: ["QtQuick/Application 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "active"; type: "bool"; isReadonly: true } + Property { name: "layoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } + Property { name: "supportsMultipleWindows"; type: "bool"; isReadonly: true } + Property { name: "state"; type: "Qt::ApplicationState"; isReadonly: true } + Signal { + name: "stateChanged" + Parameter { name: "state"; type: "Qt::ApplicationState" } + } + } + Component { + name: "QQuickBasePositioner" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + exports: ["QtQuick/Positioner 2.0"] + exportMetaObjectRevisions: [0] + attachedType: "QQuickPositionerAttached" + Property { name: "spacing"; type: "double" } + Property { name: "populate"; type: "QQuickTransition"; isPointer: true } + Property { name: "move"; type: "QQuickTransition"; isPointer: true } + Property { name: "add"; type: "QQuickTransition"; isPointer: true } + } + Component { + name: "QQuickBehavior" + defaultProperty: "animation" + prototype: "QObject" + exports: ["QtQuick/Behavior 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true } + Property { name: "enabled"; type: "bool" } + } + Component { + name: "QQuickBorderImage" + defaultProperty: "data" + prototype: "QQuickImageBase" + exports: ["QtQuick/BorderImage 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "TileMode" + values: { + "Stretch": 0, + "Repeat": 1, + "Round": 2 + } + } + Property { name: "border"; type: "QQuickScaleGrid"; isReadonly: true; isPointer: true } + Property { name: "horizontalTileMode"; type: "TileMode" } + Property { name: "verticalTileMode"; type: "TileMode" } + Property { name: "sourceSize"; type: "QSize"; isReadonly: true } + } + Component { + name: "QQuickCanvasItem" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/Canvas 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "RenderTarget" + values: { + "Image": 0, + "FramebufferObject": 1 + } + } + Enum { + name: "RenderStrategy" + values: { + "Immediate": 0, + "Threaded": 1, + "Cooperative": 2 + } + } + Property { name: "available"; type: "bool"; isReadonly: true } + Property { name: "contextType"; type: "string" } + Property { name: "context"; type: "QQmlV4Handle"; isReadonly: true } + Property { name: "canvasSize"; type: "QSizeF" } + Property { name: "tileSize"; type: "QSize" } + Property { name: "canvasWindow"; type: "QRectF" } + Property { name: "renderTarget"; type: "RenderTarget" } + Property { name: "renderStrategy"; type: "RenderStrategy" } + Signal { + name: "paint" + Parameter { name: "region"; type: "QRect" } + } + Signal { name: "painted" } + Signal { name: "imageLoaded" } + Method { + name: "loadImage" + Parameter { name: "url"; type: "QUrl" } + } + Method { + name: "unloadImage" + Parameter { name: "url"; type: "QUrl" } + } + Method { + name: "isImageLoaded" + type: "bool" + Parameter { name: "url"; type: "QUrl" } + } + Method { + name: "isImageLoading" + type: "bool" + Parameter { name: "url"; type: "QUrl" } + } + Method { + name: "isImageError" + type: "bool" + Parameter { name: "url"; type: "QUrl" } + } + Method { + name: "getContext" + Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "requestAnimationFrame" + Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "cancelRequestAnimationFrame" + Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true } + } + Method { name: "requestPaint" } + Method { + name: "markDirty" + Parameter { name: "dirtyRect"; type: "QRectF" } + } + Method { name: "markDirty" } + Method { + name: "save" + type: "bool" + Parameter { name: "filename"; type: "string" } + } + Method { + name: "toDataURL" + type: "string" + Parameter { name: "type"; type: "string" } + } + Method { name: "toDataURL"; type: "string" } + } + Component { + name: "QQuickColorAnimation" + prototype: "QQuickPropertyAnimation" + exports: ["QtQuick/ColorAnimation 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "from"; type: "QColor" } + Property { name: "to"; type: "QColor" } + } + Component { + name: "QQuickColumn" + defaultProperty: "data" + prototype: "QQuickBasePositioner" + exports: ["QtQuick/Column 2.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickCurve" + prototype: "QQuickPathElement" + Property { name: "x"; type: "double" } + Property { name: "y"; type: "double" } + Property { name: "relativeX"; type: "double" } + Property { name: "relativeY"; type: "double" } + } + Component { + name: "QQuickDoubleValidator" + prototype: "QDoubleValidator" + exports: ["QtQuick/DoubleValidator 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "locale"; type: "string" } + Signal { name: "localeNameChanged" } + } + Component { + name: "QQuickDrag" + prototype: "QObject" + exports: ["QtQuick/Drag 2.0"] + exportMetaObjectRevisions: [0] + attachedType: "QQuickDragAttached" + Enum { + name: "DragType" + values: { + "None": 0, + "Automatic": 1, + "Internal": 2 + } + } + Enum { + name: "Axis" + values: { + "XAxis": 1, + "YAxis": 2, + "XAndYAxis": 3, + "XandYAxis": 3 + } + } + Property { name: "target"; type: "QQuickItem"; isPointer: true } + Property { name: "axis"; type: "Axis" } + Property { name: "minimumX"; type: "double" } + Property { name: "maximumX"; type: "double" } + Property { name: "minimumY"; type: "double" } + Property { name: "maximumY"; type: "double" } + Property { name: "active"; type: "bool"; isReadonly: true } + Property { name: "filterChildren"; type: "bool" } + Property { name: "threshold"; type: "double" } + } + Component { + name: "QQuickDragAttached" + prototype: "QObject" + Property { name: "active"; type: "bool" } + Property { name: "source"; type: "QObject"; isPointer: true } + Property { name: "target"; type: "QObject"; isReadonly: true; isPointer: true } + Property { name: "hotSpot"; type: "QPointF" } + Property { name: "keys"; type: "QStringList" } + Property { name: "mimeData"; type: "QVariantMap" } + Property { name: "supportedActions"; type: "Qt::DropActions" } + Property { name: "proposedAction"; type: "Qt::DropAction" } + Property { name: "dragType"; type: "QQuickDrag::DragType" } + Signal { name: "dragStarted" } + Signal { + name: "dragFinished" + Parameter { name: "dropAction"; type: "Qt::DropAction" } + } + Method { + name: "start" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "startDrag" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { name: "cancel" } + Method { name: "drop"; type: "int" } + } + Component { + name: "QQuickDropArea" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/DropArea 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "containsDrag"; type: "bool"; isReadonly: true } + Property { name: "keys"; type: "QStringList" } + Property { name: "drag"; type: "QQuickDropAreaDrag"; isReadonly: true; isPointer: true } + Signal { name: "sourceChanged" } + Signal { + name: "entered" + Parameter { name: "drag"; type: "QQuickDropEvent"; isPointer: true } + } + Signal { name: "exited" } + Signal { + name: "positionChanged" + Parameter { name: "drag"; type: "QQuickDropEvent"; isPointer: true } + } + Signal { + name: "dropped" + Parameter { name: "drop"; type: "QQuickDropEvent"; isPointer: true } + } + } + Component { + name: "QQuickDropAreaDrag" + prototype: "QObject" + Property { name: "x"; type: "double"; isReadonly: true } + Property { name: "y"; type: "double"; isReadonly: true } + Property { name: "source"; type: "QObject"; isReadonly: true; isPointer: true } + Signal { name: "positionChanged" } + } + Component { + name: "QQuickFlickable" + defaultProperty: "flickableData" + prototype: "QQuickItem" + exports: ["QtQuick/Flickable 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "BoundsBehavior" + values: { + "StopAtBounds": 0, + "DragOverBounds": 1, + "DragAndOvershootBounds": 2 + } + } + Enum { + name: "FlickableDirection" + values: { + "AutoFlickDirection": 0, + "HorizontalFlick": 1, + "VerticalFlick": 2, + "HorizontalAndVerticalFlick": 3 + } + } + Property { name: "contentWidth"; type: "double" } + Property { name: "contentHeight"; type: "double" } + Property { name: "contentX"; type: "double" } + Property { name: "contentY"; type: "double" } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "topMargin"; type: "double" } + Property { name: "bottomMargin"; type: "double" } + Property { name: "originY"; type: "double"; isReadonly: true } + Property { name: "leftMargin"; type: "double" } + Property { name: "rightMargin"; type: "double" } + Property { name: "originX"; type: "double"; isReadonly: true } + Property { name: "horizontalVelocity"; type: "double"; isReadonly: true } + Property { name: "verticalVelocity"; type: "double"; isReadonly: true } + Property { name: "boundsBehavior"; type: "BoundsBehavior" } + Property { name: "rebound"; type: "QQuickTransition"; isPointer: true } + Property { name: "maximumFlickVelocity"; type: "double" } + Property { name: "flickDeceleration"; type: "double" } + Property { name: "moving"; type: "bool"; isReadonly: true } + Property { name: "movingHorizontally"; type: "bool"; isReadonly: true } + Property { name: "movingVertically"; type: "bool"; isReadonly: true } + Property { name: "flicking"; type: "bool"; isReadonly: true } + Property { name: "flickingHorizontally"; type: "bool"; isReadonly: true } + Property { name: "flickingVertically"; type: "bool"; isReadonly: true } + Property { name: "dragging"; type: "bool"; isReadonly: true } + Property { name: "draggingHorizontally"; type: "bool"; isReadonly: true } + Property { name: "draggingVertically"; type: "bool"; isReadonly: true } + Property { name: "flickableDirection"; type: "FlickableDirection" } + Property { name: "interactive"; type: "bool" } + Property { name: "pressDelay"; type: "int" } + Property { name: "atXEnd"; type: "bool"; isReadonly: true } + Property { name: "atYEnd"; type: "bool"; isReadonly: true } + Property { name: "atXBeginning"; type: "bool"; isReadonly: true } + Property { name: "atYBeginning"; type: "bool"; isReadonly: true } + Property { + name: "visibleArea" + type: "QQuickFlickableVisibleArea" + isReadonly: true + isPointer: true + } + Property { name: "pixelAligned"; type: "bool" } + Property { name: "flickableData"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "flickableChildren"; type: "QQuickItem"; isList: true; isReadonly: true } + Signal { name: "isAtBoundaryChanged" } + Signal { name: "movementStarted" } + Signal { name: "movementEnded" } + Signal { name: "flickStarted" } + Signal { name: "flickEnded" } + Signal { name: "dragStarted" } + Signal { name: "dragEnded" } + Method { + name: "resizeContent" + Parameter { name: "w"; type: "double" } + Parameter { name: "h"; type: "double" } + Parameter { name: "center"; type: "QPointF" } + } + Method { name: "returnToBounds" } + Method { + name: "flick" + Parameter { name: "xVelocity"; type: "double" } + Parameter { name: "yVelocity"; type: "double" } + } + Method { name: "cancelFlick" } + } + Component { + name: "QQuickFlickableVisibleArea" + prototype: "QObject" + Property { name: "xPosition"; type: "double"; isReadonly: true } + Property { name: "yPosition"; type: "double"; isReadonly: true } + Property { name: "widthRatio"; type: "double"; isReadonly: true } + Property { name: "heightRatio"; type: "double"; isReadonly: true } + Signal { + name: "xPositionChanged" + Parameter { name: "xPosition"; type: "double" } + } + Signal { + name: "yPositionChanged" + Parameter { name: "yPosition"; type: "double" } + } + Signal { + name: "widthRatioChanged" + Parameter { name: "widthRatio"; type: "double" } + } + Signal { + name: "heightRatioChanged" + Parameter { name: "heightRatio"; type: "double" } + } + } + Component { + name: "QQuickFlipable" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/Flipable 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Side" + values: { + "Front": 0, + "Back": 1 + } + } + Property { name: "front"; type: "QQuickItem"; isPointer: true } + Property { name: "back"; type: "QQuickItem"; isPointer: true } + Property { name: "side"; type: "Side"; isReadonly: true } + } + Component { + name: "QQuickFlow" + defaultProperty: "data" + prototype: "QQuickBasePositioner" + exports: ["QtQuick/Flow 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Flow" + values: { + "LeftToRight": 0, + "TopToBottom": 1 + } + } + Property { name: "flow"; type: "Flow" } + Property { name: "layoutDirection"; type: "Qt::LayoutDirection" } + Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } + } + Component { + name: "QQuickFocusScope" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/FocusScope 2.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickFontLoader" + prototype: "QObject" + exports: ["QtQuick/FontLoader 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Status" + values: { + "Null": 0, + "Ready": 1, + "Loading": 2, + "Error": 3 + } + } + Property { name: "source"; type: "QUrl" } + Property { name: "name"; type: "string" } + Property { name: "status"; type: "Status"; isReadonly: true } + } + Component { + name: "QQuickFontValueType" + prototype: "QQmlValueType" + exports: ["QtQuick/Font 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "FontWeight" + values: { + "Light": 25, + "Normal": 50, + "DemiBold": 63, + "Bold": 75, + "Black": 87 + } + } + Enum { + name: "Capitalization" + values: { + "MixedCase": 0, + "AllUppercase": 1, + "AllLowercase": 2, + "SmallCaps": 3, + "Capitalize": 4 + } + } + Property { name: "family"; type: "string" } + Property { name: "bold"; type: "bool" } + Property { name: "weight"; type: "FontWeight" } + Property { name: "italic"; type: "bool" } + Property { name: "underline"; type: "bool" } + Property { name: "overline"; type: "bool" } + Property { name: "strikeout"; type: "bool" } + Property { name: "pointSize"; type: "double" } + Property { name: "pixelSize"; type: "int" } + Property { name: "capitalization"; type: "Capitalization" } + Property { name: "letterSpacing"; type: "double" } + Property { name: "wordSpacing"; type: "double" } + } + Component { + name: "QQuickGradient" + defaultProperty: "stops" + prototype: "QObject" + exports: ["QtQuick/Gradient 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "stops"; type: "QQuickGradientStop"; isList: true; isReadonly: true } + Signal { name: "updated" } + } + Component { + name: "QQuickGradientStop" + prototype: "QObject" + exports: ["QtQuick/GradientStop 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "position"; type: "double" } + Property { name: "color"; type: "QColor" } + } + Component { + name: "QQuickGrid" + defaultProperty: "data" + prototype: "QQuickBasePositioner" + exports: ["QtQuick/Grid 2.0", "QtQuick/Grid 2.1"] + exportMetaObjectRevisions: [0, 1] + Enum { + name: "Flow" + values: { + "LeftToRight": 0, + "TopToBottom": 1 + } + } + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Property { name: "rows"; type: "int" } + Property { name: "columns"; type: "int" } + Property { name: "rowSpacing"; type: "double" } + Property { name: "columnSpacing"; type: "double" } + Property { name: "flow"; type: "Flow" } + Property { name: "layoutDirection"; type: "Qt::LayoutDirection" } + Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } + Property { name: "horizontalItemAlignment"; revision: 1; type: "HAlignment" } + Property { + name: "effectiveHorizontalItemAlignment" + revision: 1 + type: "HAlignment" + isReadonly: true + } + Property { name: "verticalItemAlignment"; revision: 1; type: "VAlignment" } + Signal { + name: "horizontalAlignmentChanged" + revision: 1 + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "effectiveHorizontalAlignmentChanged" + revision: 1 + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + revision: 1 + Parameter { name: "alignment"; type: "VAlignment" } + } + } + Component { + name: "QQuickGridMesh" + prototype: "QQuickShaderEffectMesh" + exports: ["QtQuick/GridMesh 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "resolution"; type: "QSize" } + } + Component { + name: "QQuickGridView" + defaultProperty: "data" + prototype: "QQuickItemView" + exports: ["QtQuick/GridView 2.0", "QtQuick/GridView 2.1"] + exportMetaObjectRevisions: [0, 1] + attachedType: "QQuickGridViewAttached" + Enum { + name: "Flow" + values: { + "FlowLeftToRight": 0, + "FlowTopToBottom": 2 + } + } + Enum { + name: "SnapMode" + values: { + "NoSnap": 0, + "SnapToRow": 1, + "SnapOneRow": 2 + } + } + Property { name: "flow"; type: "Flow" } + Property { name: "cellWidth"; type: "double" } + Property { name: "cellHeight"; type: "double" } + Property { name: "snapMode"; type: "SnapMode" } + Signal { name: "highlightMoveDurationChanged" } + Method { name: "moveCurrentIndexUp" } + Method { name: "moveCurrentIndexDown" } + Method { name: "moveCurrentIndexLeft" } + Method { name: "moveCurrentIndexRight" } + } + Component { + name: "QQuickGridViewAttached" + prototype: "QQuickItemViewAttached" + Property { name: "view"; type: "QQuickGridView"; isReadonly: true; isPointer: true } + } + Component { + name: "QQuickImage" + defaultProperty: "data" + prototype: "QQuickImageBase" + exports: ["QtQuick/Image 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Enum { + name: "FillMode" + values: { + "Stretch": 0, + "PreserveAspectFit": 1, + "PreserveAspectCrop": 2, + "Tile": 3, + "TileVertically": 4, + "TileHorizontally": 5, + "Pad": 6 + } + } + Property { name: "fillMode"; type: "FillMode" } + Property { name: "paintedWidth"; type: "double"; isReadonly: true } + Property { name: "paintedHeight"; type: "double"; isReadonly: true } + Property { name: "horizontalAlignment"; type: "HAlignment" } + Property { name: "verticalAlignment"; type: "VAlignment" } + Signal { name: "paintedGeometryChanged" } + Signal { + name: "horizontalAlignmentChanged" + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + Parameter { name: "alignment"; type: "VAlignment" } + } + } + Component { + name: "QQuickImageBase" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + Enum { + name: "Status" + values: { + "Null": 0, + "Ready": 1, + "Loading": 2, + "Error": 3 + } + } + Property { name: "status"; type: "Status"; isReadonly: true } + Property { name: "source"; type: "QUrl" } + Property { name: "progress"; type: "double"; isReadonly: true } + Property { name: "asynchronous"; type: "bool" } + Property { name: "cache"; type: "bool" } + Property { name: "sourceSize"; type: "QSize" } + Property { name: "mirror"; type: "bool" } + Signal { + name: "sourceChanged" + Parameter { type: "QUrl" } + } + Signal { + name: "statusChanged" + Parameter { type: "QQuickImageBase::Status" } + } + Signal { + name: "progressChanged" + Parameter { name: "progress"; type: "double" } + } + } + Component { + name: "QQuickImplicitSizeItem" + defaultProperty: "data" + prototype: "QQuickItem" + Property { name: "implicitWidth"; type: "double"; isReadonly: true } + Property { name: "implicitHeight"; type: "double"; isReadonly: true } + Signal { name: "implicitWidthChanged2"; revision: 1 } + Signal { name: "implicitHeightChanged2"; revision: 1 } + } + Component { + name: "QQuickIntValidator" + prototype: "QIntValidator" + exports: ["QtQuick/IntValidator 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "locale"; type: "string" } + Signal { name: "localeNameChanged" } + } + Component { + name: "QQuickItem" + defaultProperty: "data" + prototype: "QObject" + exports: ["QtQuick/Item 2.0", "QtQuick/Item 2.1"] + exportMetaObjectRevisions: [0, 1] + Enum { + name: "TransformOrigin" + values: { + "TopLeft": 0, + "Top": 1, + "TopRight": 2, + "Left": 3, + "Center": 4, + "Right": 5, + "BottomLeft": 6, + "Bottom": 7, + "BottomRight": 8 + } + } + Property { name: "parent"; type: "QQuickItem"; isPointer: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "x"; type: "double" } + Property { name: "y"; type: "double" } + Property { name: "z"; type: "double" } + Property { name: "width"; type: "double" } + Property { name: "height"; type: "double" } + Property { name: "opacity"; type: "double" } + Property { name: "enabled"; type: "bool" } + Property { name: "visible"; type: "bool" } + Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true } + Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true } + Property { name: "state"; type: "string" } + Property { name: "childrenRect"; type: "QRectF"; isReadonly: true } + Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true } + Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baselineOffset"; type: "double" } + Property { name: "clip"; type: "bool" } + Property { name: "focus"; type: "bool" } + Property { name: "activeFocus"; type: "bool"; isReadonly: true } + Property { name: "activeFocusOnTab"; revision: 1; type: "bool" } + Property { name: "rotation"; type: "double" } + Property { name: "scale"; type: "double" } + Property { name: "transformOrigin"; type: "TransformOrigin" } + Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true } + Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true } + Property { name: "smooth"; type: "bool" } + Property { name: "antialiasing"; type: "bool" } + Property { name: "implicitWidth"; type: "double" } + Property { name: "implicitHeight"; type: "double" } + Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true } + Signal { + name: "childrenRectChanged" + Parameter { type: "QRectF" } + } + Signal { + name: "baselineOffsetChanged" + Parameter { type: "double" } + } + Signal { + name: "stateChanged" + Parameter { type: "string" } + } + Signal { + name: "focusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusOnTabChanged" + revision: 1 + Parameter { type: "bool" } + } + Signal { + name: "parentChanged" + Parameter { type: "QQuickItem"; isPointer: true } + } + Signal { + name: "transformOriginChanged" + Parameter { type: "TransformOrigin" } + } + Signal { + name: "smoothChanged" + Parameter { type: "bool" } + } + Signal { + name: "antialiasingChanged" + Parameter { type: "bool" } + } + Signal { + name: "clipChanged" + Parameter { type: "bool" } + } + Signal { + name: "windowChanged" + revision: 1 + Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } + } + Method { name: "update" } + Method { + name: "contains" + type: "bool" + Parameter { name: "point"; type: "QPointF" } + } + Method { + name: "mapFromItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapToItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { name: "forceActiveFocus" } + Method { + name: "forceActiveFocus" + Parameter { name: "reason"; type: "Qt::FocusReason" } + } + Method { + name: "nextItemInFocusChain" + revision: 1 + type: "QQuickItem*" + Parameter { name: "forward"; type: "bool" } + } + Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" } + Method { + name: "childAt" + type: "QQuickItem*" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } + Component { + name: "QQuickItemLayer" + prototype: "QObject" + Property { name: "enabled"; type: "bool" } + Property { name: "textureSize"; type: "QSize" } + Property { name: "sourceRect"; type: "QRectF" } + Property { name: "mipmap"; type: "bool" } + Property { name: "smooth"; type: "bool" } + Property { name: "wrapMode"; type: "QQuickShaderEffectSource::WrapMode" } + Property { name: "format"; type: "QQuickShaderEffectSource::Format" } + Property { name: "samplerName"; type: "QByteArray" } + Property { name: "effect"; type: "QQmlComponent"; isPointer: true } + Signal { + name: "enabledChanged" + Parameter { name: "enabled"; type: "bool" } + } + Signal { + name: "sizeChanged" + Parameter { name: "size"; type: "QSize" } + } + Signal { + name: "mipmapChanged" + Parameter { name: "mipmap"; type: "bool" } + } + Signal { + name: "wrapModeChanged" + Parameter { name: "mode"; type: "QQuickShaderEffectSource::WrapMode" } + } + Signal { + name: "nameChanged" + Parameter { name: "name"; type: "QByteArray" } + } + Signal { + name: "effectChanged" + Parameter { name: "component"; type: "QQmlComponent"; isPointer: true } + } + Signal { + name: "smoothChanged" + Parameter { name: "smooth"; type: "bool" } + } + Signal { + name: "formatChanged" + Parameter { name: "format"; type: "QQuickShaderEffectSource::Format" } + } + Signal { + name: "sourceRectChanged" + Parameter { name: "sourceRect"; type: "QRectF" } + } + } + Component { + name: "QQuickItemView" + defaultProperty: "flickableData" + prototype: "QQuickFlickable" + exports: ["QtQuick/ItemView 2.1"] + exportMetaObjectRevisions: [1] + Enum { + name: "LayoutDirection" + values: { + "LeftToRight": 0, + "RightToLeft": 1, + "VerticalTopToBottom": 2, + "VerticalBottomToTop": 3 + } + } + Enum { + name: "VerticalLayoutDirection" + values: { + "TopToBottom": 2, + "BottomToTop": 3 + } + } + Enum { + name: "HighlightRangeMode" + values: { + "NoHighlightRange": 0, + "ApplyRange": 1, + "StrictlyEnforceRange": 2 + } + } + Enum { + name: "PositionMode" + values: { + "Beginning": 0, + "Center": 1, + "End": 2, + "Visible": 3, + "Contain": 4, + "SnapPosition": 5 + } + } + Property { name: "model"; type: "QVariant" } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "currentIndex"; type: "int" } + Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "keyNavigationWraps"; type: "bool" } + Property { name: "cacheBuffer"; type: "int" } + Property { name: "layoutDirection"; type: "Qt::LayoutDirection" } + Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } + Property { name: "verticalLayoutDirection"; type: "VerticalLayoutDirection" } + Property { name: "header"; type: "QQmlComponent"; isPointer: true } + Property { name: "headerItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "footer"; type: "QQmlComponent"; isPointer: true } + Property { name: "footerItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "populate"; type: "QQuickTransition"; isPointer: true } + Property { name: "add"; type: "QQuickTransition"; isPointer: true } + Property { name: "addDisplaced"; type: "QQuickTransition"; isPointer: true } + Property { name: "move"; type: "QQuickTransition"; isPointer: true } + Property { name: "moveDisplaced"; type: "QQuickTransition"; isPointer: true } + Property { name: "remove"; type: "QQuickTransition"; isPointer: true } + Property { name: "removeDisplaced"; type: "QQuickTransition"; isPointer: true } + Property { name: "displaced"; type: "QQuickTransition"; isPointer: true } + Property { name: "highlight"; type: "QQmlComponent"; isPointer: true } + Property { name: "highlightItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "highlightFollowsCurrentItem"; type: "bool" } + Property { name: "highlightRangeMode"; type: "HighlightRangeMode" } + Property { name: "preferredHighlightBegin"; type: "double" } + Property { name: "preferredHighlightEnd"; type: "double" } + Property { name: "highlightMoveDuration"; type: "int" } + Signal { name: "populateTransitionChanged" } + Signal { name: "addTransitionChanged" } + Signal { name: "addDisplacedTransitionChanged" } + Signal { name: "moveTransitionChanged" } + Signal { name: "moveDisplacedTransitionChanged" } + Signal { name: "removeTransitionChanged" } + Signal { name: "removeDisplacedTransitionChanged" } + Signal { name: "displacedTransitionChanged" } + Method { + name: "positionViewAtIndex" + Parameter { name: "index"; type: "int" } + Parameter { name: "mode"; type: "int" } + } + Method { + name: "indexAt" + type: "int" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + Method { + name: "itemAt" + type: "QQuickItem*" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + Method { name: "positionViewAtBeginning" } + Method { name: "positionViewAtEnd" } + Method { name: "forceLayout"; revision: 1 } + } + Component { + name: "QQuickItemViewAttached" + prototype: "QObject" + Property { name: "isCurrentItem"; type: "bool"; isReadonly: true } + Property { name: "delayRemove"; type: "bool" } + Property { name: "section"; type: "string"; isReadonly: true } + Property { name: "previousSection"; type: "string"; isReadonly: true } + Property { name: "nextSection"; type: "string"; isReadonly: true } + Signal { name: "currentItemChanged" } + Signal { name: "add" } + Signal { name: "remove" } + Signal { name: "prevSectionChanged" } + } + Component { + name: "QQuickKeyNavigationAttached" + prototype: "QObject" + exports: ["QtQuick/KeyNavigation 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Priority" + values: { + "BeforeItem": 0, + "AfterItem": 1 + } + } + Property { name: "left"; type: "QQuickItem"; isPointer: true } + Property { name: "right"; type: "QQuickItem"; isPointer: true } + Property { name: "up"; type: "QQuickItem"; isPointer: true } + Property { name: "down"; type: "QQuickItem"; isPointer: true } + Property { name: "tab"; type: "QQuickItem"; isPointer: true } + Property { name: "backtab"; type: "QQuickItem"; isPointer: true } + Property { name: "priority"; type: "Priority" } + } + Component { + name: "QQuickKeysAttached" + prototype: "QObject" + exports: ["QtQuick/Keys 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Priority" + values: { + "BeforeItem": 0, + "AfterItem": 1 + } + } + Property { name: "enabled"; type: "bool" } + Property { name: "forwardTo"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "priority"; type: "Priority" } + Signal { + name: "pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "released" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit0Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit1Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit2Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit3Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit4Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit5Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit6Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit7Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit8Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit9Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "leftPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "rightPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "upPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "downPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "tabPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "backtabPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "asteriskPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "numberSignPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "escapePressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "returnPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "enterPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "deletePressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "spacePressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "backPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "cancelPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "selectPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "yesPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "noPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "context1Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "context2Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "context3Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "context4Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "callPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "hangupPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "flipPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "menuPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "volumeUpPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "volumeDownPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + } + Component { + name: "QQuickLayoutMirroringAttached" + prototype: "QObject" + exports: ["QtQuick/LayoutMirroring 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "enabled"; type: "bool" } + Property { name: "childrenInherit"; type: "bool" } + } + Component { + name: "QQuickListView" + defaultProperty: "data" + prototype: "QQuickItemView" + exports: ["QtQuick/ListView 2.0", "QtQuick/ListView 2.1"] + exportMetaObjectRevisions: [0, 1] + attachedType: "QQuickListViewAttached" + Enum { + name: "Orientation" + values: { + "Horizontal": 1, + "Vertical": 2 + } + } + Enum { + name: "SnapMode" + values: { + "NoSnap": 0, + "SnapToItem": 1, + "SnapOneItem": 2 + } + } + Property { name: "highlightMoveVelocity"; type: "double" } + Property { name: "highlightResizeVelocity"; type: "double" } + Property { name: "highlightResizeDuration"; type: "int" } + Property { name: "spacing"; type: "double" } + Property { name: "orientation"; type: "Orientation" } + Property { name: "section"; type: "QQuickViewSection"; isReadonly: true; isPointer: true } + Property { name: "currentSection"; type: "string"; isReadonly: true } + Property { name: "snapMode"; type: "SnapMode" } + Method { name: "incrementCurrentIndex" } + Method { name: "decrementCurrentIndex" } + } + Component { + name: "QQuickListViewAttached" + prototype: "QQuickItemViewAttached" + Property { name: "view"; type: "QQuickListView"; isReadonly: true; isPointer: true } + } + Component { + name: "QQuickLoader" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + exports: ["QtQuick/Loader 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Status" + values: { + "Null": 0, + "Ready": 1, + "Loading": 2, + "Error": 3 + } + } + Property { name: "active"; type: "bool" } + Property { name: "source"; type: "QUrl" } + Property { name: "sourceComponent"; type: "QQmlComponent"; isPointer: true } + Property { name: "item"; type: "QObject"; isReadonly: true; isPointer: true } + Property { name: "status"; type: "Status"; isReadonly: true } + Property { name: "progress"; type: "double"; isReadonly: true } + Property { name: "asynchronous"; type: "bool" } + Signal { name: "loaded" } + Method { + name: "setSource" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + } + Component { + name: "QQuickMouseArea" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/MouseArea 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "mouseX"; type: "double"; isReadonly: true } + Property { name: "mouseY"; type: "double"; isReadonly: true } + Property { name: "containsMouse"; type: "bool"; isReadonly: true } + Property { name: "pressed"; type: "bool"; isReadonly: true } + Property { name: "enabled"; type: "bool" } + Property { name: "pressedButtons"; type: "Qt::MouseButtons"; isReadonly: true } + Property { name: "acceptedButtons"; type: "Qt::MouseButtons" } + Property { name: "hoverEnabled"; type: "bool" } + Property { name: "drag"; type: "QQuickDrag"; isReadonly: true; isPointer: true } + Property { name: "preventStealing"; type: "bool" } + Property { name: "propagateComposedEvents"; type: "bool" } + Property { name: "cursorShape"; type: "Qt::CursorShape" } + Signal { name: "hoveredChanged" } + Signal { + name: "positionChanged" + Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "mouseXChanged" + Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "mouseYChanged" + Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "pressed" + Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "pressAndHold" + Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "released" + Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "clicked" + Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "doubleClicked" + Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "wheel" + Parameter { name: "wheel"; type: "QQuickWheelEvent"; isPointer: true } + } + Signal { name: "entered" } + Signal { name: "exited" } + Signal { name: "canceled" } + } + Component { + name: "QQuickMouseEvent" + prototype: "QObject" + Property { name: "x"; type: "double"; isReadonly: true } + Property { name: "y"; type: "double"; isReadonly: true } + Property { name: "button"; type: "int"; isReadonly: true } + Property { name: "buttons"; type: "int"; isReadonly: true } + Property { name: "modifiers"; type: "int"; isReadonly: true } + Property { name: "wasHeld"; type: "bool"; isReadonly: true } + Property { name: "isClick"; type: "bool"; isReadonly: true } + Property { name: "accepted"; type: "bool" } + } + Component { + name: "QQuickMultiPointTouchArea" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/MultiPointTouchArea 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "touchPoints"; type: "QQuickTouchPoint"; isList: true; isReadonly: true } + Property { name: "minimumTouchPoints"; type: "int" } + Property { name: "maximumTouchPoints"; type: "int" } + Signal { + name: "pressed" + Parameter { name: "touchPoints"; type: "QList" } + } + Signal { + name: "updated" + Parameter { name: "touchPoints"; type: "QList" } + } + Signal { + name: "released" + Parameter { name: "touchPoints"; type: "QList" } + } + Signal { + name: "canceled" + Parameter { name: "touchPoints"; type: "QList" } + } + Signal { + name: "gestureStarted" + Parameter { name: "gesture"; type: "QQuickGrabGestureEvent"; isPointer: true } + } + Signal { + name: "touchUpdated" + Parameter { name: "touchPoints"; type: "QList" } + } + } + Component { + name: "QQuickNumberAnimation" + prototype: "QQuickPropertyAnimation" + exports: ["QtQuick/NumberAnimation 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "from"; type: "double" } + Property { name: "to"; type: "double" } + } + Component { + name: "QQuickOpacityAnimator" + prototype: "QQuickAnimator" + exports: ["QtQuick/OpacityAnimator 2.2"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickPackage" + defaultProperty: "data" + prototype: "QObject" + exports: ["QtQuick/Package 2.0"] + exportMetaObjectRevisions: [0] + attachedType: "QQuickPackageAttached" + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + } + Component { + name: "QQuickPackageAttached" + prototype: "QObject" + Property { name: "name"; type: "string" } + } + Component { + name: "QQuickPaintedItem" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/PaintedItem 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "RenderTarget" + values: { + "Image": 0, + "FramebufferObject": 1, + "InvertedYFramebufferObject": 2 + } + } + Property { name: "contentsSize"; type: "QSize" } + Property { name: "fillColor"; type: "QColor" } + Property { name: "contentsScale"; type: "double" } + Property { name: "renderTarget"; type: "RenderTarget" } + } + Component { + name: "QQuickParallelAnimation" + defaultProperty: "animations" + prototype: "QQuickAnimationGroup" + exports: ["QtQuick/ParallelAnimation 2.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickParentAnimation" + defaultProperty: "animations" + prototype: "QQuickAnimationGroup" + exports: ["QtQuick/ParentAnimation 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "target"; type: "QQuickItem"; isPointer: true } + Property { name: "newParent"; type: "QQuickItem"; isPointer: true } + Property { name: "via"; type: "QQuickItem"; isPointer: true } + } + Component { + name: "QQuickParentChange" + prototype: "QQuickStateOperation" + exports: ["QtQuick/ParentChange 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "target"; type: "QQuickItem"; isPointer: true } + Property { name: "parent"; type: "QQuickItem"; isPointer: true } + Property { name: "x"; type: "QQmlScriptString" } + Property { name: "y"; type: "QQmlScriptString" } + Property { name: "width"; type: "QQmlScriptString" } + Property { name: "height"; type: "QQmlScriptString" } + Property { name: "scale"; type: "QQmlScriptString" } + Property { name: "rotation"; type: "QQmlScriptString" } + } + Component { + name: "QQuickPath" + defaultProperty: "pathElements" + prototype: "QObject" + exports: ["QtQuick/Path 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "pathElements"; type: "QQuickPathElement"; isList: true; isReadonly: true } + Property { name: "startX"; type: "double" } + Property { name: "startY"; type: "double" } + Property { name: "closed"; type: "bool"; isReadonly: true } + Signal { name: "changed" } + } + Component { + name: "QQuickPathAnimation" + prototype: "QQuickAbstractAnimation" + exports: ["QtQuick/PathAnimation 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Orientation" + values: { + "Fixed": 0, + "RightFirst": 1, + "LeftFirst": 2, + "BottomFirst": 3, + "TopFirst": 4 + } + } + Property { name: "duration"; type: "int" } + Property { name: "easing"; type: "QEasingCurve" } + Property { name: "path"; type: "QQuickPath"; isPointer: true } + Property { name: "target"; type: "QQuickItem"; isPointer: true } + Property { name: "orientation"; type: "Orientation" } + Property { name: "anchorPoint"; type: "QPointF" } + Property { name: "orientationEntryDuration"; type: "int" } + Property { name: "orientationExitDuration"; type: "int" } + Property { name: "endRotation"; type: "double" } + Signal { + name: "durationChanged" + Parameter { type: "int" } + } + Signal { + name: "easingChanged" + Parameter { type: "QEasingCurve" } + } + Signal { + name: "orientationChanged" + Parameter { type: "Orientation" } + } + Signal { + name: "anchorPointChanged" + Parameter { type: "QPointF" } + } + Signal { + name: "orientationEntryDurationChanged" + Parameter { type: "double" } + } + Signal { + name: "orientationExitDurationChanged" + Parameter { type: "double" } + } + Signal { + name: "endRotationChanged" + Parameter { type: "double" } + } + } + Component { + name: "QQuickPathArc" + prototype: "QQuickCurve" + exports: ["QtQuick/PathArc 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "ArcDirection" + values: { + "Clockwise": 0, + "Counterclockwise": 1 + } + } + Property { name: "radiusX"; type: "double" } + Property { name: "radiusY"; type: "double" } + Property { name: "useLargeArc"; type: "bool" } + Property { name: "direction"; type: "ArcDirection" } + } + Component { + name: "QQuickPathAttribute" + prototype: "QQuickPathElement" + exports: ["QtQuick/PathAttribute 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "name"; type: "string" } + Property { name: "value"; type: "double" } + } + Component { + name: "QQuickPathCatmullRomCurve" + prototype: "QQuickCurve" + exports: ["QtQuick/PathCurve 2.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickPathCubic" + prototype: "QQuickCurve" + exports: ["QtQuick/PathCubic 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "control1X"; type: "double" } + Property { name: "control1Y"; type: "double" } + Property { name: "control2X"; type: "double" } + Property { name: "control2Y"; type: "double" } + Property { name: "relativeControl1X"; type: "double" } + Property { name: "relativeControl1Y"; type: "double" } + Property { name: "relativeControl2X"; type: "double" } + Property { name: "relativeControl2Y"; type: "double" } + } + Component { + name: "QQuickPathElement" + prototype: "QObject" + Signal { name: "changed" } + } + Component { + name: "QQuickPathInterpolator" + prototype: "QObject" + exports: ["QtQuick/PathInterpolator 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "path"; type: "QQuickPath"; isPointer: true } + Property { name: "progress"; type: "double" } + Property { name: "x"; type: "double"; isReadonly: true } + Property { name: "y"; type: "double"; isReadonly: true } + Property { name: "angle"; type: "double"; isReadonly: true } + } + Component { + name: "QQuickPathLine" + prototype: "QQuickCurve" + exports: ["QtQuick/PathLine 2.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickPathPercent" + prototype: "QQuickPathElement" + exports: ["QtQuick/PathPercent 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "value"; type: "double" } + } + Component { + name: "QQuickPathQuad" + prototype: "QQuickCurve" + exports: ["QtQuick/PathQuad 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "controlX"; type: "double" } + Property { name: "controlY"; type: "double" } + Property { name: "relativeControlX"; type: "double" } + Property { name: "relativeControlY"; type: "double" } + } + Component { + name: "QQuickPathSvg" + prototype: "QQuickCurve" + exports: ["QtQuick/PathSvg 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "path"; type: "string" } + } + Component { + name: "QQuickPathView" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/PathView 2.0"] + exportMetaObjectRevisions: [0] + attachedType: "QQuickPathViewAttached" + Enum { + name: "HighlightRangeMode" + values: { + "NoHighlightRange": 0, + "ApplyRange": 1, + "StrictlyEnforceRange": 2 + } + } + Enum { + name: "SnapMode" + values: { + "NoSnap": 0, + "SnapToItem": 1, + "SnapOneItem": 2 + } + } + Enum { + name: "PositionMode" + values: { + "Beginning": 0, + "Center": 1, + "End": 2, + "Contain": 4, + "SnapPosition": 5 + } + } + Property { name: "model"; type: "QVariant" } + Property { name: "path"; type: "QQuickPath"; isPointer: true } + Property { name: "currentIndex"; type: "int" } + Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "offset"; type: "double" } + Property { name: "highlight"; type: "QQmlComponent"; isPointer: true } + Property { name: "highlightItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "preferredHighlightBegin"; type: "double" } + Property { name: "preferredHighlightEnd"; type: "double" } + Property { name: "highlightRangeMode"; type: "HighlightRangeMode" } + Property { name: "highlightMoveDuration"; type: "int" } + Property { name: "dragMargin"; type: "double" } + Property { name: "maximumFlickVelocity"; type: "double" } + Property { name: "flickDeceleration"; type: "double" } + Property { name: "interactive"; type: "bool" } + Property { name: "moving"; type: "bool"; isReadonly: true } + Property { name: "flicking"; type: "bool"; isReadonly: true } + Property { name: "dragging"; type: "bool"; isReadonly: true } + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "pathItemCount"; type: "int" } + Property { name: "snapMode"; type: "SnapMode" } + Property { name: "cacheItemCount"; type: "int" } + Signal { name: "snapPositionChanged" } + Signal { name: "movementStarted" } + Signal { name: "movementEnded" } + Signal { name: "flickStarted" } + Signal { name: "flickEnded" } + Signal { name: "dragStarted" } + Signal { name: "dragEnded" } + Method { name: "incrementCurrentIndex" } + Method { name: "decrementCurrentIndex" } + Method { + name: "positionViewAtIndex" + Parameter { name: "index"; type: "int" } + Parameter { name: "mode"; type: "int" } + } + Method { + name: "indexAt" + type: "int" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + Method { + name: "itemAt" + type: "QQuickItem*" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } + Component { + name: "QQuickPathViewAttached" + prototype: "QObject" + Property { name: "view"; type: "QQuickPathView"; isReadonly: true; isPointer: true } + Property { name: "isCurrentItem"; type: "bool"; isReadonly: true } + Property { name: "onPath"; type: "bool"; isReadonly: true } + Signal { name: "currentItemChanged" } + Signal { name: "pathChanged" } + } + Component { + name: "QQuickPauseAnimation" + prototype: "QQuickAbstractAnimation" + exports: ["QtQuick/PauseAnimation 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "duration"; type: "int" } + Signal { + name: "durationChanged" + Parameter { type: "int" } + } + } + Component { + name: "QQuickPen" + prototype: "QObject" + Property { name: "width"; type: "double" } + Property { name: "color"; type: "QColor" } + Property { name: "pixelAligned"; type: "bool" } + Signal { name: "penChanged" } + } + Component { + name: "QQuickPinch" + prototype: "QObject" + exports: ["QtQuick/Pinch 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Axis" + values: { + "NoDrag": 0, + "XAxis": 1, + "YAxis": 2, + "XAndYAxis": 3, + "XandYAxis": 3 + } + } + Property { name: "target"; type: "QQuickItem"; isPointer: true } + Property { name: "minimumScale"; type: "double" } + Property { name: "maximumScale"; type: "double" } + Property { name: "minimumRotation"; type: "double" } + Property { name: "maximumRotation"; type: "double" } + Property { name: "dragAxis"; type: "Axis" } + Property { name: "minimumX"; type: "double" } + Property { name: "maximumX"; type: "double" } + Property { name: "minimumY"; type: "double" } + Property { name: "maximumY"; type: "double" } + Property { name: "active"; type: "bool"; isReadonly: true } + } + Component { + name: "QQuickPinchArea" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/PinchArea 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "enabled"; type: "bool" } + Property { name: "pinch"; type: "QQuickPinch"; isReadonly: true; isPointer: true } + Signal { + name: "pinchStarted" + Parameter { name: "pinch"; type: "QQuickPinchEvent"; isPointer: true } + } + Signal { + name: "pinchUpdated" + Parameter { name: "pinch"; type: "QQuickPinchEvent"; isPointer: true } + } + Signal { + name: "pinchFinished" + Parameter { name: "pinch"; type: "QQuickPinchEvent"; isPointer: true } + } + } + Component { + name: "QQuickPositionerAttached" + prototype: "QObject" + Property { name: "index"; type: "int"; isReadonly: true } + Property { name: "isFirstItem"; type: "bool"; isReadonly: true } + Property { name: "isLastItem"; type: "bool"; isReadonly: true } + } + Component { + name: "QQuickPropertyAction" + prototype: "QQuickAbstractAnimation" + exports: ["QtQuick/PropertyAction 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "target"; type: "QObject"; isPointer: true } + Property { name: "property"; type: "string" } + Property { name: "properties"; type: "string" } + Property { name: "targets"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "exclude"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "value"; type: "QVariant" } + Signal { + name: "valueChanged" + Parameter { type: "QVariant" } + } + Signal { + name: "propertiesChanged" + Parameter { type: "string" } + } + } + Component { + name: "QQuickPropertyAnimation" + prototype: "QQuickAbstractAnimation" + exports: ["QtQuick/PropertyAnimation 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "duration"; type: "int" } + Property { name: "from"; type: "QVariant" } + Property { name: "to"; type: "QVariant" } + Property { name: "easing"; type: "QEasingCurve" } + Property { name: "target"; type: "QObject"; isPointer: true } + Property { name: "property"; type: "string" } + Property { name: "properties"; type: "string" } + Property { name: "targets"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "exclude"; type: "QObject"; isList: true; isReadonly: true } + Signal { + name: "durationChanged" + Parameter { type: "int" } + } + Signal { + name: "fromChanged" + Parameter { type: "QVariant" } + } + Signal { + name: "toChanged" + Parameter { type: "QVariant" } + } + Signal { + name: "easingChanged" + Parameter { type: "QEasingCurve" } + } + Signal { + name: "propertiesChanged" + Parameter { type: "string" } + } + } + Component { + name: "QQuickPropertyChanges" + prototype: "QQuickStateOperation" + exports: ["QtQuick/PropertyChanges 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "target"; type: "QObject"; isPointer: true } + Property { name: "restoreEntryValues"; type: "bool" } + Property { name: "explicit"; type: "bool" } + } + Component { + name: "QQuickRectangle" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/Rectangle 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "color"; type: "QColor" } + Property { name: "gradient"; type: "QQuickGradient"; isPointer: true } + Property { name: "border"; type: "QQuickPen"; isReadonly: true; isPointer: true } + Property { name: "radius"; type: "double" } + } + Component { + name: "QQuickRepeater" + defaultProperty: "delegate" + prototype: "QQuickItem" + exports: ["QtQuick/Repeater 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "model"; type: "QVariant" } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "count"; type: "int"; isReadonly: true } + Signal { + name: "itemAdded" + Parameter { name: "index"; type: "int" } + Parameter { name: "item"; type: "QQuickItem"; isPointer: true } + } + Signal { + name: "itemRemoved" + Parameter { name: "index"; type: "int" } + Parameter { name: "item"; type: "QQuickItem"; isPointer: true } + } + Method { + name: "itemAt" + type: "QQuickItem*" + Parameter { name: "index"; type: "int" } + } + } + Component { + name: "QQuickRotation" + prototype: "QQuickTransform" + exports: ["QtQuick/Rotation 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "origin"; type: "QVector3D" } + Property { name: "angle"; type: "double" } + Property { name: "axis"; type: "QVector3D" } + } + Component { + name: "QQuickRotationAnimation" + prototype: "QQuickPropertyAnimation" + exports: ["QtQuick/RotationAnimation 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "RotationDirection" + values: { + "Numerical": 0, + "Shortest": 1, + "Clockwise": 2, + "Counterclockwise": 3 + } + } + Property { name: "from"; type: "double" } + Property { name: "to"; type: "double" } + Property { name: "direction"; type: "RotationDirection" } + } + Component { + name: "QQuickRotationAnimator" + prototype: "QQuickAnimator" + exports: ["QtQuick/RotationAnimator 2.2"] + exportMetaObjectRevisions: [0] + Enum { + name: "RotationDirection" + values: { + "Numerical": 0, + "Shortest": 1, + "Clockwise": 2, + "Counterclockwise": 3 + } + } + Property { name: "direction"; type: "RotationDirection" } + Signal { + name: "directionChanged" + Parameter { name: "dir"; type: "RotationDirection" } + } + } + Component { + name: "QQuickRow" + defaultProperty: "data" + prototype: "QQuickBasePositioner" + exports: ["QtQuick/Row 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "layoutDirection"; type: "Qt::LayoutDirection" } + Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } + } + Component { + name: "QQuickScale" + prototype: "QQuickTransform" + exports: ["QtQuick/Scale 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "origin"; type: "QVector3D" } + Property { name: "xScale"; type: "double" } + Property { name: "yScale"; type: "double" } + Property { name: "zScale"; type: "double" } + Signal { name: "scaleChanged" } + } + Component { + name: "QQuickScaleAnimator" + prototype: "QQuickAnimator" + exports: ["QtQuick/ScaleAnimator 2.2"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickScaleGrid" + prototype: "QObject" + Property { name: "left"; type: "int" } + Property { name: "top"; type: "int" } + Property { name: "right"; type: "int" } + Property { name: "bottom"; type: "int" } + Signal { name: "borderChanged" } + } + Component { + name: "QQuickScriptAction" + prototype: "QQuickAbstractAnimation" + exports: ["QtQuick/ScriptAction 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "script"; type: "QQmlScriptString" } + Property { name: "scriptName"; type: "string" } + } + Component { + name: "QQuickSequentialAnimation" + defaultProperty: "animations" + prototype: "QQuickAnimationGroup" + exports: ["QtQuick/SequentialAnimation 2.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickShaderEffect" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/ShaderEffect 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "CullMode" + values: { + "NoCulling": 0, + "BackFaceCulling": 1, + "FrontFaceCulling": 2 + } + } + Enum { + name: "Status" + values: { + "Compiled": 0, + "Uncompiled": 1, + "Error": 2 + } + } + Property { name: "fragmentShader"; type: "QByteArray" } + Property { name: "vertexShader"; type: "QByteArray" } + Property { name: "blending"; type: "bool" } + Property { name: "mesh"; type: "QVariant" } + Property { name: "cullMode"; type: "CullMode" } + Property { name: "log"; type: "string"; isReadonly: true } + Property { name: "status"; type: "Status"; isReadonly: true } + } + Component { + name: "QQuickShaderEffectMesh" + prototype: "QObject" + exports: ["QtQuick/ShaderEffectMesh 2.0"] + exportMetaObjectRevisions: [0] + Signal { name: "geometryChanged" } + } + Component { + name: "QQuickShaderEffectSource" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/ShaderEffectSource 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "WrapMode" + values: { + "ClampToEdge": 0, + "RepeatHorizontally": 1, + "RepeatVertically": 2, + "Repeat": 3 + } + } + Enum { + name: "Format" + values: { + "Alpha": 6406, + "RGB": 6407, + "RGBA": 6408 + } + } + Property { name: "wrapMode"; type: "WrapMode" } + Property { name: "sourceItem"; type: "QQuickItem"; isPointer: true } + Property { name: "sourceRect"; type: "QRectF" } + Property { name: "textureSize"; type: "QSize" } + Property { name: "format"; type: "Format" } + Property { name: "live"; type: "bool" } + Property { name: "hideSource"; type: "bool" } + Property { name: "mipmap"; type: "bool" } + Property { name: "recursive"; type: "bool" } + Signal { name: "scheduledUpdateCompleted" } + Method { name: "scheduleUpdate" } + } + Component { + name: "QQuickSmoothedAnimation" + prototype: "QQuickNumberAnimation" + exports: ["QtQuick/SmoothedAnimation 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "ReversingMode" + values: { + "Eased": 0, + "Immediate": 1, + "Sync": 2 + } + } + Property { name: "velocity"; type: "double" } + Property { name: "reversingMode"; type: "ReversingMode" } + Property { name: "maximumEasingTime"; type: "double" } + } + Component { + name: "QQuickSpringAnimation" + prototype: "QQuickNumberAnimation" + exports: ["QtQuick/SpringAnimation 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "velocity"; type: "double" } + Property { name: "spring"; type: "double" } + Property { name: "damping"; type: "double" } + Property { name: "epsilon"; type: "double" } + Property { name: "modulus"; type: "double" } + Property { name: "mass"; type: "double" } + Signal { name: "syncChanged" } + } + Component { + name: "QQuickSprite" + prototype: "QQuickStochasticState" + exports: ["QtQuick/Sprite 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "source"; type: "QUrl" } + Property { name: "reverse"; type: "bool" } + Property { name: "frameSync"; type: "bool" } + Property { name: "frames"; type: "int" } + Property { name: "frameCount"; type: "int" } + Property { name: "frameHeight"; type: "int" } + Property { name: "frameWidth"; type: "int" } + Property { name: "frameX"; type: "int" } + Property { name: "frameY"; type: "int" } + Property { name: "frameRate"; type: "double" } + Property { name: "frameRateVariation"; type: "double" } + Property { name: "frameDuration"; type: "int" } + Property { name: "frameDurationVariation"; type: "int" } + Signal { + name: "sourceChanged" + Parameter { name: "arg"; type: "QUrl" } + } + Signal { + name: "frameHeightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameWidthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "reverseChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "frameCountChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameXChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameYChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameRateChanged" + Parameter { name: "arg"; type: "double" } + } + Signal { + name: "frameRateVariationChanged" + Parameter { name: "arg"; type: "double" } + } + Signal { + name: "frameDurationChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameDurationVariationChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameSyncChanged" + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "setSource" + Parameter { name: "arg"; type: "QUrl" } + } + Method { + name: "setFrameHeight" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameWidth" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setReverse" + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "setFrames" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameCount" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameX" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameY" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameRate" + Parameter { name: "arg"; type: "double" } + } + Method { + name: "setFrameRateVariation" + Parameter { name: "arg"; type: "double" } + } + Method { + name: "setFrameDuration" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameDurationVariation" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameSync" + Parameter { name: "arg"; type: "bool" } + } + } + Component { + name: "QQuickSpriteSequence" + defaultProperty: "sprites" + prototype: "QQuickItem" + exports: ["QtQuick/SpriteSequence 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "running"; type: "bool" } + Property { name: "interpolate"; type: "bool" } + Property { name: "goalSprite"; type: "string" } + Property { name: "currentSprite"; type: "string"; isReadonly: true } + Property { name: "sprites"; type: "QQuickSprite"; isList: true; isReadonly: true } + Signal { + name: "runningChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "interpolateChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "goalSpriteChanged" + Parameter { name: "arg"; type: "string" } + } + Signal { + name: "currentSpriteChanged" + Parameter { name: "arg"; type: "string" } + } + Method { + name: "jumpTo" + Parameter { name: "sprite"; type: "string" } + } + Method { + name: "setGoalSprite" + Parameter { name: "sprite"; type: "string" } + } + Method { + name: "setRunning" + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "setInterpolate" + Parameter { name: "arg"; type: "bool" } + } + } + Component { + name: "QQuickState" + defaultProperty: "changes" + prototype: "QObject" + exports: ["QtQuick/State 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "name"; type: "string" } + Property { name: "when"; type: "QQmlBinding"; isPointer: true } + Property { name: "extend"; type: "string" } + Property { name: "changes"; type: "QQuickStateOperation"; isList: true; isReadonly: true } + Signal { name: "completed" } + } + Component { + name: "QQuickStateChangeScript" + prototype: "QQuickStateOperation" + exports: ["QtQuick/StateChangeScript 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "script"; type: "QQmlScriptString" } + Property { name: "name"; type: "string" } + } + Component { + name: "QQuickStateGroup" + prototype: "QObject" + exports: ["QtQuick/StateGroup 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "state"; type: "string" } + Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true } + Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true } + Signal { + name: "stateChanged" + Parameter { type: "string" } + } + } + Component { name: "QQuickStateOperation"; prototype: "QObject" } + Component { + name: "QQuickStochasticState" + prototype: "QObject" + Property { name: "duration"; type: "int" } + Property { name: "durationVariation"; type: "int" } + Property { name: "randomStart"; type: "bool" } + Property { name: "to"; type: "QVariantMap" } + Property { name: "name"; type: "string" } + Signal { + name: "durationChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "nameChanged" + Parameter { name: "arg"; type: "string" } + } + Signal { + name: "toChanged" + Parameter { name: "arg"; type: "QVariantMap" } + } + Signal { + name: "durationVariationChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { name: "entered" } + Signal { + name: "randomStartChanged" + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "setDuration" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setName" + Parameter { name: "arg"; type: "string" } + } + Method { + name: "setTo" + Parameter { name: "arg"; type: "QVariantMap" } + } + Method { + name: "setDurationVariation" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setRandomStart" + Parameter { name: "arg"; type: "bool" } + } + } + Component { + name: "QQuickSystemPalette" + prototype: "QObject" + exports: ["QtQuick/SystemPalette 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "ColorGroup" + values: { + "Active": 0, + "Inactive": 2, + "Disabled": 1 + } + } + Property { name: "colorGroup"; type: "QQuickSystemPalette::ColorGroup" } + Property { name: "window"; type: "QColor"; isReadonly: true } + Property { name: "windowText"; type: "QColor"; isReadonly: true } + Property { name: "base"; type: "QColor"; isReadonly: true } + Property { name: "text"; type: "QColor"; isReadonly: true } + Property { name: "alternateBase"; type: "QColor"; isReadonly: true } + Property { name: "button"; type: "QColor"; isReadonly: true } + Property { name: "buttonText"; type: "QColor"; isReadonly: true } + Property { name: "light"; type: "QColor"; isReadonly: true } + Property { name: "midlight"; type: "QColor"; isReadonly: true } + Property { name: "dark"; type: "QColor"; isReadonly: true } + Property { name: "mid"; type: "QColor"; isReadonly: true } + Property { name: "shadow"; type: "QColor"; isReadonly: true } + Property { name: "highlight"; type: "QColor"; isReadonly: true } + Property { name: "highlightedText"; type: "QColor"; isReadonly: true } + Signal { name: "paletteChanged" } + } + Component { + name: "QQuickText" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + exports: ["QtQuick/Text 2.0", "QtQuick/Text 2.2"] + exportMetaObjectRevisions: [0, 2] + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4, + "AlignJustify": 8 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Enum { + name: "TextStyle" + values: { + "Normal": 0, + "Outline": 1, + "Raised": 2, + "Sunken": 3 + } + } + Enum { + name: "TextFormat" + values: { + "PlainText": 0, + "RichText": 1, + "AutoText": 2, + "StyledText": 4 + } + } + Enum { + name: "TextElideMode" + values: { + "ElideLeft": 0, + "ElideRight": 1, + "ElideMiddle": 2, + "ElideNone": 3 + } + } + Enum { + name: "WrapMode" + values: { + "NoWrap": 0, + "WordWrap": 1, + "WrapAnywhere": 3, + "WrapAtWordBoundaryOrAnywhere": 4, + "Wrap": 4 + } + } + Enum { + name: "RenderType" + values: { + "QtRendering": 0, + "NativeRendering": 1 + } + } + Enum { + name: "LineHeightMode" + values: { + "ProportionalHeight": 0, + "FixedHeight": 1 + } + } + Enum { + name: "FontSizeMode" + values: { + "FixedSize": 0, + "HorizontalFit": 1, + "VerticalFit": 2, + "Fit": 3 + } + } + Property { name: "text"; type: "string" } + Property { name: "font"; type: "QFont" } + Property { name: "color"; type: "QColor" } + Property { name: "linkColor"; type: "QColor" } + Property { name: "style"; type: "TextStyle" } + Property { name: "styleColor"; type: "QColor" } + Property { name: "horizontalAlignment"; type: "HAlignment" } + Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true } + Property { name: "verticalAlignment"; type: "VAlignment" } + Property { name: "wrapMode"; type: "WrapMode" } + Property { name: "lineCount"; type: "int"; isReadonly: true } + Property { name: "truncated"; type: "bool"; isReadonly: true } + Property { name: "maximumLineCount"; type: "int" } + Property { name: "textFormat"; type: "TextFormat" } + Property { name: "elide"; type: "TextElideMode" } + Property { name: "contentWidth"; type: "double"; isReadonly: true } + Property { name: "contentHeight"; type: "double"; isReadonly: true } + Property { name: "paintedWidth"; type: "double"; isReadonly: true } + Property { name: "paintedHeight"; type: "double"; isReadonly: true } + Property { name: "lineHeight"; type: "double" } + Property { name: "lineHeightMode"; type: "LineHeightMode" } + Property { name: "baseUrl"; type: "QUrl" } + Property { name: "minimumPixelSize"; type: "int" } + Property { name: "minimumPointSize"; type: "int" } + Property { name: "fontSizeMode"; type: "FontSizeMode" } + Property { name: "renderType"; type: "RenderType" } + Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true } + Signal { + name: "textChanged" + Parameter { name: "text"; type: "string" } + } + Signal { + name: "linkActivated" + Parameter { name: "link"; type: "string" } + } + Signal { + name: "linkHovered" + revision: 2 + Parameter { name: "link"; type: "string" } + } + Signal { + name: "fontChanged" + Parameter { name: "font"; type: "QFont" } + } + Signal { + name: "styleChanged" + Parameter { name: "style"; type: "TextStyle" } + } + Signal { + name: "horizontalAlignmentChanged" + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + Parameter { name: "alignment"; type: "VAlignment" } + } + Signal { + name: "textFormatChanged" + Parameter { name: "textFormat"; type: "TextFormat" } + } + Signal { + name: "elideModeChanged" + Parameter { name: "mode"; type: "TextElideMode" } + } + Signal { name: "contentSizeChanged" } + Signal { + name: "lineHeightChanged" + Parameter { name: "lineHeight"; type: "double" } + } + Signal { + name: "lineHeightModeChanged" + Parameter { name: "mode"; type: "LineHeightMode" } + } + Signal { + name: "lineLaidOut" + Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true } + } + Method { name: "doLayout" } + } + Component { name: "QQuickTextDocument"; prototype: "QObject" } + Component { + name: "QQuickTextEdit" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + exports: [ + "QtQuick/TextEdit 2.0", + "QtQuick/TextEdit 2.1", + "QtQuick/TextEdit 2.2" + ] + exportMetaObjectRevisions: [0, 1, 2] + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4, + "AlignJustify": 8 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Enum { + name: "TextFormat" + values: { + "PlainText": 0, + "RichText": 1, + "AutoText": 2 + } + } + Enum { + name: "WrapMode" + values: { + "NoWrap": 0, + "WordWrap": 1, + "WrapAnywhere": 3, + "WrapAtWordBoundaryOrAnywhere": 4, + "Wrap": 4 + } + } + Enum { + name: "SelectionMode" + values: { + "SelectCharacters": 0, + "SelectWords": 1 + } + } + Enum { + name: "RenderType" + values: { + "QtRendering": 0, + "NativeRendering": 1 + } + } + Property { name: "text"; type: "string" } + Property { name: "color"; type: "QColor" } + Property { name: "selectionColor"; type: "QColor" } + Property { name: "selectedTextColor"; type: "QColor" } + Property { name: "font"; type: "QFont" } + Property { name: "horizontalAlignment"; type: "HAlignment" } + Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true } + Property { name: "verticalAlignment"; type: "VAlignment" } + Property { name: "wrapMode"; type: "WrapMode" } + Property { name: "lineCount"; type: "int"; isReadonly: true } + Property { name: "length"; type: "int"; isReadonly: true } + Property { name: "contentWidth"; type: "double"; isReadonly: true } + Property { name: "contentHeight"; type: "double"; isReadonly: true } + Property { name: "paintedWidth"; type: "double"; isReadonly: true } + Property { name: "paintedHeight"; type: "double"; isReadonly: true } + Property { name: "textFormat"; type: "TextFormat" } + Property { name: "readOnly"; type: "bool" } + Property { name: "cursorVisible"; type: "bool" } + Property { name: "cursorPosition"; type: "int" } + Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true } + Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "selectionStart"; type: "int"; isReadonly: true } + Property { name: "selectionEnd"; type: "int"; isReadonly: true } + Property { name: "selectedText"; type: "string"; isReadonly: true } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "persistentSelection"; type: "bool" } + Property { name: "textMargin"; type: "double" } + Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" } + Property { name: "selectByKeyboard"; revision: 1; type: "bool" } + Property { name: "selectByMouse"; type: "bool" } + Property { name: "mouseSelectionMode"; type: "SelectionMode" } + Property { name: "canPaste"; type: "bool"; isReadonly: true } + Property { name: "canUndo"; type: "bool"; isReadonly: true } + Property { name: "canRedo"; type: "bool"; isReadonly: true } + Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true } + Property { name: "baseUrl"; type: "QUrl" } + Property { name: "renderType"; type: "RenderType" } + Property { + name: "textDocument" + revision: 1 + type: "QQuickTextDocument" + isReadonly: true + isPointer: true + } + Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true } + Signal { name: "contentSizeChanged" } + Signal { + name: "colorChanged" + Parameter { name: "color"; type: "QColor" } + } + Signal { + name: "selectionColorChanged" + Parameter { name: "color"; type: "QColor" } + } + Signal { + name: "selectedTextColorChanged" + Parameter { name: "color"; type: "QColor" } + } + Signal { + name: "fontChanged" + Parameter { name: "font"; type: "QFont" } + } + Signal { + name: "horizontalAlignmentChanged" + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + Parameter { name: "alignment"; type: "VAlignment" } + } + Signal { + name: "textFormatChanged" + Parameter { name: "textFormat"; type: "TextFormat" } + } + Signal { + name: "readOnlyChanged" + Parameter { name: "isReadOnly"; type: "bool" } + } + Signal { + name: "cursorVisibleChanged" + Parameter { name: "isCursorVisible"; type: "bool" } + } + Signal { + name: "activeFocusOnPressChanged" + Parameter { name: "activeFocusOnPressed"; type: "bool" } + } + Signal { + name: "persistentSelectionChanged" + Parameter { name: "isPersistentSelection"; type: "bool" } + } + Signal { + name: "textMarginChanged" + Parameter { name: "textMargin"; type: "double" } + } + Signal { + name: "selectByKeyboardChanged" + revision: 1 + Parameter { name: "selectByKeyboard"; type: "bool" } + } + Signal { + name: "selectByMouseChanged" + Parameter { name: "selectByMouse"; type: "bool" } + } + Signal { + name: "mouseSelectionModeChanged" + Parameter { name: "mode"; type: "SelectionMode" } + } + Signal { + name: "linkActivated" + Parameter { name: "link"; type: "string" } + } + Signal { + name: "linkHovered" + revision: 2 + Parameter { name: "link"; type: "string" } + } + Method { name: "selectAll" } + Method { name: "selectWord" } + Method { + name: "select" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { name: "deselect" } + Method { + name: "isRightToLeft" + type: "bool" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { name: "cut" } + Method { name: "copy" } + Method { name: "paste" } + Method { name: "undo" } + Method { name: "redo" } + Method { + name: "insert" + Parameter { name: "position"; type: "int" } + Parameter { name: "text"; type: "string" } + } + Method { + name: "remove" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { + name: "append" + revision: 2 + Parameter { name: "text"; type: "string" } + } + Method { + name: "positionToRectangle" + type: "QRectF" + Parameter { type: "int" } + } + Method { + name: "positionAt" + type: "int" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + Method { + name: "moveCursorSelection" + Parameter { name: "pos"; type: "int" } + } + Method { + name: "moveCursorSelection" + Parameter { name: "pos"; type: "int" } + Parameter { name: "mode"; type: "SelectionMode" } + } + Method { + name: "getText" + type: "string" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { + name: "getFormattedText" + type: "string" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + } + Component { + name: "QQuickTextInput" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + exports: ["QtQuick/TextInput 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "EchoMode" + values: { + "Normal": 0, + "NoEcho": 1, + "Password": 2, + "PasswordEchoOnEdit": 3 + } + } + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Enum { + name: "WrapMode" + values: { + "NoWrap": 0, + "WordWrap": 1, + "WrapAnywhere": 3, + "WrapAtWordBoundaryOrAnywhere": 4, + "Wrap": 4 + } + } + Enum { + name: "SelectionMode" + values: { + "SelectCharacters": 0, + "SelectWords": 1 + } + } + Enum { + name: "CursorPosition" + values: { + "CursorBetweenCharacters": 0, + "CursorOnCharacter": 1 + } + } + Enum { + name: "RenderType" + values: { + "QtRendering": 0, + "NativeRendering": 1 + } + } + Property { name: "text"; type: "string" } + Property { name: "length"; type: "int"; isReadonly: true } + Property { name: "color"; type: "QColor" } + Property { name: "selectionColor"; type: "QColor" } + Property { name: "selectedTextColor"; type: "QColor" } + Property { name: "font"; type: "QFont" } + Property { name: "horizontalAlignment"; type: "HAlignment" } + Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true } + Property { name: "verticalAlignment"; type: "VAlignment" } + Property { name: "wrapMode"; type: "WrapMode" } + Property { name: "readOnly"; type: "bool" } + Property { name: "cursorVisible"; type: "bool" } + Property { name: "cursorPosition"; type: "int" } + Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true } + Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "selectionStart"; type: "int"; isReadonly: true } + Property { name: "selectionEnd"; type: "int"; isReadonly: true } + Property { name: "selectedText"; type: "string"; isReadonly: true } + Property { name: "maximumLength"; type: "int" } + Property { name: "validator"; type: "QValidator"; isPointer: true } + Property { name: "inputMask"; type: "string" } + Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" } + Property { name: "acceptableInput"; type: "bool"; isReadonly: true } + Property { name: "echoMode"; type: "EchoMode" } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "passwordCharacter"; type: "string" } + Property { name: "displayText"; type: "string"; isReadonly: true } + Property { name: "autoScroll"; type: "bool" } + Property { name: "selectByMouse"; type: "bool" } + Property { name: "mouseSelectionMode"; type: "SelectionMode" } + Property { name: "persistentSelection"; type: "bool" } + Property { name: "canPaste"; type: "bool"; isReadonly: true } + Property { name: "canUndo"; type: "bool"; isReadonly: true } + Property { name: "canRedo"; type: "bool"; isReadonly: true } + Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true } + Property { name: "contentWidth"; type: "double"; isReadonly: true } + Property { name: "contentHeight"; type: "double"; isReadonly: true } + Property { name: "renderType"; type: "RenderType" } + Signal { name: "accepted" } + Signal { + name: "fontChanged" + Parameter { name: "font"; type: "QFont" } + } + Signal { + name: "horizontalAlignmentChanged" + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + Parameter { name: "alignment"; type: "VAlignment" } + } + Signal { + name: "readOnlyChanged" + Parameter { name: "isReadOnly"; type: "bool" } + } + Signal { + name: "cursorVisibleChanged" + Parameter { name: "isCursorVisible"; type: "bool" } + } + Signal { + name: "maximumLengthChanged" + Parameter { name: "maximumLength"; type: "int" } + } + Signal { + name: "inputMaskChanged" + Parameter { name: "inputMask"; type: "string" } + } + Signal { + name: "echoModeChanged" + Parameter { name: "echoMode"; type: "EchoMode" } + } + Signal { + name: "activeFocusOnPressChanged" + Parameter { name: "activeFocusOnPress"; type: "bool" } + } + Signal { + name: "autoScrollChanged" + Parameter { name: "autoScroll"; type: "bool" } + } + Signal { + name: "selectByMouseChanged" + Parameter { name: "selectByMouse"; type: "bool" } + } + Signal { + name: "mouseSelectionModeChanged" + Parameter { name: "mode"; type: "SelectionMode" } + } + Signal { name: "contentSizeChanged" } + Method { name: "selectAll" } + Method { name: "selectWord" } + Method { + name: "select" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { name: "deselect" } + Method { + name: "isRightToLeft" + type: "bool" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { name: "cut" } + Method { name: "copy" } + Method { name: "paste" } + Method { name: "undo" } + Method { name: "redo" } + Method { + name: "insert" + Parameter { name: "position"; type: "int" } + Parameter { name: "text"; type: "string" } + } + Method { + name: "remove" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { + name: "positionAt" + Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "positionToRectangle" + type: "QRectF" + Parameter { name: "pos"; type: "int" } + } + Method { + name: "moveCursorSelection" + Parameter { name: "pos"; type: "int" } + } + Method { + name: "moveCursorSelection" + Parameter { name: "pos"; type: "int" } + Parameter { name: "mode"; type: "SelectionMode" } + } + Method { + name: "getText" + type: "string" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + } + Component { + name: "QQuickTouchPoint" + prototype: "QObject" + exports: ["QtQuick/TouchPoint 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "pointId"; type: "int"; isReadonly: true } + Property { name: "pressed"; type: "bool"; isReadonly: true } + Property { name: "x"; type: "double"; isReadonly: true } + Property { name: "y"; type: "double"; isReadonly: true } + Property { name: "pressure"; type: "double"; isReadonly: true } + Property { name: "velocity"; type: "QVector2D"; isReadonly: true } + Property { name: "area"; type: "QRectF"; isReadonly: true } + Property { name: "startX"; type: "double"; isReadonly: true } + Property { name: "startY"; type: "double"; isReadonly: true } + Property { name: "previousX"; type: "double"; isReadonly: true } + Property { name: "previousY"; type: "double"; isReadonly: true } + Property { name: "sceneX"; type: "double"; isReadonly: true } + Property { name: "sceneY"; type: "double"; isReadonly: true } + } + Component { name: "QQuickTransform"; prototype: "QObject" } + Component { + name: "QQuickTransition" + defaultProperty: "animations" + prototype: "QObject" + exports: ["QtQuick/Transition 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "from"; type: "string" } + Property { name: "to"; type: "string" } + Property { name: "reversible"; type: "bool" } + Property { name: "running"; type: "bool"; isReadonly: true } + Property { name: "animations"; type: "QQuickAbstractAnimation"; isList: true; isReadonly: true } + Property { name: "enabled"; type: "bool" } + } + Component { + name: "QQuickTranslate" + prototype: "QQuickTransform" + exports: ["QtQuick/Translate 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "x"; type: "double" } + Property { name: "y"; type: "double" } + } + Component { + name: "QQuickUniformAnimator" + prototype: "QQuickAnimator" + exports: ["QtQuick/UniformAnimator 2.2"] + exportMetaObjectRevisions: [0] + Property { name: "uniform"; type: "string" } + Signal { + name: "uniformChanged" + Parameter { type: "string" } + } + } + Component { + name: "QQuickVector3dAnimation" + prototype: "QQuickPropertyAnimation" + exports: ["QtQuick/Vector3dAnimation 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "from"; type: "QVector3D" } + Property { name: "to"; type: "QVector3D" } + } + Component { + name: "QQuickViewSection" + prototype: "QObject" + exports: ["QtQuick/ViewSection 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "SectionCriteria" + values: { + "FullString": 0, + "FirstCharacter": 1 + } + } + Enum { + name: "LabelPositioning" + values: { + "InlineLabels": 1, + "CurrentLabelAtStart": 2, + "NextLabelAtEnd": 4 + } + } + Property { name: "property"; type: "string" } + Property { name: "criteria"; type: "SectionCriteria" } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "labelPositioning"; type: "int" } + Signal { name: "sectionsChanged" } + } + Component { + name: "QQuickViewTransitionAttached" + prototype: "QObject" + exports: ["QtQuick/ViewTransition 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "index"; type: "int"; isReadonly: true } + Property { name: "item"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "destination"; type: "QPointF"; isReadonly: true } + Property { name: "targetIndexes"; type: "QList"; isReadonly: true } + Property { name: "targetItems"; type: "QObject"; isList: true; isReadonly: true } + } + Component { + name: "QQuickWorkerScript" + prototype: "QObject" + exports: ["QtQuick/WorkerScript 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "source"; type: "QUrl" } + Signal { + name: "message" + Parameter { name: "messageObject"; type: "QQmlV4Handle" } + } + Method { + name: "sendMessage" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + } + Component { + name: "QQuickXAnimator" + prototype: "QQuickAnimator" + exports: ["QtQuick/XAnimator 2.2"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickYAnimator" + prototype: "QQuickAnimator" + exports: ["QtQuick/YAnimator 2.2"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QRegExpValidator" + prototype: "QValidator" + exports: ["QtQuick/RegExpValidator 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "regExp"; type: "QRegExp" } + Signal { + name: "regExpChanged" + Parameter { name: "regExp"; type: "QRegExp" } + } + } + Component { + name: "QValidator" + prototype: "QObject" + Signal { name: "changed" } + } + Component { + name: "Qt" + Enum { + name: "GlobalColor" + values: { + "color0": 0, + "color1": 1, + "black": 2, + "white": 3, + "darkGray": 4, + "gray": 5, + "lightGray": 6, + "red": 7, + "green": 8, + "blue": 9, + "cyan": 10, + "magenta": 11, + "yellow": 12, + "darkRed": 13, + "darkGreen": 14, + "darkBlue": 15, + "darkCyan": 16, + "darkMagenta": 17, + "darkYellow": 18, + "transparent": 19 + } + } + Enum { + name: "KeyboardModifiers" + values: { + "NoModifier": 0, + "ShiftModifier": 33554432, + "ControlModifier": 67108864, + "AltModifier": 134217728, + "MetaModifier": 268435456, + "KeypadModifier": 536870912, + "GroupSwitchModifier": 1073741824, + "KeyboardModifierMask": -33554432 + } + } + Enum { + name: "MouseButtons" + values: { + "NoButton": 0, + "LeftButton": 1, + "RightButton": 2, + "MidButton": 4, + "MiddleButton": 4, + "BackButton": 8, + "XButton1": 8, + "ExtraButton1": 8, + "ForwardButton": 16, + "XButton2": 16, + "ExtraButton2": 16, + "TaskButton": 32, + "ExtraButton3": 32, + "ExtraButton4": 64, + "ExtraButton5": 128, + "ExtraButton6": 256, + "ExtraButton7": 512, + "ExtraButton8": 1024, + "ExtraButton9": 2048, + "ExtraButton10": 4096, + "ExtraButton11": 8192, + "ExtraButton12": 16384, + "ExtraButton13": 32768, + "ExtraButton14": 65536, + "ExtraButton15": 131072, + "ExtraButton16": 262144, + "ExtraButton17": 524288, + "ExtraButton18": 1048576, + "ExtraButton19": 2097152, + "ExtraButton20": 4194304, + "ExtraButton21": 8388608, + "ExtraButton22": 16777216, + "ExtraButton23": 33554432, + "ExtraButton24": 67108864, + "AllButtons": 134217727, + "MaxMouseButton": 67108864, + "MouseButtonMask": -1 + } + } + Enum { + name: "Orientation" + values: { + "Horizontal": 1, + "Vertical": 2 + } + } + Enum { + name: "Orientations" + values: { + "Horizontal": 1, + "Vertical": 2 + } + } + Enum { + name: "FocusPolicy" + values: { + "NoFocus": 0, + "TabFocus": 1, + "ClickFocus": 2, + "StrongFocus": 11, + "WheelFocus": 15 + } + } + Enum { + name: "SortOrder" + values: { + "AscendingOrder": 0, + "DescendingOrder": 1 + } + } + Enum { + name: "Alignment" + values: { + "AlignLeft": 1, + "AlignLeading": 1, + "AlignRight": 2, + "AlignTrailing": 2, + "AlignHCenter": 4, + "AlignJustify": 8, + "AlignAbsolute": 16, + "AlignHorizontal_Mask": 31, + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128, + "AlignBaseline": 256, + "AlignVertical_Mask": 480, + "AlignCenter": 132 + } + } + Enum { + name: "TextElideMode" + values: { + "ElideLeft": 0, + "ElideRight": 1, + "ElideMiddle": 2, + "ElideNone": 3 + } + } + Enum { + name: "WindowType" + values: { + "Widget": 0, + "Window": 1, + "Dialog": 3, + "Sheet": 5, + "Drawer": 7, + "Popup": 9, + "Tool": 11, + "ToolTip": 13, + "SplashScreen": 15, + "Desktop": 17, + "SubWindow": 18, + "ForeignWindow": 33, + "CoverWindow": 65, + "WindowType_Mask": 255, + "MSWindowsFixedSizeDialogHint": 256, + "MSWindowsOwnDC": 512, + "BypassWindowManagerHint": 1024, + "X11BypassWindowManagerHint": 1024, + "FramelessWindowHint": 2048, + "WindowTitleHint": 4096, + "WindowSystemMenuHint": 8192, + "WindowMinimizeButtonHint": 16384, + "WindowMaximizeButtonHint": 32768, + "WindowMinMaxButtonsHint": 49152, + "WindowContextHelpButtonHint": 65536, + "WindowShadeButtonHint": 131072, + "WindowStaysOnTopHint": 262144, + "WindowTransparentForInput": 524288, + "WindowOverridesSystemGestures": 1048576, + "WindowDoesNotAcceptFocus": 2097152, + "CustomizeWindowHint": 33554432, + "WindowStaysOnBottomHint": 67108864, + "WindowCloseButtonHint": 134217728, + "MacWindowToolBarButtonHint": 268435456, + "BypassGraphicsProxyWidget": 536870912, + "WindowOkButtonHint": 524288, + "WindowCancelButtonHint": 1048576, + "NoDropShadowWindowHint": 1073741824, + "WindowFullscreenButtonHint": -2147483648 + } + } + Enum { + name: "WindowFlags" + values: { + "Widget": 0, + "Window": 1, + "Dialog": 3, + "Sheet": 5, + "Drawer": 7, + "Popup": 9, + "Tool": 11, + "ToolTip": 13, + "SplashScreen": 15, + "Desktop": 17, + "SubWindow": 18, + "ForeignWindow": 33, + "CoverWindow": 65, + "WindowType_Mask": 255, + "MSWindowsFixedSizeDialogHint": 256, + "MSWindowsOwnDC": 512, + "BypassWindowManagerHint": 1024, + "X11BypassWindowManagerHint": 1024, + "FramelessWindowHint": 2048, + "WindowTitleHint": 4096, + "WindowSystemMenuHint": 8192, + "WindowMinimizeButtonHint": 16384, + "WindowMaximizeButtonHint": 32768, + "WindowMinMaxButtonsHint": 49152, + "WindowContextHelpButtonHint": 65536, + "WindowShadeButtonHint": 131072, + "WindowStaysOnTopHint": 262144, + "WindowTransparentForInput": 524288, + "WindowOverridesSystemGestures": 1048576, + "WindowDoesNotAcceptFocus": 2097152, + "CustomizeWindowHint": 33554432, + "WindowStaysOnBottomHint": 67108864, + "WindowCloseButtonHint": 134217728, + "MacWindowToolBarButtonHint": 268435456, + "BypassGraphicsProxyWidget": 536870912, + "WindowOkButtonHint": 524288, + "WindowCancelButtonHint": 1048576, + "NoDropShadowWindowHint": 1073741824, + "WindowFullscreenButtonHint": -2147483648 + } + } + Enum { + name: "WindowState" + values: { + "WindowNoState": 0, + "WindowMinimized": 1, + "WindowMaximized": 2, + "WindowFullScreen": 4, + "WindowActive": 8 + } + } + Enum { + name: "WindowStates" + values: { + "WindowNoState": 0, + "WindowMinimized": 1, + "WindowMaximized": 2, + "WindowFullScreen": 4, + "WindowActive": 8 + } + } + Enum { + name: "ApplicationState" + values: { + "ApplicationSuspended": 0, + "ApplicationHidden": 1, + "ApplicationInactive": 2, + "ApplicationActive": 4 + } + } + Enum { + name: "ScreenOrientation" + values: { + "PrimaryOrientation": 0, + "PortraitOrientation": 1, + "LandscapeOrientation": 2, + "InvertedPortraitOrientation": 4, + "InvertedLandscapeOrientation": 8 + } + } + Enum { + name: "ScreenOrientations" + values: { + "PrimaryOrientation": 0, + "PortraitOrientation": 1, + "LandscapeOrientation": 2, + "InvertedPortraitOrientation": 4, + "InvertedLandscapeOrientation": 8 + } + } + Enum { + name: "WidgetAttribute" + values: { + "WA_Disabled": 0, + "WA_UnderMouse": 1, + "WA_MouseTracking": 2, + "WA_ContentsPropagated": 3, + "WA_OpaquePaintEvent": 4, + "WA_NoBackground": 4, + "WA_StaticContents": 5, + "WA_LaidOut": 7, + "WA_PaintOnScreen": 8, + "WA_NoSystemBackground": 9, + "WA_UpdatesDisabled": 10, + "WA_Mapped": 11, + "WA_MacNoClickThrough": 12, + "WA_InputMethodEnabled": 14, + "WA_WState_Visible": 15, + "WA_WState_Hidden": 16, + "WA_ForceDisabled": 32, + "WA_KeyCompression": 33, + "WA_PendingMoveEvent": 34, + "WA_PendingResizeEvent": 35, + "WA_SetPalette": 36, + "WA_SetFont": 37, + "WA_SetCursor": 38, + "WA_NoChildEventsFromChildren": 39, + "WA_WindowModified": 41, + "WA_Resized": 42, + "WA_Moved": 43, + "WA_PendingUpdate": 44, + "WA_InvalidSize": 45, + "WA_MacBrushedMetal": 46, + "WA_MacMetalStyle": 46, + "WA_CustomWhatsThis": 47, + "WA_LayoutOnEntireRect": 48, + "WA_OutsideWSRange": 49, + "WA_GrabbedShortcut": 50, + "WA_TransparentForMouseEvents": 51, + "WA_PaintUnclipped": 52, + "WA_SetWindowIcon": 53, + "WA_NoMouseReplay": 54, + "WA_DeleteOnClose": 55, + "WA_RightToLeft": 56, + "WA_SetLayoutDirection": 57, + "WA_NoChildEventsForParent": 58, + "WA_ForceUpdatesDisabled": 59, + "WA_WState_Created": 60, + "WA_WState_CompressKeys": 61, + "WA_WState_InPaintEvent": 62, + "WA_WState_Reparented": 63, + "WA_WState_ConfigPending": 64, + "WA_WState_Polished": 66, + "WA_WState_DND": 67, + "WA_WState_OwnSizePolicy": 68, + "WA_WState_ExplicitShowHide": 69, + "WA_ShowModal": 70, + "WA_MouseNoMask": 71, + "WA_GroupLeader": 72, + "WA_NoMousePropagation": 73, + "WA_Hover": 74, + "WA_InputMethodTransparent": 75, + "WA_QuitOnClose": 76, + "WA_KeyboardFocusChange": 77, + "WA_AcceptDrops": 78, + "WA_DropSiteRegistered": 79, + "WA_ForceAcceptDrops": 79, + "WA_WindowPropagation": 80, + "WA_NoX11EventCompression": 81, + "WA_TintedBackground": 82, + "WA_X11OpenGLOverlay": 83, + "WA_AlwaysShowToolTips": 84, + "WA_MacOpaqueSizeGrip": 85, + "WA_SetStyle": 86, + "WA_SetLocale": 87, + "WA_MacShowFocusRect": 88, + "WA_MacNormalSize": 89, + "WA_MacSmallSize": 90, + "WA_MacMiniSize": 91, + "WA_LayoutUsesWidgetRect": 92, + "WA_StyledBackground": 93, + "WA_MSWindowsUseDirect3D": 94, + "WA_CanHostQMdiSubWindowTitleBar": 95, + "WA_MacAlwaysShowToolWindow": 96, + "WA_StyleSheet": 97, + "WA_ShowWithoutActivating": 98, + "WA_X11BypassTransientForHint": 99, + "WA_NativeWindow": 100, + "WA_DontCreateNativeAncestors": 101, + "WA_MacVariableSize": 102, + "WA_DontShowOnScreen": 103, + "WA_X11NetWmWindowTypeDesktop": 104, + "WA_X11NetWmWindowTypeDock": 105, + "WA_X11NetWmWindowTypeToolBar": 106, + "WA_X11NetWmWindowTypeMenu": 107, + "WA_X11NetWmWindowTypeUtility": 108, + "WA_X11NetWmWindowTypeSplash": 109, + "WA_X11NetWmWindowTypeDialog": 110, + "WA_X11NetWmWindowTypeDropDownMenu": 111, + "WA_X11NetWmWindowTypePopupMenu": 112, + "WA_X11NetWmWindowTypeToolTip": 113, + "WA_X11NetWmWindowTypeNotification": 114, + "WA_X11NetWmWindowTypeCombo": 115, + "WA_X11NetWmWindowTypeDND": 116, + "WA_MacFrameworkScaled": 117, + "WA_SetWindowModality": 118, + "WA_WState_WindowOpacitySet": 119, + "WA_TranslucentBackground": 120, + "WA_AcceptTouchEvents": 121, + "WA_WState_AcceptedTouchBeginEvent": 122, + "WA_TouchPadAcceptSingleTouchEvents": 123, + "WA_X11DoNotAcceptFocus": 126, + "WA_MacNoShadow": 127, + "WA_AttributeCount": 128 + } + } + Enum { + name: "ApplicationAttribute" + values: { + "AA_ImmediateWidgetCreation": 0, + "AA_MSWindowsUseDirect3DByDefault": 1, + "AA_DontShowIconsInMenus": 2, + "AA_NativeWindows": 3, + "AA_DontCreateNativeWidgetSiblings": 4, + "AA_MacPluginApplication": 5, + "AA_DontUseNativeMenuBar": 6, + "AA_MacDontSwapCtrlAndMeta": 7, + "AA_Use96Dpi": 8, + "AA_X11InitThreads": 10, + "AA_SynthesizeTouchForUnhandledMouseEvents": 11, + "AA_SynthesizeMouseForUnhandledTouchEvents": 12, + "AA_UseHighDpiPixmaps": 13, + "AA_AttributeCount": 14 + } + } + Enum { + name: "ImageConversionFlags" + values: { + "ColorMode_Mask": 3, + "AutoColor": 0, + "ColorOnly": 3, + "MonoOnly": 2, + "AlphaDither_Mask": 12, + "ThresholdAlphaDither": 0, + "OrderedAlphaDither": 4, + "DiffuseAlphaDither": 8, + "NoAlpha": 12, + "Dither_Mask": 48, + "DiffuseDither": 0, + "OrderedDither": 16, + "ThresholdDither": 32, + "DitherMode_Mask": 192, + "AutoDither": 0, + "PreferDither": 64, + "AvoidDither": 128, + "NoOpaqueDetection": 256, + "NoFormatConversion": 512 + } + } + Enum { + name: "BGMode" + values: { + "TransparentMode": 0, + "OpaqueMode": 1 + } + } + Enum { + name: "Key" + values: { + "Key_Escape": 16777216, + "Key_Tab": 16777217, + "Key_Backtab": 16777218, + "Key_Backspace": 16777219, + "Key_Return": 16777220, + "Key_Enter": 16777221, + "Key_Insert": 16777222, + "Key_Delete": 16777223, + "Key_Pause": 16777224, + "Key_Print": 16777225, + "Key_SysReq": 16777226, + "Key_Clear": 16777227, + "Key_Home": 16777232, + "Key_End": 16777233, + "Key_Left": 16777234, + "Key_Up": 16777235, + "Key_Right": 16777236, + "Key_Down": 16777237, + "Key_PageUp": 16777238, + "Key_PageDown": 16777239, + "Key_Shift": 16777248, + "Key_Control": 16777249, + "Key_Meta": 16777250, + "Key_Alt": 16777251, + "Key_CapsLock": 16777252, + "Key_NumLock": 16777253, + "Key_ScrollLock": 16777254, + "Key_F1": 16777264, + "Key_F2": 16777265, + "Key_F3": 16777266, + "Key_F4": 16777267, + "Key_F5": 16777268, + "Key_F6": 16777269, + "Key_F7": 16777270, + "Key_F8": 16777271, + "Key_F9": 16777272, + "Key_F10": 16777273, + "Key_F11": 16777274, + "Key_F12": 16777275, + "Key_F13": 16777276, + "Key_F14": 16777277, + "Key_F15": 16777278, + "Key_F16": 16777279, + "Key_F17": 16777280, + "Key_F18": 16777281, + "Key_F19": 16777282, + "Key_F20": 16777283, + "Key_F21": 16777284, + "Key_F22": 16777285, + "Key_F23": 16777286, + "Key_F24": 16777287, + "Key_F25": 16777288, + "Key_F26": 16777289, + "Key_F27": 16777290, + "Key_F28": 16777291, + "Key_F29": 16777292, + "Key_F30": 16777293, + "Key_F31": 16777294, + "Key_F32": 16777295, + "Key_F33": 16777296, + "Key_F34": 16777297, + "Key_F35": 16777298, + "Key_Super_L": 16777299, + "Key_Super_R": 16777300, + "Key_Menu": 16777301, + "Key_Hyper_L": 16777302, + "Key_Hyper_R": 16777303, + "Key_Help": 16777304, + "Key_Direction_L": 16777305, + "Key_Direction_R": 16777312, + "Key_Space": 32, + "Key_Any": 32, + "Key_Exclam": 33, + "Key_QuoteDbl": 34, + "Key_NumberSign": 35, + "Key_Dollar": 36, + "Key_Percent": 37, + "Key_Ampersand": 38, + "Key_Apostrophe": 39, + "Key_ParenLeft": 40, + "Key_ParenRight": 41, + "Key_Asterisk": 42, + "Key_Plus": 43, + "Key_Comma": 44, + "Key_Minus": 45, + "Key_Period": 46, + "Key_Slash": 47, + "Key_0": 48, + "Key_1": 49, + "Key_2": 50, + "Key_3": 51, + "Key_4": 52, + "Key_5": 53, + "Key_6": 54, + "Key_7": 55, + "Key_8": 56, + "Key_9": 57, + "Key_Colon": 58, + "Key_Semicolon": 59, + "Key_Less": 60, + "Key_Equal": 61, + "Key_Greater": 62, + "Key_Question": 63, + "Key_At": 64, + "Key_A": 65, + "Key_B": 66, + "Key_C": 67, + "Key_D": 68, + "Key_E": 69, + "Key_F": 70, + "Key_G": 71, + "Key_H": 72, + "Key_I": 73, + "Key_J": 74, + "Key_K": 75, + "Key_L": 76, + "Key_M": 77, + "Key_N": 78, + "Key_O": 79, + "Key_P": 80, + "Key_Q": 81, + "Key_R": 82, + "Key_S": 83, + "Key_T": 84, + "Key_U": 85, + "Key_V": 86, + "Key_W": 87, + "Key_X": 88, + "Key_Y": 89, + "Key_Z": 90, + "Key_BracketLeft": 91, + "Key_Backslash": 92, + "Key_BracketRight": 93, + "Key_AsciiCircum": 94, + "Key_Underscore": 95, + "Key_QuoteLeft": 96, + "Key_BraceLeft": 123, + "Key_Bar": 124, + "Key_BraceRight": 125, + "Key_AsciiTilde": 126, + "Key_nobreakspace": 160, + "Key_exclamdown": 161, + "Key_cent": 162, + "Key_sterling": 163, + "Key_currency": 164, + "Key_yen": 165, + "Key_brokenbar": 166, + "Key_section": 167, + "Key_diaeresis": 168, + "Key_copyright": 169, + "Key_ordfeminine": 170, + "Key_guillemotleft": 171, + "Key_notsign": 172, + "Key_hyphen": 173, + "Key_registered": 174, + "Key_macron": 175, + "Key_degree": 176, + "Key_plusminus": 177, + "Key_twosuperior": 178, + "Key_threesuperior": 179, + "Key_acute": 180, + "Key_mu": 181, + "Key_paragraph": 182, + "Key_periodcentered": 183, + "Key_cedilla": 184, + "Key_onesuperior": 185, + "Key_masculine": 186, + "Key_guillemotright": 187, + "Key_onequarter": 188, + "Key_onehalf": 189, + "Key_threequarters": 190, + "Key_questiondown": 191, + "Key_Agrave": 192, + "Key_Aacute": 193, + "Key_Acircumflex": 194, + "Key_Atilde": 195, + "Key_Adiaeresis": 196, + "Key_Aring": 197, + "Key_AE": 198, + "Key_Ccedilla": 199, + "Key_Egrave": 200, + "Key_Eacute": 201, + "Key_Ecircumflex": 202, + "Key_Ediaeresis": 203, + "Key_Igrave": 204, + "Key_Iacute": 205, + "Key_Icircumflex": 206, + "Key_Idiaeresis": 207, + "Key_ETH": 208, + "Key_Ntilde": 209, + "Key_Ograve": 210, + "Key_Oacute": 211, + "Key_Ocircumflex": 212, + "Key_Otilde": 213, + "Key_Odiaeresis": 214, + "Key_multiply": 215, + "Key_Ooblique": 216, + "Key_Ugrave": 217, + "Key_Uacute": 218, + "Key_Ucircumflex": 219, + "Key_Udiaeresis": 220, + "Key_Yacute": 221, + "Key_THORN": 222, + "Key_ssharp": 223, + "Key_division": 247, + "Key_ydiaeresis": 255, + "Key_AltGr": 16781571, + "Key_Multi_key": 16781600, + "Key_Codeinput": 16781623, + "Key_SingleCandidate": 16781628, + "Key_MultipleCandidate": 16781629, + "Key_PreviousCandidate": 16781630, + "Key_Mode_switch": 16781694, + "Key_Kanji": 16781601, + "Key_Muhenkan": 16781602, + "Key_Henkan": 16781603, + "Key_Romaji": 16781604, + "Key_Hiragana": 16781605, + "Key_Katakana": 16781606, + "Key_Hiragana_Katakana": 16781607, + "Key_Zenkaku": 16781608, + "Key_Hankaku": 16781609, + "Key_Zenkaku_Hankaku": 16781610, + "Key_Touroku": 16781611, + "Key_Massyo": 16781612, + "Key_Kana_Lock": 16781613, + "Key_Kana_Shift": 16781614, + "Key_Eisu_Shift": 16781615, + "Key_Eisu_toggle": 16781616, + "Key_Hangul": 16781617, + "Key_Hangul_Start": 16781618, + "Key_Hangul_End": 16781619, + "Key_Hangul_Hanja": 16781620, + "Key_Hangul_Jamo": 16781621, + "Key_Hangul_Romaja": 16781622, + "Key_Hangul_Jeonja": 16781624, + "Key_Hangul_Banja": 16781625, + "Key_Hangul_PreHanja": 16781626, + "Key_Hangul_PostHanja": 16781627, + "Key_Hangul_Special": 16781631, + "Key_Dead_Grave": 16781904, + "Key_Dead_Acute": 16781905, + "Key_Dead_Circumflex": 16781906, + "Key_Dead_Tilde": 16781907, + "Key_Dead_Macron": 16781908, + "Key_Dead_Breve": 16781909, + "Key_Dead_Abovedot": 16781910, + "Key_Dead_Diaeresis": 16781911, + "Key_Dead_Abovering": 16781912, + "Key_Dead_Doubleacute": 16781913, + "Key_Dead_Caron": 16781914, + "Key_Dead_Cedilla": 16781915, + "Key_Dead_Ogonek": 16781916, + "Key_Dead_Iota": 16781917, + "Key_Dead_Voiced_Sound": 16781918, + "Key_Dead_Semivoiced_Sound": 16781919, + "Key_Dead_Belowdot": 16781920, + "Key_Dead_Hook": 16781921, + "Key_Dead_Horn": 16781922, + "Key_Back": 16777313, + "Key_Forward": 16777314, + "Key_Stop": 16777315, + "Key_Refresh": 16777316, + "Key_VolumeDown": 16777328, + "Key_VolumeMute": 16777329, + "Key_VolumeUp": 16777330, + "Key_BassBoost": 16777331, + "Key_BassUp": 16777332, + "Key_BassDown": 16777333, + "Key_TrebleUp": 16777334, + "Key_TrebleDown": 16777335, + "Key_MediaPlay": 16777344, + "Key_MediaStop": 16777345, + "Key_MediaPrevious": 16777346, + "Key_MediaNext": 16777347, + "Key_MediaRecord": 16777348, + "Key_MediaPause": 16777349, + "Key_MediaTogglePlayPause": 16777350, + "Key_HomePage": 16777360, + "Key_Favorites": 16777361, + "Key_Search": 16777362, + "Key_Standby": 16777363, + "Key_OpenUrl": 16777364, + "Key_LaunchMail": 16777376, + "Key_LaunchMedia": 16777377, + "Key_Launch0": 16777378, + "Key_Launch1": 16777379, + "Key_Launch2": 16777380, + "Key_Launch3": 16777381, + "Key_Launch4": 16777382, + "Key_Launch5": 16777383, + "Key_Launch6": 16777384, + "Key_Launch7": 16777385, + "Key_Launch8": 16777386, + "Key_Launch9": 16777387, + "Key_LaunchA": 16777388, + "Key_LaunchB": 16777389, + "Key_LaunchC": 16777390, + "Key_LaunchD": 16777391, + "Key_LaunchE": 16777392, + "Key_LaunchF": 16777393, + "Key_MonBrightnessUp": 16777394, + "Key_MonBrightnessDown": 16777395, + "Key_KeyboardLightOnOff": 16777396, + "Key_KeyboardBrightnessUp": 16777397, + "Key_KeyboardBrightnessDown": 16777398, + "Key_PowerOff": 16777399, + "Key_WakeUp": 16777400, + "Key_Eject": 16777401, + "Key_ScreenSaver": 16777402, + "Key_WWW": 16777403, + "Key_Memo": 16777404, + "Key_LightBulb": 16777405, + "Key_Shop": 16777406, + "Key_History": 16777407, + "Key_AddFavorite": 16777408, + "Key_HotLinks": 16777409, + "Key_BrightnessAdjust": 16777410, + "Key_Finance": 16777411, + "Key_Community": 16777412, + "Key_AudioRewind": 16777413, + "Key_BackForward": 16777414, + "Key_ApplicationLeft": 16777415, + "Key_ApplicationRight": 16777416, + "Key_Book": 16777417, + "Key_CD": 16777418, + "Key_Calculator": 16777419, + "Key_ToDoList": 16777420, + "Key_ClearGrab": 16777421, + "Key_Close": 16777422, + "Key_Copy": 16777423, + "Key_Cut": 16777424, + "Key_Display": 16777425, + "Key_DOS": 16777426, + "Key_Documents": 16777427, + "Key_Excel": 16777428, + "Key_Explorer": 16777429, + "Key_Game": 16777430, + "Key_Go": 16777431, + "Key_iTouch": 16777432, + "Key_LogOff": 16777433, + "Key_Market": 16777434, + "Key_Meeting": 16777435, + "Key_MenuKB": 16777436, + "Key_MenuPB": 16777437, + "Key_MySites": 16777438, + "Key_News": 16777439, + "Key_OfficeHome": 16777440, + "Key_Option": 16777441, + "Key_Paste": 16777442, + "Key_Phone": 16777443, + "Key_Calendar": 16777444, + "Key_Reply": 16777445, + "Key_Reload": 16777446, + "Key_RotateWindows": 16777447, + "Key_RotationPB": 16777448, + "Key_RotationKB": 16777449, + "Key_Save": 16777450, + "Key_Send": 16777451, + "Key_Spell": 16777452, + "Key_SplitScreen": 16777453, + "Key_Support": 16777454, + "Key_TaskPane": 16777455, + "Key_Terminal": 16777456, + "Key_Tools": 16777457, + "Key_Travel": 16777458, + "Key_Video": 16777459, + "Key_Word": 16777460, + "Key_Xfer": 16777461, + "Key_ZoomIn": 16777462, + "Key_ZoomOut": 16777463, + "Key_Away": 16777464, + "Key_Messenger": 16777465, + "Key_WebCam": 16777466, + "Key_MailForward": 16777467, + "Key_Pictures": 16777468, + "Key_Music": 16777469, + "Key_Battery": 16777470, + "Key_Bluetooth": 16777471, + "Key_WLAN": 16777472, + "Key_UWB": 16777473, + "Key_AudioForward": 16777474, + "Key_AudioRepeat": 16777475, + "Key_AudioRandomPlay": 16777476, + "Key_Subtitle": 16777477, + "Key_AudioCycleTrack": 16777478, + "Key_Time": 16777479, + "Key_Hibernate": 16777480, + "Key_View": 16777481, + "Key_TopMenu": 16777482, + "Key_PowerDown": 16777483, + "Key_Suspend": 16777484, + "Key_ContrastAdjust": 16777485, + "Key_LaunchG": 16777486, + "Key_LaunchH": 16777487, + "Key_TouchpadToggle": 16777488, + "Key_TouchpadOn": 16777489, + "Key_TouchpadOff": 16777490, + "Key_MicMute": 16777491, + "Key_Red": 16777492, + "Key_Green": 16777493, + "Key_Yellow": 16777494, + "Key_Blue": 16777495, + "Key_ChannelUp": 16777496, + "Key_ChannelDown": 16777497, + "Key_MediaLast": 16842751, + "Key_Select": 16842752, + "Key_Yes": 16842753, + "Key_No": 16842754, + "Key_Cancel": 16908289, + "Key_Printer": 16908290, + "Key_Execute": 16908291, + "Key_Sleep": 16908292, + "Key_Play": 16908293, + "Key_Zoom": 16908294, + "Key_Context1": 17825792, + "Key_Context2": 17825793, + "Key_Context3": 17825794, + "Key_Context4": 17825795, + "Key_Call": 17825796, + "Key_Hangup": 17825797, + "Key_Flip": 17825798, + "Key_ToggleCallHangup": 17825799, + "Key_VoiceDial": 17825800, + "Key_LastNumberRedial": 17825801, + "Key_Camera": 17825824, + "Key_CameraFocus": 17825825, + "Key_unknown": 33554431 + } + } + Enum { + name: "ArrowType" + values: { + "NoArrow": 0, + "UpArrow": 1, + "DownArrow": 2, + "LeftArrow": 3, + "RightArrow": 4 + } + } + Enum { + name: "PenStyle" + values: { + "NoPen": 0, + "SolidLine": 1, + "DashLine": 2, + "DotLine": 3, + "DashDotLine": 4, + "DashDotDotLine": 5, + "CustomDashLine": 6 + } + } + Enum { + name: "PenCapStyle" + values: { + "FlatCap": 0, + "SquareCap": 16, + "RoundCap": 32, + "MPenCapStyle": 48 + } + } + Enum { + name: "PenJoinStyle" + values: { + "MiterJoin": 0, + "BevelJoin": 64, + "RoundJoin": 128, + "SvgMiterJoin": 256, + "MPenJoinStyle": 448 + } + } + Enum { + name: "BrushStyle" + values: { + "NoBrush": 0, + "SolidPattern": 1, + "Dense1Pattern": 2, + "Dense2Pattern": 3, + "Dense3Pattern": 4, + "Dense4Pattern": 5, + "Dense5Pattern": 6, + "Dense6Pattern": 7, + "Dense7Pattern": 8, + "HorPattern": 9, + "VerPattern": 10, + "CrossPattern": 11, + "BDiagPattern": 12, + "FDiagPattern": 13, + "DiagCrossPattern": 14, + "LinearGradientPattern": 15, + "RadialGradientPattern": 16, + "ConicalGradientPattern": 17, + "TexturePattern": 24 + } + } + Enum { + name: "SizeMode" + values: { + "AbsoluteSize": 0, + "RelativeSize": 1 + } + } + Enum { + name: "CursorShape" + values: { + "ArrowCursor": 0, + "UpArrowCursor": 1, + "CrossCursor": 2, + "WaitCursor": 3, + "IBeamCursor": 4, + "SizeVerCursor": 5, + "SizeHorCursor": 6, + "SizeBDiagCursor": 7, + "SizeFDiagCursor": 8, + "SizeAllCursor": 9, + "BlankCursor": 10, + "SplitVCursor": 11, + "SplitHCursor": 12, + "PointingHandCursor": 13, + "ForbiddenCursor": 14, + "WhatsThisCursor": 15, + "BusyCursor": 16, + "OpenHandCursor": 17, + "ClosedHandCursor": 18, + "DragCopyCursor": 19, + "DragMoveCursor": 20, + "DragLinkCursor": 21, + "LastCursor": 21, + "BitmapCursor": 24, + "CustomCursor": 25 + } + } + Enum { + name: "TextFormat" + values: { + "PlainText": 0, + "RichText": 1, + "AutoText": 2 + } + } + Enum { + name: "AspectRatioMode" + values: { + "IgnoreAspectRatio": 0, + "KeepAspectRatio": 1, + "KeepAspectRatioByExpanding": 2 + } + } + Enum { + name: "DockWidgetArea" + values: { + "LeftDockWidgetArea": 1, + "RightDockWidgetArea": 2, + "TopDockWidgetArea": 4, + "BottomDockWidgetArea": 8, + "DockWidgetArea_Mask": 15, + "AllDockWidgetAreas": 15, + "NoDockWidgetArea": 0 + } + } + Enum { + name: "DockWidgetAreas" + values: { + "LeftDockWidgetArea": 1, + "RightDockWidgetArea": 2, + "TopDockWidgetArea": 4, + "BottomDockWidgetArea": 8, + "DockWidgetArea_Mask": 15, + "AllDockWidgetAreas": 15, + "NoDockWidgetArea": 0 + } + } + Enum { + name: "ToolBarArea" + values: { + "LeftToolBarArea": 1, + "RightToolBarArea": 2, + "TopToolBarArea": 4, + "BottomToolBarArea": 8, + "ToolBarArea_Mask": 15, + "AllToolBarAreas": 15, + "NoToolBarArea": 0 + } + } + Enum { + name: "ToolBarAreas" + values: { + "LeftToolBarArea": 1, + "RightToolBarArea": 2, + "TopToolBarArea": 4, + "BottomToolBarArea": 8, + "ToolBarArea_Mask": 15, + "AllToolBarAreas": 15, + "NoToolBarArea": 0 + } + } + Enum { + name: "DateFormat" + values: { + "TextDate": 0, + "ISODate": 1, + "SystemLocaleDate": 2, + "LocalDate": 2, + "LocaleDate": 3, + "SystemLocaleShortDate": 4, + "SystemLocaleLongDate": 5, + "DefaultLocaleShortDate": 6, + "DefaultLocaleLongDate": 7, + "RFC2822Date": 8 + } + } + Enum { + name: "TimeSpec" + values: { + "LocalTime": 0, + "UTC": 1, + "OffsetFromUTC": 2, + "TimeZone": 3 + } + } + Enum { + name: "DayOfWeek" + values: { + "Monday": 1, + "Tuesday": 2, + "Wednesday": 3, + "Thursday": 4, + "Friday": 5, + "Saturday": 6, + "Sunday": 7 + } + } + Enum { + name: "ScrollBarPolicy" + values: { + "ScrollBarAsNeeded": 0, + "ScrollBarAlwaysOff": 1, + "ScrollBarAlwaysOn": 2 + } + } + Enum { + name: "CaseSensitivity" + values: { + "CaseInsensitive": 0, + "CaseSensitive": 1 + } + } + Enum { + name: "Corner" + values: { + "TopLeftCorner": 0, + "TopRightCorner": 1, + "BottomLeftCorner": 2, + "BottomRightCorner": 3 + } + } + Enum { + name: "Edge" + values: { + "TopEdge": 1, + "LeftEdge": 2, + "RightEdge": 4, + "BottomEdge": 8 + } + } + Enum { + name: "ConnectionType" + values: { + "AutoConnection": 0, + "DirectConnection": 1, + "QueuedConnection": 2, + "BlockingQueuedConnection": 3, + "UniqueConnection": 128 + } + } + Enum { + name: "ShortcutContext" + values: { + "WidgetShortcut": 0, + "WindowShortcut": 1, + "ApplicationShortcut": 2, + "WidgetWithChildrenShortcut": 3 + } + } + Enum { + name: "FillRule" + values: { + "OddEvenFill": 0, + "WindingFill": 1 + } + } + Enum { + name: "MaskMode" + values: { + "MaskInColor": 0, + "MaskOutColor": 1 + } + } + Enum { + name: "ClipOperation" + values: { + "NoClip": 0, + "ReplaceClip": 1, + "IntersectClip": 2 + } + } + Enum { + name: "ItemSelectionMode" + values: { + "ContainsItemShape": 0, + "IntersectsItemShape": 1, + "ContainsItemBoundingRect": 2, + "IntersectsItemBoundingRect": 3 + } + } + Enum { + name: "TransformationMode" + values: { + "FastTransformation": 0, + "SmoothTransformation": 1 + } + } + Enum { + name: "Axis" + values: { + "XAxis": 0, + "YAxis": 1, + "ZAxis": 2 + } + } + Enum { + name: "ContextMenuPolicy" + values: { + "NoContextMenu": 0, + "DefaultContextMenu": 1, + "ActionsContextMenu": 2, + "CustomContextMenu": 3, + "PreventContextMenu": 4 + } + } + Enum { + name: "InputMethodQuery" + values: { + "ImEnabled": 1, + "ImCursorRectangle": 2, + "ImMicroFocus": 2, + "ImFont": 4, + "ImCursorPosition": 8, + "ImSurroundingText": 16, + "ImCurrentSelection": 32, + "ImMaximumTextLength": 64, + "ImAnchorPosition": 128, + "ImHints": 256, + "ImPreferredLanguage": 512, + "ImPlatformData": -2147483648, + "ImQueryInput": 186, + "ImQueryAll": -1 + } + } + Enum { + name: "InputMethodQueries" + values: { + "ImEnabled": 1, + "ImCursorRectangle": 2, + "ImMicroFocus": 2, + "ImFont": 4, + "ImCursorPosition": 8, + "ImSurroundingText": 16, + "ImCurrentSelection": 32, + "ImMaximumTextLength": 64, + "ImAnchorPosition": 128, + "ImHints": 256, + "ImPreferredLanguage": 512, + "ImPlatformData": -2147483648, + "ImQueryInput": 186, + "ImQueryAll": -1 + } + } + Enum { + name: "InputMethodHint" + values: { + "ImhNone": 0, + "ImhHiddenText": 1, + "ImhSensitiveData": 2, + "ImhNoAutoUppercase": 4, + "ImhPreferNumbers": 8, + "ImhPreferUppercase": 16, + "ImhPreferLowercase": 32, + "ImhNoPredictiveText": 64, + "ImhDate": 128, + "ImhTime": 256, + "ImhPreferLatin": 512, + "ImhMultiLine": 1024, + "ImhDigitsOnly": 65536, + "ImhFormattedNumbersOnly": 131072, + "ImhUppercaseOnly": 262144, + "ImhLowercaseOnly": 524288, + "ImhDialableCharactersOnly": 1048576, + "ImhEmailCharactersOnly": 2097152, + "ImhUrlCharactersOnly": 4194304, + "ImhLatinOnly": 8388608, + "ImhExclusiveInputMask": -65536 + } + } + Enum { + name: "InputMethodHints" + values: { + "ImhNone": 0, + "ImhHiddenText": 1, + "ImhSensitiveData": 2, + "ImhNoAutoUppercase": 4, + "ImhPreferNumbers": 8, + "ImhPreferUppercase": 16, + "ImhPreferLowercase": 32, + "ImhNoPredictiveText": 64, + "ImhDate": 128, + "ImhTime": 256, + "ImhPreferLatin": 512, + "ImhMultiLine": 1024, + "ImhDigitsOnly": 65536, + "ImhFormattedNumbersOnly": 131072, + "ImhUppercaseOnly": 262144, + "ImhLowercaseOnly": 524288, + "ImhDialableCharactersOnly": 1048576, + "ImhEmailCharactersOnly": 2097152, + "ImhUrlCharactersOnly": 4194304, + "ImhLatinOnly": 8388608, + "ImhExclusiveInputMask": -65536 + } + } + Enum { + name: "ToolButtonStyle" + values: { + "ToolButtonIconOnly": 0, + "ToolButtonTextOnly": 1, + "ToolButtonTextBesideIcon": 2, + "ToolButtonTextUnderIcon": 3, + "ToolButtonFollowStyle": 4 + } + } + Enum { + name: "LayoutDirection" + values: { + "LeftToRight": 0, + "RightToLeft": 1, + "LayoutDirectionAuto": 2 + } + } + Enum { + name: "DropAction" + values: { + "CopyAction": 1, + "MoveAction": 2, + "LinkAction": 4, + "ActionMask": 255, + "TargetMoveAction": 32770, + "IgnoreAction": 0 + } + } + Enum { + name: "DropActions" + values: { + "CopyAction": 1, + "MoveAction": 2, + "LinkAction": 4, + "ActionMask": 255, + "TargetMoveAction": 32770, + "IgnoreAction": 0 + } + } + Enum { + name: "CheckState" + values: { + "Unchecked": 0, + "PartiallyChecked": 1, + "Checked": 2 + } + } + Enum { + name: "ItemFlags" + values: { + "NoItemFlags": 0, + "ItemIsSelectable": 1, + "ItemIsEditable": 2, + "ItemIsDragEnabled": 4, + "ItemIsDropEnabled": 8, + "ItemIsUserCheckable": 16, + "ItemIsEnabled": 32, + "ItemIsTristate": 64, + "ItemNeverHasChildren": 128 + } + } + Enum { + name: "MatchFlags" + values: { + "MatchExactly": 0, + "MatchContains": 1, + "MatchStartsWith": 2, + "MatchEndsWith": 3, + "MatchRegExp": 4, + "MatchWildcard": 5, + "MatchFixedString": 8, + "MatchCaseSensitive": 16, + "MatchWrap": 32, + "MatchRecursive": 64 + } + } + Enum { + name: "WindowModality" + values: { + "NonModal": 0, + "WindowModal": 1, + "ApplicationModal": 2 + } + } + Enum { + name: "TextInteractionFlag" + values: { + "NoTextInteraction": 0, + "TextSelectableByMouse": 1, + "TextSelectableByKeyboard": 2, + "LinksAccessibleByMouse": 4, + "LinksAccessibleByKeyboard": 8, + "TextEditable": 16, + "TextEditorInteraction": 19, + "TextBrowserInteraction": 13 + } + } + Enum { + name: "TextInteractionFlags" + values: { + "NoTextInteraction": 0, + "TextSelectableByMouse": 1, + "TextSelectableByKeyboard": 2, + "LinksAccessibleByMouse": 4, + "LinksAccessibleByKeyboard": 8, + "TextEditable": 16, + "TextEditorInteraction": 19, + "TextBrowserInteraction": 13 + } + } + Enum { + name: "SizeHint" + values: { + "MinimumSize": 0, + "PreferredSize": 1, + "MaximumSize": 2, + "MinimumDescent": 3, + "NSizeHints": 4 + } + } + Enum { + name: "GestureState" + values: { + "NoGesture": 0, + "GestureStarted": 1, + "GestureUpdated": 2, + "GestureFinished": 3, + "GestureCanceled": 4 + } + } + Enum { + name: "GestureType" + values: { + "TapGesture": 1, + "TapAndHoldGesture": 2, + "PanGesture": 3, + "PinchGesture": 4, + "SwipeGesture": 5, + "CustomGesture": 256, + "LastGestureType": -1 + } + } + Enum { + name: "CursorMoveStyle" + values: { + "LogicalMoveStyle": 0, + "VisualMoveStyle": 1 + } + } + Enum { + name: "TimerType" + values: { + "PreciseTimer": 0, + "CoarseTimer": 1, + "VeryCoarseTimer": 2 + } + } + Enum { + name: "ScrollPhase" + values: { + "ScrollBegin": 1, + "ScrollUpdate": 2, + "ScrollEnd": 3 + } + } + } + Component { name: "QEasingCurve"; prototype: "QQmlEasingValueType" } +} diff --git a/tests/auto/qml/codemodel/importscheck/004_cppOnly copy/QtQuick.2/qmldir b/tests/auto/qml/codemodel/importscheck/004_cppOnly copy/QtQuick.2/qmldir new file mode 100644 index 00000000000..4a79c82e769 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/004_cppOnly copy/QtQuick.2/qmldir @@ -0,0 +1,4 @@ +module QtQuick +plugin qtquick2plugin +classname QtQuick2Plugin +typeinfo plugins.qmltypes diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ApplicationWindow.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ApplicationWindow.qml new file mode 100644 index 00000000000..6e0160df27c --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ApplicationWindow.qml @@ -0,0 +1,193 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.Window 2.1 +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Layouts 1.0 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ApplicationWindow + \since 5.1 + \inqmlmodule QtQuick.Controls + \ingroup applicationwindow + \brief Provides a top-level application window. + + ApplicationWindow is a \l Window that adds convenience for positioning items, + such as \l MenuBar, \l ToolBar, and \l StatusBar in a platform independent + manner. + + \code + ApplicationWindow { + id: window + menuBar: MenuBar { + Menu { MenuItem {...} } + Menu { MenuItem {...} } + } + + toolBar: ToolBar { + RowLayout { + anchors.fill: parent + ToolButton {...} + } + } + + TabView { + id: myContent + anchors.fill: parent + ... + } + } + \endcode +*/ + +Window { + id: root + + /*! + \qmlproperty MenuBar ApplicationWindow::menuBar + + This property holds the \l MenuBar. + + By default, this value is not set. + */ + property MenuBar menuBar: null + + /*! + \qmlproperty Item ApplicationWindow::toolBar + + This property holds the toolbar \l Item. + + It can be set to any Item type, but is generally used with \l ToolBar. + + By default, this value is not set. When you set the toolbar item, it will + be anchored automatically into the application window. + */ + property Item toolBar + + /*! + \qmlproperty Item ApplicationWindow::statusBar + + This property holds the status bar \l Item. + + It can be set to any Item type, but is generally used with \l StatusBar. + + By default, this value is not set. When you set the status bar item, it + will be anchored automatically into the application window. + */ + property Item statusBar + + onToolBarChanged: { if (toolBar) { toolBar.parent = toolBarArea } } + + onStatusBarChanged: { if (statusBar) { statusBar.parent = statusBarArea } } + + onVisibleChanged: { if (visible && menuBar) { menuBar.__parentWindow = root } } + + /*! \internal */ + default property alias data: contentArea.data + + color: syspal.window + + flags: Qt.Window | Qt.WindowFullscreenButtonHint | + Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | + Qt.WindowCloseButtonHint | Qt.WindowFullscreenButtonHint + // QTBUG-35049: Windows is removing features we didn't ask for, even though Qt::CustomizeWindowHint is not set + // Otherwise Qt.Window | Qt.WindowFullscreenButtonHint would be enough + + SystemPalette {id: syspal} + + Item { + id: backgroundItem + anchors.fill: parent + + Keys.forwardTo: menuBar ? [menuBar.__contentItem] : [] + + Item { + id: contentArea + anchors.top: toolBarArea.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: statusBarArea.top + } + + Item { + id: toolBarArea + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + implicitHeight: childrenRect.height + height: visibleChildren.length > 0 ? implicitHeight: 0 + } + + Item { + id: statusBarArea + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + implicitHeight: childrenRect.height + height: visibleChildren.length > 0 ? implicitHeight: 0 + } + + onVisibleChanged: if (visible && menuBar) menuBar.__parentWindow = root + + states: State { + name: "hasMenuBar" + when: menuBar && !menuBar.__isNative + + ParentChange { + target: menuBar.__contentItem + parent: backgroundItem + } + + PropertyChanges { + target: menuBar.__contentItem + x: 0 + y: 0 + width: backgroundItem.width + } + + AnchorChanges { + target: toolBarArea + anchors.top: menuBar.__contentItem.bottom + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/BusyIndicator.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/BusyIndicator.qml new file mode 100644 index 00000000000..01820bb8200 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/BusyIndicator.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype BusyIndicator + \inqmlmodule QtQuick.Controls + \since 5.2 + \ingroup controls + \brief A busy indicator. + + The busy indicator should be used to indicate activity while content is + being loaded or the UI is blocked waiting for a resource to become available. + + You can create a custom appearance for a Busy Indicator by + assigning a \l {QtQuick.Controls.Styles::BusyIndicatorStyle}{BusyIndicatorStyle}. + */ +Control { + id: indicator + + /*! \qmlproperty bool BusyIndicator::running + + This property holds whether the busy indicator is currently indicating + activity. + + \note The indicator is only visible when this property is set to \c true. + + The default value is \c true. + */ + property bool running: true + + Accessible.role: Accessible.Indicator + Accessible.name: "busy" + + style: Qt.createComponent(Settings.style + "/BusyIndicatorStyle.qml", indicator) +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Button.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Button.qml new file mode 100644 index 00000000000..1875e423a69 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Button.qml @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype Button + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief A push button with a text label. + + The push button is perhaps the most commonly used widget in any graphical + user interface. Pushing (or clicking) a button commands the computer to + perform some action or answer a question. Common examples of buttons are + OK, Apply, Cancel, Close, Yes, No, and Help buttons. + + Button is similar to the QPushButton widget. + + You can create a custom appearance for a Button by + assigning a \l {QtQuick.Controls.Styles::ButtonStyle}{ButtonStyle}. + */ +BasicButton { + id: button + + /*! This property holds whether the push button is the default button. + Default buttons decide what happens when the user presses enter in a + dialog without giving a button explicit focus. \note This property only + changes the appearance of the button. The expected behavior needs to be + implemented by the user. + + The default value is \c false. + */ + property bool isDefault: false + + /*! Assign a \l Menu to this property to get a pull-down menu button. + + The default value is \c null. + */ + property Menu menu: null + + __effectivePressed: __behavior.effectivePressed || menu && menu.__popupVisible + + activeFocusOnTab: true + + Accessible.name: text + + style: Qt.createComponent(Settings.style + "/ButtonStyle.qml", button) + + Binding { + target: menu + property: "__minimumWidth" + value: button.__panel.width + } + + Binding { + target: menu + property: "__visualItem" + value: button + } + + Connections { + target: __behavior + onEffectivePressedChanged: { + if (__behavior.effectivePressed && menu) + popupMenuTimer.start() + } + } + + Timer { + id: popupMenuTimer + interval: 10 + onTriggered: { + __behavior.keyPressed = false + if (Qt.application.layoutDirection === Qt.RightToLeft) + menu.__popup(button.width, button.height, 0) + else + menu.__popup(0, button.height, 0) + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/CheckBox.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/CheckBox.qml new file mode 100644 index 00000000000..00671755c7d --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/CheckBox.qml @@ -0,0 +1,184 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype CheckBox + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief A checkbox with a text label. + + A CheckBox is an option button that can be toggled on (checked) or off + (unchecked). Checkboxes are typically used to represent features in an + application that can be enabled or disabled without affecting others. + + The state of the checkbox can be set with the \l {AbstractCheckable::checked}{checked} property. + + In addition to the checked and unchecked states, there is a third state: + partially checked. This state indicates that the + regular checked/unchecked state can not be determined; generally because of + other states that affect the checkbox. This state is useful when several + child nodes are selected in a treeview, for example. + + The partially checked state can be made available to the user by setting + \l partiallyCheckedEnabled to \c true, or set directly by setting + \l checkedState to \c Qt.PartiallyChecked. \l checkedState behaves + identically to \l {AbstractCheckable::checked}{checked} when \l partiallyCheckedEnabled + is \c false; setting one will appropriately set the other. + + The label is shown next to the checkbox, and you can set the label text using its + \l {AbstractCheckable::text}{text} property. + + \qml + Column { + CheckBox { + text: qsTr("Breakfast") + } + CheckBox { + text: qsTr("Lunch") + } + CheckBox { + text: qsTr("Dinner") + } + } + \endqml + + Whenever a CheckBox is clicked, it emits the \l {AbstractCheckable::clicked}{clicked()} signal. + + You can create a custom appearance for a CheckBox by + assigning a \l {QtQuick.Controls.Styles::CheckBoxStyle}{CheckBoxStyle}. +*/ + +AbstractCheckable { + id: checkBox + + /*! + \qmlproperty enumeration CheckBox::checkedState + + This property indicates the current checked state of the checkbox. + + Possible values: + \c Qt.UnChecked - The checkbox is not checked (default). + \c Qt.Checked - The checkbox is checked. + \c Qt.PartiallyChecked - The checkbox is in a partially checked (or + "mixed") state. + + The \l {AbstractCheckable::checked}{checked} property also determines whether + this property is \c Qt.Checked or \c Qt.UnChecked, and vice versa. + */ + property int checkedState: checked ? Qt.Checked : Qt.Unchecked + + /*! + This property determines whether the \c Qt.PartiallyChecked state is + available. + + A checkbox may be in a partially checked state when the regular checked + state can not be determined. + + Setting \l checkedState to \c Qt.PartiallyChecked will implicitly set + this property to \c true. + + If this property is \c true, \l {AbstractCheckable::checked}{checked} will be \c false. + + By default, this property is \c false. + */ + property bool partiallyCheckedEnabled: false + + /*! + \internal + True if onCheckedChanged should be ignored because we were reacting + to onCheckedStateChanged. + */ + property bool __ignoreChecked: false + + style: Qt.createComponent(Settings.style + "/CheckBoxStyle.qml", checkBox) + + activeFocusOnTab: true + + Accessible.role: Accessible.CheckBox + Accessible.name: text + + __cycleStatesHandler: __cycleCheckBoxStates + + onCheckedChanged: { + if (!__ignoreChecked) + checkedState = checked ? Qt.Checked : Qt.Unchecked; + } + + onCheckedStateChanged: { + __ignoreChecked = true; + if (checkedState === Qt.PartiallyChecked) { + partiallyCheckedEnabled = true; + checked = false; + } else { + checked = checkedState === Qt.Checked; + } + __ignoreChecked = false; + } + + onPartiallyCheckedEnabledChanged: { + if (exclusiveGroup && partiallyCheckedEnabled) { + console.warn("Cannot have partially checked boxes in an ExclusiveGroup."); + } + } + + onExclusiveGroupChanged: { + if (exclusiveGroup && partiallyCheckedEnabled) { + console.warn("Cannot have partially checked boxes in an ExclusiveGroup."); + } + } + + /*! \internal */ + function __cycleCheckBoxStates() { + if (!partiallyCheckedEnabled) { + checked = !checked; + } else { + switch (checkedState) { + case Qt.Unchecked: checkedState = Qt.Checked; break; + case Qt.Checked: checkedState = Qt.PartiallyChecked; break; + case Qt.PartiallyChecked: checkedState = Qt.Unchecked; break; + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ComboBox.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ComboBox.qml new file mode 100644 index 00000000000..db39f579fe1 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ComboBox.qml @@ -0,0 +1,562 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ComboBox + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief Provides a drop-down list functionality. + + Add items to the comboBox by assigning it a ListModel, or a list of strings to the \l model property. + + \qml + ComboBox { + width: 200 + model: [ "Banana", "Apple", "Coconut" ] + } + \endqml + + In this example we are demonstrating how to use a ListModel with a combo box. + + \qml + ComboBox { + currentIndex: 2 + model: ListModel { + id: cbItems + ListElement { text: "Banana"; color: "Yellow" } + ListElement { text: "Apple"; color: "Green" } + ListElement { text: "Coconut"; color: "Brown" } + } + width: 200 + onCurrentIndexChanged: console.debug(cbItems.get(currentIndex).text + ", " + cbItems.get(currentIndex).color) + } + \endqml + + You can make a combo box editable by setting the \l editable property. An editable combo box will + autocomplete its text based on what is available in the model. + + In the next example we demonstrate how you can append content to an editable combo box by + reacting to the \l accepted signal. Note that you have to explicitly prevent duplicates. + + \qml + ComboBox { + editable: true + model: ListModel { + id: model + ListElement { text: "Banana"; color: "Yellow" } + ListElement { text: "Apple"; color: "Green" } + ListElement { text: "Coconut"; color: "Brown" } + } + onAccepted: { + if (editableCombo.find(currentText) === -1) { + model.append({text: editText}) + currentIndex = editableCombo.find(editText) + } + } + } + \endqml + + + You can create a custom appearance for a ComboBox by + assigning a \l {QtQuick.Controls.Styles::ComboBoxStyle}{ComboBoxStyle}. +*/ + +Control { + id: comboBox + + /*! \qmlproperty model ComboBox::model + The model to populate the ComboBox from. + + Changing the model after initialization will reset \l currentIndex to \c 0. + */ + property alias model: popupItems.model + + /*! The model role used for populating the ComboBox. */ + property string textRole: "" + + /*! \qmlproperty int ComboBox::currentIndex + The index of the currently selected item in the ComboBox. + + \sa model + */ + property alias currentIndex: popup.__selectedIndex + + /*! \qmlproperty string ComboBox::currentText + The text of the currently selected item in the ComboBox. + + \note Since \c currentText depends on \c currentIndex, there's no way to ensure \c currentText + will be up to date whenever a \c onCurrentIndexChanged handler is called. + */ + readonly property alias currentText: popup.currentText + + /*! This property holds whether the combo box can be edited by the user. + The default value is \c false. + \since QtQuick.Controls 1.1 + */ + property bool editable: false + + /*! \qmlproperty string ComboBox::editText + \since QtQuick.Controls 1.1 + This property specifies text being manipulated by the user for an editable combo box. + */ + property alias editText: input.text + + /*! This property specifies whether the combobox should gain active focus when pressed. + The default value is \c false. */ + property bool activeFocusOnPress: false + + /*! \qmlproperty bool ComboBox::pressed + + This property holds whether the button is being pressed. */ + readonly property bool pressed: mouseArea.pressed && mouseArea.containsMouse || popup.__popupVisible + + /*! \qmlproperty bool ComboBox::hovered + + This property indicates whether the control is being hovered. + */ + readonly property alias hovered: mouseArea.containsMouse + + /*! \qmlproperty int ComboBox::count + \since QtQuick.Controls 1.1 + This property holds the number of items in the combo box. + */ + readonly property alias count: popupItems.count + + /*! Returns the text for a given \a index. + If an invalid index is provided, \c null is returned + \since QtQuick.Controls 1.1 + */ + function textAt (index) { + if (index >= count || index < 0) + return null; + return popupItems.objectAt(index).text; + } + + /*! Finds and returns the index of a given \a text + If no match is found, \c -1 is returned. The search is case sensitive. + \since QtQuick.Controls 1.1 + */ + function find (text) { + return input.find(text, Qt.MatchExactly) + } + + /*! + \qmlproperty Validator ComboBox::validator + \since QtQuick.Controls 1.1 + + Allows you to set a text validator for an editable ComboBox. + When a validator is set, + the text field will only accept input which leaves the text property in + an intermediate state. The accepted signal will only be sent + if the text is in an acceptable state when enter is pressed. + + Currently supported validators are \l{QtQuick2::IntValidator}, + \l{QtQuick2::DoubleValidator}, and \l{QtQuick2::RegExpValidator}. An + example of using validators is shown below, which allows input of + integers between 11 and 31 into the text field: + + \note This property is only applied when \l editable is \c true + + \qml + import QtQuick 2.1 + import QtQuick.Controls 1.1 + + ComboBox { + editable: true + model: 10 + validator: IntValidator {bottom: 0; top: 10;} + focus: true + } + \endqml + + \sa acceptableInput, accepted, editable + */ + property alias validator: input.validator + + /*! + \qmlproperty bool ComboBox::acceptableInput + \since QtQuick.Controls 1.1 + + Returns \c true if the combo box contains acceptable + text in the editable text field. + + If a validator was set, this property will return \c + true if the current text satisfies the validator or mask as + a final string (not as an intermediate string). + + \sa validator, accepted + + */ + readonly property alias acceptableInput: input.acceptableInput + + /*! + \qmlsignal ComboBox::accepted() + \since QtQuick.Controls 1.1 + + This signal is emitted when the Return or Enter key is pressed on an + \l editable combo box. If the confirmed string is not currently in the model, + the currentIndex will be set to -1 and the \l currentText will be updated + accordingly. + + \note If there is a \l validator set on the combobox, + the signal will only be emitted if the input is in an acceptable state. + */ + signal accepted + + /*! + \qmlsignal ComboBox::activated(int index) + \since QtQuick.Controls 1.1 + + \a index is the triggered model index or -1 if a new string is accepted + + This signal is similar to currentIndex changed, but will only + be emitted if the combo box index was changed by the user and not + when set programatically. + */ + signal activated(int index) + + /*! + \qmlmethod ComboBox::selectAll() + \since QtQuick.Controls 1.1 + + Causes all \l editText to be selected. + */ + function selectAll() { + input.selectAll() + } + + /*! \internal */ + property var __popup: popup + + style: Qt.createComponent(Settings.style + "/ComboBoxStyle.qml", comboBox) + + activeFocusOnTab: true + + Accessible.role: Accessible.ComboBox + + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + onPressed: { + if (comboBox.activeFocusOnPress) + forceActiveFocus() + popup.show() + } + } + + Component.onCompleted: { + if (currentIndex === -1) + currentIndex = 0 + + popup.ready = true + popup.resolveTextValue(textRole) + } + + Keys.onPressed: { + // Perform one-character based lookup for non-editable combo box + if (!editable && event.text.length > 0) { + var index = input.find(event.text, Qt.MatchStartsWith); + if (index >= 0 && index !== currentIndex) { + currentIndex = index; + activated(currentIndex); + } + } + } + + TextInput { + id: input + + visible: editable + enabled: editable + focus: true + clip: contentWidth > width + text: currentText + + anchors.fill: parent + anchors.leftMargin: 8 + anchors.rightMargin: __style.drowDownButtonWidth + + verticalAlignment: Text.AlignVCenter + + renderType: Text.NativeRendering + selectByMouse: true + selectionColor: syspal.highlight + selectedTextColor: syspal.highlightedText + onAccepted: { + var idx = input.find(editText) + if (idx > -1) { + var string = textAt(idx); + if (string.length === editText.length) { + currentIndex = idx; + editText = string; + } + } else { + currentIndex = -1; + popup.currentText = editText; + } + comboBox.accepted(); + } + + SystemPalette { id: syspal } + + property bool blockUpdate: false + property string prevText + + function find (text, searchType) { + for (var i = 0 ; i < popupItems.count ; ++i) { + var currentString = popupItems.objectAt(i).text + if (searchType === Qt.MatchExactly) { + if (text === currentString) + return i; + } else if (searchType === Qt.CaseSensitive) { + if (currentString.indexOf(text) === 0) + return i; + } else if (currentString.toLowerCase().indexOf(text.toLowerCase()) === 0) { + return i + } + } + return -1; + } + + // Finds first entry and shortest entry. Used by editable combo + function tryComplete (inputText) { + var candidate = ""; + var shortestString = ""; + for (var i = 0 ; i < popupItems.count ; ++i) { + var currentString = popupItems.objectAt(i).text; + + if (currentString.toLowerCase().indexOf(inputText.toLowerCase()) === 0) { + if (candidate.length) { // Find smallest possible match + var cmp = 0; + + // We try to complete the shortest string that matches our search + if (currentString.length < candidate.length) + candidate = currentString + + while (cmp < Math.min(currentString.length, shortestString.length) + && shortestString[cmp].toLowerCase() === currentString[cmp].toLowerCase()) + cmp++; + shortestString = shortestString.substring(0, cmp); + } else { // First match, select as current index and find other matches + candidate = currentString; + shortestString = currentString; + } + } + } + + if (candidate.length) + return inputText + candidate.substring(inputText.length, candidate.length); + return inputText; + } + + property bool allowComplete: false + Keys.onPressed: allowComplete = (event.key !== Qt.Key_Backspace && event.key !== Qt.Key_Delete); + + onTextChanged: { + if (editable && !blockUpdate && allowComplete) { + var completed = input.tryComplete(text) + if (completed.length > text.length) { + var oldtext = input.text; + input.text = completed; + input.select(text.length, oldtext.length); + } + } + prevText = text + } + } + + onTextRoleChanged: popup.resolveTextValue(textRole) + + Menu { + id: popup + objectName: "popup" + + style: isPopup ? __style.__popupStyle : __style.__dropDownStyle + + property string currentText: selectedText + onSelectedTextChanged: if (selectedText) popup.currentText = selectedText + + property string selectedText + on__SelectedIndexChanged: updateSelectedText() + property string textRole: "" + + property bool ready: false + property bool isPopup: !editable && !!__panel && __panel.popup + + property int y: isPopup ? (comboBox.__panel.height - comboBox.__panel.implicitHeight) / 2.0 : comboBox.__panel.height + __minimumWidth: comboBox.width + __visualItem: comboBox + + property ExclusiveGroup eg: ExclusiveGroup { id: eg } + + property bool __modelIsArray: popupItems.model ? popupItems.model.constructor === Array : false + + Instantiator { + id: popupItems + active: false + + property bool updatingModel: false + onModelChanged: { + if (active) { + if (updatingModel && popup.__selectedIndex === 0) { + // We still want to update the currentText + popup.updateSelectedText() + } else { + updatingModel = true + popup.__selectedIndex = 0 + } + } + } + + MenuItem { + text: popup.textRole === '' ? + modelData : + ((popup.__modelIsArray ? modelData[popup.textRole] : model[popup.textRole]) || '') + onTriggered: { + if (index !== currentIndex) + activated(index) + comboBox.editText = text + } + checkable: true + exclusiveGroup: eg + } + onObjectAdded: { + popup.insertItem(index, object) + if (!updatingModel && index === popup.__selectedIndex) + popup.selectedText = object["text"] + } + onObjectRemoved: popup.removeItem(object) + + } + + function resolveTextValue(initialTextRole) { + if (!ready || !model) { + popupItems.active = false + return; + } + + var get = model['get']; + if (!get && popup.__modelIsArray) { + if (model[0].constructor !== String && model[0].constructor !== Number) + get = function(i) { return model[i]; } + } + + var modelMayHaveRoles = get !== undefined + textRole = initialTextRole + if (textRole === "" && modelMayHaveRoles && get(0)) { + // No text role set, check whether model has a suitable role + // If 'text' is found, or there's only one role, pick that. + var listElement = get(0) + var roleName = "" + var roleCount = 0 + for (var role in listElement) { + if (listElement[role].constructor === Function) + continue; + if (role === "text") { + roleName = role + break + } else if (!roleName) { + roleName = role + } + ++roleCount + } + if (roleCount > 1 && roleName !== "text") { + console.warn("No suitable 'textRole' found for ComboBox.") + } else { + textRole = roleName + } + } + + if (!popupItems.active) + popupItems.active = true + else + updateSelectedText() + } + + function show() { + if (items[__selectedIndex]) + items[__selectedIndex].checked = true + __currentIndex = comboBox.currentIndex + if (Qt.application.layoutDirection === Qt.RightToLeft) + __popup(comboBox.width, y, isPopup ? __selectedIndex : 0) + else + __popup(0, y, isPopup ? __selectedIndex : 0) + } + + function updateSelectedText() { + var selectedItem; + if (__selectedIndex !== -1 && (selectedItem = items[__selectedIndex])) + selectedText = selectedItem.text + } + } + + // The key bindings below will only be in use when popup is + // not visible. Otherwise, native popup key handling will take place: + Keys.onSpacePressed: { + if (!popup.popupVisible) + popup.show() + } + + Keys.onUpPressed: { + input.blockUpdate = true + if (currentIndex > 0) { + currentIndex--; + input.text = popup.currentText; + activated(currentIndex); + } + input.blockUpdate = false; + } + + Keys.onDownPressed: { + input.blockUpdate = true; + if (currentIndex < popupItems.count - 1) { + currentIndex++; + input.text = popup.currentText; + activated(currentIndex); + } + input.blockUpdate = false; + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/GroupBox.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/GroupBox.qml new file mode 100644 index 00000000000..12959d16ff3 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/GroupBox.qml @@ -0,0 +1,226 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.0 + +/*! + \qmltype GroupBox + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief GroupBox provides a group box frame with a title. + + A group box provides a frame, a title on top and displays various other controls inside itself. Group boxes can also be checkable. + + Child controls in checkable group boxes are enabled or disabled depending on whether or not the group box is checked. + + You can minimize the space consumption of a group box by enabling the flat property. + In most styles, enabling this property results in the removal of the left, right and bottom edges of the frame. + + To add content to a group box, you can reparent it to its contentItem property. + + The implicit size of the GroupBox is calculated based on the size of its content. If you want to anchor + items inside the group box, you must specify an explicit width and height on the GroupBox itself. + + The following example shows how we use a GroupBox with a column: + + \qml + GroupBox { + title: qsTr("Package selection") + Column { + spacing: 2 + CheckBox { + text: qsTr("Update system") + } + CheckBox { + text: qsTr("Update applications") + } + CheckBox { + text: qsTr("Update documentation") + } + } + } + \endqml + + \sa CheckBox, RadioButton, Layout + +*/ + +FocusScope { + id: groupbox + + /*! + This property holds the group box title text. + + There is no default title text. + */ + property string title + + /*! + This property holds whether the group box is painted flat or has a frame. + + A group box usually consists of a surrounding frame with a title at the top. + If this property is enabled, only the top part of the frame is drawn in most styles; + otherwise, the whole frame is drawn. + + By default, this property is disabled, so group boxes are not flat unless explicitly specified. + + \note In some styles, flat and non-flat group boxes have similar representations and may not be as + distinguishable as they are in other styles. + */ + property bool flat: false + + /*! + This property holds whether the group box has a checkbox in its title. + + If this property is true, the group box displays its title using a checkbox in place of an ordinary label. + If the checkbox is checked, the group box's children are enabled; otherwise, they are disabled and inaccessible. + + By default, group boxes are not checkable. + */ + property bool checkable: false + + /*! + \qmlproperty bool GroupBox::checked + + This property holds whether the group box is checked. + + If the group box is checkable, it is displayed with a check box. If the check box is checked, the group + box's children are enabled; otherwise, the children are disabled and are inaccessible to the user. + + By default, checkable group boxes are also checked. + */ + property alias checked: check.checked + + + /*! \internal */ + default property alias __content: container.data + + /*! + \qmlproperty Item GroupBox::contentItem + + This property holds the content Item of the group box. + + Items declared as children of a GroupBox are automatically parented to the GroupBox's contentItem. + Items created dynamically need to be explicitly parented to the contentItem: + + \note The implicit size of the GroupBox is calculated based on the size of its content. If you want to anchor + items inside the group box, you must specify an explicit width and height on the GroupBox itself. + */ + readonly property alias contentItem: container + + /*! \internal */ + property Component style: Qt.createComponent(Settings.style + "/GroupBoxStyle.qml", groupbox) + + /*! \internal */ + property alias __checkbox: check + + /*! \internal */ + property alias __style: styleLoader.item + + implicitWidth: Math.max((!anchors.fill ? container.calcWidth() : 0) + loader.leftMargin + loader.rightMargin, + sizeHint.implicitWidth + (checkable ? 24 : 6)) + implicitHeight: (!anchors.fill ? container.calcHeight() : 0) + loader.topMargin + loader.bottomMargin + + Layout.minimumWidth: implicitWidth + Layout.minimumHeight: implicitHeight + + Accessible.role: Accessible.Grouping + Accessible.name: title + + activeFocusOnTab: false + + + data: [ + Loader { + id: loader + anchors.fill: parent + property int topMargin: __style ? __style.padding.top : 0 + property int bottomMargin: __style ? __style.padding.bottom : 0 + property int leftMargin: __style ? __style.padding.left : 0 + property int rightMargin: __style ? __style.padding.right : 0 + sourceComponent: styleLoader.item ? styleLoader.item.panel : null + onLoaded: item.z = -1 + Text { id: sizeHint ; visible: false ; text: title } + Loader { + id: styleLoader + property alias __control: groupbox + sourceComponent: groupbox.style + } + }, + CheckBox { + id: check + objectName: "check" + checked: true + text: groupbox.title + visible: checkable + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + height: loader.topMargin + activeFocusOnTab: groupbox.checkable + style: CheckBoxStyle { panel: Item{} } + }, + Item { + id: container + objectName: "container" + z: 1 + focus: true + anchors.fill: parent + + anchors.topMargin: loader.topMargin + anchors.leftMargin: loader.leftMargin + anchors.rightMargin: loader.rightMargin + anchors.bottomMargin: loader.bottomMargin + enabled: (!groupbox.checkable || groupbox.checked) + + property Item layoutItem: container.children.length === 1 ? container.children[0] : null + function calcWidth () { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) + + (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin + + layoutItem.anchors.rightMargin : 0) : container.childrenRect.width) } + function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) + + (layoutItem.anchors.fill ? layoutItem.anchors.topMargin + + layoutItem.anchors.bottomMargin : 0) : container.childrenRect.height) } + }] +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Label.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Label.qml new file mode 100644 index 00000000000..01f2a1629c0 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Label.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 + +/*! + \qmltype Label + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief A text label. + + In addition to the normal \l Text element, Label follows the font and + color scheme of the system. + Use the \c text property to assign a text to the label. For other properties + check \l Text. + + A simple label looks like this: + \qml + Label { + text: "Hello world" + } + \endqml + + You can use the properties of \l Text to change the appearance + of the text as desired: + \qml + Label { + text: "Hello world" + font.pixelSize: 22 + font.italic: true + color: "steelblue" + } + \endqml + + \sa Text, TextField, TextEdit +*/ + +Text { + /*! + \qmlproperty string Label::text + + The text to display. Use this property to get and set it. + */ + + id: label + color: pal.text + activeFocusOnTab: false + renderType: Text.NativeRendering + SystemPalette { + id: pal + colorGroup: enabled ? SystemPalette.Active : SystemPalette.Disabled + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Menu.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Menu.qml new file mode 100644 index 00000000000..9c76684605f --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Menu.qml @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype Menu + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup menus + \brief Provides a menu component for use in menu bars, as context menu, + and other popup menus. + + \code + Menu { + title: "Edit" + + MenuItem { + text: "Cut" + shortcut: "Ctrl+X" + onTriggered: ... + } + + MenuItem { + text: "Copy" + shortcut: "Ctrl+C" + onTriggered: ... + } + + MenuItem { + text: "Paste" + shortcut: "Ctrl+V" + onTriggered: ... + } + + MenuSeparator { } + + Menu { + title: "More Stuff" + + MenuItem { + text: "Do Nothing" + } + } + } + \endcode + + The main uses for menus: + \list + \li + as a \e top-level menu in a \l MenuBar + \li + as a \e submenu inside another menu + \li + as a standalone or \e context menu + \endlist + + Note that some properties, such as \c enabled, \c text, or \c iconSource, + only make sense in a particular use case of the menu. + + \sa MenuBar, MenuItem, MenuSeparator +*/ + +MenuPrivate { + id: root + + /*! \internal + \omit + Documented in qqquickmenu.cpp. + \endomit + */ + function addMenu(title) { + return root.insertMenu(items.length, title) + } + + /*! \internal + \omit + Documented in qquickmenu.cpp. + \endomit + */ + function insertMenu(index, title) { + if (!__selfComponent) + __selfComponent = Qt.createComponent("Menu.qml", root) + var submenu = __selfComponent.createObject(__selfComponent, { "title": title }) + root.insertItem(index, submenu) + return submenu + } + + /*! \internal */ + property Component __selfComponent: null + + /*! \internal */ + property Component style: Qt.createComponent(Settings.style + "/MenuStyle.qml", root) + + /*! \internal */ + property var __parentContentItem: __parentMenu.__contentItem + /*! \internal */ + property int __currentIndex: -1 + /*! \internal */ + on__MenuClosed: __currentIndex = -1 + + /*! \internal */ + __contentItem: Loader { + sourceComponent: MenuContentItem { + menu: root + } + active: !root.__isNative && root.__popupVisible + focus: true + Keys.forwardTo: item ? [item, root.__parentContentItem] : [] + property bool altPressed: root.__parentContentItem ? root.__parentContentItem.altPressed : false + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/MenuBar.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/MenuBar.qml new file mode 100644 index 00000000000..42b3f39aad6 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/MenuBar.qml @@ -0,0 +1,276 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype MenuBar + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup applicationwindow + \brief Provides a horizontal menu bar. + + \code + MenuBar { + Menu { + title: "File" + MenuItem { text: "Open..." } + MenuItem { text: "Close" } + } + + Menu { + title: "Edit" + MenuItem { text: "Cut" } + MenuItem { text: "Copy" } + MenuItem { text: "Paste" } + } + } + \endcode + + \sa ApplicationWindow::menuBar +*/ + +MenuBarPrivate { + id: root + + /*! \internal */ + property Component style: Qt.createComponent(Settings.style + "/MenuBarStyle.qml", root) + + /*! \internal */ + __contentItem: Loader { + id: topLoader + sourceComponent: __menuBarComponent + active: !root.__isNative + focus: true + Keys.forwardTo: [item] + property bool altPressed: item ? item.altPressed : false + } + + /*! \internal */ + property Component __menuBarComponent: Loader { + id: menuBarLoader + + property Style __style: styleLoader.item + property Component menuItemStyle: __style ? __style.menuItem : null + + property var control: root + onStatusChanged: if (status === Loader.Error) console.error("Failed to load panel for", root) + + visible: status === Loader.Ready + sourceComponent: __style ? __style.frame : undefined + + Loader { + id: styleLoader + property alias __control: menuBarLoader + sourceComponent: root.style + onStatusChanged: { + if (status === Loader.Error) + console.error("Failed to load Style for", root) + } + } + + property int openedMenuIndex: -1 + property bool preselectMenuItem: false + property alias contentHeight: row.height + + Binding { + // Make sure the styled menu bar is in the background + target: menuBarLoader.item + property: "z" + value: menuMouseArea.z - 1 + } + + focus: true + + property bool altPressed: false + property bool altPressedAgain: false + property var mnemonicsMap: ({}) + + Keys.onPressed: { + var action = null + if (event.key === Qt.Key_Alt) { + if (!altPressed) + altPressed = true + else + altPressedAgain = true + } else if (altPressed && (action = mnemonicsMap[event.text.toUpperCase()])) { + preselectMenuItem = true + action.trigger() + event.accepted = true + } + } + + function dismissActiveFocus(event, reason) { + if (reason) { + altPressedAgain = false + altPressed = false + openedMenuIndex = -1 + root.__contentItem.parent.forceActiveFocus() + } else { + event.accepted = false + } + } + + Keys.onReleased: dismissActiveFocus(event, altPressedAgain && openedMenuIndex === -1) + Keys.onEscapePressed: dismissActiveFocus(event, openedMenuIndex === -1) + + function maybeOpenFirstMenu(event) { + if (altPressed && openedMenuIndex === -1) { + preselectMenuItem = true + openedMenuIndex = 0 + } else { + event.accepted = false + } + } + + Keys.onUpPressed: maybeOpenFirstMenu(event) + Keys.onDownPressed: maybeOpenFirstMenu(event) + + Keys.onLeftPressed: { + if (openedMenuIndex > 0) { + preselectMenuItem = true + openedMenuIndex-- + } + } + + Keys.onRightPressed: { + if (openedMenuIndex !== -1 && openedMenuIndex < root.menus.length - 1) { + preselectMenuItem = true + openedMenuIndex++ + } + } + + MouseArea { + id: menuMouseArea + anchors.fill: parent + hoverEnabled: true + + onPositionChanged: updateCurrentItem(mouse, false) + onPressed: { + if (updateCurrentItem(mouse)) { + menuBarLoader.preselectMenuItem = false + menuBarLoader.openedMenuIndex = currentItem.menuItemIndex + } + } + onExited: hoveredItem = null + + property Item currentItem: null + property Item hoveredItem: null + function updateCurrentItem(mouse) { + var pos = mapToItem(row, mouse.x, mouse.y) + if (!hoveredItem || !hoveredItem.contains(Qt.point(pos.x - currentItem.x, pos.y - currentItem.y))) { + hoveredItem = row.childAt(pos.x, pos.y) + if (!hoveredItem) + return false; + currentItem = hoveredItem + if (menuBarLoader.openedMenuIndex !== -1) { + menuBarLoader.preselectMenuItem = false + menuBarLoader.openedMenuIndex = currentItem.menuItemIndex + } + } + return true; + } + + Row { + id: row + width: parent.width + LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft + + Repeater { + id: itemsRepeater + model: root.menus + Loader { + id: menuItemLoader + + property var menuItem: modelData + property bool selected: menuMouseArea.hoveredItem === menuItemLoader + property bool sunken: menuItem.__popupVisible || menuBarLoader.openedMenuIndex === index + property bool showUnderlined: menuBarLoader.altPressed + + sourceComponent: menuBarLoader.menuItemStyle + property int menuItemIndex: index + visible: menuItem.visible + + Connections { + target: menuBarLoader + onOpenedMenuIndexChanged: { + if (menuBarLoader.openedMenuIndex === index) { + if (row.LayoutMirroring.enabled) + menuItem.__popup(menuItemLoader.width, menuBarLoader.height, 0) + else + menuItem.__popup(0, menuBarLoader.height, 0) + if (menuBarLoader.preselectMenuItem) + menuItem.__currentIndex = 0 + } else { + menuItem.__closeMenu() + } + } + } + + Connections { + target: menuItem + onPopupVisibleChanged: { + if (!menuItem.__popupVisible && menuBarLoader.openedMenuIndex === index) + menuBarLoader.openedMenuIndex = -1 + } + } + + Connections { + target: menuItem.__action + onTriggered: menuBarLoader.openedMenuIndex = menuItemIndex + } + + Component.onCompleted: { + menuItem.__visualItem = menuItemLoader + + var title = menuItem.title + var ampersandPos = title.indexOf("&") + if (ampersandPos !== -1) + menuBarLoader.mnemonicsMap[title[ampersandPos + 1].toUpperCase()] = menuItem.__action + } + } + } + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/AbstractCheckable.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/AbstractCheckable.qml new file mode 100644 index 00000000000..858569e8f52 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/AbstractCheckable.qml @@ -0,0 +1,149 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 + +/*! + \qmltype AbstractCheckable + \inqmlmodule QtQuick.Controls + \ingroup controls + \brief An abstract representation of a checkable control with a label + \qmlabstract + \internal + + A checkable control is one that has two states: checked (on) and + unchecked (off). AbstractCheckable encapsulates the basic behavior and + states that are required by checkable controls. + + Examples of checkable controls are RadioButton and + CheckBox. CheckBox extends AbstractCheckable's behavior by adding a third + state: partially checked. +*/ + +Control { + id: abstractCheckable + + /*! + Emitted whenever the control is clicked. + */ + signal clicked + + /*! + \qmlproperty bool AbstractCheckable::pressed + + This property is \c true if the control is being pressed. + Set this property to manually invoke a mouse click. + */ + property alias pressed: mouseArea.effectivePressed + + /*! \qmlproperty bool AbstractCheckcable::hovered + + This property indicates whether the control is being hovered. + */ + readonly property alias hovered: mouseArea.containsMouse + + /*! + This property is \c true if the control is checked. + */ + property bool checked: false + + /*! + This property is \c true if the control takes the focus when it is + pressed; \l{QQuickItem::forceActiveFocus()}{forceActiveFocus()} will be + called on the control. + */ + property bool activeFocusOnPress: false + + /*! + This property stores the ExclusiveGroup that the control belongs to. + */ + property ExclusiveGroup exclusiveGroup: null + + /*! + This property holds the text that the label should display. + */ + property string text + + /*! \internal */ + property var __cycleStatesHandler: cycleRadioButtonStates + + activeFocusOnTab: true + + MouseArea { + id: mouseArea + focus: true + anchors.fill: parent + hoverEnabled: true + enabled: !keyPressed + + property bool keyPressed: false + property bool effectivePressed: pressed && containsMouse || keyPressed + + onClicked: abstractCheckable.clicked(); + + onPressed: if (activeFocusOnPress) forceActiveFocus(); + + onReleased: { + if (containsMouse && (!exclusiveGroup || !checked)) + __cycleStatesHandler(); + } + } + + /*! \internal */ + onExclusiveGroupChanged: { + if (exclusiveGroup) + exclusiveGroup.bindCheckable(abstractCheckable) + } + + Keys.onPressed: { + if (event.key === Qt.Key_Space && !event.isAutoRepeat && !mouseArea.pressed) + mouseArea.keyPressed = true; + } + + Keys.onReleased: { + if (event.key === Qt.Key_Space && !event.isAutoRepeat && mouseArea.keyPressed) { + mouseArea.keyPressed = false; + if (!exclusiveGroup || !checked) + __cycleStatesHandler(); + clicked(); + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/BasicButton.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/BasicButton.qml new file mode 100644 index 00000000000..4c1eeb042c1 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/BasicButton.qml @@ -0,0 +1,233 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.1 + +/*! + \qmltype BasicButton + \internal + \qmlabstract + \inqmlmodule QtQuick.Controls.Private +*/ + +Control { + id: button + + /*! This signal is emitted when the button is clicked. */ + signal clicked + + /*! \qmlproperty bool BasicButton::pressed + + This property holds whether the button is being pressed. */ + readonly property alias pressed: button.__effectivePressed + + /*! \qmlproperty bool BasicButton::hovered + + This property indicates whether the control is being hovered. + */ + readonly property alias hovered: behavior.containsMouse + + /*! This property holds whether the button is checkable. + + The default value is \c false. */ + property bool checkable: false + + /*! This property holds whether the button is checked. + + Only checkable buttons can be checked. + + The default value is \c false. */ + property bool checked: false + + /*! This property holds the ExclusiveGroup that the button belongs to. + + The default value is \c null. */ + property ExclusiveGroup exclusiveGroup: null + + /*! This property holds the associated button action. + + If a button has an action associated, the action defines the + button's properties like checked, text, tooltip etc. + + When an action is set, it's still possible to override the \l text, + \l tooltip, \l iconSource, and \l iconName properties. + + The default value is \c null. */ + property Action action: null + + /*! This property specifies whether the button should gain active focus when pressed. + + The default value is \c false. */ + property bool activeFocusOnPress: false + + /*! This property holds the text shown on the button. If the button has no + text, the \l text property will be an empty string. + + The default value is the empty string. + */ + property string text: action ? action.text : "" + + /*! This property holds the button tooltip. */ + property string tooltip: action ? (action.tooltip || StyleHelpers.removeMnemonics(action.text)) : "" + + /*! This property holds the icon shown on the button. If the button has no + icon, the iconSource property will be an empty string. + + The default value is the empty string. + */ + property url iconSource: action ? action.iconSource : "" + + /*! The image label source as theme name. + When an icon from the platform icon theme is found, this takes + precedence over iconSource. + */ + property string iconName: action ? action.iconName : "" + + /*! \internal */ + property color __textColor: syspal.text + /*! \internal */ + property string __position: "only" + /*! \internal */ + readonly property bool __iconOverriden: button.action && (button.action.iconSource !== button.iconSource || button.action.iconName !== button.iconName) + /*! \internal */ + property Action __action: action || ownAction + /*! \internal */ + readonly property Action __iconAction: __iconOverriden ? ownAction : __action + + /*! \internal */ + onExclusiveGroupChanged: { + if (exclusiveGroup) + exclusiveGroup.bindCheckable(button) + } + + Accessible.role: Accessible.Button + Accessible.description: tooltip + + /*! \internal */ + function accessiblePressAction() { + __action.trigger(button) + } + + Action { + id: ownAction + iconSource: !button.action || __iconOverriden ? button.iconSource : "" + iconName: !button.action || __iconOverriden ? button.iconName : "" + } + + Connections { + target: __action + onTriggered: button.clicked() + } + + activeFocusOnTab: true + + Keys.onPressed: { + if (event.key === Qt.Key_Space && !event.isAutoRepeat && !behavior.pressed) + behavior.keyPressed = true; + } + + onFocusChanged: if (!focus) behavior.keyPressed = false + + Keys.onReleased: { + if (event.key === Qt.Key_Space && !event.isAutoRepeat && behavior.keyPressed) { + behavior.keyPressed = false; + __action.trigger(button) + behavior.toggle() + } + } + + MouseArea { + id: behavior + property bool keyPressed: false + property bool effectivePressed: pressed && containsMouse || keyPressed + + anchors.fill: parent + hoverEnabled: true + enabled: !keyPressed + + function toggle() { + if (button.checkable && !button.action && !(button.checked && button.exclusiveGroup)) + button.checked = !button.checked + } + + onReleased: { + if (containsMouse) { + toggle() + __action.trigger(button) + } + } + onExited: Tooltip.hideText() + onCanceled: Tooltip.hideText() + onPressed: { + if (activeFocusOnPress) + button.forceActiveFocus() + } + + Timer { + interval: 1000 + running: behavior.containsMouse && !pressed && tooltip.length + onTriggered: Tooltip.showText(behavior, Qt.point(behavior.mouseX, behavior.mouseY), tooltip) + } + } + + /*! \internal */ + property var __behavior: behavior + + /*! \internal */ + property bool __effectivePressed: behavior.effectivePressed + + SystemPalette { id: syspal } + + states: [ + State { + name: "boundAction" + when: action !== null + PropertyChanges { + target: button + enabled: action.enabled + checkable: action.checkable + checked: action.checked + } + } + ] +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ColumnMenuContent.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ColumnMenuContent.qml new file mode 100644 index 00000000000..bb21dcb9ce9 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ColumnMenuContent.qml @@ -0,0 +1,160 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 + +Item { + id: content + + property Component menuItemDelegate + property Component scrollerStyle + property var itemsModel + property int minWidth: 100 + property real maxHeight: 800 + property int margin: 1 + + signal triggered(var item) + + function menuItemAt(index) { + list.currentIndex = index + return list.currentItem + } + + width: Math.max(list.contentWidth, minWidth) + height: Math.min(list.contentHeight, fittedMaxHeight) + 2 * margin + + readonly property int currentIndex: menu.__currentIndex + property Item currentItem: null + readonly property int itemHeight: (list.count > 0 && list.contentItem.children[0]) ? list.contentItem.children[0].height : 23 + readonly property int fittingItems: Math.floor((maxHeight - downScroller.height) / itemHeight) + readonly property real fittedMaxHeight: itemHeight * fittingItems + downScroller.height + readonly property bool shouldUseScrollers: scrollView.__style.useScrollers && itemsModel.length > fittingItems + readonly property real upScrollerHeight: upScroller.visible ? upScroller.height : 0 + readonly property real downScrollerHeight: downScroller.visible ? downScroller.height : 0 + + function updateCurrentItem(mouse) { + var pos = mapToItem(list.contentItem, mouse.x, mouse.y) + if (!currentItem || !currentItem.contains(Qt.point(pos.x - currentItem.x, pos.y - currentItem.y))) { + if (currentItem && !hoverArea.pressed && currentItem.isSubmenu) + currentItem.closeSubMenu() + currentItem = list.itemAt(pos.x, pos.y) + if (currentItem) { + menu.__currentIndex = currentItem.menuItemIndex + if (currentItem.isSubmenu && !currentItem.menuItem.__popupVisible) + currentItem.showSubMenu(false) + } else { + menu.__currentIndex = -1 + } + } + } + + ScrollView { + id: scrollView + anchors { + fill: parent + topMargin: content.margin + upScrollerHeight + bottomMargin: downScrollerHeight - content.margin - 1 + rightMargin: -1 + } + + style: scrollerStyle + __wheelAreaScrollSpeed: itemHeight + + ListView { + id: list + model: itemsModel + delegate: menuItemDelegate + snapMode: ListView.SnapToItem + boundsBehavior: Flickable.StopAtBounds + highlightFollowsCurrentItem: true + highlightMoveDuration: 0 + } + } + + MouseArea { + id: hoverArea + anchors.left: scrollView.left + width: scrollView.width - scrollView.__verticalScrollBar.width + height: parent.height + + hoverEnabled: true + acceptedButtons: Qt.AllButtons + + onPositionChanged: updateCurrentItem(mouse) + onReleased: content.triggered(currentItem) + onExited: { + if (currentItem && !currentItem.menuItem.__popupVisible) { + currentItem = null + menu.__currentIndex = -1 + } + } + + MenuContentScroller { + id: upScroller + direction: "up" + visible: shouldUseScrollers && !list.atYBeginning + x: margin + function scrollABit() { list.contentY -= itemHeight } + } + + MenuContentScroller { + id: downScroller + direction: "down" + visible: shouldUseScrollers && !list.atYEnd + x: margin + function scrollABit() { list.contentY += itemHeight } + } + } + + Timer { + interval: 1 + running: true + repeat: false + onTriggered: list.positionViewAtIndex(currentIndex, scrollView.__style.useScrollers + ? ListView.Center : ListView.Beginning) + } + + Binding { + target: scrollView.__verticalScrollBar + property: "singleStep" + value: itemHeight + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/Control.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/Control.qml new file mode 100644 index 00000000000..0ce8908fb05 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/Control.qml @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls.Styles 1.1 + +/*! + \qmltype Control + \internal + \qmlabstract + \inqmlmodule QtQuick.Controls.Private +*/ +FocusScope { + id: root + + /*! \qmlproperty Component Control::style + + The style Component for this control. + \sa {Qt Quick Controls Styles QML Types} + + */ + property Component style + + /*! \internal */ + property QtObject __style: styleLoader.item + + /*! \internal */ + property Item __panel: panelLoader.item + + /*! \internal */ + property var styleHints + + implicitWidth: __panel ? __panel.implicitWidth: 0 + implicitHeight: __panel ? __panel.implicitHeight: 0 + baselineOffset: __panel ? __panel.baselineOffset: 0 + activeFocusOnTab: false + + /*! \internal */ + property alias __styleData: styleLoader.styleData + + Loader { + id: panelLoader + anchors.fill: parent + sourceComponent: __style ? __style.panel : null + onStatusChanged: if (status === Loader.Error) console.error("Failed to load Style for", root) + Loader { + id: styleLoader + sourceComponent: style + property Item __control: root + property QtObject styleData: null + onStatusChanged: { + if (status === Loader.Error) + console.error("Failed to load Style for", root) + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/FastGlow.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/FastGlow.qml new file mode 100644 index 00000000000..f4bd2c74219 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/FastGlow.qml @@ -0,0 +1,393 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant source + property real spread: 0.0 + property real blur: 0.0 + property color color: "white" + property bool transparentBorder: false + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + property string __internalBlurVertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_Matrix; + uniform highp float yStep; + uniform highp float xStep; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36); + qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep); + qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep); + qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36); + gl_Position = qt_Matrix * qt_Vertex; + } + " + + property string __internalBlurFragmentShader: " + uniform lowp sampler2D source; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) + + texture2D(source, qt_TexCoord1) + + texture2D(source, qt_TexCoord2) + + texture2D(source, qt_TexCoord3)) * 0.25; + gl_FragColor = sourceColor * qt_Opacity; + } + " + + ShaderEffect { + id: level0 + property variant source: sourceProxy.output + anchors.fill: parent + visible: false + smooth: true + } + + ShaderEffectSource { + id: level1 + width: Math.ceil(shaderItem.width / 32) * 32 + height: Math.ceil(shaderItem.height / 32) * 32 + sourceItem: level0 + hideSource: rootItem.visible + sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0,0,0,0) + smooth: true + visible: false + } + + ShaderEffect { + id: effect1 + property variant source: level1 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level2 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level2 + width: level1.width / 2 + height: level1.height / 2 + sourceItem: effect1 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect2 + property variant source: level2 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level3 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level3 + width: level2.width / 2 + height: level2.height / 2 + sourceItem: effect2 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect3 + property variant source: level3 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level4 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level4 + width: level3.width / 2 + height: level3.height / 2 + sourceItem: effect3 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect4 + property variant source: level4 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level5 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level5 + width: level4.width / 2 + height: level4.height / 2 + sourceItem: effect4 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect5 + property variant source: level5 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level6 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level6 + width: level5.width / 2 + height: level5.height / 2 + sourceItem: effect5 + hideSource: rootItem.visible + visible: false + smooth: true + } + + Item { + id: dummysource + width: 1 + height: 1 + visible: false + } + + ShaderEffectSource { + id: dummy + width: 1 + height: 1 + sourceItem: dummysource + visible: false + smooth: false + live: false + } + + ShaderEffect { + id: shaderItem + x: transparentBorder ? -64 : 0 + y: transparentBorder ? -64 : 0 + width: transparentBorder ? parent.width + 128 : parent.width + height: transparentBorder ? parent.height + 128 : parent.height + + property variant source1: level1 + property variant source2: level2 + property variant source3: level3 + property variant source4: level4 + property variant source5: level5 + property variant source6: level6 + property real lod: rootItem.blur + + property real weight1; + property real weight2; + property real weight3; + property real weight4; + property real weight5; + property real weight6; + + property real spread: 1.0 - (rootItem.spread * 0.98) + property alias color: rootItem.color + + function weight(v) { + if (v <= 0.0) + return 1 + if (v >= 0.5) + return 0 + + return 1.0 - v / 0.5 + } + + function calculateWeights() { + + var w1 = weight(Math.abs(lod - 0.100)) + var w2 = weight(Math.abs(lod - 0.300)) + var w3 = weight(Math.abs(lod - 0.500)) + var w4 = weight(Math.abs(lod - 0.700)) + var w5 = weight(Math.abs(lod - 0.900)) + var w6 = weight(Math.abs(lod - 1.100)) + + var sum = w1 + w2 + w3 + w4 + w5 + w6; + weight1 = w1 / sum; + weight2 = w2 / sum; + weight3 = w3 / sum; + weight4 = w4 / sum; + weight5 = w5 / sum; + weight6 = w6 / sum; + + upateSources() + } + + function upateSources() { + var sources = new Array(); + var weights = new Array(); + + if (weight1 > 0) { + sources.push(level1) + weights.push(weight1) + } + + if (weight2 > 0) { + sources.push(level2) + weights.push(weight2) + } + + if (weight3 > 0) { + sources.push(level3) + weights.push(weight3) + } + + if (weight4 > 0) { + sources.push(level4) + weights.push(weight4) + } + + if (weight5 > 0) { + sources.push(level5) + weights.push(weight5) + } + + if (weight6 > 0) { + sources.push(level6) + weights.push(weight6) + } + + for (var j = sources.length; j < 6; j++) { + sources.push(dummy) + weights.push(0.0) + } + + source1 = sources[0] + source2 = sources[1] + source3 = sources[2] + source4 = sources[3] + source5 = sources[4] + source6 = sources[5] + + weight1 = weights[0] + weight2 = weights[1] + weight3 = weights[2] + weight4 = weights[3] + weight5 = weights[4] + weight6 = weights[5] + } + + Component.onCompleted: calculateWeights() + + onLodChanged: calculateWeights() + + fragmentShader: " + uniform lowp sampler2D source1; + uniform lowp sampler2D source2; + uniform lowp sampler2D source3; + uniform lowp sampler2D source4; + uniform lowp sampler2D source5; + uniform mediump float weight1; + uniform mediump float weight2; + uniform mediump float weight3; + uniform mediump float weight4; + uniform mediump float weight5; + uniform highp vec4 color; + uniform highp float spread; + uniform lowp float qt_Opacity; + varying mediump vec2 qt_TexCoord0; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main() { + lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1; + sourceColor += texture2D(source2, qt_TexCoord0) * weight2; + sourceColor += texture2D(source3, qt_TexCoord0) * weight3; + sourceColor += texture2D(source4, qt_TexCoord0) * weight4; + sourceColor += texture2D(source5, qt_TexCoord0) * weight5; + sourceColor = mix(vec4(0), color, linearstep(0.0, spread, sourceColor.a)); + gl_FragColor = sourceColor * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/FocusFrame.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/FocusFrame.qml new file mode 100644 index 00000000000..449d06b1a68 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/FocusFrame.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype FocusFrame + \internal + \inqmlmodule QtQuick.Controls.Private +*/ +Item { + id: root + activeFocusOnTab: false + Accessible.role: Accessible.StatusBar + + anchors.topMargin: focusMargin + anchors.leftMargin: focusMargin + anchors.rightMargin: focusMargin + anchors.bottomMargin: focusMargin + + property int focusMargin: loader.item ? loader.item.margin : -3 + + Loader { + id: loader + z: 2 + anchors.fill: parent + sourceComponent: Qt.createComponent(Settings.style + "/FocusFrameStyle.qml", root) + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/MenuContentItem.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/MenuContentItem.qml new file mode 100644 index 00000000000..7056b4e1f08 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/MenuContentItem.qml @@ -0,0 +1,234 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 + +Loader { + id: menuFrameLoader + + readonly property Style __style: styleLoader.item + readonly property Component menuItemStyle: __style ? __style.menuItem : null + + property var menu: root + property alias contentWidth: content.width + property alias contentHeight: content.height + + readonly property int subMenuXPos: width + (item && item["subMenuOverlap"] || 0) + + visible: status === Loader.Ready + sourceComponent: __style ? __style.frame : undefined + + Loader { + id: styleLoader + active: !menu.isNative + sourceComponent: menu.style + property alias __control: menuFrameLoader + onStatusChanged: { + if (status === Loader.Error) + console.error("Failed to load Style for", menu) + } + } + + focus: true + property var mnemonicsMap: ({}) + + Keys.onPressed: { + var item = null + if (!(event.modifiers & Qt.AltModifier) + && (item = mnemonicsMap[event.text.toUpperCase()])) { + if (item.isSubmenu) { + menu.__currentIndex = item.menuItemIndex + item.showSubMenu(true) + item.menuItem.__currentIndex = 0 + } else { + triggerAndDismiss(item) + } + event.accepted = true + } else { + event.accepted = false + } + } + + Keys.onEscapePressed: menu.__dismissMenu() + + Keys.onDownPressed: { + if (menu.__currentIndex < 0) + menu.__currentIndex = -1 + + for (var i = menu.__currentIndex + 1; + i < menu.items.length && !canBeHovered(i); i++) + ; + event.accepted = true + } + + Keys.onUpPressed: { + for (var i = menu.__currentIndex - 1; + i >= 0 && !canBeHovered(i); i--) + ; + event.accepted = true + } + + function canBeHovered(index) { + var item = content.menuItemAt(index) + if (item && !item["isSeparator"] && item.enabled) { + menu.__currentIndex = index + return true + } + return false + } + + Keys.onLeftPressed: { + if ((event.accepted = menu.__parentMenu.hasOwnProperty("title"))) + __closeMenu() + } + + Keys.onRightPressed: { + var item = content.menuItemAt(menu.__currentIndex) + if ((event.accepted = (item && item.isSubmenu))) { + item.showSubMenu(true) + item.menuItem.__currentIndex = 0 + } + } + + Keys.onSpacePressed: triggerCurrent() + Keys.onReturnPressed: triggerCurrent() + Keys.onEnterPressed: triggerCurrent() + + function triggerCurrent() { + var item = content.menuItemAt(menu.__currentIndex) + if (item) + content.triggered(item) + } + + function triggerAndDismiss(item) { + if (item && !item.isSeparator) { + menu.__dismissMenu() + if (!item.isSubmenu) + item.menuItem.trigger() + } + } + + Binding { + // Make sure the styled frame is in the background + target: item + property: "z" + value: content.z - 1 + } + + ColumnMenuContent { + id: content + menuItemDelegate: menuItemComponent + scrollerStyle: __style ? __style.scrollerStyle : undefined + itemsModel: menu.items + margin: menuFrameLoader.item ? menuFrameLoader.item.margin : 0 + minWidth: menu.__minimumWidth + maxHeight: menuFrameLoader.item ? menuFrameLoader.item.maxHeight : 0 + onTriggered: triggerAndDismiss(item) + } + + Component { + id: menuItemComponent + Loader { + id: menuItemLoader + + property var menuItem: modelData + readonly property bool isSeparator: !!menuItem && menuItem.type === MenuItemType.Separator + readonly property bool isSubmenu: !!menuItem && menuItem.type === MenuItemType.Menu + property bool selected: !(isSeparator || !!scrollerDirection) && menu.__currentIndex === index + property string text: isSubmenu ? menuItem.title : !(isSeparator || !!scrollerDirection) ? menuItem.text : "" + property bool showUnderlined: menu.__contentItem.altPressed + readonly property var scrollerDirection: menuItem["scrollerDirection"] + + property int menuItemIndex: index + + sourceComponent: menuFrameLoader.menuItemStyle + enabled: visible && !isSeparator && !!menuItem && menuItem.enabled + visible: !!menuItem && menuItem.visible + active: visible + + function showSubMenu(immediately) { + if (immediately) { + if (menu.__currentIndex === menuItemIndex) + menuItem.__popup(menuFrameLoader.subMenuXPos, 0, -1) + } else { + openMenuTimer.start() + } + } + + Timer { + id: openMenuTimer + interval: 50 + onTriggered: menuItemLoader.showSubMenu(true) + } + + function closeSubMenu() { closeMenuTimer.start() } + + Timer { + id: closeMenuTimer + interval: 1 + onTriggered: { + if (menu.__currentIndex !== menuItemIndex) + menuItem.__closeMenu() + } + } + + onLoaded: { + menuItem.__visualItem = menuItemLoader + + if (content.width < item.implicitWidth) + content.width = item.implicitWidth + + var title = text + var ampersandPos = title.indexOf("&") + if (ampersandPos !== -1) + menuFrameLoader.mnemonicsMap[title[ampersandPos + 1].toUpperCase()] = menuItemLoader + } + + Binding { + target: menuItemLoader.item + property: "width" + property alias menuItem: menuItemLoader.item + value: menuItem ? Math.max(menu.__minimumWidth, content.width) - 2 * menuItem.x : 0 + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/MenuContentScroller.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/MenuContentScroller.qml new file mode 100644 index 00000000000..30a8825af2a --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/MenuContentScroller.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 + +MouseArea { + property string direction + + anchors { + top: direction === "up" ? parent.top : undefined + bottom: direction === "down" ? parent.bottom : undefined + } + + hoverEnabled: visible + height: scrollerLoader.item.height + width: parent.width + + Loader { + id: scrollerLoader + + sourceComponent: menuItemDelegate + property int index: -1 + property var modelData: { + "visible": true, + "scrollerDirection": direction, + "enabled": true + } + } + + Timer { + interval: 100 + repeat: true + triggeredOnStart: true + running: parent.containsMouse + onTriggered: scrollABit() + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ModalPopupBehavior.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ModalPopupBehavior.qml new file mode 100644 index 00000000000..8b78cb31b39 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ModalPopupBehavior.qml @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 + +// KNOWN ISSUES +// none + +/*! + \qmltype ModalPopupBehavior + \internal + \inqmlmodule QtQuick.Controls.Private +*/ +Item { + id: popupBehavior + + property bool showing: false + property bool whenAlso: true // modifier to the "showing" property + property bool consumeCancelClick: true + property int delay: 0 // delay before popout becomes visible + property int deallocationDelay: 3000 // 3 seconds + + property Component popupComponent + + property alias popup: popupLoader.item // read-only + property alias window: popupBehavior.root // read-only + + signal prepareToShow + signal prepareToHide + signal cancelledByClick + + // implementation + + anchors.fill: parent + + onShowingChanged: notifyChange() + onWhenAlsoChanged: notifyChange() + function notifyChange() { + if(showing && whenAlso) { + if(popupLoader.sourceComponent == undefined) { + popupLoader.sourceComponent = popupComponent; + } + } else { + mouseArea.enabled = false; // disable before opacity is changed in case it has fading behavior + if(Qt.isQtObject(popupLoader.item)) { + popupBehavior.prepareToHide(); + popupLoader.item.opacity = 0; + } + } + } + + property Item root: findRoot() + function findRoot() { + var p = parent; + while(p.parent != undefined) + p = p.parent; + + return p; + } + + MouseArea { + id: mouseArea + anchors.fill: parent + enabled: false // enabled only when popout is showing + onPressed: { + popupBehavior.showing = false; + mouse.accepted = consumeCancelClick; + cancelledByClick(); + } + } + + Loader { + id: popupLoader + } + + Timer { // visibility timer + running: Qt.isQtObject(popupLoader.item) && showing && whenAlso + interval: delay + onTriggered: { + popupBehavior.prepareToShow(); + mouseArea.enabled = true; + popup.opacity = 1; + } + } + + Timer { // deallocation timer + running: Qt.isQtObject(popupLoader.item) && popupLoader.item.opacity == 0 + interval: deallocationDelay + onTriggered: popupLoader.sourceComponent = undefined + } + + states: State { + name: "active" + when: Qt.isQtObject(popupLoader.item) && popupLoader.item.opacity > 0 + ParentChange { target: popupBehavior; parent: root } + } + } + diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ScrollBar.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ScrollBar.qml new file mode 100644 index 00000000000..65ed51cfcee --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ScrollBar.qml @@ -0,0 +1,234 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ScrollBar + \internal + \inqmlmodule QtQuick.Controls.Private +*/ +Item { + id: scrollbar + + property bool isTransient: false + property bool active: false + property int orientation: Qt.Horizontal + property alias minimumValue: slider.minimumValue + property alias maximumValue: slider.maximumValue + property alias value: slider.value + property int singleStep: 20 + + activeFocusOnTab: false + + Accessible.role: Accessible.ScrollBar + implicitWidth: panelLoader.implicitWidth + implicitHeight: panelLoader.implicitHeight + + property bool upPressed + property bool downPressed + property bool pageUpPressed + property bool pageDownPressed + property bool handlePressed + + + property Item __panel: panelLoader.item + Loader { + id: panelLoader + anchors.fill: parent + sourceComponent: __style ? __style.__scrollbar : null + onStatusChanged: if (status === Loader.Error) console.error("Failed to load Style for", root) + property alias __control: scrollbar + property QtObject __styleData: QtObject { + readonly property alias horizontal: internal.horizontal + readonly property alias upPressed: scrollbar.upPressed + readonly property alias downPressed: scrollbar.downPressed + readonly property alias handlePressed: scrollbar.handlePressed + } + } + + MouseArea { + id: internal + property bool horizontal: orientation === Qt.Horizontal + property int pageStep: internal.horizontal ? width : height + property bool scrollToClickposition: internal.scrollToClickPosition + anchors.fill: parent + cursorShape: __panel.visible ? Qt.ArrowCursor : Qt.IBeamCursor // forces a cursor change + + property bool autoincrement: false + property bool scrollToClickPosition: __style ? __style.scrollToClickedPosition : 0 + + // Update hover item + onEntered: if (!pressed) __panel.activeControl = __panel.hitTest(mouseX, mouseY) + onExited: if (!pressed) __panel.activeControl = "none" + onMouseXChanged: if (!pressed) __panel.activeControl = __panel.hitTest(mouseX, mouseY) + hoverEnabled: true + + property var pressedX + property var pressedY + property int oldPosition + property int grooveSize + + Timer { + running: upPressed || downPressed || pageUpPressed || pageDownPressed + interval: 350 + onTriggered: internal.autoincrement = true + } + + Timer { + running: internal.autoincrement + interval: 60 + repeat: true + onTriggered: { + if (upPressed && internal.containsMouse) + internal.decrement(); + else if (downPressed && internal.containsMouse) + internal.increment(); + else if (pageUpPressed) + internal.decrementPage(); + else if (pageDownPressed) + internal.incrementPage(); + } + } + + onPositionChanged: { + if (handlePressed) { + if (!horizontal) + slider.position = oldPosition + (mouseY - pressedY) + else + slider.position = oldPosition + (mouseX - pressedX) + } + } + + onPressed: { + __panel.activeControl = __panel.hitTest(mouseX, mouseY) + scrollToClickposition = scrollToClickPosition + var handleRect = __panel.subControlRect("handle") + var grooveRect = __panel.subControlRect("groove") + grooveSize = horizontal ? grooveRect.width - handleRect.width: + grooveRect.height - handleRect.height; + if (__panel.activeControl === "handle") { + pressedX = mouseX; + pressedY = mouseY; + handlePressed = true; + oldPosition = slider.position; + } else if (__panel.activeControl === "up") { + decrement(); + upPressed = Qt.binding(function() {return containsMouse}); + } else if (__panel.activeControl === "down") { + increment(); + downPressed = Qt.binding(function() {return containsMouse}); + } else if (!scrollToClickposition){ + if (__panel.activeControl === "upPage") { + decrementPage(); + pageUpPressed = true; + } else if (__panel.activeControl === "downPage") { + incrementPage(); + pageDownPressed = true; + } + } else { // scroll to click position + slider.position = horizontal ? mouseX - handleRect.width/2 - grooveRect.x + : mouseY - handleRect.height/2 - grooveRect.y + pressedX = mouseX; + pressedY = mouseY; + handlePressed = true; + oldPosition = slider.position; + } + } + + onReleased: { + __panel.activeControl = __panel.hitTest(mouseX, mouseY); + autoincrement = false; + upPressed = false; + downPressed = false; + handlePressed = false; + pageUpPressed = false; + pageDownPressed = false; + } + + onWheel: { + var stepCount = -(wheel.angleDelta.x ? wheel.angleDelta.x : wheel.angleDelta.y) / 120 + if (stepCount != 0) { + if (wheel.modifiers & Qt.ControlModifier || wheel.modifiers & Qt.ShiftModifier) + incrementPage(stepCount) + else + increment(stepCount) + } + } + + function incrementPage(stepCount) { + value = boundValue(value + getSteps(pageStep, stepCount)) + } + + function decrementPage(stepCount) { + value = boundValue(value - getSteps(pageStep, stepCount)) + } + + function increment(stepCount) { + value = boundValue(value + getSteps(singleStep, stepCount)) + } + + function decrement(stepCount) { + value = boundValue(value - getSteps(singleStep, stepCount)) + } + + function boundValue(val) { + return Math.min(Math.max(val, minimumValue), maximumValue) + } + + function getSteps(step, count) { + if (count) + step *= count + return step + } + + RangeModel { + id: slider + minimumValue: 0.0 + maximumValue: 1.0 + value: 0 + stepSize: 0.0 + inverted: false + positionAtMaximum: internal.grooveSize + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ScrollViewHelper.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ScrollViewHelper.qml new file mode 100644 index 00000000000..3f1166f3e87 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/ScrollViewHelper.qml @@ -0,0 +1,216 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ScrollViewHeader + \internal + \inqmlmodule QtQuick.Controls.Private +*/ +Item { + id: wheelarea + + property alias horizontalScrollBar: hscrollbar + property alias verticalScrollBar: vscrollbar + property bool blockUpdates: false + property int availableHeight + property int availableWidth + property int contentHeight + property int contentWidth + property real originX + property real originY + property bool active + + property int leftMargin: outerFrame ? root.__style.padding.left : 0 + property int rightMargin: outerFrame ? root.__style.padding.right : 0 + property int topMargin: outerFrame ? root.__style.padding.top : 0 + property int bottomMargin: outerFrame ? root.__style.padding.bottom : 0 + + anchors.fill: parent + + property bool recursionGuard: false + + function doLayout() { + if (!recursionGuard) { + recursionGuard = true + wheelarea.availableWidth = viewport.width + wheelarea.availableHeight = viewport.height + wheelarea.contentWidth = flickableItem !== null ? flickableItem.contentWidth : 0 + wheelarea.contentHeight = flickableItem !== null ? flickableItem.contentHeight : 0 + wheelarea.originX = flickableItem !== null ? flickableItem.originX : 0 + wheelarea.originY = flickableItem !== null ? flickableItem.originY : 0 + recursionGuard = false + } + } + + Connections { + target: viewport + onWidthChanged: doLayout() + onHeightChanged: doLayout() + } + + Connections { + target: flickableItem + onContentWidthChanged: doLayout() + onContentHeightChanged: doLayout() + } + + Connections { + target: flickableItem + onContentXChanged: { + hscrollbar.flash() + vscrollbar.flash() + } + onContentYChanged: { + hscrollbar.flash() + vscrollbar.flash() + } + } + + Loader { + id: cornerFill + z: 1 + sourceComponent: __style.corner + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.bottomMargin: bottomMargin + anchors.rightMargin: rightMargin + width: visible ? vscrollbar.width : 0 + height: visible ? hscrollbar.height : 0 + visible: hscrollbar.visible && !hscrollbar.isTransient && vscrollbar.visible && !vscrollbar.isTransient + } + + ScrollBar { + id: hscrollbar + isTransient: !!__panel && !!__panel.isTransient + active: !!__panel && (__panel.sunken || __panel.activeControl !== "none") + enabled: !isTransient || __panel.visible + orientation: Qt.Horizontal + visible: contentWidth > availableWidth + height: visible ? implicitHeight : 0 + z: 1 + maximumValue: contentWidth > availableWidth ? originX + contentWidth - availableWidth : 0 + minimumValue: originX + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: cornerFill.left + anchors.leftMargin: leftMargin + anchors.bottomMargin: bottomMargin + onValueChanged: { + if (!blockUpdates) { + flickableItem.contentX = value + } + } + Binding { + target: hscrollbar.__panel + property: "raised" + value: vscrollbar.active || wheelarea.active + when: hscrollbar.isTransient + } + Binding { + target: hscrollbar.__panel + property: "visible" + value: true + when: !hscrollbar.isTransient || wheelarea.active + } + function flash() { + if (hscrollbar.isTransient) { + hscrollbar.__panel.on = true + hscrollbar.__panel.visible = true + hFlasher.start() + } + } + Timer { + id: hFlasher + interval: 10 + onTriggered: hscrollbar.__panel.on = false + } + } + + ScrollBar { + id: vscrollbar + isTransient: !!__panel && !!__panel.isTransient + active: !!__panel && (__panel.sunken || __panel.activeControl !== "none") + enabled: !isTransient || __panel.visible + orientation: Qt.Vertical + visible: contentHeight > availableHeight + width: visible ? implicitWidth : 0 + z: 1 + anchors.bottom: cornerFill.top + maximumValue: contentHeight > availableHeight ? originY + contentHeight - availableHeight + __viewTopMargin : 0 + minimumValue: originY + anchors.right: parent.right + anchors.top: parent.top + anchors.topMargin: __scrollBarTopMargin + topMargin + anchors.rightMargin: rightMargin + onValueChanged: { + if (flickableItem && !blockUpdates && enabled) { + flickableItem.contentY = value + } + } + Binding { + target: vscrollbar.__panel + property: "raised" + value: hscrollbar.active || wheelarea.active + when: vscrollbar.isTransient + } + Binding { + target: vscrollbar.__panel + property: "visible" + value: true + when: !vscrollbar.isTransient || wheelarea.active + } + function flash() { + if (vscrollbar.isTransient) { + vscrollbar.__panel.on = true + vscrollbar.__panel.visible = true + vFlasher.start() + } + } + Timer { + id: vFlasher + interval: 10 + onTriggered: vscrollbar.__panel.on = false + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/SourceProxy.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/SourceProxy.qml new file mode 100644 index 00000000000..1cf03f313e0 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/SourceProxy.qml @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant input + property variant output + property variant sourceRect + visible: false + + Component.onCompleted: evaluateInput() + + onInputChanged: evaluateInput() + + onSourceRectChanged: evaluateInput() + + function evaluateInput() { + if (input == undefined) { + output = input + } + else if (sourceRect != undefined && sourceRect != Qt.rect(0, 0, 0, 0) && !isQQuickShaderEffectSource(input)) { + proxySource.sourceItem = input + output = proxySource + proxySource.sourceRect = sourceRect + } + else if (isQQuickItemLayerEnabled(input)) { + output = input + } + else if ((isQQuickImage(input) && !hasTileMode(input) && !hasChildren(input))) { + output = input + } + else if (isQQuickShaderEffectSource(input)) { + output = input + } + else { + proxySource.sourceItem = input + output = proxySource + proxySource.sourceRect = Qt.rect(0, 0, 0, 0) + } + } + + function isQQuickItemLayerEnabled(item) { + if (item.hasOwnProperty("layer")) { + var l = item["layer"] + if (l.hasOwnProperty("enabled") && l["enabled"].toString() == "true") + return true + } + return false + } + + function isQQuickImage(item) { + var imageProperties = [ "fillMode", "progress", "asynchronous", "sourceSize", "status", "smooth" ] + return hasProperties(item, imageProperties) + } + + function isQQuickShaderEffectSource(item) { + var shaderEffectSourceProperties = [ "hideSource", "format", "sourceItem", "mipmap", "wrapMode", "live", "recursive", "sourceRect" ] + return hasProperties(item, shaderEffectSourceProperties) + } + + function hasProperties(item, properties) { + var counter = 0 + for (var j = 0; j < properties.length; j++) { + if (item.hasOwnProperty(properties [j])) + counter++ + } + return properties.length == counter + } + + function hasChildren(item) { + if (item.hasOwnProperty("childrenRect")) { + if (item["childrenRect"].toString() != "QRectF(0, 0, 0, 0)") + return true + else + return false + } + return false + } + + function hasTileMode(item) { + if (item.hasOwnProperty("fillMode")) { + if (item["fillMode"].toString() != "0") + return true + else + return false + } + return false + } + + ShaderEffectSource { + id: proxySource + live: rootItem.input != rootItem.output + hideSource: false + smooth: true + visible: false + } +} + diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/StackView.js b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/StackView.js new file mode 100644 index 00000000000..fa9bb08e8c3 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/StackView.js @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +var stackView = []; + +function push(p) +{ + if (!p) + return + stackView.push(p) + __depth++ + return p +} + +function pop() +{ + if (stackView.length === 0) + return null + var p = stackView.pop() + __depth-- + return p +} + +function current() +{ + if (stackView.length === 0) + return null + return stackView[stackView.length-1] +} + diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/StackViewSlideDelegate.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/StackViewSlideDelegate.qml new file mode 100644 index 00000000000..88530e696c2 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/StackViewSlideDelegate.qml @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 + +/*! + \qmltype StackViewSlideTransition + \internal + \inqmlmodule QtQuick.Controls.Private +*/ +StackViewDelegate { + id: root + + property bool horizontal: true + + function getTransition(properties) + { + return root[horizontal ? "horizontalSlide" : "verticalSlide"][properties.name] + } + + function transitionFinished(properties) + { + properties.exitItem.x = 0 + properties.exitItem.y = 0 + } + + property QtObject horizontalSlide: QtObject { + property Component pushTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "x" + from: target.width + to: 0 + duration: 300 + } + PropertyAnimation { + target: exitItem + property: "x" + from: 0 + to: -target.width + duration: 300 + } + } + + property Component popTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "x" + from: -target.width + to: 0 + duration: 300 + } + PropertyAnimation { + target: exitItem + property: "x" + from: 0 + to: target.width + duration: 300 + } + } + property Component replaceTransition: pushTransition + } + + property QtObject verticalSlide: QtObject { + property Component pushTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "y" + from: target.height + to: 0 + duration: 300 + } + PropertyAnimation { + target: exitItem + property: "y" + from: 0 + to: -target.height + duration: 300 + } + } + + property Component popTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "y" + from: -target.height + to: 0 + duration: 300 + } + PropertyAnimation { + target: exitItem + property: "y" + from: 0 + to: target.height + duration: 300 + } + property Component replaceTransition: pushTransition + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/Style.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/Style.qml new file mode 100644 index 00000000000..ed31536dd7f --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/Style.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype Style + \internal + \inqmlmodule QtQuick.Controls.Private +*/ + +AbstractStyle { + /*! The control attached to this style */ + readonly property Item control: __control + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TabBar.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TabBar.qml new file mode 100644 index 00000000000..2e374f994e5 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TabBar.qml @@ -0,0 +1,308 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 + +/*! + \qmltype TabBar + \internal + \inqmlmodule QtQuick.Controls.Private +*/ +FocusScope { + id: tabbar + height: Math.max(tabrow.height, Math.max(leftCorner.height, rightCorner.height)) + width: tabView.width + + activeFocusOnTab: true + + Keys.onRightPressed: { + if (tabView && tabView.currentIndex < tabView.count - 1) + tabView.currentIndex = tabView.currentIndex + 1 + } + Keys.onLeftPressed: { + if (tabView && tabView.currentIndex > 0) + tabView.currentIndex = tabView.currentIndex - 1 + } + + onTabViewChanged: parent = tabView + visible: tabView ? tabView.tabsVisible : true + + property var tabView + property var style + property var styleItem: tabView.__styleItem ? tabView.__styleItem : null + + property bool tabsMovable: styleItem ? styleItem.tabsMovable : false + + property int tabsAlignment: styleItem ? styleItem.tabsAlignment : Qt.AlignLeft + + property int tabOverlap: styleItem ? styleItem.tabOverlap : 0 + + property int elide: Text.ElideRight + + property real availableWidth: tabbar.width - leftCorner.width - rightCorner.width + + property var __selectedTabRect + + function tab(index) { + for (var i = 0; i < tabrow.children.length; ++i) { + if (tabrow.children[i].tabindex == index) { + return tabrow.children[i] + } + } + return null; + } + + /*! \internal */ + function __isAncestorOf(item, child) { + //TODO: maybe removed from 5.2 if the function was merged in qtdeclarative + if (child === item) + return false; + + while (child) { + child = child.parent; + if (child === item) + return true; + } + return false; + } + Loader { + id: background + anchors.fill: parent + sourceComponent: styleItem ? styleItem.tabBar : undefined + } + + ListView { + id: tabrow + objectName: "tabrow" + Accessible.role: Accessible.PageTabList + LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft + spacing: -tabOverlap + orientation: Qt.Horizontal + interactive: false + focus: true + + // Note this will silence the binding loop warnings caused by QTBUG-35038 + // and should be removed when this issue is resolved. + property int contentWidthWorkaround: contentWidth > 0 ? contentWidth: 0 + width: Math.min(availableWidth, count ? contentWidthWorkaround : availableWidth) + height: currentItem ? currentItem.height : 0 + + highlightMoveDuration: 0 + currentIndex: tabView.currentIndex + onCurrentIndexChanged: tabrow.positionViewAtIndex(currentIndex, ListView.Contain) + + moveDisplaced: Transition { + NumberAnimation { + property: "x" + duration: 125 + easing.type: Easing.OutQuad + } + } + + states: [ + State { + name: "left" + when: tabsAlignment === Qt.AlignLeft + AnchorChanges { target:tabrow ; anchors.left: parent.left } + PropertyChanges { target:tabrow ; anchors.leftMargin: leftCorner.width } + }, + State { + name: "center" + when: tabsAlignment === Qt.AlignHCenter + AnchorChanges { target:tabrow ; anchors.horizontalCenter: tabbar.horizontalCenter } + }, + State { + name: "right" + when: tabsAlignment === Qt.AlignRight + AnchorChanges { target:tabrow ; anchors.right: parent.right } + PropertyChanges { target:tabrow ; anchors.rightMargin: rightCorner.width } + } + ] + + model: tabView.__tabs + + delegate: MouseArea { + id: tabitem + objectName: "mousearea" + hoverEnabled: true + focus: true + + Binding { + target: tabbar + when: selected + property: "__selectedTabRect" + value: Qt.rect(x, y, width, height) + } + + drag.target: tabsMovable ? tabloader : null + drag.axis: Drag.XAxis + drag.minimumX: drag.active ? 0 : -Number.MAX_VALUE + drag.maximumX: tabrow.width - tabitem.width + + property int tabindex: index + property bool selected : tabView.currentIndex === index + property string title: modelData.title + property bool nextSelected: tabView.currentIndex === index + 1 + property bool previousSelected: tabView.currentIndex === index - 1 + + z: selected ? 1 : -index + implicitWidth: tabloader.implicitWidth + implicitHeight: tabloader.implicitHeight + + function changeTab() { + tabView.currentIndex = index; + var next = tabbar.nextItemInFocusChain(true); + if (__isAncestorOf(tabView.getTab(currentIndex), next)) + next.forceActiveFocus(); + } + + onClicked: { + if (tabrow.interactive) { + changeTab() + } + } + onPressed: { + if (!tabrow.interactive) { + changeTab() + } + } + + Loader { + id: tabloader + + property Item control: tabView + property int index: tabindex + + property QtObject styleData: QtObject { + readonly property alias index: tabitem.tabindex + readonly property alias selected: tabitem.selected + readonly property alias title: tabitem.title + readonly property alias nextSelected: tabitem.nextSelected + readonly property alias previsousSelected: tabitem.previousSelected + readonly property alias hovered: tabitem.containsMouse + readonly property bool activeFocus: tabbar.activeFocus + readonly property real availableWidth: tabbar.availableWidth + } + + sourceComponent: loader.item ? loader.item.tab : null + + Drag.keys: "application/x-tabbartab" + Drag.active: tabitem.drag.active + Drag.source: tabitem + + property real __prevX: 0 + property real __dragX: 0 + onXChanged: { + if (Drag.active) { + // keep track for the snap back animation + __dragX = tabitem.mapFromItem(tabrow, tabloader.x, 0).x + + // when moving to the left, the hot spot is the left edge and vice versa + Drag.hotSpot.x = x < __prevX ? 0 : width + __prevX = x + } + } + + width: tabitem.width + state: Drag.active ? "drag" : "" + + transitions: [ + Transition { + to: "drag" + PropertyAction { target: tabloader; property: "parent"; value: tabrow } + }, + Transition { + from: "drag" + SequentialAnimation { + PropertyAction { target: tabloader; property: "parent"; value: tabitem } + NumberAnimation { + target: tabloader + duration: 50 + easing.type: Easing.OutQuad + property: "x" + from: tabloader.__dragX + to: 0 + } + } + } + ] + } + + Accessible.role: Accessible.PageTab + Accessible.name: modelData.title + } + } + + Loader { + id: leftCorner + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + sourceComponent: styleItem ? styleItem.leftCorner : undefined + width: item ? item.implicitWidth : 0 + height: item ? item.implicitHeight : 0 + } + + Loader { + id: rightCorner + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + sourceComponent: styleItem ? styleItem.rightCorner : undefined + width: item ? item.implicitWidth : 0 + height: item ? item.implicitHeight : 0 + } + + DropArea { + anchors.fill: tabrow + keys: "application/x-tabbartab" + onPositionChanged: { + var source = drag.source + var target = tabrow.itemAt(drag.x, drag.y) + if (source && target && source !== target) { + source = source.drag.target + target = target.drag.target + var center = target.parent.x + target.width / 2 + if ((source.index > target.index && source.x < center) + || (source.index < target.index && source.x + source.width > center)) + tabView.moveTab(source.index, target.index) + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TableViewSelection.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TableViewSelection.qml new file mode 100644 index 00000000000..181c19e7792 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TableViewSelection.qml @@ -0,0 +1,197 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 + +QtObject { + + property int count: 0 + signal selectionChanged + + property bool __dirty: false + property var __ranges: new Array() + + function forEach (callback) { + if (!(callback instanceof Function)) { + console.warn("TableViewSelection.forEach: argument is not a function") + return; + } + __forEach(callback, -1) + } + + function contains(index) { + for (var i = 0 ; i < __ranges.length ; ++i) { + if (__ranges[i][0] <= index && index <= __ranges[i][1]) + return true; + else if (__ranges[i][0] > index) + return false; + } + return false; + } + + function clear() { + __ranges = new Array() + __dirty = true + count = 0 + selectionChanged() + } + + function selectAll() { select(0, rowCount - 1) } + function select(first, last) { __select(true, first, last) } + function deselect(first, last) { __select(false, first, last) } + + // --- private section --- + + function __printRanges() { + var out = "" + for (var i = 0 ; i < __ranges.length ; ++ i) + out += ("{" + __ranges[i][0] + "," + __ranges[i][1] + "} ") + print(out) + } + + function __count() { + var sum = 0 + for (var i = 0 ; i < __ranges.length ; ++i) { + sum += (1 + __ranges[i][1] - __ranges[i][0]) + } + return sum + } + + function __forEach (callback, startIndex) { + __dirty = false + var i, j + + for (i = 0 ; i < __ranges.length && !__dirty ; ++i) { + for (j = __ranges[i][0] ; !__dirty && j <= __ranges[i][1] ; ++j) { + if (j >= startIndex) + callback.call(this, j) + } + } + + // Restart iteration at last index if selection changed + if (__dirty) + return __forEach(callback, j) + } + + function __selectOne(index) { + __ranges = [[index, index]] + __dirty = true + count = 1 + selectionChanged(); + } + + function __select(select, first, last) { + + var i, range + var start = first + var stop = first + var startRangeIndex = -1 + var stopRangeIndex = -1 + var newRangePos = 0 + + if (first < 0 || last < 0 || first >= rowCount || last >=rowCount) { + console.warn("TableViewSelection: index out of range") + return + } + + if (last !== undefined) { + start = first <= last ? first : last + stop = first <= last ? last : first + } + + if (select) { + + // Find beginning and end ranges + for (i = 0 ; i < __ranges.length; ++ i) { + range = __ranges[i] + if (range[0] > stop + 1) continue; // above range + if (range[1] < start - 1) { // below range + newRangePos = i + 1 + continue; + } + if (startRangeIndex == -1) + startRangeIndex = i + stopRangeIndex = i + } + + if (startRangeIndex !== -1) + start = Math.min(__ranges[startRangeIndex][0], start) + if (stopRangeIndex !== -1) + stop = Math.max(__ranges[stopRangeIndex][1], stop) + + if (startRangeIndex == -1) + startRangeIndex = newRangePos + + __ranges.splice(Math.max(0, startRangeIndex), + 1 + stopRangeIndex - startRangeIndex, [start, stop]) + + } else { + + // Find beginning and end ranges + for (i = 0 ; i < __ranges.length; ++ i) { + range = __ranges[i] + if (range[1] < start) continue; // below range + if (range[0] > stop) continue; // above range + if (startRangeIndex == -1) + startRangeIndex = i + stopRangeIndex = i + } + + // Slice ranges accordingly + if (startRangeIndex >= 0 && stopRangeIndex >= 0) { + var startRange = __ranges[startRangeIndex] + var stopRange = __ranges[stopRangeIndex] + var length = 1 + stopRangeIndex - startRangeIndex + if (start <= startRange[0] && stop >= stopRange[1]) { //remove + __ranges.splice(startRangeIndex, length) + } else if (start - 1 < startRange[0] && stop <= stopRange[1]) { //cut front + __ranges.splice(startRangeIndex, length, [stop + 1, stopRange[1]]) + } else if (start - 1 < startRange[1] && stop >= stopRange[1]) { // cut back + __ranges.splice(startRangeIndex, length, [startRange[0], start - 1]) + } else { //split + __ranges.splice(startRangeIndex, length, [startRange[0], start - 1], [stop + 1, stopRange[1]]) + } + } + } + __dirty = true + count = __count() // forces a re-evaluation of indexes in the delegates + selectionChanged() + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TextSingleton.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TextSingleton.qml new file mode 100644 index 00000000000..7a3f07cdd15 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/TextSingleton.qml @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +pragma Singleton +import QtQuick 2.1 +Text {} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/qmldir b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/qmldir new file mode 100644 index 00000000000..3513878067d --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/qmldir @@ -0,0 +1,22 @@ +module QtQuick.Controls.Private +AbstractCheckable 1.0 AbstractCheckable.qml +Control 1.0 Control.qml +FocusFrame 1.0 FocusFrame.qml +Margins 1.0 Margins.qml +BasicButton 1.0 BasicButton.qml +ScrollBar 1.0 ScrollBar.qml +ScrollViewHelper 1.0 ScrollViewHelper.qml +Style 1.0 Style.qml +TabBar 1.0 TabBar.qml +StackViewSlideDelegate 1.0 StackViewSlideDelegate.qml +StyleHelpers 1.0 style.js +JSArray 1.0 StackView.js +TableViewSelection 1.0 TableViewSelection.qml +FastGlow 1.0 FastGlow.qml +SourceProxy 1.0 SourceProxy.qml +GroupBoxStyle 1.0 ../Styles/Base/GroupBoxStyle.qml +ToolButtonStyle 1.0 ../Styles/Base/ToolButtonStyle.qml +MenuContentItem 1.0 MenuContentItem.qml +MenuContentScroller 1.0 MenuContentScroller.qml +ColumnMenuContent 1.0 ColumnMenuContent.qml +singleton TextSingleton 1.0 TextSingleton.qml diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/style.js b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/style.js new file mode 100644 index 00000000000..2c47ff0e72a --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/style.js @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +.pragma library + +function underlineAmpersands(match, p1, p2, p3) { + if (p2 === "&") + return p1.concat(p2, p3) + return p1.concat("", p2, "", p3) +} + +function removeAmpersands(match, p1, p2, p3) { + return p1.concat(p2, p3) +} + +function replaceAmpersands(text, replaceFunction) { + return text.replace(/([^&]*)&(.)([^&]*)/g, replaceFunction) +} + +function stylizeMnemonics(text) { + return replaceAmpersands(text, underlineAmpersands) +} + +function removeMnemonics(text) { + return replaceAmpersands(text, removeAmpersands) +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ProgressBar.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ProgressBar.qml new file mode 100644 index 00000000000..523f3978e0b --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ProgressBar.qml @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ProgressBar + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief A progress indicator. + + The ProgressBar is used to give an indication of the progress of an operation. + \l value is updated regularly and must be between \l minimumValue and \l maximumValue. + + You can create a custom appearance for a ProgressBar by + assigning a \l {QtQuick.Controls.Styles::ProgressBarStyle}{ProgressBarStyle}. +*/ + +Control { + id: progressbar + + /*! This property holds the progress bar's current value. + Attempting to change the current value to one outside the minimum-maximum + range has no effect on the current value. + + The default value is \c{0}. + */ + property real value: 0 + + /*! This property is the progress bar's minimum value. + The \l value is clamped to this value. + The default value is \c{0}. + */ + property real minimumValue: 0 + + /*! This property is the progress bar's maximum value. + The \l value is clamped to this value. + If maximumValue is smaller than \l minimumValue, \l minimumValue will be enforced. + The default value is \c{1}. + */ + property real maximumValue: 1 + + /*! This property toggles indeterminate mode. + When the actual progress is unknown, use this option. + The progress bar will be animated as a busy indicator instead. + The default value is \c false. + */ + property bool indeterminate: false + + /*! \qmlproperty enumeration orientation + + This property holds the orientation of the progress bar. + + \list + \li Qt.Horizontal - Horizontal orientation. (Default) + \li Qt.Vertical - Vertical orientation. + \endlist + */ + property int orientation: Qt.Horizontal + + /*! \qmlproperty bool ProgressBar::hovered + + This property indicates whether the control is being hovered. + */ + readonly property alias hovered: hoverArea.containsMouse + + /*! \internal */ + style: Qt.createComponent(Settings.style + "/ProgressBarStyle.qml", progressbar) + + /*! \internal */ + property bool __initialized: false + /*! \internal */ + onMaximumValueChanged: setValue(value) + /*! \internal */ + onMinimumValueChanged: setValue(value) + /*! \internal */ + onValueChanged: if (__initialized) setValue(value) + /*! \internal */ + Component.onCompleted: { + __initialized = true; + setValue(value) + } + + activeFocusOnTab: false + + Accessible.role: Accessible.ProgressBar + Accessible.name: value + + implicitWidth:(__panel ? __panel.implicitWidth : 0) + implicitHeight: (__panel ? __panel.implicitHeight: 0) + + MouseArea { + id: hoverArea + anchors.fill: parent + hoverEnabled: true + } + + /*! \internal */ + function setValue(v) { + var newval = parseFloat(v) + if (!isNaN(newval)) { + // we give minimumValue priority over maximum if they are inconsistent + if (newval > maximumValue) { + if (maximumValue >= minimumValue) + newval = maximumValue; + else + newval = minimumValue + } else if (v < minimumValue) { + newval = minimumValue + } + if (value !== newval) + value = newval + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/RadioButton.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/RadioButton.qml new file mode 100644 index 00000000000..5ab7f68cb9a --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/RadioButton.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype RadioButton + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief A radio button with a text label. + + A RadioButton is an option button that can be switched on (checked) or off + (unchecked). Radio buttons typically present the user with a "one of many" + choice. In a group of radio buttons, only one radio button at a time can be + checked; if the user selects another button, the previously selected button + is switched off. + + \qml + GroupBox { + title: qsTr("Search") + Column { + ExclusiveGroup { id: group } + RadioButton { + text: qsTr("From top") + exclusiveGroup: group + checked: true + } + RadioButton { + text: qsTr("From cursor") + exclusiveGroup: group + } + } + } + \endqml + + You can create a custom appearance for a RadioButton by + assigning a \l {QtQuick.Controls.Styles::RadioButtonStyle}{RadioButtonStyle}. +*/ + +AbstractCheckable { + id: radioButton + + activeFocusOnTab: true + + Accessible.role: Accessible.RadioButton + + /*! + The style that should be applied to the radio button. Custom style + components can be created with: + + \codeline Qt.createComponent("path/to/style.qml", radioButtonId); + */ + style: Qt.createComponent(Settings.style + "/RadioButtonStyle.qml", radioButton) + + __cycleStatesHandler: function() { checked = !checked; } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ScrollView.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ScrollView.qml new file mode 100644 index 00000000000..6f1187ea50f --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ScrollView.qml @@ -0,0 +1,318 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.1 + +/*! + \qmltype ScrollView + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup views + \brief Provides a scrolling view within another Item. + + A ScrollView can be used either to replace a \l Flickable or decorate an + existing \l Flickable. Depending on the platform, it will add scroll bars and + a content frame. + + Only one Item can be a direct child of the ScrollView and the child is implicitly anchored + to fill the scroll view. + + Example: + \code + ScrollView { + Image { imageSource: "largeImage.png" } + } + \endcode + + In the previous example the Image item will implicitly get scroll behavior as if it was + used within a \l Flickable. The width and height of the child item will be used to + define the size of the content area. + + Example: + \code + ScrollView { + ListView { + ... + } + } + \endcode + + In this case the content size of the ScrollView will simply mirror that of its contained + \l flickableItem. + + You can create a custom appearance for a ScrollView by + assigning a \l {QtQuick.Controls.Styles::ScrollViewStyle}{ScrollViewStyle}. +*/ + +FocusScope { + id: root + + implicitWidth: 240 + implicitHeight: 150 + + /*! + This property tells the ScrollView if it should render + a frame around its content. + + The default value is \c false. + */ + property bool frameVisible: false + + /*! + This property controls if there should be a highlight + around the frame when the ScrollView has input focus. + + The default value is \c false. + + \note This property is only applicable on some platforms, such + as Mac OS. + */ + property bool highlightOnFocus: false + + /*! + \qmlproperty Item ScrollView::viewport + + The viewport determines the current "window" on the contentItem. + In other words, it clips it and the size of the viewport tells you + how much of the content area is visible. + */ + property alias viewport: viewportItem + + /*! + \qmlproperty Item ScrollView::flickableItem + + The flickableItem of the ScrollView. If the contentItem provided + to the ScrollView is a Flickable, it will be the \l contentItem. + */ + readonly property alias flickableItem: internal.flickableItem + + /*! + The contentItem of the ScrollView. This is set by the user. + + Note that the definition of contentItem is somewhat different to that + of a Flickable, where the contentItem is implicitly created. + */ + default property Item contentItem + + /*! \internal */ + property Item __scroller: scroller + /*! \internal */ + property alias __wheelAreaScrollSpeed: wheelArea.scrollSpeed + /*! \internal */ + property int __scrollBarTopMargin: 0 + /*! \internal */ + property int __viewTopMargin: 0 + /*! \internal */ + property alias __horizontalScrollBar: scroller.horizontalScrollBar + /*! \internal */ + property alias __verticalScrollBar: scroller.verticalScrollBar + /*! \qmlproperty Component ScrollView::style + + The style Component for this control. + \sa {Qt Quick Controls Styles QML Types} + + */ + property Component style: Qt.createComponent(Settings.style + "/ScrollViewStyle.qml", root) + + /*! \internal */ + property Style __style: styleLoader.item + + activeFocusOnTab: true + + onContentItemChanged: { + + if (contentItem.hasOwnProperty("contentY") && // Check if flickable + contentItem.hasOwnProperty("contentHeight")) { + internal.flickableItem = contentItem // "Use content if it is a flickable + internal.flickableItem.parent = viewportItem + } else { + internal.flickableItem = flickableComponent.createObject(viewportItem) + contentItem.parent = internal.flickableItem.contentItem + } + internal.flickableItem.anchors.fill = viewportItem + if (!Settings.hasTouchScreen) + internal.flickableItem.interactive = false + } + + + children: Item { + id: internal + + property Flickable flickableItem + + Loader { + id: styleLoader + sourceComponent: style + onStatusChanged: { + if (status === Loader.Error) + console.error("Failed to load Style for", root) + } + property alias __control: root + } + + Binding { + target: flickableItem + property: "contentHeight" + when: contentItem !== flickableItem + value: contentItem ? contentItem.height : 0 + } + + Binding { + target: flickableItem + when: contentItem !== flickableItem + property: "contentWidth" + value: contentItem ? contentItem.width : 0 + } + + Connections { + target: flickableItem + + onContentYChanged: { + scroller.blockUpdates = true + scroller.verticalScrollBar.value = flickableItem.contentY + scroller.blockUpdates = false + } + + onContentXChanged: { + scroller.blockUpdates = true + scroller.horizontalScrollBar.value = flickableItem.contentX + scroller.blockUpdates = false + } + + } + + anchors.fill: parent + + Component { + id: flickableComponent + Flickable {} + } + + WheelArea { + id: wheelArea + parent: flickableItem + + // ### Note this is needed due to broken mousewheel behavior in Flickable. + + anchors.fill: parent + + property int acceleration: 40 + property int flickThreshold: 20 + property real speedThreshold: 3 + property real ignored: 0.001 // ## flick() does not work with 0 yVelocity + property int maxFlick: 400 + + property bool horizontalRecursionGuard: false + property bool verticalRecursionGuard: false + + horizontalMinimumValue: flickableItem ? flickableItem.originX : 0 + horizontalMaximumValue: flickableItem ? flickableItem.originX + flickableItem.contentWidth - viewport.width : 0 + + verticalMinimumValue: flickableItem ? flickableItem.originY : 0 + verticalMaximumValue: flickableItem ? flickableItem.originY + flickableItem.contentHeight - viewport.height + __viewTopMargin : 0 + + Connections { + target: flickableItem + + onContentYChanged: { + wheelArea.verticalRecursionGuard = true + wheelArea.verticalValue = flickableItem.contentY + wheelArea.verticalRecursionGuard = false + } + onContentXChanged: { + wheelArea.horizontalRecursionGuard = true + wheelArea.horizontalValue = flickableItem.contentX + wheelArea.horizontalRecursionGuard = false + } + } + + onVerticalValueChanged: { + if (!verticalRecursionGuard) { + if (flickableItem.contentY < flickThreshold && verticalDelta > speedThreshold) { + flickableItem.flick(ignored, Math.min(maxFlick, acceleration * verticalDelta)) + } else if (flickableItem.contentY > flickableItem.contentHeight + - flickThreshold - viewport.height && verticalDelta < -speedThreshold) { + flickableItem.flick(ignored, Math.max(-maxFlick, acceleration * verticalDelta)) + } else { + flickableItem.contentY = verticalValue + } + } + } + + onHorizontalValueChanged: { + if (!horizontalRecursionGuard) + flickableItem.contentX = horizontalValue + } + } + + ScrollViewHelper { + id: scroller + anchors.fill: parent + active: wheelArea.active + property bool outerFrame: !frameVisible || !(__style ? __style.__externalScrollBars : 0) + property int scrollBarSpacing: outerFrame ? 0 : (__style ? __style.__scrollBarSpacing : 0) + property int verticalScrollbarOffset: verticalScrollBar.visible && !verticalScrollBar.isTransient ? + verticalScrollBar.width + scrollBarSpacing : 0 + property int horizontalScrollbarOffset: horizontalScrollBar.visible && !horizontalScrollBar.isTransient ? + horizontalScrollBar.height + scrollBarSpacing : 0 + Loader { + id: frameLoader + sourceComponent: __style ? __style.frame : null + anchors.fill: parent + anchors.rightMargin: scroller.outerFrame ? 0 : scroller.verticalScrollbarOffset + anchors.bottomMargin: scroller.outerFrame ? 0 : scroller.horizontalScrollbarOffset + } + + Item { + id: viewportItem + anchors.fill: frameLoader + anchors.topMargin: frameVisible ? __style.padding.top : 0 + anchors.leftMargin: frameVisible ? __style.padding.left : 0 + anchors.rightMargin: (frameVisible ? __style.padding.right : 0) + (scroller.outerFrame ? scroller.verticalScrollbarOffset : 0) + anchors.bottomMargin: (frameVisible ? __style.padding.bottom : 0) + (scroller.outerFrame ? scroller.horizontalScrollbarOffset : 0) + clip: true + } + } + FocusFrame { visible: highlightOnFocus && root.activeFocus } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Slider.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Slider.qml new file mode 100644 index 00000000000..d87bb526ae4 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Slider.qml @@ -0,0 +1,299 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype Slider + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief Provides a vertical or horizontal slider control. + + The slider is the classic control for providing a bounded value. It lets + the user move a slider handle along a horizontal or vertical groove + and translates the handle's position into a value within the legal range. + + \code + Slider { + onValueChanged: print(value) + } + \endcode + + The Slider value is by default in the range [0, 1]. If integer values are + needed, you can set the \l stepSize. + + You can create a custom appearance for a Slider by + assigning a \l {QtQuick.Controls.Styles::SliderStyle}{SliderStyle}. +*/ + +Control { + id: slider + + /*! + \qmlproperty enumeration Slider::orientation + + This property holds the layout orientation of the slider. + The default value is \c Qt.Horizontal. + */ + property int orientation: Qt.Horizontal + + /*! + \qmlproperty real Slider::minimumValue + + This property holds the minimum value of the Slider. + The default value is \c{0.0}. + */ + property alias minimumValue: range.minimumValue + + /*! + \qmlproperty real Slider::maximumValue + + This property holds the maximum value of the Slider + The default value is \c{1.0}. + */ + property alias maximumValue: range.maximumValue + + /*! + \qmlproperty bool Slider::updateValueWhileDragging + + This property indicates whether the current \l value should be updated while + the user is moving the slider handle, or only when the button has been released. + This property could for instance be modified if changing the slider value would turn + out to be too time consuming. + + The default value is \c true. + */ + property bool updateValueWhileDragging: true + + /*! + \qmlproperty bool Slider::pressed + + This property indicates whether the slider handle is being pressed. + */ + readonly property alias pressed: mouseArea.pressed + + /*! + \qmlproperty bool Slider::hovered + + This property indicates whether the control is being hovered. + */ + readonly property alias hovered: mouseArea.containsMouse + + /*! + \qmlproperty real Slider::stepSize + + This property indicates the slider step size. + + A value of 0 indicates that the value of the slider operates in a + continuous range between \l minimumValue and \l maximumValue. + + Any non 0 value indicates a discrete stepSize. The following example + will generate a slider with integer values in the range [0-5]. + + \qml + Slider { + maximumValue: 5.0 + stepSize: 1.0 + } + \endqml + + The default value is \c{0.0}. + */ + property alias stepSize: range.stepSize + + /*! + \qmlproperty real Slider::value + + This property holds the current value of the Slider. + The default value is \c{0.0}. + */ + property alias value: range.value + + /*! + \qmlproperty bool Slider::activeFocusOnPress + + This property indicates whether the Slider should receive active focus when + pressed. + */ + property bool activeFocusOnPress: false + + /*! + \qmlproperty bool Slider::tickmarksEnabled + + This property indicates whether the Slider should display tickmarks + at step intervals. Tick mark spacing is calculated based on the + \l stepSize property. + + The default value is \c false. + */ + property bool tickmarksEnabled: false + + /*! \internal */ + property bool __horizontal: orientation === Qt.Horizontal + + /*! \internal */ + property real __handlePos: range.valueForPosition(__horizontal ? fakeHandle.x : fakeHandle.y) + + activeFocusOnTab: true + + Accessible.role: Accessible.Slider + Accessible.name: value + + style: Qt.createComponent(Settings.style + "/SliderStyle.qml", slider) + + Keys.onRightPressed: value += (maximumValue - minimumValue)/10.0 + Keys.onLeftPressed: value -= (maximumValue - minimumValue)/10.0 + + RangeModel { + id: range + minimumValue: 0.0 + maximumValue: 1.0 + value: 0 + stepSize: 0.0 + inverted: __horizontal ? false : true + + positionAtMinimum: 0 + positionAtMaximum: __horizontal ? slider.width - fakeHandle.width : slider.height - fakeHandle.height + } + + Item { + id: fakeHandle + anchors.verticalCenter: __horizontal ? parent.verticalCenter : undefined + anchors.horizontalCenter: !__horizontal ? parent.horizontalCenter : undefined + width: __panel.handleWidth + height: __panel.handleHeight + + function updatePos() { + if (updateValueWhileDragging && !mouseArea.drag.active) + range.position = __horizontal ? x : y + } + + onXChanged: updatePos(); + onYChanged: updatePos(); + } + + MouseArea { + id: mouseArea + + hoverEnabled: true + anchors.centerIn: parent + + preventStealing: true + + width: parent.width + height: parent.height + + property int clickOffset: 0 + + function clamp ( val ) { + return Math.max(range.positionAtMinimum, Math.min(range.positionAtMaximum, val)) + } + + onMouseXChanged: { + if (pressed && __horizontal) { + var pos = clamp (mouse.x + clickOffset - fakeHandle.width/2) + fakeHandle.x = pos + } + } + + onMouseYChanged: { + if (pressed && !__horizontal) { + var pos = clamp (mouse.y + clickOffset- fakeHandle.height/2) + fakeHandle.y = pos + } + } + + onPressed: { + if (slider.activeFocusOnPress) + slider.forceActiveFocus(); + + var point = mouseArea.mapToItem(fakeHandle, mouse.x, mouse.y) + if (fakeHandle.contains(Qt.point(point.x, point.y))) { + clickOffset = __horizontal ? fakeHandle.width/2 - point.x : fakeHandle.height/2 - point.y + } + } + + onReleased: { + // If we don't update while dragging, this is the only + // moment that the range is updated. + if (!slider.updateValueWhileDragging) + range.position = __horizontal ? fakeHandle.x : fakeHandle.y; + clickOffset = 0 + } + } + + + // During the drag, we simply ignore the position set from the range, this + // means that setting a value while dragging will not "interrupt" the + // dragging activity. + Binding { + when: !mouseArea.drag.active + target: fakeHandle + property: __horizontal ? "x" : "y" + value: range.position + } + + WheelArea { + id: wheelarea + anchors.fill: parent + horizontalMinimumValue: slider.minimumValue + horizontalMaximumValue: slider.maximumValue + verticalMinimumValue: slider.minimumValue + verticalMaximumValue: slider.maximumValue + property real step: (slider.maximumValue - slider.minimumValue)/(range.positionAtMaximum - range.positionAtMinimum) + + onVerticalWheelMoved: { + if (verticalDelta !== 0) { + var delta = Math.abs(verticalDelta)*step > stepSize ? verticalDelta*step : verticalDelta/Math.abs(verticalDelta)*stepSize + value += delta + } + } + + onHorizontalWheelMoved: { + if (horizontalDelta !== 0) { + var delta = Math.abs(horizontalDelta)*step > stepSize ? horizontalDelta*step : horizontalDelta/Math.abs(horizontalDelta)*stepSize + value += delta + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/SpinBox.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/SpinBox.qml new file mode 100644 index 00000000000..c756566deca --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/SpinBox.qml @@ -0,0 +1,339 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.2 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype SpinBox + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief Provides a spin box control. + + SpinBox allows the user to choose a value by clicking the up or down buttons, or by + pressing up or down on the keyboard. The user can also type the value in manually. + + By default the SpinBox provides discrete values in the range [0-99] with a \l stepSize of 1 and 0 \l decimals. + + \code + SpinBox { + id: spinbox + } + \endcode + + Note that if you require decimal values you will need to set the \l decimals to a non 0 value. + + \code + SpinBox { + id: spinbox + decimals: 2 + } + \endcode + +*/ + +Control { + id: spinbox + + /*! + \qmlproperty real SpinBox::value + + The value of this SpinBox, clamped to \l minimumValue and \l maximumValue. + + The default value is \c{0.0}. + */ + property alias value: validator.value + + /*! + \qmlproperty real SpinBox::minimumValue + + The minimum value of the SpinBox range. + The \l value is clamped to this value. + + The default value is \c{0.0}. + */ + property alias minimumValue: validator.minimumValue + + /*! + \qmlproperty real SpinBox::maximumValue + + The maximum value of the SpinBox range. + The \l value is clamped to this value. If maximumValue is smaller than + \l minimumValue, \l minimumValue will be enforced. + + The default value is \c{99}. + */ + property alias maximumValue: validator.maximumValue + + /*! \qmlproperty real SpinBox::stepSize + The amount by which the \l value is incremented/decremented when a + spin button is pressed. + + The default value is \c{1.0}. + */ + property alias stepSize: validator.stepSize + + /*! \qmlproperty string SpinBox::suffix + The suffix for the value. I.e "cm" */ + property alias suffix: validator.suffix + + /*! \qmlproperty string SpinBox::prefix + The prefix for the value. I.e "$" */ + property alias prefix: validator.prefix + + /*! \qmlproperty int SpinBox::decimals + This property indicates the amount of decimals. + Note that if you enter more decimals than specified, they will + be truncated to the specified amount of decimal places. + The default value is \c{0}. + */ + property alias decimals: validator.decimals + + /*! \qmlproperty font SpinBox::font + + This property indicates the current font used by the SpinBox. + */ + property alias font: input.font + + /*! This property indicates whether the Spinbox should get active + focus when pressed. + The default value is \c true. + */ + property bool activeFocusOnPress: true + + /*! \qmlproperty enumeration horizontalAlignment + \since 5.2 + + This property indicates how the content is horizontally aligned + within the text field. + + The supported values are: + \list + \li Qt.AlignLeft + \li Qt.AlignHCenter + \li Qt.AlignRight + \endlist + + The default value is style dependent. + */ + property int horizontalAlignment: __panel ? __panel.horizontalAlignment : Qt.AlignLeft + + /*! + \qmlproperty bool SpinBox::hovered + + This property indicates whether the control is being hovered. + */ + readonly property alias hovered: mouseArea.containsMouse + + /*! + \qmlsignal SpinBox::editingFinished() + \since 5.2 + + This signal is emitted when the Return or Enter key is pressed or + the control loses focus. Note that if there is a validator + set on the control and enter/return is pressed, this signal will + only be emitted if the validator returns an acceptable state. + */ + signal editingFinished() + + style: Qt.createComponent(Settings.style + "/SpinBoxStyle.qml", spinbox) + + /*! \internal */ + function __increment() { + validator.increment() + input.selectValue() + } + + /*! \internal */ + function __decrement() { + validator.decrement() + input.selectValue() + } + + /*! \internal */ + property alias __text: input.text + + __styleData: QtObject { + readonly property bool upEnabled: value != maximumValue; + readonly property alias upHovered: mouseUp.containsMouse + readonly property alias upPressed: mouseUp.pressed + + readonly property bool downEnabled: value != minimumValue; + readonly property alias downPressed: mouseDown.pressed + readonly property alias downHovered: mouseDown.containsMouse + + readonly property int contentHeight: Math.max(input.implicitHeight, 16) + readonly property int contentWidth: Math.max(maxSizeHint.implicitWidth, minSizeHint.implicitWidth) + } + + Text { + id: maxSizeHint + text: prefix + maximumValue.toFixed(decimals) + suffix + font: input.font + visible: false + } + + Text { + id: minSizeHint + text: prefix + minimumValue.toFixed(decimals) + suffix + font: input.font + visible: false + } + + activeFocusOnTab: true + + onActiveFocusChanged: if (activeFocus) input.selectValue() + + Accessible.name: input.text + Accessible.role: Accessible.SpinBox + + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + onPressed: if (activeFocusOnPress) input.forceActiveFocus() + onWheel: { + if (wheel.angleDelta.y > 0) + __increment(); + else + __decrement(); + } + } + + TextInput { + id: input + clip: contentWidth > width + anchors.fill: parent + anchors.leftMargin: __style ? __style.padding.left : 0 + anchors.topMargin: __style ? __style.padding.top : 0 + anchors.rightMargin: __style ? __style.padding.right: 0 + anchors.bottomMargin: __style ? __style.padding.bottom: 0 + + focus: true + activeFocusOnPress: spinbox.activeFocusOnPress + + horizontalAlignment: spinbox.horizontalAlignment + verticalAlignment: __panel ? __panel.verticalAlignment : Qt.AlignVCenter + selectByMouse: true + + validator: SpinBoxValidator { + id: validator + property bool ready: false // Delay validation until all properties are ready + onTextChanged: if (ready) input.text = validator.text + Component.onCompleted: {input.text = validator.text ; ready = true} + } + onAccepted: { + input.text = validator.text + selectValue() + } + + onEditingFinished: spinbox.editingFinished() + + color: __panel ? __panel.foregroundColor : "black" + selectionColor: __panel ? __panel.selectionColor : "black" + selectedTextColor: __panel ? __panel.selectedTextColor : "black" + + opacity: parent.enabled ? 1 : 0.5 + renderType: __style ? __style.renderType : Text.NativeRendering + + function selectValue() { + select(prefix.length, text.length - suffix.length) + } + } + + // Spinbox increment button + + MouseArea { + id: mouseUp + objectName: "mouseUp" + hoverEnabled: true + + property var upRect: __panel ? __panel.upRect : null + + anchors.left: parent.left + anchors.top: parent.top + + anchors.leftMargin: upRect ? upRect.x : 0 + anchors.topMargin: upRect ? upRect.y : 0 + + width: upRect ? upRect.width : 0 + height: upRect ? upRect.height : 0 + + onClicked: __increment() + onPressed: if (activeFocusOnPress) input.forceActiveFocus() + + property bool autoincrement: false; + onReleased: autoincrement = false + Timer { running: mouseUp.pressed; interval: 350 ; onTriggered: mouseUp.autoincrement = true } + Timer { running: mouseUp.autoincrement; interval: 60 ; repeat: true ; onTriggered: __increment() } + } + + // Spinbox decrement button + + MouseArea { + id: mouseDown + objectName: "mouseDown" + hoverEnabled: true + + onClicked: __decrement() + onPressed: if (activeFocusOnPress) input.forceActiveFocus() + + property var downRect: __panel ? __panel.downRect : null + + anchors.left: parent.left + anchors.top: parent.top + + anchors.leftMargin: downRect ? downRect.x : 0 + anchors.topMargin: downRect ? downRect.y : 0 + + width: downRect ? downRect.width : 0 + height: downRect ? downRect.height : 0 + + property bool autoincrement: false; + onReleased: autoincrement = false + Timer { running: mouseDown.pressed; interval: 350 ; onTriggered: mouseDown.autoincrement = true } + Timer { running: mouseDown.autoincrement; interval: 60 ; repeat: true ; onTriggered: __decrement() } + } + + Keys.onUpPressed: __increment() + Keys.onDownPressed: __decrement() +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/SplitView.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/SplitView.qml new file mode 100644 index 00000000000..1f829a34689 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/SplitView.qml @@ -0,0 +1,504 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Layouts 1.0 +import QtQuick.Controls.Private 1.0 as Private + +/*! + \qmltype SplitView + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup views + \brief Lays out items with a draggable splitter between each item. + + SplitView is a control that lays out items horizontally or + vertically with a draggable splitter between each item. + + There will always be one (and only one) item in the SplitView that has \l{Layout::fillWidth}{Layout.fillWidth} + set to \c true (or \l{Layout::fillHeight}{Layout.fillHeight}, if orientation is Qt.Vertical). This means that the + item will get all leftover space when other items have been laid out. + By default, the last visible child of the SplitView will have this set, but + it can be changed by explicitly setting fillWidth to \c true on another item. + As the fillWidth item will automatically be resized to fit the extra space, explicit assignments + to width and height will be ignored (but \l{Layout::minimumWidth}{Layout.minimumWidth} and + \l{Layout::maximumWidth}{Layout.maximumWidth} will still be respected). + + A handle can belong to the item either on the left or top side, or on the right or bottom side: + \list + \li If the fillWidth item is to the right: the handle belongs to the left item. + \li if the fillWidth item is on the left: the handle belongs to the right item. + \endlist + + This will again control which item gets resized when the user drags a handle, + and which handle gets hidden when an item is told to hide. + + SplitView supports setting attached Layout properties on child items, which + means that you can set the following attached properties for each child: + \list + \li \l{Layout::minimumWidth}{Layout.minimumWidth} + \li \l{Layout::minimumHeight}{Layout.minimumHeight} + \li \l{Layout::maximumWidth}{Layout.maximumWidth} + \li \l{Layout::maximumHeight}{Layout.maximumHeight} + \li \l{Layout::fillWidth}{Layout.fillWidth} (\c true for only one child) + \li \l{Layout::fillHeight}{Layout.fillHeight} (\c true for only one child) + \endlist + + \note Please import QtQuick.Layout 1.0 in your QML file in order to use the Layout + attached properties inside SplitView. + + Example: + + To create a SplitView with three items, and let the center item get superfluous space, one + could do the following: + + \qml + SplitView { + anchors.fill: parent + orientation: Qt.Horizontal + + Rectangle { + width: 200 + Layout.maximumWidth: 400 + color: "gray" + } + Rectangle { + id: centerItem + Layout.minimumWidth: 50 + Layout.fillWidth: true + color: "darkgray" + } + Rectangle { + width: 200 + color: "gray" + } + } + \endqml +*/ + +Item { + id: root + + /*! + \qmlproperty enumeration SplitView::orientation + + This property holds the orientation of the SplitView. + The value can be either \c Qt.Horizontal or \c Qt.Vertical. + The default value is \c Qt.Horizontal. + */ + property int orientation: Qt.Horizontal + + /*! + This property holds the delegate that will be instantiated between each + child item. Inside the delegate the following properties are available: + + \table + \row \li readonly property bool styleData.index \li Specifies the index of the splitter handle. The handle + between the first and the second item will get index 0, + the next handle index 1 etc. + \row \li readonly property bool styleData.hovered \li The handle is being hovered. + \row \li readonly property bool styleData.pressed \li The handle is being pressed. + \row \li readonly property bool styleData.resizing \li The handle is being dragged. + \endtable + +*/ + property Component handleDelegate: Rectangle { + width: 1 + height: 1 + color: Qt.darker(pal.window, 1.5) + } + + /*! + This propery is \c true when the user is resizing any of the items by + dragging on the splitter handles. + */ + property bool resizing: false + + /*! \internal */ + default property alias __contents: contents.data + /*! \internal */ + property alias __items: splitterItems.children + /*! \internal */ + property alias __handles: splitterHandles.children + + clip: true + Component.onCompleted: d.init() + onWidthChanged: d.updateLayout() + onHeightChanged: d.updateLayout() + onOrientationChanged: d.changeOrientation() + + SystemPalette { id: pal } + + QtObject { + id: d + property bool horizontal: orientation == Qt.Horizontal + readonly property string minimum: horizontal ? "minimumWidth" : "minimumHeight" + readonly property string maximum: horizontal ? "maximumWidth" : "maximumHeight" + readonly property string otherMinimum: horizontal ? "minimumHeight" : "minimumWidth" + readonly property string otherMaximum: horizontal ? "maximumHeight" : "maximumWidth" + readonly property string offset: horizontal ? "x" : "y" + readonly property string otherOffset: horizontal ? "y" : "x" + readonly property string size: horizontal ? "width" : "height" + readonly property string otherSize: horizontal ? "height" : "width" + readonly property string implicitSize: horizontal ? "implicitWidth" : "implicitHeight" + readonly property string implicitOtherSize: horizontal ? "implicitHeight" : "implicitWidth" + + property int fillIndex: -1 + property bool updateLayoutGuard: true + + function init() + { + for (var i=0; i<__contents.length; ++i) { + var item = __contents[i]; + if (!item.hasOwnProperty("x")) + continue + + if (splitterItems.children.length > 0) + handleLoader.createObject(splitterHandles, {"__handleIndex":splitterItems.children.length - 1}) + item.parent = splitterItems + i-- // item was removed from list + + // should match disconnections in Component.onDestruction + item.widthChanged.connect(d.updateLayout) + item.heightChanged.connect(d.updateLayout) + item.Layout.maximumWidthChanged.connect(d.updateLayout) + item.Layout.minimumWidthChanged.connect(d.updateLayout) + item.Layout.maximumHeightChanged.connect(d.updateLayout) + item.Layout.minimumHeightChanged.connect(d.updateLayout) + item.visibleChanged.connect(d.updateFillIndex) + item.Layout.fillWidthChanged.connect(d.updateFillIndex) + item.Layout.fillHeightChanged.connect(d.updateFillIndex) + } + + d.calculateImplicitSize() + d.updateLayoutGuard = false + d.updateFillIndex() + } + + function updateFillIndex() + { + if (lastItem.visible !== root.visible) + return + var policy = (root.orientation === Qt.Horizontal) ? "fillWidth" : "fillHeight" + for (var i=0; i<__items.length-1; ++i) { + if (__items[i].Layout[policy] === true) + break; + } + + d.fillIndex = i + d.updateLayout() + } + + function changeOrientation() + { + if (__items.length == 0) + return; + d.updateLayoutGuard = true + + // Swap width/height for items and handles: + for (var i=0; i<__items.length; ++i) { + var item = __items[i] + var tmp = item.x + item.x = item.y + item.y = tmp + tmp = item.width + item.width = item.height + item.height = tmp + + var handle = __handles[i] + if (handle) { + tmp = handle.x + handle.x = handle.y + handle.y = handle.x + tmp = handle.width + handle.width = handle.height + handle.height = tmp + } + } + + // Change d.horizontal explicit, since the binding will change too late: + d.horizontal = orientation == Qt.Horizontal + d.updateLayoutGuard = false + d.updateFillIndex() + } + + function calculateImplicitSize() + { + var implicitSize = 0 + var implicitOtherSize = 0 + + for (var i=0; i<__items.length; ++i) { + var item = __items[i]; + implicitSize += clampedMinMax(item[d.size], item.Layout[minimum], item.Layout[maximum]) + var os = clampedMinMax(item[otherSize], item.Layout[otherMinimum], item.Layout[otherMaximum]) + implicitOtherSize = Math.max(implicitOtherSize, os) + + var handle = __handles[i] + if (handle) + implicitSize += handle[d.size] + } + + root[d.implicitSize] = implicitSize + root[d.implicitOtherSize] = implicitOtherSize + } + + function clampedMinMax(value, minimum, maximum) + { + if (value < minimum) + value = minimum + if (value > maximum) + value = maximum + return value + } + + function accumulatedSize(firstIndex, lastIndex, includeFillItemMinimum) + { + // Go through items and handles, and + // calculate their acummulated width. + var w = 0 + for (var i=firstIndex; i __handleIndex) + visible: __items[__handleIndex + (resizeLeftItem ? 0 : 1)].visible + sourceComponent: handleDelegate + onWidthChanged: d.updateLayout() + onHeightChanged: d.updateLayout() + onXChanged: moveHandle() + onYChanged: moveHandle() + + MouseArea { + id: mouseArea + anchors.fill: parent + anchors.leftMargin: (parent.width <= 1) ? -2 : 0 + anchors.rightMargin: (parent.width <= 1) ? -2 : 0 + anchors.topMargin: (parent.height <= 1) ? -2 : 0 + anchors.bottomMargin: (parent.height <= 1) ? -2 : 0 + hoverEnabled: true + drag.threshold: 0 + drag.target: parent + drag.axis: root.orientation === Qt.Horizontal ? Drag.XAxis : Drag.YAxis + cursorShape: root.orientation === Qt.Horizontal ? Qt.SplitHCursor : Qt.SplitVCursor + } + + function moveHandle() { + // Moving the handle means resizing an item. Which one, + // left or right, depends on where the fillItem is. + // 'updateLayout' will be overridden in case new width violates max/min. + // 'updateLayout' will be triggered when an item changes width. + if (d.updateLayoutGuard) + return + + var leftHandle, leftItem, rightItem, rightHandle + var leftEdge, rightEdge, newWidth, leftStopX, rightStopX + var i + + if (resizeLeftItem) { + // Ensure that the handle is not crossing other handles. So + // find the first visible handle to the left to determine the left edge: + leftEdge = 0 + for (i=__handleIndex-1; i>=0; --i) { + leftHandle = __handles[i] + if (leftHandle.visible) { + leftEdge = leftHandle[d.offset] + leftHandle[d.size] + break; + } + } + + // Ensure: leftStopX >= itemHandle[d.offset] >= rightStopX + var min = d.accumulatedSize(__handleIndex+1, __items.length, true) + rightStopX = root[d.size] - min - itemHandle[d.size] + leftStopX = Math.max(leftEdge, itemHandle[d.offset]) + itemHandle[d.offset] = Math.min(rightStopX, Math.max(leftStopX, itemHandle[d.offset])) + + newWidth = itemHandle[d.offset] - leftEdge + leftItem = __items[__handleIndex] + // The next line will trigger 'updateLayout': + leftItem[d.size] = newWidth + } else { + // Resize item to the right. + // Ensure that the handle is not crossing other handles. So + // find the first visible handle to the right to determine the right edge: + rightEdge = root[d.size] + for (i=__handleIndex+1; i<__handles.length; ++i) { + rightHandle = __handles[i] + if (rightHandle.visible) { + rightEdge = rightHandle[d.offset] + break; + } + } + + // Ensure: leftStopX <= itemHandle[d.offset] <= rightStopX + min = d.accumulatedSize(0, __handleIndex+1, true) + leftStopX = min - itemHandle[d.size] + rightStopX = Math.min((rightEdge - itemHandle[d.size]), itemHandle[d.offset]) + itemHandle[d.offset] = Math.max(leftStopX, Math.min(itemHandle[d.offset], rightStopX)) + + newWidth = rightEdge - (itemHandle[d.offset] + itemHandle[d.size]) + rightItem = __items[__handleIndex+1] + // The next line will trigger 'updateLayout': + rightItem[d.size] = newWidth + } + } + } + } + + Item { + id: contents + visible: false + anchors.fill: parent + } + Item { + id: splitterItems + anchors.fill: parent + } + Item { + id: splitterHandles + anchors.fill: parent + } + + Item { + id: lastItem + onVisibleChanged: d.updateFillIndex() + } + + Component.onDestruction: { + for (var i=0; i [A, B, C, D] - "push" transition animation between C and D + \li pop() => [A, B] - "pop" transition animation between C and B + \li \l{push()}{push(D, replace)} => [A, B, D] - "replace" transition between C and D + \li \l{pop()}{pop(A)} => [A] - "pop" transition between C and A + \endlist + + \note Note that when the stack is empty, a push() will not perform a + transition animation because there is nothing to transition from (typically during + application start-up). A pop() on a stack with depth 1 or 0 is a no-operation. + If removing all items from the stack is needed, a separate function clear() is + available. + + Calling push() returns the item that was pushed onto the stack. + Calling pop() returns the item that was popped off the stack. When pop() is + called in an unwind operation the top-most item (the first item that was + popped, which will also be the one transitioning out) is returned. + + \section1 Deep Linking + \e{Deep linking} means launching an application into a particular state. For example, + a newspaper application could be launched into showing a particular article, + bypassing the front item (and possibly a section item) that would normally have + to be navigated through to get to the article concerned. In terms of StackView, deep + linking means the ability to modify the state of the stack, so much so that it is + possible to push a set of items to the top of the stack, or to completely reset + the stack to a given state. + + The API for deep linking in StackView is the same as for basic navigation. Pushing + an array instead of a single item, will involve that all the items in that array will + be pushed onto the stack. The transition animation, however, will be conducted as + if only the last item in the array was pushed onto the stack. The normal semantics + of push() apply for deep linking, meaning that push() adds whatever is pushed onto + the stack. Note also that only the last item of the array will be loaded. + The rest will be lazy-loaded as needed when entering the screen upon subsequent + calls to pop (or when requesting the item by using \a get). + + This gives us the following result, given the stack [A, B, C]: + + \list + \li \l{push()}{push([D, E, F])} => [A, B, C, D, E, F] - "push" transition animation between C and F + \li \l{push()}{push([D, E, F], replace)} => [A, B, D, E, F] - "replace" transition animation between C and F + \li clear(); \l{push()}{push([D, E, F])} => [D, E, F] - no transition animation (since the stack was empty) + \endlist + + \section1 Pushing items + + An item pushed onto the StackView can be either an Item, a URL, a string + with a URL, or a Component. To push it, assign it to a property "item" + inside a property list, and send it as an argument to \l{StackView::push}{push}: + + \code + stackView.push({item: yourItem}) + \endcode + + The list can contain several properties that control how the item should be pushed: + \list + \li \c item: this property is required, and holds the item to be pushed. + \li \c properties: a list of QML properties to be assigned to the item upon push. These + properties will be copied into the item at load time, or when the item will become + the current item (normally upon push). + \li \c immediate: set this property to \c true to skip transition effects. When pushing + an array, this property only needs to be set on the first element to make the + whole operation immediate. + \li \c replace: set this property to replace the current item on the stack. When pushing + an array, you only need to set this property on the first element to replace + as many elements on the stack as inside the array. + \li \c destroyOnPop: set this boolean to true if StackView needs to destroy the item when + it is popped off the stack. By default (if \a destroyOnPop is not specified), StackView + will destroy items pushed as components or URLs. Items not destroyed will be re-parented + back to the original parents they had before being pushed onto the stack and hidden. + If you need to set this property, do it with care, so that items are not leaked. + \endlist + + If the only argument needed is "item", the following short-hand notation can be applied: + + \code + stackView.push(yourItem) + \endcode + + You can push several items in one go by using an array of property lists. This is + optimizing compared to pushing items one by one, since StackView then can load only the + last item in the list. The rest will be loaded as they are about to become + the current item (which happens when the stack is popped). The following example shows how + to push an array of items: + + \code + stackView.push([{item: yourItem1}, {item: yourItem2}]) + \endcode + + If an inline item is pushed, the item is temporarily re-parented into the StackView. When the item + is later popped off, it gets re-parented back to its original owner again. + If, however, an item is pushed as a component or a URL, the actual item will be created as an + item from that component. This happens automatically when the item is about to become the current + item in the stack. Ownership of the item will then normally be taken by the StackView. It will as + such automatically destroy the item when it is later popped off. The component that declared the item, by + contrast, remains in the ownership of the application and is not destroyed by the stack. + This can be overridden by explicitly setting \c{destroyOnPop} in the list of arguments given to push. + + If the \c properties to be pushed are specified, they will be copied into the item at loading time + (in case of a component or URL), or when the item will become the current item (in case of an inline + item). The following example shows how this can be done: + + \code + stackView.push({item: someItem, properties: {fgcolor: "red", bgcolor: "blue"}}) + \endcode + + + \note Note that if an item is declared inside another item, and if that parent gets destroyed, + (even if a component was used), that child item will also be destroyed. + This follows normal Qt parent-child destruction rules, but sometimes comes as a surprise + for developers. + + \section1 Lifecycle + An item's lifecycle in the StackView can have the following transitions: + \list 1 + \li instantiation + \li inactive + \li activating + \li active + \li deactivating + \li inactive + \li destruction + \endlist + + It can move any number of times between inactive and active. When an item is activated, + it's visible on the screen and is considered to be the current item. An item + in a StackView that is not visible is not activated, even if the item is currently the + top-most item in the stack. When the stack becomes visible, the item that is top-most gets + activated. Likewise if the stack is then hidden, the topmost item would be deactivated. + Popping the item off the top of the stack at this point would not result in further + deactivation since the item is not active. + + There is an attached \l{Stack::status}{Stack.status} property that tracks the lifecycle. The + status values list is an enumeration with values \c Stack.Inactive, \c Stack.Activating, + \c Stack.Active and \c Stack.Deactivating. Combined with the normal \c Component.onComplete and + \c Component.onDestruction signals the entire lifecycle is thus: + + \list + \li Created: Component.onCompleted() + \li Activating: Stack.onStatusChanged (Stack.status is Stack.Activating) + \li Acivated: Stack.onStatusChanged (Stack.status is Stack.Active) + \li Deactivating: Stack.onStatusChanged (Stack.status is Stack.Deactivating) + \li Deactivated: Stack.onStatusChanged (Stack.status is Stack.Inactive) + \li Destruction: Component.onDestruction() + \endlist + + \section1 Finding items + Sometimes it is necessary to search for an item, for example, in order to unwind the stack to + an item to which the application does not have a reference. This is facilitated using a + function find() in StackView. The find() function takes a callback function as its + only argument. The callback gets invoked for each item in the stack (starting at the top). + If the callback returns true, then it signals that a match has been found and the find() + function returns that item. If the callback fails to return true (no match is found), + then find() returns \c null. + + The code below searches for an item in the stack that has a name "order_id" and then unwinds to + that item. Note that since find() returns \c {null} if no item is found, and since pop unwinds to + the bottom of the stack if null is given as the target item, the code works well even in + case no matching item is found. + + \code + stackView.pop(stackView.find(function(item) { + return item.name == "order_id"; + })); + \endcode + + You can also get to an item in the stack using \l {get()}{get(index)}. You should use + this function if your item depends on another item in the stack, as the function will + ensure that the item at the given index gets loaded before it is returned. + + \code + previousItem = stackView.get(myItem.Stack.index - 1)); + \endcode + + \section1 Transitions + + A transition is performed whenever a item is pushed or popped, and consists of + two items: enterItem and exitItem. The StackView itself will never move items + around, but instead delegate the job to an external animation set provided + by the style or the application developer. How items should visually enter and leave the stack + (and the geometry they should end up with) is therefore completely controlled from the outside. + + When the transition starts, the StackView will search for a transition that + matches the operation executed. There are three transitions to choose + from: pushTransition, popTransition, and replaceTransition. Each implements how + enterItem should animate in, and exitItem out. The transitions are + collected inside a StackViewDelegate object assigned to + \l {StackView::delegate}{delegate}. By default, popTransition and + replaceTransition will be the same as pushTransition, unless you set them + to something else. + + A simple fade transition could be implemented as: + + \qml + StackView { + delegate: StackViewDelegate { + function transitionFinished(properties) + { + properties.exitItem.opacity = 1 + } + + property Component pushTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "opacity" + from: 0 + to: 1 + } + PropertyAnimation { + target: exitItem + property: "opacity" + from: 1 + to: 0 + } + } + } + } + \endqml + + PushTransition needs to inherit from StackViewTransition, which is a ParallelAnimation that + contains the properties \c enterItem and \c exitItem. You set the target of your + inner animations to those items. Since the same items instance can be pushed several + times to a StackView, you should always override + \l {StackViewDelegate::transitionFinished(properties)}{StackViewDelegate.transitionFinished(properties)}. + Implement this function to reset any properties animated on the exitItem so that later + transitions can expect the items to be in a default state. + + A more complex example could look like the following. Here, the items are lying on the side before + being rotated to an upright position: + + \qml + StackView { + delegate: StackViewDelegate { + function transitionFinished(properties) + { + properties.exitItem.x = 0 + properties.exitItem.rotation = 0 + } + + property Component pushTransition: StackViewTransition { + SequentialAnimation { + ScriptAction { + script: enterItem.rotation = 90 + } + PropertyAnimation { + target: enterItem + property: "x" + from: enterItem.width + to: 0 + } + PropertyAnimation { + target: enterItem + property: "rotation" + from: 90 + to: 0 + } + } + PropertyAnimation { + target: exitItem + property: "x" + from: 0 + to: -exitItem.width + } + } + } + } + \endqml + + \section2 Advanced usage + + When the StackView needs a new transition, it first calls + \l {StackViewDelegate::getTransition(properties)}{StackViewDelegate.getTransition(properties)}. + The base implementation of this function just looks for a property named \c properties.name inside + itself (root), which is how it finds \c {property Component pushTransition} in the examples above. + + \code + function getTransition(properties) + { + return root[properties.name] + } + \endcode + + You can override this function for your delegate if you need extra logic to decide which + transition to return. You could for example introspect the items, and return different animations + depending on the their internal state. StackView will expect you to return a Component that + contains a StackViewTransition, or a StackViewTransition directly. The former is easier, as StackView will + then create the transition and later destroy it when it's done, while avoiding any sideeffects + caused by the transition being alive long after it has run. Returning a StackViewTransition directly + can be useful if you need to write some sort of transition caching for performance reasons. + As an optimization, you can also return \c null to signal that you just want to show/hide the items + immediately without creating or running any transitions. You can also override this function if + you need to alter the items in any way before the transition starts. + + \c properties contains the properties that will be assigned to the StackViewTransition before + it runs. In fact, you can add more properties to this object during the call + if you need to initialize additional properties of your custom StackViewTransition when the returned + component is instantiated. + + The following example shows how you can decide which animation to use during runtime : + + \qml + StackViewDelegate { + function getTransition(properties) + { + return (properties.enterItem.Stack.index % 2) ? horizontalTransition : verticalTransition + } + + function transitionFinished(properties) + { + properties.exitItem.x = 0 + properties.exitItem.y = 0 + } + + property Component horizontalTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "x" + from: target.width + to: 0 + duration: 300 + } + PropertyAnimation { + target: exitItem + property: "x" + from: 0 + to: target.width + duration: 300 + } + } + + property Component verticalTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "y" + from: target.height + to: 0 + duration: 300 + } + PropertyAnimation { + target: exitItem + property: "y" + from: 0 + to: target.height + duration: 300 + } + } + } + \endqml + + \section1 Supported Attached Properties + + Items in a StackView support these attached properties: + \list + \li \l{Stack::index}{Stack.index} - Contains the index of the item inside the StackView + \li \l{Stack::view}{Stack.view} - Contains the StackView the item is in + \li \l{Stack::status}{Stack.status} - Contains the status of the item + \endlist +*/ + +Item { + id: root + + /*! \qmlproperty int StackView::depth + \readonly + The number of items currently pushed onto the stack. + */ + readonly property alias depth: root.__depth + + /*! \qmlproperty Item StackView::currentItem + \readonly + The currently top-most item in the stack. + */ + readonly property alias currentItem: root.__currentItem + + /*! The first \l item that should be shown when the StackView is created. + \a initialItem can take same value as the first argument to \l{StackView::push()} + {StackView.push()}. Note that this is just a convenience for writing + \c{Component.onCompleted: stackView.push(myInitialItem)} + + Examples: + + \list + \li initialItem: Qt.resolvedUrl("MyItem.qml") + \li initialItem: myItem + \li initialItem: {"item" : Qt.resolvedUrl("MyRectangle.qml"), "properties" : {"color" : "red"}} + \endlist + \sa push + */ + property var initialItem: null + + /*! \readonly + \a busy is \c true if a transition is running, and \c false otherwise. */ + readonly property bool busy: __currentTransition !== null + + /*! The transitions to use when pushing or popping items. + For better understanding on how to apply custom transitions, read \l{Transitions}. + \sa {Stack::transitions}{Stack.transitions} */ + property StackViewDelegate delegate: StackViewSlideDelegate {} + + /*! Pushes an item onto the stack. The function takes a property list as argument, which + should contain one or more of the following properties: + \list + \li \c item: this property is required, and holds the item you want to push. + \li \c properties: a list of QML properties that should be assigned + to the item upon push. These properties will be copied into the item when it is + loaded (in case of a component or URL), or when it becomes the current item for the + first time (normally upon push). + \li \c immediate: set this property to \c true to skip transition effects. When pushing + an array, you only need to set this property on the first element to make the + whole operation immediate. + \li \c replace: set this property to replace the current item on the stack. When pushing + an array, you only need to set this property on the first element to replace + as many elements on the stack as inside the array. + \li \c destroyOnPop: set this property to specify if the item needs to be destroyed + when its popped off the stack. By default (if \a destroyOnPop is not specified), + StackView will destroy items pushed as components or URLs. Items + not destroyed will be re-parented to the original parents they had before being + pushed onto the stack, and hidden. If you need to set this property, do it with + care, so that items are not leaked. + \endlist + + You can also push an array of items (property lists) if you need to push several items + in one go. A transition will then only occur between the current item and the last + item in the list. Loading the other items will be deferred until needed. + + Examples: + \list + \li stackView.push({item:anItem}) + \li stackView.push({item:aURL, immediate: true, replace: true}) + \li stackView.push({item:aRectangle, properties:{color:"red"}}) + \li stackView.push({item:aComponent, properties:{color:"red"}}) + \li stackView.push({item:aComponent.createObject(), destroyOnPop:true}) + \li stackView.push([{item:anitem, immediate:true}, {item:aURL}]) + \endlist + + \note Note: if the only argument needed is "item", you can apply the following short- + hand notation: \c{stackView.push(anItem)}. + + Returns the item that became current. + + \sa initialItem + \sa {Pushing items} + */ + function push(item) { + // Note: we support two different APIs in this function; The old meego API, and + // the new "property list" API. Hence the reason for hiding the fact that you + // can pass more arguments than shown in the signature: + if (__recursionGuard(true)) + return + var properties = arguments[1] + var immediate = arguments[2] + var replace = arguments[3] + var arrayPushed = (item instanceof Array) + var firstItem = arrayPushed ? item[0] : item + immediate = (immediate || JSArray.stackView.length === 0) + + if (firstItem && firstItem.item && firstItem.hasOwnProperty("x") === false) { + // Property list API used: + immediate = immediate || firstItem.immediate + replace = replace || firstItem.replace + } + + // Create, and push, a new javascript object, called "element", onto the stack. + // This element contains all the information necessary to construct the item, and + // will, after loaded, also contain the loaded item: + if (arrayPushed) { + if (item.length === 0) + return + var outElement = replace ? JSArray.pop() : JSArray.current() + for (var i=0; i 1 && item !== undefined && item !== inElement.item) { + // Pop from the top until we find 'item', and return the corresponding + // element. Skip all non-loaded items (except the first), since no one + // has any references to such items anyway: + while (__depth > 1 && !JSArray.current().loaded) + JSArray.pop() + inElement = JSArray.current() + while (__depth > 1 && item !== inElement.item) { + JSArray.pop() + __cleanup(inElement) + while (__depth > 1 && !JSArray.current().loaded) + JSArray.pop() + inElement = JSArray.current() + } + } + + var transition = { + inElement: inElement, + outElement: outElement, + immediate: immediate, + replace: false, + push: false + } + __performTransition(transition) + __recursionGuard(false) + return outElement.item; + } + + /*! Remove all items from the stack. No animations will be applied. */ + function clear() { + if (__recursionGuard(true)) + return + if (__currentTransition) + __currentTransition.animation.complete() + __currentItem = null + var count = __depth + for (var i=0; i=0; --i) { + var element = JSArray.stackView[i]; + if (onlySearchLoadedItems !== true) + __loadElement(element) + else if (!element.item) + continue + if (func(element.item)) + return element.item + } + return null; + } + + /*! Returns the item at position \a index in + the stack. If \a dontLoad is true, the + item will not be forced to load (and \c null + will be returned if not yet loaded) */ + function get(index, dontLoad) + { + if (index < 0 || index >= JSArray.stackView.length) + return null + var element = JSArray.stackView[index] + if (dontLoad !== true) { + __loadElement(element) + return element.item + } else if (element.item) { + return element.item + } else { + return null + } + } + + /*! Immediately completes any ongoing transition. + /sa Animation.complete + */ + function completeTransition() + { + if (__recursionGuard(true)) + return + if (__currentTransition) + __currentTransition.animation.complete() + __recursionGuard(false) + } + + /********* DEPRECATED API *********/ + + /*! \internal + \deprecated Use Push() instead */ + function replace(item, properties, immediate) { + push(item, properties, immediate, true) + } + + /********* PRIVATE API *********/ + + width: parent ? parent.width : 0 + height: parent ? parent.height : 0 + + /*! \internal The currently top-most item on the stack. */ + property Item __currentItem: null + /*! \internal The number of items currently pushed onto the stack. */ + property int __depth: 0 + /*! \internal Stores the transition info while a transition is ongoing */ + property var __currentTransition: null + /*! \internal Stops the user from pushing items while preparing a transition */ + property bool __guard: false + + Component.onCompleted: { + if (initialItem) + push(initialItem) + } + + Component.onDestruction: { + if (__currentTransition) + __currentTransition.animation.complete() + __currentItem = null + } + + /*! \internal */ + function __recursionGuard(use) + { + if (use && __guard) { + console.warn("Warning: StackView: You cannot push/pop recursively!") + console.trace() + return true + } + __guard = use + } + + /*! \internal */ + function __loadElement(element) + { + if (element.loaded) { + if (!element.item) { + element.item = invalidItemReplacement.createObject(root) + element.item.text = "\nError: The item has been deleted outside StackView!" + } + return + } + if (!element.itemComponent) { + element.item = invalidItemReplacement.createObject(root) + element.item.text = "\nError: Invalid item (item was 'null'). " + + "This might indicate that the item was deleted outside StackView!" + return + } + + var comp = __resolveComponent(element.itemComponent, element) + + // Assign properties to item: + if (!element.properties) + element.properties = {} + + if (comp.hasOwnProperty("createObject")) { + if (comp.status === Component.Error) { + element.item = invalidItemReplacement.createObject(root) + element.item.text = "\nError: Could not load: " + comp.errorString() + } else { + element.item = comp.createObject(root, element.properties) + // Destroy items we create unless the user specified something else: + if (!element.hasOwnProperty("destroyOnPop")) + element.destroyOnPop = true + } + } else { + // comp is already an Item, so just re-parent it into the StackView: + element.item = comp + element.originalParent = parent + element.item.parent = root + for (var prop in element.properties) { + if (element.item.hasOwnProperty(prop)) + element.item[prop] = element.properties[prop]; + } + // Do not destroy items we didn't create, unless the user specified something else: + if (!element.hasOwnProperty("destroyOnPop")) + element.destroyOnPop = false + } + + element.item.Stack.__index = element.index + element.item.Stack.__view = root + // Let item fill all available space by default: + element.item.width = Qt.binding(function() { return root.width }) + element.item.height = Qt.binding(function() { return root.height }) + element.loaded = true + } + + /*! \internal */ + function __resolveComponent(unknownObjectType, element) + { + // We need this extra resolve function since we dont really + // know what kind of object the user pushed. So we try to + // figure it out by inspecting the object: + if (unknownObjectType.hasOwnProperty("createObject")) { + return unknownObjectType + } else if (typeof unknownObjectType == "string") { + return Qt.createComponent(unknownObjectType) + } else if (unknownObjectType.hasOwnProperty("x")) { + return unknownObjectType + } else if (unknownObjectType.hasOwnProperty("item")) { + // INVARIANT: user pushed a JS-object + element.properties = unknownObjectType.properties + if (!unknownObjectType.item) + unknownObjectType.item = invalidItemReplacement + if (unknownObjectType.hasOwnProperty("destroyOnPop")) + element.destroyOnPop = unknownObjectType.destroyOnPop + return __resolveComponent(unknownObjectType.item, element) + } else { + // We cannot determine the type, so assume its a URL: + return Qt.createComponent(unknownObjectType) + } + } + + /*! \internal */ + function __cleanup(element) { + // INVARIANT: element has been removed from JSArray. Destroy its + // item, or re-parent it back to the parent it had before it was pushed: + var item = element.item + if (element.destroyOnPop) { + item.destroy() + } else { + // Mark the item as no longer part of the StackView. It + // might reenter on pop if pushed several times: + item.visible = false + __setStatus(item, Stack.Inactive) + item.Stack.__view = null + item.Stack.__index = -1 + if (element.originalParent) + item.parent = element.originalParent + } + } + + /*! \internal */ + function __setStatus(item, status) { + item.Stack.__status = status + } + + /*! \internal */ + function __performTransition(transition) + { + // Animate item in "outElement" out, and item in "inElement" in. Set a guard to protect + // the user from pushing new items on signals that will fire while preparing for the transition + // (e.g Stack.onCompleted, Stack.onStatusChanged, Stack.onIndexChanged etc). Otherwise, we will enter + // this function several times, which causes the items to be updated half-way. + if (__currentTransition) + __currentTransition.animation.complete() + __loadElement(transition.inElement) + + transition.name = transition.replace ? "replaceTransition" : (transition.push ? "pushTransition" : "popTransition") + var enterItem = transition.inElement.item + transition.enterItem = enterItem + + // Since an item can be pushed several times, we need to update its properties: + enterItem.parent = root + enterItem.Stack.__view = root + enterItem.Stack.__index = transition.inElement.index + __currentItem = enterItem + + if (!transition.outElement) { + // A transition consists of two items, but we got just one. So just show the item: + enterItem.visible = true + __setStatus(enterItem, Stack.Activating) + __setStatus(enterItem, Stack.Active) + return + } + + var exitItem = transition.outElement.item + transition.exitItem = exitItem + if (enterItem === exitItem) + return + + if (root.delegate) { + transition.properties = { + "name":transition.name, + "enterItem":transition.enterItem, + "exitItem":transition.exitItem, + "immediate":transition.immediate } + var anim = root.delegate.getTransition(transition.properties) + if (anim.createObject) { + anim = anim.createObject(null, transition.properties) + anim.runningChanged.connect(function(){ if (anim.running === false) anim.destroy() }) + } + transition.animation = anim + } + + if (!transition.animation) { + console.warn("Warning: StackView: no", transition.name, "found!") + return + } + if (enterItem.anchors.fill || exitItem.anchors.fill) + console.warn("Warning: StackView: cannot transition an item that is anchored!") + + __currentTransition = transition + __setStatus(exitItem, Stack.Deactivating) + enterItem.visible = true + __setStatus(enterItem, Stack.Activating) + transition.animation.runningChanged.connect(animationFinished) + transition.animation.start() + // NB! For empty animations, "animationFinished" is already + // executed at this point, leaving __animation === null: + if (transition.immediate === true && transition.animation) + transition.animation.complete() + } + + /*! \internal */ + function animationFinished() + { + if (!__currentTransition || __currentTransition.animation.running) + return + + __currentTransition.animation.runningChanged.disconnect(animationFinished) + __currentTransition.exitItem.visible = false + __setStatus(__currentTransition.exitItem, Stack.Inactive); + __setStatus(__currentTransition.enterItem, Stack.Active); + __currentTransition.properties.animation = __currentTransition.animation + root.delegate.transitionFinished(__currentTransition.properties) + + if (!__currentTransition.push || __currentTransition.replace) + __cleanup(__currentTransition.outElement) + + __currentTransition = null + } + + /*! \internal */ + property Component invalidItemReplacement: Component { + Text { + width: parent.width + height: parent.height + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackViewDelegate.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackViewDelegate.qml new file mode 100644 index 00000000000..e77b8235276 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackViewDelegate.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 + +/*! + \qmltype StackViewDelegate + \inqmlmodule QtQuick.Controls + \since 5.1 + + \brief A delegate used by StackView for loading transitions. + + See the documentation for the \l {QtQuick.Controls1::StackView} {StackView} + component. + +*/ +QtObject { + id: root + + function getTransition(properties) + { + return root[properties.name] + } + + function transitionFinished(properties) + { + } + + property Component pushTransition: StackViewTransition {} + property Component popTransition: root["pushTransition"] + property Component replaceTransition: root["pushTransition"] +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackViewTransition.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackViewTransition.qml new file mode 100644 index 00000000000..e58ad3f34e7 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StackViewTransition.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 + +ParallelAnimation { + id: root + /*! The name of the animation that is running. Can be one of the following: + \list + \li 'PushTransition' + \li 'PopTransition' + \li 'ReplaceTransition' + \endlist + */ + property string name + /*! The page that is transitioning in. */ + property Item enterItem + /*! The page that is transitioning out */ + property Item exitItem + /*! Set to \c true if the transition is told to + fast-forward directly to its end-state */ + property bool immediate +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StatusBar.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StatusBar.qml new file mode 100644 index 00000000000..cf41a2dc760 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/StatusBar.qml @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype StatusBar + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup applicationwindow + \brief Contains status information in your app. + + The common way of using StatusBar is in relation to \l ApplicationWindow. + + Note that the StatusBar does not provide a layout of its own, but requires + you to position its contents, for instance by creating a \l RowLayout. + + If only a single item is used within the StatusBar, it will resize to fit the implicitHeight + of its contained item. This makes it particularly suitable for use together with layouts. + Otherwise the height is platform dependent. + + \code + import QtQuick.Controls 1.1 + import QtQuick.Layouts 1.0 + + ApplicationWindow { + statusBar: StatusBar { + RowLayout { + Label { text: "Read Only" } + } + } + } + \endcode +*/ + +Item { + id: statusbar + + activeFocusOnTab: false + Accessible.role: Accessible.StatusBar + + width: parent ? parent.width : implicitWidth + implicitWidth: container.leftMargin + container.rightMargin + container.calcWidth() + implicitHeight: Math.max(container.topMargin + container.bottomMargin + container.calcHeight(), + loader.item ? loader.item.implicitHeight : 19) + + /*! \internal */ + property Component style: Qt.createComponent(Settings.style + "/StatusBarStyle.qml", statusbar) + + /*! \internal */ + property alias __style: styleLoader.item + + /*! \internal */ + default property alias __content: container.data + + /*! + \qmlproperty Item StatusBar::contentItem + + This property holds the content Item of the status bar. + + Items declared as children of a StatusBar are automatically parented to the StatusBar's contentItem. + Items created dynamically need to be explicitly parented to the contentItem: + + \note The implicit size of the StatusBar is calculated based on the size of its content. If you want to anchor + items inside the status bar, you must specify an explicit width and height on the StatusBar itself. + */ + readonly property alias contentItem: container + + data: [ + Loader { + id: loader + anchors.fill: parent + sourceComponent: styleLoader.item ? styleLoader.item.panel : null + onLoaded: item.z = -1 + Loader { + id: styleLoader + property alias __control: statusbar + sourceComponent: style + } + }, + Item { + id: container + z: 1 + focus: true + anchors.fill: parent + + anchors.topMargin: topMargin + anchors.leftMargin: leftMargin + anchors.rightMargin: rightMargin + anchors.bottomMargin: bottomMargin + + property int topMargin: __style ? __style.padding.top : 0 + property int bottomMargin: __style ? __style.padding.bottom : 0 + property int leftMargin: __style ? __style.padding.left : 0 + property int rightMargin: __style ? __style.padding.right : 0 + + property Item layoutItem: container.children.length === 1 ? container.children[0] : null + function calcWidth() { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) + + (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin + + layoutItem.anchors.rightMargin : 0) : + loader.item ? loader.item.implicitWidth: 0) } + function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) + + (layoutItem.anchors.fill ? layoutItem.anchors.topMargin + + layoutItem.anchors.bottomMargin : 0) : loader.item ? loader.item.implicitHeight : 0) } + }] +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/BusyIndicatorStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/BusyIndicatorStyle.qml new file mode 100644 index 00000000000..d53ccb29255 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/BusyIndicatorStyle.qml @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.2 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype BusyIndicatorStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.2 + \ingroup controlsstyling + \brief Provides custom styling for BusyIndicatorStyle + + You can create a busy indicator by replacing the "indicator" delegate + of the BusyIndicatorStyle with a custom design. + + Example: + \qml + BusyIndicator { + style: BusyIndicatorStyle + indicator: Image { + visible: control.running + source: "spinner.png" + NumberAnimation on rotation { + running: control.running + loops: Animation.Infinite + duration: 2000 + from: 0 ; to: 360 + } + } + } + } + \endqml +*/ +Style { + id: indicatorstyle + + /*! The \l BusyIndicator attached to this style. */ + readonly property BusyIndicator control: __control + + /*! This defines the appearance of the busy indicator. */ + property Component indicator: Item { + implicitWidth: 48 + implicitHeight: 48 + + opacity: control.running ? 1 : 0 + Behavior on opacity { OpacityAnimator { duration: 250 } } + + Image { + anchors.centerIn: parent + anchors.alignWhenCentered: true + width: Math.min(parent.width, parent.height) + height: width + source: width <= 32 ? "images/spinner_small.png" : + width >= 48 ? "images/spinner_large.png" : + "images/spinner_medium.png" + RotationAnimator on rotation { + duration: 800 + loops: Animation.Infinite + from: 0 + to: 360 + } + } + } + + /*! \internal */ + property Component panel: Item { + anchors.fill: parent + implicitWidth: indicatorLoader.implicitWidth + implicitHeight: indicatorLoader.implicitHeight + + Loader { + id: indicatorLoader + sourceComponent: indicator + anchors.centerIn: parent + width: Math.min(parent.width, parent.height) + height: width + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ButtonStyle.qml new file mode 100644 index 00000000000..ad14095c59c --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ButtonStyle.qml @@ -0,0 +1,177 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ButtonStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup controlsstyling + \brief Provides custom styling for Button + + You can create a custom button by replacing the "background" delegate + of the ButtonStyle with a custom design. + + Example: + \qml + Button { + text: "A button" + style: ButtonStyle { + background: Rectangle { + implicitWidth: 100 + implicitHeight: 25 + border.width: control.activeFocus ? 2 : 1 + border.color: "#888" + radius: 4 + gradient: Gradient { + GradientStop { position: 0 ; color: control.pressed ? "#ccc" : "#eee" } + GradientStop { position: 1 ; color: control.pressed ? "#aaa" : "#ccc" } + } + } + } + } + \endqml + If you need a custom label, you can replace the label item. +*/ + +Style { + id: buttonstyle + + /*! The \l Button attached to this style. */ + readonly property Button control: __control + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + + /*! The padding between the background and the label components. */ + padding { + top: 4 + left: 4 + right: control.menu !== null ? Math.round(TextSingleton.implicitHeight * 0.5) : 4 + bottom: 4 + } + + /*! This defines the background of the button. */ + property Component background: Item { + implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5) + implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2)) + Rectangle { + anchors.fill: parent + anchors.bottomMargin: control.pressed ? 0 : -1 + color: "#10000000" + radius: baserect.radius + } + Rectangle { + id: baserect + gradient: Gradient { + GradientStop {color: control.pressed ? "#aaa" : "#fefefe" ; position: 0} + GradientStop {color: control.pressed ? "#ccc" : "#e3e3e3" ; position: control.pressed ? 0.1: 1} + } + radius: TextSingleton.implicitHeight * 0.16 + anchors.fill: parent + border.color: control.activeFocus ? "#47b" : "#999" + Rectangle { + anchors.fill: parent + radius: parent.radius + color: control.activeFocus ? "#47b" : "white" + opacity: control.hovered || control.activeFocus ? 0.1 : 0 + Behavior on opacity {NumberAnimation{ duration: 100 }} + } + } + Image { + id: imageItem + visible: control.menu !== null + source: "images/arrow-down.png" + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: padding.right + opacity: control.enabled ? 0.6 : 0.5 + } + } + + /*! This defines the label of the button. */ + property Component label: Item { + implicitWidth: row.implicitWidth + implicitHeight: row.implicitHeight + Row { + id: row + anchors.centerIn: parent + spacing: 2 + Image { + source: control.iconSource + anchors.verticalCenter: parent.verticalCenter + } + Text { + renderType: Text.NativeRendering + anchors.verticalCenter: parent.verticalCenter + text: control.text + color: __syspal.text + } + } + } + + /*! \internal */ + property Component panel: Item { + anchors.fill: parent + implicitWidth: Math.max(labelLoader.implicitWidth + padding.left + padding.right, backgroundLoader.implicitWidth) + implicitHeight: Math.max(labelLoader.implicitHeight + padding.top + padding.bottom, backgroundLoader.implicitHeight) + + Loader { + id: backgroundLoader + anchors.fill: parent + sourceComponent: background + } + + Loader { + id: labelLoader + sourceComponent: label + anchors.fill: parent + anchors.leftMargin: padding.left + anchors.topMargin: padding.top + anchors.rightMargin: padding.right + anchors.bottomMargin: padding.bottom + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/CheckBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/CheckBoxStyle.qml new file mode 100644 index 00000000000..8fb58207cbb --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/CheckBoxStyle.qml @@ -0,0 +1,196 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Window 2.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype CheckBoxStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup controlsstyling + \brief Provides custom styling for CheckBox + + Example: + \qml + CheckBox { + text: "Check Box" + style: CheckBoxStyle { + indicator: Rectangle { + implicitWidth: 16 + implicitHeight: 16 + radius: 3 + border.color: control.activeFocus ? "darkblue" : "gray" + border.width: 1 + Rectangle { + visible: control.checked + color: "#555" + border.color: "#333" + radius: 1 + anchors.margins: 4 + anchors.fill: parent + } + } + } + } + \endqml +*/ +Style { + id: checkboxStyle + + /*! The \l CheckBox attached to this style. */ + readonly property CheckBox control: __control + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + + /*! This defines the text label. */ + property Component label: Item { + implicitWidth: text.implicitWidth + 2 + implicitHeight: text.implicitHeight + Rectangle { + anchors.fill: text + anchors.margins: -1 + anchors.leftMargin: -3 + anchors.rightMargin: -3 + visible: control.activeFocus + height: 6 + radius: 3 + color: "#224f9fef" + border.color: "#47b" + opacity: 0.6 + } + Text { + id: text + text: control.text + anchors.centerIn: parent + color: __syspal.text + renderType: Text.NativeRendering + } + } + /*! The background under indicator and label. */ + property Component background + + /*! The spacing between indicator and label. */ + property int spacing: Math.round(TextSingleton.implicitHeight/4) + + /*! This defines the indicator button. */ + property Component indicator: Item { + implicitWidth: Math.round(TextSingleton.implicitHeight) + height: width + Rectangle { + anchors.fill: parent + anchors.bottomMargin: -1 + color: "#44ffffff" + radius: baserect.radius + } + Rectangle { + id: baserect + gradient: Gradient { + GradientStop {color: "#eee" ; position: 0} + GradientStop {color: control.pressed ? "#eee" : "#fff" ; position: 0.1} + GradientStop {color: "#fff" ; position: 1} + } + radius: TextSingleton.implicitHeight * 0.16 + anchors.fill: parent + border.color: control.activeFocus ? "#47b" : "#999" + } + + Image { + source: "images/check.png" + opacity: control.checkedState === Qt.Checked ? control.enabled ? 1 : 0.5 : 0 + anchors.centerIn: parent + anchors.verticalCenterOffset: 1 + Behavior on opacity {NumberAnimation {duration: 80}} + } + + Rectangle { + anchors.fill: parent + anchors.margins: Math.round(baserect.radius) + antialiasing: true + gradient: Gradient { + GradientStop {color: control.pressed ? "#555" : "#999" ; position: 0} + GradientStop {color: "#555" ; position: 1} + } + radius: baserect.radius - 1 + anchors.centerIn: parent + anchors.alignWhenCentered: true + border.color: "#222" + Behavior on opacity {NumberAnimation {duration: 80}} + opacity: control.checkedState === Qt.PartiallyChecked ? control.enabled ? 1 : 0.5 : 0 + } + } + + /*! \internal */ + property Component panel: Item { + implicitWidth: Math.max(backgroundLoader.implicitWidth, row.implicitWidth + padding.left + padding.right) + implicitHeight: Math.max(backgroundLoader.implicitHeight, labelLoader.implicitHeight + padding.top + padding.bottom,indicatorLoader.implicitHeight + padding.top + padding.bottom) + + Loader { + id: backgroundLoader + sourceComponent: background + anchors.fill: parent + } + Row { + id: row + anchors.fill: parent + + anchors.leftMargin: padding.left + anchors.rightMargin: padding.right + anchors.topMargin: padding.top + anchors.bottomMargin: padding.bottom + + spacing: checkboxStyle.spacing + Loader { + id: indicatorLoader + sourceComponent: indicator + anchors.verticalCenter: parent.verticalCenter + } + Loader { + id: labelLoader + sourceComponent: label + anchors.verticalCenter: parent.verticalCenter + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ComboBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ComboBoxStyle.qml new file mode 100644 index 00000000000..2b4b237d20d --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ComboBoxStyle.qml @@ -0,0 +1,233 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Window 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ComboBoxStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup controlsstyling + \brief Provides custom styling for ComboBox +*/ + +Style { + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + /*! The \l ComboBox attached to this style. */ + readonly property ComboBox control: __control + + /*! The padding between the background and the label components. */ + padding { top: 4 ; left: 6 ; right: 6 ; bottom:4 } + + /*! The size of the drop down button when the combobox is editable. */ + property int drowDownButtonWidth: Math.round(TextSingleton.implicitHeight) + + /*! This defines the background of the button. */ + property Component background: Item { + implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5) + implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2)) + Rectangle { + anchors.fill: parent + anchors.bottomMargin: control.pressed ? 0 : -1 + color: "#10000000" + radius: baserect.radius + } + Rectangle { + id: baserect + gradient: Gradient { + GradientStop {color: control.pressed ? "#bababa" : "#fefefe" ; position: 0} + GradientStop {color: control.pressed ? "#ccc" : "#e3e3e3" ; position: 1} + } + radius: TextSingleton.implicitHeight * 0.16 + anchors.fill: parent + border.color: control.activeFocus ? "#47b" : "#999" + Rectangle { + anchors.fill: parent + radius: parent.radius + color: control.activeFocus ? "#47b" : "white" + opacity: control.hovered || control.activeFocus ? 0.1 : 0 + Behavior on opacity {NumberAnimation{ duration: 100 }} + } + } + Image { + id: imageItem + visible: control.menu !== null + source: "images/arrow-down.png" + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: drowDownButtonWidth / 2 + opacity: control.enabled ? 0.6 : 0.3 + } + } + + /*! \internal */ + property Component __editor: Item { + implicitWidth: 100 + implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2)) + clip: true + Rectangle { + anchors.fill: parent + anchors.bottomMargin: 0 + color: "#44ffffff" + radius: baserect.radius + } + Rectangle { + id: baserect + anchors.rightMargin: -radius + anchors.bottomMargin: 1 + gradient: Gradient { + GradientStop {color: "#e0e0e0" ; position: 0} + GradientStop {color: "#fff" ; position: 0.1} + GradientStop {color: "#fff" ; position: 1} + } + radius: TextSingleton.implicitHeight * 0.16 + anchors.fill: parent + border.color: control.activeFocus ? "#47b" : "#999" + } + Rectangle { + color: "#aaa" + anchors.bottomMargin: 2 + anchors.topMargin: 1 + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + width: 1 + } + } + + /*! This defines the label of the button. */ + property Component label: Item { + implicitWidth: textitem.implicitWidth + 20 + Text { + id: textitem + anchors.left: parent.left + anchors.right: parent.right + anchors.leftMargin: 4 + anchors.rightMargin: 10 + anchors.verticalCenter: parent.verticalCenter + text: control.currentText + renderType: Text.NativeRendering + color: __syspal.text + elide: Text.ElideRight + } + } + + /*! \internal */ + property Component panel: Item { + property bool popup: false + anchors.centerIn: parent + anchors.fill: parent + implicitWidth: backgroundLoader.implicitWidth + implicitHeight: Math.max(labelLoader.implicitHeight + padding.top + padding.bottom, backgroundLoader.implicitHeight) + + Loader { + id: backgroundLoader + anchors.fill: parent + sourceComponent: background + + } + + Loader { + id: editorLoader + anchors.fill: parent + anchors.rightMargin: drowDownButtonWidth + padding.right + anchors.bottomMargin: -1 + sourceComponent: control.editable ? __editor : null + } + + Loader { + id: labelLoader + sourceComponent: label + visible: !control.editable + anchors.fill: parent + anchors.leftMargin: padding.left + anchors.topMargin: padding.top + anchors.rightMargin: padding.right + anchors.bottomMargin: padding.bottom + } + } + + /*! \internal */ + property Component __dropDownStyle: MenuStyle { + maxPopupHeight: 600 + __menuItemType: "comboboxitem" + scrollerStyle: ScrollViewStyle { + property bool useScrollers: false + } + } + + /*! \internal */ + property Component __popupStyle: Style { + + property Component frame: Rectangle { + width: (parent ? parent.contentWidth : 0) + height: (parent ? parent.contentHeight : 0) + 2 + border.color: "white" + property real maxHeight: 500 + property int margin: 1 + } + + property Component menuItem: Text { + text: "NOT IMPLEMENTED" + color: "red" + font { + pixelSize: 14 + bold: true + } + } + + property Component scrollerStyle: Style { + padding { left: 0; right: 0; top: 0; bottom: 0 } + property bool scrollToClickedPosition: false + property Component frame: Item { visible: false } + property Component corner: Item { visible: false } + property Component __scrollbar: Item { visible: false } + property bool useScrollers: true + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/FocusFrameStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/FocusFrameStyle.qml new file mode 100644 index 00000000000..27edf11c5c5 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/FocusFrameStyle.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype FocusFrameStyle + \internal + \inqmlmodule QtQuick.Controls.Styles +*/ +Item { + property int margin: -3 +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/GroupBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/GroupBoxStyle.qml new file mode 100644 index 00000000000..c0c08d56230 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/GroupBoxStyle.qml @@ -0,0 +1,148 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype GroupBoxStyle + \internal + \inqmlmodule QtQuick.Controls.Styles + \ingroup controlsstyling + \since 5.1 +*/ +Style { + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + /*! The \l GroupBox attached to this style. */ + readonly property GroupBox control: __control + + /*! The margin from the content item to the groupbox. */ + padding { + top: (control.title.length > 0 || control.checkable ? TextSingleton.implicitHeight : 0) + 10 + left: 8 + right: 8 + bottom: 6 + } + + /*! The title text color. */ + property color textColor: __syspal.text + + /*! The check box. */ + property Component checkbox: Item { + implicitWidth: 18 + implicitHeight: 18 + BorderImage { + anchors.fill: parent + source: "images/editbox.png" + border.top: 6 + border.bottom: 6 + border.left: 6 + border.right: 6 + } + Rectangle { + height: 16 + width: 16 + antialiasing: true + visible: control.checked + color: "#666" + radius: 1 + anchors.margins: 4 + anchors.fill: parent + anchors.topMargin: 3 + anchors.bottomMargin: 5 + border.color: "#222" + opacity: control.enabled ? 1 : 0.5 + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + border.color: "#33ffffff" + } + } + BorderImage { + anchors.fill: parent + anchors.margins: -1 + source: "images/focusframe.png" + visible: control.activeFocus + border.left: 4 + border.right: 4 + border.top: 4 + border.bottom: 4 + } + } + + /*! The groupbox frame. */ + property Component panel: Item { + anchors.fill: parent + Loader { + id: checkboxloader + anchors.left: parent.left + sourceComponent: control.checkable ? checkbox : null + anchors.verticalCenter: label.verticalCenter + width: item ? item.implicitWidth : 0 + } + + Text { + id: label + anchors.top: parent.top + anchors.left: checkboxloader.right + anchors.margins: 4 + text: control.title + color: textColor + renderType: Text.NativeRendering + } + + BorderImage { + anchors.fill: parent + anchors.topMargin: padding.top - 7 + source: "images/groupbox.png" + border.left: 4 + border.right: 4 + border.top: 4 + border.bottom: 4 + visible: !control.flat + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/MenuBarStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/MenuBarStyle.qml new file mode 100644 index 00000000000..3a3b552dd66 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/MenuBarStyle.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype MenuBarStyle + \internal + \ingroup applicationwindowstyling + \inqmlmodule QtQuick.Controls.Styles +*/ + +Style { + readonly property color __backgroundColor: "#dcdcdc" + + property Component frame: Rectangle { + width: control.__contentItem.width + height: contentHeight + color: __backgroundColor + } + + property Component menuItem: Rectangle { + width: text.width + 12 + height: text.height + 4 + color: sunken ? "#49d" :__backgroundColor + + SystemPalette { id: syspal } + + Text { + id: text + text: StyleHelpers.stylizeMnemonics(menuItem.title) + anchors.centerIn: parent + renderType: Text.NativeRendering + color: sunken ? "white" : syspal.windowText + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/MenuStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/MenuStyle.qml new file mode 100644 index 00000000000..c05c6a6d100 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/MenuStyle.qml @@ -0,0 +1,220 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Window 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype MenuStyle + \internal + \ingroup menusstyling + \inqmlmodule QtQuick.Controls.Styles +*/ + +Style { + id: styleRoot + + property string __menuItemType: "menuitem" + property real maxPopupHeight: 600 // ### FIXME Screen.desktopAvailableHeight * 0.99 + + property Component frame: Rectangle { + width: (parent ? parent.contentWidth : 0) + 2 + height: (parent ? parent.contentHeight : 0) + 2 + + color: "lightgray" + border { width: 1; color: "darkgray" } + + property int subMenuOverlap: -1 + property real maxHeight: maxPopupHeight + property int margin: 1 + } + + property Component menuItem: Rectangle { + x: 1 + y: 1 + implicitWidth: Math.max((parent ? parent.width : 0), + 18 + text.paintedWidth + (rightDecoration.visible ? rightDecoration.width + 40 : 12)) + implicitHeight: isSeparator ? text.font.pixelSize / 2 : !!scrollerDirection ? text.font.pixelSize * 0.75 : text.paintedHeight + 4 + color: selected && enabled ? "" : backgroundColor + gradient: selected && enabled ? selectedGradient : undefined + border.width: 1 + border.color: selected && enabled ? Qt.darker(selectedColor, 1) : color + readonly property int leftMargin: __menuItemType === "menuitem" ? 18 : 0 + + readonly property color backgroundColor: "#dcdcdc" + readonly property color selectedColor: "#49d" + Gradient { + id: selectedGradient + GradientStop {color: Qt.lighter(selectedColor, 1.3) ; position: -0.2} + GradientStop {color: selectedColor; position: 1.4} + } + antialiasing: true + + SystemPalette { + id: syspal + colorGroup: enabled ? SystemPalette.Active : SystemPalette.Disabled + } + + readonly property string itemText: parent ? parent.text : "" + readonly property bool mirrored: Qt.application.layoutDirection === Qt.RightToLeft + + Loader { + id: checkMark + x: mirrored ? parent.width - width - 4 : 4 + y: 6 + active: __menuItemType === "menuitem" && !!menuItem && !!menuItem["checkable"] + sourceComponent: exclusive ? exclusiveCheckMark : nonExclusiveCheckMark + + readonly property bool checked: !!menuItem && !!menuItem.checked + readonly property bool exclusive: !!menuItem && !!menuItem["exclusiveGroup"] + + Component { + id: nonExclusiveCheckMark + BorderImage { + width: 12 + height: 12 + source: "images/editbox.png" + border.top: 6 + border.bottom: 6 + border.left: 6 + border.right: 6 + + Rectangle { + antialiasing: true + visible: checkMark.checked + color: "#666" + radius: 1 + anchors.margins: 4 + anchors.fill: parent + anchors.topMargin: 3 + anchors.bottomMargin: 5 + border.color: "#222" + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + border.color: "#33ffffff" + } + } + } + } + + Component { + id: exclusiveCheckMark + Rectangle { + x: 1 + width: 10 + height: 10 + color: "white" + border.color: "gray" + antialiasing: true + radius: height/2 + + Rectangle { + anchors.centerIn: parent + visible: checkMark.checked + width: 4 + height: 4 + color: "#666" + border.color: "#222" + antialiasing: true + radius: height/2 + } + } + } + } + + Text { + id: text + visible: !isSeparator + text: StyleHelpers.stylizeMnemonics(itemText) + readonly property real offset: __menuItemType === "menuitem" ? 24 : 6 + x: mirrored ? parent.width - width - offset : offset + anchors.verticalCenter: parent.verticalCenter + renderType: Text.NativeRendering + color: selected && enabled ? "white" : syspal.text + } + + Text { + id: rightDecoration + readonly property string shortcut: !!menuItem && menuItem["shortcut"] || "" + visible: isSubmenu || shortcut !== "" + text: isSubmenu ? mirrored ? "\u25c2" : "\u25b8" // BLACK LEFT/RIGHT-POINTING SMALL TRIANGLE + : shortcut + LayoutMirroring.enabled: mirrored + anchors { + right: parent.right + rightMargin: 6 + baseline: isSubmenu ? undefined : text.baseline + } + font.pixelSize: isSubmenu ? text.font.pixelSize : text.font.pixelSize * 0.9 + color: text.color + renderType: Text.NativeRendering + style: selected || !isSubmenu ? Text.Normal : Text.Raised; styleColor: Qt.lighter(color, 4) + } + + Image { + id: scrollerDecoration + visible: !!scrollerDirection + anchors.centerIn: parent + source: scrollerDirection === "up" ? "images/arrow-up.png" : "images/arrow-down.png" + } + + Rectangle { + visible: isSeparator + width: parent.width - 2 + height: 1 + x: 1 + anchors.verticalCenter: parent.verticalCenter + color: "darkgray" + } + } + + property Component scrollerStyle: Style { + padding { left: 0; right: 0; top: 0; bottom: 0 } + property bool scrollToClickedPosition: false + property Component frame: Item { visible: false } + property Component corner: Item { visible: false } + property Component __scrollbar: Item { visible: false } + property bool useScrollers: true + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ProgressBarStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ProgressBarStyle.qml new file mode 100644 index 00000000000..d8ff8140ebe --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ProgressBarStyle.qml @@ -0,0 +1,232 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ProgressBarStyle + + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup controlsstyling + \brief Provides custom styling for ProgressBar + + Example: + \qml + ProgressBar { + value: slider.value + style: ProgressBarStyle { + background: Rectangle { + radius: 2 + color: "lightgray" + border.color: "gray" + border.width: 1 + implicitWidth: 200 + implicitHeight: 24 + } + progress: Rectangle { + color: "lightsteelblue" + border.color: "steelblue" + } + } + } + \endqml +*/ + +Style { + id: progressBarStyle + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + /*! The \l ProgressBar attached to this style. */ + readonly property ProgressBar control: __control + + /*! A value in the range [0-1] indicating the current progress. */ + readonly property real currentProgress: control.indeterminate ? 1.0 : + control.value / control.maximumValue + + /*! This property holds the visible contents of the progress bar + You can access the Slider through the \c control property. + + For convenience, you can also access the readonly property \c styleData.progress + which provides the current progress as a \c real in the range [0-1] + */ + padding { top: 0 ; left: 0 ; right: 0 ; bottom: 0 } + + /*! \qmlproperty Component ProgressBarStyle::progress + The progress component for this style. + */ + property Component progress: Item { + property color progressColor: "#49d" + anchors.fill: parent + clip: true + Rectangle { + id: base + width: control.width + height: control.height + radius: TextSingleton.implicitHeight * 0.16 + antialiasing: true + gradient: Gradient { + GradientStop {color: Qt.lighter(progressColor, 1.3) ; position: 0} + GradientStop {color: progressColor ; position: 1.4} + } + border.width: 1 + border.color: Qt.darker(progressColor, 1.2) + Rectangle { + color: "transparent" + radius: 1.5 + clip: true + antialiasing: true + anchors.fill: parent + anchors.margins: 1 + border.color: Qt.rgba(1,1,1,0.1) + Image { + visible: control.indeterminate + height: parent.height + NumberAnimation on x { + from: -39 + to: 0 + running: control.indeterminate + duration: 800 + loops: Animation.Infinite + } + fillMode: Image.Tile + width: parent.width + 25 + source: "images/progress-indeterminate.png" + } + } + } + Rectangle { + height: parent.height - 2 + width: 1 + y: 1 + anchors.right: parent.right + anchors.rightMargin: 1 + color: Qt.rgba(1,1,1,0.1) + visible: splitter.visible + } + Rectangle { + id: splitter + height: parent.height - 2 + width: 1 + y: 1 + anchors.right: parent.right + color: Qt.darker(progressColor, 1.2) + property int offset: currentProgress * control.width + visible: offset > base.radius && offset < control.width - base.radius + 1 + } + } + + /*! \qmlproperty Component ProgressBarStyle::background + The background component for this style. + + \note The implicitWidth and implicitHeight of the background component + must be set. + */ + property Component background: Item { + implicitWidth: 200 + implicitHeight: Math.max(17, Math.round(TextSingleton.implicitHeight * 0.7)) + Rectangle { + anchors.fill: parent + anchors.bottomMargin: control.pressed ? 0 : -1 + color: "#44ffffff" + radius: baserect.radius + } + Rectangle { + id: baserect + gradient: Gradient { + GradientStop {color: "#eee" ; position: 0} + GradientStop {color: "#fff" ; position: 0.1} + GradientStop {color: "#fff" ; position: 1} + } + radius: TextSingleton.implicitHeight * 0.16 + anchors.fill: parent + border.color: control.activeFocus ? "#47b" : "#999" + Rectangle { + anchors.fill: parent + radius: parent.radius + color: control.activeFocus ? "#47b" : "white" + opacity: control.hovered || control.activeFocus ? 0.1 : 0 + Behavior on opacity {NumberAnimation{ duration: 100 }} + } + } + } + + /*! \qmlproperty Component ProgressBarStyle::panel + The panel component for this style. + */ + property Component panel: Item{ + property bool horizontal: control.orientation == Qt.Horizontal + implicitWidth: horizontal ? backgroundLoader.implicitWidth : backgroundLoader.implicitHeight + implicitHeight: horizontal ? backgroundLoader.implicitHeight : backgroundLoader.implicitWidth + + Item { + width: horizontal ? parent.width : parent.height + height: !horizontal ? parent.width : parent.height + y: horizontal ? 0 : width + rotation: horizontal ? 0 : -90 + transformOrigin: Item.TopLeft + + Loader { + id: backgroundLoader + anchors.fill: parent + sourceComponent: background + } + + Loader { + sourceComponent: progressBarStyle.progress + anchors.topMargin: padding.top + anchors.leftMargin: padding.left + anchors.rightMargin: padding.right + anchors.bottomMargin: padding.bottom + + anchors.top: parent.top + anchors.left: parent.left + anchors.bottom: parent.bottom + width: currentProgress * (parent.width - padding.left - padding.right) + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/RadioButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/RadioButtonStyle.qml new file mode 100644 index 00000000000..78f423ace4c --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/RadioButtonStyle.qml @@ -0,0 +1,177 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype RadioButtonStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup controlsstyling + \brief Provides custom styling for RadioButton + + Example: + \qml + RadioButton { + text: "Radio Button" + style: RadioButtonStyle { + indicator: Rectangle { + implicitWidth: 16 + implicitHeight: 16 + radius: 9 + border.color: control.activeFocus ? "darkblue" : "gray" + border.width: 1 + Rectangle { + anchors.fill: parent + visible: control.checked + color: "#555" + radius: 9 + anchors.margins: 4 + } + } + } + } + \endqml +*/ + +Style { + id: radiobuttonStyle + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + /*! The \l RadioButton attached to this style. */ + readonly property RadioButton control: __control + + /*! This defines the text label. */ + property Component label: Item { + implicitWidth: text.implicitWidth + 2 + implicitHeight: text.implicitHeight + Rectangle { + anchors.fill: text + anchors.margins: -1 + anchors.leftMargin: -3 + anchors.rightMargin: -3 + visible: control.activeFocus + height: 6 + radius: 3 + color: "#224f9fef" + border.color: "#47b" + opacity: 0.6 + } + Text { + id: text + text: control.text + anchors.centerIn: parent + color: __syspal.text + renderType: Text.NativeRendering + } + } + + /*! The background under indicator and label. */ + property Component background + + /*! The spacing between indicator and label. */ + property int spacing: Math.round(TextSingleton.implicitHeight/4) + + /*! This defines the indicator button. */ + property Component indicator: Rectangle { + width: Math.round(TextSingleton.implicitHeight) + height: width + gradient: Gradient { + GradientStop {color: "#eee" ; position: 0} + GradientStop {color: control.pressed ? "#eee" : "#fff" ; position: 0.4} + GradientStop {color: "#fff" ; position: 1} + } + border.color: control.activeFocus ? "#16c" : "gray" + antialiasing: true + radius: height/2 + Rectangle { + anchors.centerIn: parent + width: Math.round(parent.width * 0.5) + height: width + gradient: Gradient { + GradientStop {color: "#999" ; position: 0} + GradientStop {color: "#555" ; position: 1} + } + border.color: "#222" + antialiasing: true + radius: height/2 + Behavior on opacity {NumberAnimation {duration: 80}} + opacity: control.checked ? control.enabled ? 1 : 0.5 : 0 + } + } + + /*! \internal */ + property Component panel: Item { + implicitWidth: Math.max(backgroundLoader.implicitWidth, row.implicitWidth + padding.left + padding.right) + implicitHeight: Math.max(backgroundLoader.implicitHeight, labelLoader.implicitHeight + padding.top + padding.bottom,indicatorLoader.implicitHeight + padding.top + padding.bottom) + + Loader { + id:backgroundLoader + sourceComponent: background + anchors.fill: parent + } + Row { + id: row + anchors.fill: parent + + anchors.leftMargin: padding.left + anchors.rightMargin: padding.right + anchors.topMargin: padding.top + anchors.bottomMargin: padding.bottom + + spacing: radiobuttonStyle.spacing + Loader { + id: indicatorLoader + sourceComponent: indicator + anchors.verticalCenter: parent.verticalCenter + } + Loader { + id: labelLoader + sourceComponent: label + anchors.verticalCenter: parent.verticalCenter + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ScrollViewStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ScrollViewStyle.qml new file mode 100644 index 00000000000..a7dbcc520ea --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ScrollViewStyle.qml @@ -0,0 +1,398 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ScrollViewStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup viewsstyling + \brief Provides custom styling for ScrollView +*/ +Style { + id: root + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + /*! The \l ScrollView attached to this style. */ + readonly property ScrollView control: __control + + /*! This property controls the frame border padding of the scrollView. */ + padding {left: 1; top: 1; right: 1; bottom: 1} + + /*! This Component paints the corner area between scroll bars */ + property Component corner: Rectangle { color: "#ccc" } + + /*! This component determines if the flickable should reposition itself at the + mouse location when clicked. */ + property bool scrollToClickedPosition: true + + /*! This property holds whether the scroll bars are transient. Transient scroll bars + appear when the content is scrolled and disappear when they are no longer needed. + + The default value is platform dependent. */ + property bool transientScrollBars: Settings.hasTouchScreen + + /*! This Component paints the frame around scroll bars. */ + property Component frame: Rectangle { + color: control["backgroundVisible"] ? "white": "transparent" + border.color: "#999" + border.width: 1 + radius: 1 + visible: control.frameVisible + } + + /*! This is the minimum extent of the scroll bar handle. + + The default value is \c 30. + */ + + property int minimumHandleLength: 30 + + /*! This property controls the edge overlap + between the handle and the increment/decrement buttons. + + The default value is \c 30. + */ + + property int handleOverlap: 1 + + /*! This component controls the appearance of the + scroll bar background. + + You can access the following state properties: + + \table + \row \li property bool \b styleData.hovered + \row \li property bool \b styleData.horizontal + \endtable + */ + + property Component scrollBarBackground: Item { + property bool sticky: false + property bool hovered: styleData.hovered + implicitWidth: Math.round(TextSingleton.implicitHeight) + implicitHeight: Math.round(TextSingleton.implicitHeight) + clip: true + opacity: transientScrollBars ? 0.5 : 1.0 + visible: !transientScrollBars || sticky + Rectangle { + anchors.fill: parent + color: "#ddd" + border.color: "#aaa" + anchors.rightMargin: styleData.horizontal ? -2 : -1 + anchors.leftMargin: styleData.horizontal ? -2 : 0 + anchors.topMargin: styleData.horizontal ? 0 : -2 + anchors.bottomMargin: styleData.horizontal ? -1 : -2 + } + onHoveredChanged: if (hovered) sticky = true + onVisibleChanged: if (!visible) sticky = false + } + + /*! This component controls the appearance of the + scroll bar handle. + + You can access the following state properties: + + \table + \row \li property bool \b styleData.hovered + \row \li property bool \b styleData.pressed + \row \li property bool \b styleData.horizontal + \endtable + */ + + property Component handle: Item { + property bool sticky: false + property bool hovered: __activeControl !== "none" + implicitWidth: Math.round(TextSingleton.implicitHeight) + 1 + implicitHeight: Math.round(TextSingleton.implicitHeight) + 1 + BorderImage { + id: img + opacity: styleData.pressed && !transientScrollBars ? 0.5 : styleData.hovered ? 1 : 0.8 + source: "images/scrollbar-handle-" + (transientScrollBars ? "transient" : styleData.horizontal ? "horizontal" : "vertical") + ".png" + border.left: transientScrollBars ? 5 : 2 + border.top: transientScrollBars ? 5 : 2 + border.right: transientScrollBars ? 5 : 2 + border.bottom: transientScrollBars ? 5 : 2 + anchors.top: !styleData.horizontal ? parent.top : undefined + anchors.margins: transientScrollBars ? 2 : 0 + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.left: styleData.horizontal ? parent.left : undefined + width: !styleData.horizontal && transientScrollBars ? sticky ? 13 : 10 : parent.width + height: styleData.horizontal && transientScrollBars ? sticky ? 13 : 10 : parent.height + Behavior on width { enabled: !styleData.horizontal && transientScrollBars; NumberAnimation { duration: 100 } } + Behavior on height { enabled: styleData.horizontal && transientScrollBars; NumberAnimation { duration: 100 } } + } + onHoveredChanged: if (hovered) sticky = true + onVisibleChanged: if (!visible) sticky = false + } + + /*! This component controls the appearance of the + scroll bar increment button. + + You can access the following state properties: + + \table + \row \li property bool \b styleData.hovered + \row \li property bool \b styleData.pressed + \row \li property bool \b styleData.horizontal + \endtable + */ + property Component incrementControl: Rectangle { + visible: !transientScrollBars + implicitWidth: transientScrollBars ? 0 : Math.round(TextSingleton.implicitHeight) + implicitHeight: transientScrollBars ? 0 : Math.round(TextSingleton.implicitHeight) + Rectangle { + anchors.fill: parent + anchors.bottomMargin: -1 + anchors.rightMargin: -1 + border.color: "#aaa" + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + border.color: "#44ffffff" + } + Image { + source: styleData.horizontal ? "images/arrow-right.png" : "images/arrow-down.png" + anchors.centerIn: parent + opacity: control.enabled ? 0.6 : 0.5 + } + gradient: Gradient { + GradientStop {color: styleData.pressed ? "lightgray" : "white" ; position: 0} + GradientStop {color: styleData.pressed ? "lightgray" : "lightgray" ; position: 1} + } + } + } + + /*! This component controls the appearance of the + scroll bar decrement button. + + You can access the following state properties: + + \table + \row \li property bool \b styleData.hovered + \row \li property bool \b styleData.pressed + \row \li property bool \b styleData.horizontal + \endtable + */ + property Component decrementControl: Rectangle { + visible: !transientScrollBars + implicitWidth: transientScrollBars ? 0 : Math.round(TextSingleton.implicitHeight) + implicitHeight: transientScrollBars ? 0 : Math.round(TextSingleton.implicitHeight) + Rectangle { + anchors.fill: parent + anchors.topMargin: styleData.horizontal ? 0 : -1 + anchors.leftMargin: styleData.horizontal ? -1 : 0 + anchors.bottomMargin: styleData.horizontal ? -1 : 0 + anchors.rightMargin: styleData.horizontal ? 0 : -1 + color: "lightgray" + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + border.color: "#44ffffff" + } + Image { + source: styleData.horizontal ? "images/arrow-left.png" : "images/arrow-up.png" + anchors.centerIn: parent + anchors.verticalCenterOffset: styleData.horizontal ? 0 : -1 + anchors.horizontalCenterOffset: styleData.horizontal ? -1 : 0 + opacity: control.enabled ? 0.6 : 0.5 + } + gradient: Gradient { + GradientStop {color: styleData.pressed ? "lightgray" : "white" ; position: 0} + GradientStop {color: styleData.pressed ? "lightgray" : "lightgray" ; position: 1} + } + border.color: "#aaa" + } + } + + /*! \internal */ + property Component __scrollbar: Item { + id: panel + property string activeControl: "none" + property bool scrollToClickPosition: true + property bool isTransient: transientScrollBars + + property bool on: false + property bool raised: false + property bool sunken: __styleData.upPressed | __styleData.downPressed | __styleData.handlePressed + + states: State { + name: "out" + when: isTransient && panel.activeControl === "none" && !panel.on && !panel.raised + PropertyChanges { target: panel; opacity: 0 } + } + + transitions: Transition { + to: "out" + SequentialAnimation { + PauseAnimation { duration: 450 } + NumberAnimation { properties: "opacity"; duration: 200 } + PropertyAction { target: panel; property: "visible"; value: false } + } + } + + implicitWidth: __styleData.horizontal ? 200 : bg.implicitWidth + implicitHeight: __styleData.horizontal ? bg.implicitHeight : 200 + + function pixelMetric(arg) { + if (arg === "scrollbarExtent") + return (__styleData.horizontal ? bg.height : bg.width); + return 0; + } + + function styleHint(arg) { + return false; + } + + function hitTest(argX, argY) { + if (itemIsHit(handleControl, argX, argY)) + return "handle" + else if (itemIsHit(incrementLoader, argX, argY)) + return "up"; + else if (itemIsHit(decrementLoader, argX, argY)) + return "down"; + else if (itemIsHit(bg, argX, argY)) { + if (__styleData.horizontal && argX < handleControl.x || !__styleData.horizontal && argY < handleControl.y) + return "upPage" + else + return "downPage" + } + + return "none"; + } + + function subControlRect(arg) { + if (arg === "handle") { + return Qt.rect(handleControl.x, handleControl.y, handleControl.width, handleControl.height); + } else if (arg === "groove") { + if (__styleData.horizontal) { + return Qt.rect(incrementLoader.width - handleOverlap, + 0, + __control.width - (incrementLoader.width + decrementLoader.width - handleOverlap * 2), + __control.height); + } else { + return Qt.rect(0, + incrementLoader.height - handleOverlap, + __control.width, + __control.height - (incrementLoader.height + decrementLoader.height - handleOverlap * 2)); + } + } + return Qt.rect(0,0,0,0); + } + + function itemIsHit(argItem, argX, argY) { + var pos = argItem.mapFromItem(__control, argX, argY); + return (pos.x >= 0 && pos.x <= argItem.width && pos.y >= 0 && pos.y <= argItem.height); + } + + Loader { + id: incrementLoader + anchors.top: parent.top + anchors.left: parent.left + sourceComponent: decrementControl + property QtObject styleData: QtObject { + readonly property bool hovered: activeControl === "up" + readonly property bool pressed: __styleData.upPressed + readonly property bool horizontal: __styleData.horizontal + } + } + + Loader { + id: bg + anchors.top: __styleData.horizontal ? undefined : incrementLoader.bottom + anchors.bottom: __styleData.horizontal ? undefined : decrementLoader.top + anchors.left: __styleData.horizontal ? incrementLoader.right : undefined + anchors.right: __styleData.horizontal ? decrementLoader.left : undefined + sourceComponent: scrollBarBackground + property QtObject styleData: QtObject { + readonly property bool horizontal: __styleData.horizontal + readonly property bool hovered: activeControl !== "none" + } + } + + Loader { + id: decrementLoader + anchors.bottom: __styleData.horizontal ? undefined : parent.bottom + anchors.right: __styleData.horizontal ? parent.right : undefined + sourceComponent: incrementControl + property QtObject styleData: QtObject { + readonly property bool hovered: activeControl === "down" + readonly property bool pressed: __styleData.downPressed + readonly property bool horizontal: __styleData.horizontal + } + } + + property var flickableItem: control.flickableItem + property int extent: Math.max(minimumHandleLength, __styleData.horizontal ? + (flickableItem ? flickableItem.width/flickableItem.contentWidth : 0 ) * bg.width : + (flickableItem ? flickableItem.height/flickableItem.contentHeight : 0) * bg.height) + + Loader { + id: handleControl + height: __styleData.horizontal ? implicitHeight : extent + width: __styleData.horizontal ? extent : implicitWidth + anchors.top: bg.top + anchors.left: bg.left + anchors.topMargin: __styleData.horizontal ? 0 : -handleOverlap + (__control.value / __control.maximumValue) * (bg.height + 2 * handleOverlap- height) + anchors.leftMargin: __styleData.horizontal ? -handleOverlap + (__control.value / __control.maximumValue) * (bg.width + 2 * handleOverlap - width) : 0 + sourceComponent: handle + property QtObject styleData: QtObject { + readonly property bool hovered: activeControl === "handle" + readonly property bool pressed: __styleData.handlePressed + readonly property bool horizontal: __styleData.horizontal + } + readonly property alias __activeControl: panel.activeControl + } + } + + /*! \internal */ + property bool __externalScrollBars: false + /*! \internal */ + property int __scrollBarSpacing: 4 +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SliderStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SliderStyle.qml new file mode 100644 index 00000000000..a62230bcf52 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SliderStyle.qml @@ -0,0 +1,234 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype SliderStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup controlsstyling + \brief Provides custom styling for Slider + + The slider style allows you to create a custom appearance for + a \l Slider control. + + The implicit size of the slider is calculated based on the + maximum implicit size of the \c background and \c handle + delegates combined. + + Example: + \qml + Slider { + anchors.centerIn: parent + style: SliderStyle { + groove: Rectangle { + implicitWidth: 200 + implicitHeight: 8 + color: "gray" + radius: 8 + } + handle: Rectangle { + anchors.centerIn: parent + color: control.pressed ? "white" : "lightgray" + border.color: "gray" + border.width: 2 + width: 34 + height: 34 + radius: 12 + } + } + } + \endqml +*/ +Style { + id: styleitem + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + /*! The \l Slider attached to this style. */ + readonly property Slider control: __control + + padding { top: 0 ; left: 0 ; right: 0 ; bottom: 0 } + + /*! This property holds the item for the slider handle. + You can access the slider through the \c control property + */ + property Component handle: Item{ + implicitWidth: implicitHeight + implicitHeight: TextSingleton.implicitHeight * 1.2 + + FastGlow { + source: handle + anchors.fill: parent + anchors.bottomMargin: -1 + anchors.topMargin: 1 + smooth: true + color: "#11000000" + spread: 0.8 + transparentBorder: true + blur: 0.1 + + } + Rectangle { + id: handle + anchors.fill: parent + + radius: width/2 + gradient: Gradient { + GradientStop { color: control.pressed ? "#e0e0e0" : "#fff" ; position: 1 } + GradientStop { color: "#eee" ; position: 0 } + } + Rectangle { + anchors.fill: parent + anchors.margins: 1 + radius: width/2 + border.color: "#99ffffff" + color: control.activeFocus ? "#224f7fbf" : "transparent" + } + border.color: control.activeFocus ? "#47b" : "#777" + } + + } + /*! This property holds the background groove of the slider. + + You can access the handle position through the \c styleData.handlePosition property. + */ + property Component groove: Item { + property color fillColor: "#49d" + anchors.verticalCenter: parent.verticalCenter + implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5) + implicitHeight: Math.max(6, Math.round(TextSingleton.implicitHeight * 0.3)) + Rectangle { + radius: height/2 + anchors.fill: parent + border.width: 1 + border.color: "#888" + gradient: Gradient { + GradientStop { color: "#bbb" ; position: 0 } + GradientStop { color: "#ccc" ; position: 0.6 } + GradientStop { color: "#ccc" ; position: 1 } + } + } + Item { + clip: true + width: styleData.handlePosition + height: parent.height + Rectangle { + anchors.fill: parent + border.color: Qt.darker(fillColor, 1.2) + radius: height/2 + gradient: Gradient { + GradientStop {color: Qt.lighter(fillColor, 1.3) ; position: 0} + GradientStop {color: fillColor ; position: 1.4} + } + } + } + } + + /*! This property holds the tick mark labels + \since QtQuick.Controls.Styles 1.1 + + You can access the handle width through the \c styleData.handleWidth property. + */ + property Component tickmarks: Repeater { + id: repeater + model: control.stepSize > 0 ? 1 + (control.maximumValue - control.minimumValue) / control.stepSize : 0 + Rectangle { + color: "#777" + width: 1 ; height: 3 + y: repeater.height + x: styleData.handleWidth / 2 + index * ((repeater.width - styleData.handleWidth) / (repeater.count-1)) + } + } + + /*! This property holds the slider style panel. + + Note that it is generally not recommended to override this. + */ + property Component panel: Item { + id: root + property int handleWidth: handleLoader.width + property int handleHeight: handleLoader.height + + property bool horizontal : control.orientation === Qt.Horizontal + property int horizontalSize: grooveLoader.implicitWidth + padding.left + padding.right + property int verticalSize: Math.max(handleLoader.implicitHeight, grooveLoader.implicitHeight) + padding.top + padding.bottom + + implicitWidth: horizontal ? horizontalSize : verticalSize + implicitHeight: horizontal ? verticalSize : horizontalSize + + y: horizontal ? 0 : height + rotation: horizontal ? 0 : -90 + transformOrigin: Item.TopLeft + + Item { + + anchors.fill: parent + + Loader { + id: grooveLoader + property QtObject styleData: QtObject { + readonly property int handlePosition: handleLoader.x + handleLoader.width/2 + } + x: padding.left + sourceComponent: groove + width: (horizontal ? parent.width : parent.height) - padding.left - padding.right + y: Math.round(padding.top + (Math.round(horizontal ? parent.height : parent.width - padding.top - padding.bottom) - grooveLoader.item.height)/2) + } + Loader { + id: tickMarkLoader + anchors.fill: parent + sourceComponent: control.tickmarksEnabled ? tickmarks : null + property QtObject styleData: QtObject { readonly property int handleWidth: control.__panel.handleWidth } + } + Loader { + id: handleLoader + sourceComponent: handle + anchors.verticalCenter: grooveLoader.verticalCenter + x: Math.round((control.__handlePos - control.minimumValue) / (control.maximumValue - control.minimumValue) * ((horizontal ? root.width : root.height) - item.width)) + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SpinBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SpinBoxStyle.qml new file mode 100644 index 00000000000..9f1b565d324 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SpinBoxStyle.qml @@ -0,0 +1,207 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype SpinBoxStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.2 + \ingroup controlsstyling + \brief Provides custom styling for SpinBox + + Example: + \qml + SpinBox { + style: SpinBoxStyle{ + background: Rectangle { + implicitWidth: 100 + implicitHeight: 20 + border.color: "gray" + radius: 2 + } + } + } + \endqml +*/ + +Style { + id: spinboxStyle + + /*! The \l SpinBox attached to this style. */ + readonly property SpinBox control: __control + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + + /*! The content margins of the text field. */ + padding { top: 1 ; left: Math.round(TextSingleton.implicitHeight/2) ; right: Math.round(TextSingleton.implicitHeight) ; bottom: 0 } + + /*! \qmlproperty enumeration horizontalAlignment + + This property defines the default text aligment. + + The supported values are: + \list + \li Qt.AlignLeft + \li Qt.AlignHCenter + \li Qt.AlignRight + \endlist + + The default value is Qt.AlignRight + */ + property int horizontalAlignment: Qt.AlignRight + + /*! The text color. */ + property color textColor: __syspal.text + + /*! The text highlight color, used behind selections. */ + property color selectionColor: __syspal.highlight + + /*! The highlighted text color, used in selections. */ + property color selectedTextColor: __syspal.highlightedText + + /*! + \qmlproperty enumeration renderType + + Override the default rendering type for the control. + + Supported render types are: + \list + \li Text.QtRendering + \li Text.NativeRendering - the default + \endlist + + \sa Text::renderType + */ + property int renderType: Text.NativeRendering + + /*! The button used to increment the value. */ + property Component incrementControl: Item { + implicitWidth: padding.right + Image { + source: "images/arrow-up.png" + anchors.centerIn: parent + anchors.verticalCenterOffset: 1 + opacity: control.enabled ? (styleData.upPressed ? 1 : 0.6) : 0.5 + } + } + + /*! The button used to decrement the value. */ + property Component decrementControl: Item { + implicitWidth: padding.right + Image { + source: "images/arrow-down.png" + anchors.centerIn: parent + anchors.verticalCenterOffset: -2 + opacity: control.enabled ? (styleData.downPressed ? 1 : 0.6) : 0.5 + } + } + + /*! The background of the SpinBox. */ + property Component background: Item { + implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2)) + implicitWidth: styleData.contentWidth + 26 + Rectangle { + anchors.fill: parent + anchors.bottomMargin: -1 + color: "#44ffffff" + radius: baserect.radius + } + Rectangle { + id: baserect + gradient: Gradient { + GradientStop {color: "#eee" ; position: 0} + GradientStop {color: "#fff" ; position: 0.1} + GradientStop {color: "#fff" ; position: 1} + } + radius: TextSingleton.implicitHeight * 0.16 + anchors.fill: parent + border.color: control.activeFocus ? "#47b" : "#999" + } + } + + /*! \internal */ + property Component panel: Item { + id: styleitem + implicitWidth: backgroundLoader.implicitWidth + implicitHeight: backgroundLoader.implicitHeight + + property color foregroundColor: spinboxStyle.textColor + property color selectionColor: spinboxStyle.selectionColor + property color selectedTextColor: spinboxStyle.selectedTextColor + + property var margins: spinboxStyle.padding + + property rect upRect: Qt.rect(width - incrementControlLoader.implicitWidth, 0, incrementControlLoader.implicitWidth, height / 2 + 1) + property rect downRect: Qt.rect(width - decrementControlLoader.implicitWidth, height / 2, decrementControlLoader.implicitWidth, height / 2) + + property int horizontalAlignment: spinboxStyle.horizontalAlignment + property int verticalAlignment: Qt.AlignVCenter + + Loader { + id: backgroundLoader + anchors.fill: parent + sourceComponent: background + } + + Loader { + id: incrementControlLoader + x: upRect.x + y: upRect.y + width: upRect.width + height: upRect.height + sourceComponent: incrementControl + } + + Loader { + id: decrementControlLoader + x: downRect.x + y: downRect.y + width: downRect.width + height: downRect.height + sourceComponent: decrementControl + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/StatusBarStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/StatusBarStyle.qml new file mode 100644 index 00000000000..aa8f6d6e9f6 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/StatusBarStyle.qml @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype StatusBarStyle + \inqmlmodule QtQuick.Controls.Styles + \ingroup controlsstyling + \since 5.2 + \brief Provides custom styling for StatusBar + + The status bar can be defined by overriding the background component and + setting the content padding. + + Example: + \qml + StatusBar { + style: StatusBarStyle { + padding { + left: 8 + right: 8 + top: 3 + bottom: 3 + } + background: Rectangle { + implicitHeight: 16 + implicitWidth: 200 + gradient: Gradient{ + GradientStop{color: "#eee" ; position: 0} + GradientStop{color: "#ccc" ; position: 1} + } + Rectangle { + anchors.top: parent.top + width: parent.width + height: 1 + color: "#999" + } + } + } + } + \endqml +*/ + +Style { + + /*! The content padding inside the status bar. */ + padding { + left: 3 + right: 3 + top: 3 + bottom: 2 + } + + /*! This defines the background of the tool bar. */ + property Component background: Rectangle { + implicitHeight: 16 + implicitWidth: 200 + + gradient: Gradient{ + GradientStop{color: "#eee" ; position: 0} + GradientStop{color: "#ccc" ; position: 1} + } + + Rectangle { + anchors.top: parent.top + width: parent.width + height: 1 + color: "#999" + } + } + + property Component panel: Loader { + sourceComponent: background + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SwitchStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SwitchStyle.qml new file mode 100644 index 00000000000..687966453e9 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/SwitchStyle.qml @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.2 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype SwitchStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.2 + \ingroup controlsstyling + \brief Provides custom styling for Switch + + Example: + \qml + Switch { + style: SwitchStyle { + groove: Rectangle { + implicitWidth: 100 + implicitHeight: 20 + radius: 9 + border.color: control.activeFocus ? "darkblue" : "gray" + border.width: 1 + } + } + } + \endqml +*/ +Style { + id: switchstyle + + /*! The content padding. */ + padding { + top: 0 + left: 0 + right: 0 + bottom: 0 + } + + /*! This defines the switch handle. */ + property Component handle: Rectangle { + opacity: control.enabled ? 1.0 : 0.5 + implicitWidth: Math.round((parent.parent.width - padding.left - padding.right)/2) + implicitHeight: control.height - padding.top - padding.bottom + + border.color: control.activeFocus ? Qt.darker(__syspal.highlight, 2) : Qt.darker(__syspal.button, 2) + property color bg: control.activeFocus ? Qt.darker(__syspal.highlight, 1.2) : __syspal.button + gradient: Gradient { + GradientStop {color: Qt.lighter(bg, 1.4) ; position: 0} + GradientStop {color: bg ; position: 1} + } + + radius: 2 + } + + /*! This property holds the background groove of the switch. */ + property Component groove: Rectangle { + property color shadow: control.checked ? Qt.darker(__syspal.highlight, 1.2): "#999" + property color bg: control.checked ? __syspal.highlight:"#bbb" + + implicitWidth: Math.round(implicitHeight * 3) + implicitHeight: Math.max(16, Math.round(TextSingleton.implicitHeight)) + + border.color: "gray" + color: "red" + + radius: 2 + Behavior on shadow {ColorAnimation{ duration: 80 }} + Behavior on bg {ColorAnimation{ duration: 80 }} + gradient: Gradient { + GradientStop {color: shadow; position: 0} + GradientStop {color: bg ; position: 0.2} + GradientStop {color: bg ; position: 1} + } + Rectangle { + color: "#44ffffff" + height: 1 + anchors.bottom: parent.bottom + anchors.bottomMargin: -1 + width: parent.width - 2 + x: 1 + } + } + + /*! \internal */ + property Component panel: Item { + + implicitWidth: Math.round(grooveLoader.width + padding.left + padding.right) + implicitHeight: grooveLoader.implicitHeight + padding.top + padding.bottom + + property var __groove: grooveLoader + property var __handle: handleLoader + property bool enableAnimation: false + + Loader { + id: grooveLoader + y: padding.top + x: padding.left + + sourceComponent: groove + anchors.verticalCenter: parent.verticalCenter + + + Loader { + id: handleLoader + + z:1 + anchors.top: grooveLoader.top + anchors.bottom: grooveLoader.bottom + anchors.topMargin: padding.top + anchors.bottomMargin: padding.bottom + + Behavior on x { + id: behavior + enabled: enableAnimation + NumberAnimation { + duration: 150 + easing.type: Easing.OutCubic + } + } + + sourceComponent: handle + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TabViewStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TabViewStyle.qml new file mode 100644 index 00000000000..430dd02fa47 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TabViewStyle.qml @@ -0,0 +1,190 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype TabViewStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup viewsstyling + \brief Provides custom styling for TabView + +\qml + TabView { + id: frame + anchors.fill: parent + anchors.margins: 4 + Tab { title: "Tab 1" } + Tab { title: "Tab 2" } + Tab { title: "Tab 3" } + + style: TabViewStyle { + frameOverlap: 1 + tab: Rectangle { + color: styleData.selected ? "steelblue" :"lightsteelblue" + border.color: "steelblue" + implicitWidth: Math.max(text.width + 4, 80) + implicitHeight: 20 + radius: 2 + Text { + id: text + anchors.centerIn: parent + text: styleData.title + color: styleData.selected ? "white" : "black" + } + } + frame: Rectangle { color: "steelblue" } + } + } +\endqml + +*/ + +Style { + + /*! The \l ScrollView attached to this style. */ + readonly property TabView control: __control + + /*! This property holds whether the user can move the tabs. + Tabs are not movable by default. */ + property bool tabsMovable: false + + /*! This property holds the horizontal alignment of + the tab buttons. Supported values are: + \list + \li Qt.AlignLeft (default) + \li Qt.AlignHCenter + \li Qt.AlignRight + \endlist + */ + property int tabsAlignment: Qt.AlignLeft + + /*! This property holds the amount of overlap there are between + individual tab buttons. */ + property int tabOverlap: 1 + + /*! This property holds the amount of overlap there are between + individual tab buttons and the frame. */ + property int frameOverlap: 2 + + /*! This defines the tab frame. */ + property Component frame: Rectangle { + color: "#dcdcdc" + border.color: "#aaa" + + Rectangle { + anchors.fill: parent + color: "transparent" + border.color: "#66ffffff" + anchors.margins: 1 + } + } + + /*! This defines the tab. You can access the tab state through the + \c styleData property, with the following properties: + + \table + \row \li readonly property int \b styleData.index \li This is the current tab index. + \row \li readonly property bool \b styleData.selected \li This is the active tab. + \row \li readonly property string \b styleData.title \li Tab title text. + \row \li readonly property bool \b styleData.nextSelected \li The next tab is selected. + \row \li readonly property bool \b styleData.previousSelected \li The previous tab is selected. + \row \li readonly property bool \b styleData.hovered \li The tab is being hovered. + \row \li readonly property bool \b styleData.activeFocus \li The tab button has keyboard focus. + \row \li readonly property bool \b styleData.availableWidth \li The available width for the tabs. + \endtable + */ + property Component tab: Item { + scale: control.tabPosition === Qt.TopEdge ? 1 : -1 + + property int totalOverlap: tabOverlap * (control.count - 1) + property real maxTabWidth: (styleData.availableWidth + totalOverlap) / control.count + + implicitWidth: Math.round(Math.min(maxTabWidth, textitem.implicitWidth + 20)) + implicitHeight: Math.round(textitem.implicitHeight + 10) + + clip: true + Item { + anchors.fill: parent + anchors.bottomMargin: styleData.selected ? 0 : 2 + clip: true + BorderImage { + anchors.fill: parent + source: styleData.selected ? "images/tab_selected.png" : "images/tab.png" + border.top: 6 + border.bottom: 6 + border.left: 6 + border.right: 6 + anchors.topMargin: styleData.selected ? 0 : 1 + } + } + Rectangle { + anchors.fill: textitem + anchors.margins: -1 + anchors.leftMargin: -3 + anchors.rightMargin: -3 + visible: (styleData.activeFocus && styleData.selected) + height: 6 + radius: 3 + color: "#224f9fef" + border.color: "#47b" + } + Text { + id: textitem + anchors.centerIn: parent + anchors.alignWhenCentered: true + text: styleData.title + renderType: Text.NativeRendering + scale: control.tabPosition === Qt.TopEdge ? 1 : -1 + color: __syspal.text + } + } + + /*! This defines the left corner. */ + property Component leftCorner: null + + /*! This defines the right corner. */ + property Component rightCorner: null + + /*! This defines the tab bar background. */ + property Component tabBar: null +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TableViewStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TableViewStyle.qml new file mode 100644 index 00000000000..512b0cfef7d --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TableViewStyle.qml @@ -0,0 +1,142 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype TableViewStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup viewsstyling + \brief Provides custom styling for TableView + + Note that this class derives from \l ScrollViewStyle + and supports all of the properties defined there. +*/ +ScrollViewStyle { + id: root + + /*! The \l TableView attached to this style. */ + readonly property TableView control: __control + + /*! The text color. */ + property color textColor: __syspal.text + + /*! The background color. */ + property color backgroundColor: control.backgroundVisible ? __syspal.base : "transparent" + + /*! The alternate background color. */ + property color alternateBackgroundColor: "#f5f5f5" + + /*! The text highlight color, used within selections. */ + property color highlightedTextColor: "white" + + /*! Activates items on single click. */ + property bool activateItemOnSingleClick: false + + padding.top: control.headerVisible ? 0 : 1 + + /*! \qmlproperty Component TableViewStyle::headerDelegate + Delegate for header. This delegate is described in \l {TableView::headerDelegate} + */ + property Component headerDelegate: BorderImage { + height: textItem.implicitHeight * 1.2 + source: "images/header.png" + border.left: 4 + border.bottom: 2 + border.top: 2 + Text { + id: textItem + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignLeft + anchors.leftMargin: 12 + text: styleData.value + elide: Text.ElideRight + color: textColor + renderType: Text.NativeRendering + } + Rectangle { + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.bottomMargin: 1 + anchors.topMargin: 1 + width: 1 + color: "#ccc" + } + } + + /*! \qmlproperty Component TableViewStyle::rowDelegate + Delegate for header. This delegate is described in \l {TableView::rowDelegate} + */ + property Component rowDelegate: Rectangle { + height: Math.round(TextSingleton.implicitHeight * 1.2) + property color selectedColor: styleData.hasActiveFocus ? "#07c" : "#999" + color: styleData.selected ? selectedColor : + !styleData.alternate ? alternateBackgroundColor : backgroundColor + } + + /*! \qmlproperty Component TableViewStyle::itemDelegate + Delegate for item. This delegate is described in \l {TableView::itemDelegate} + */ + property Component itemDelegate: Item { + height: Math.max(16, label.implicitHeight) + property int implicitWidth: label.implicitWidth + 20 + + Text { + id: label + objectName: "label" + width: parent.width + anchors.leftMargin: 12 + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: styleData.textAlignment + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: 1 + elide: styleData.elideMode + text: styleData.value !== undefined ? styleData.value : "" + color: styleData.textColor + renderType: Text.NativeRendering + } + } +} + diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TextAreaStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TextAreaStyle.qml new file mode 100644 index 00000000000..c974c01dac7 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TextAreaStyle.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype TextAreaStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.2 + \ingroup controlsstyling + \brief Provides custom styling for TextArea. + + Example: + \qml + TextArea { + style: TextAreaStyle { + textColor: "#333" + selectionColor: "steelblue" + selectedTextColor: "#eee" + backgroundColor: "#eee" + } + } + \endqml +*/ + +ScrollViewStyle { + id: style + + /*! The \l TextArea attached to this style. */ + readonly property TextArea control: __control + + /*! The current font. */ + property font font + + /*! The text color. */ + property color textColor: __syspal.text + + /*! The text highlight color, used behind selections. */ + property color selectionColor: __syspal.highlight + + /*! The highlighted text color, used in selections. */ + property color selectedTextColor: __syspal.highlightedText + + /*! The background color. */ + property color backgroundColor: control.backgroundVisible ? __syspal.base : "transparent" + + /*! + \qmlproperty enumeration renderType + + Override the default rendering type for the control. + + Supported render types are: + \list + \li Text.QtRendering + \li Text.NativeRendering - the default + \endlist + + \sa Text::renderType + */ + property int renderType: Text.NativeRendering +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TextFieldStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TextFieldStyle.qml new file mode 100644 index 00000000000..8b4494d1864 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/TextFieldStyle.qml @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype TextFieldStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup controlsstyling + \brief Provides custom styling for TextField. + + Example: + \qml + TextField { + style: TextFieldStyle { + textColor: "black" + background: Rectangle { + radius: 2 + implicitWidth: 100 + implicitHeight: 24 + border.color: "#333" + border.width: 1 + } + } + } + \endqml +*/ + +Style { + id: style + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + /*! The \l TextField attached to this style. */ + readonly property TextField control: __control + + /*! The content margins of the text field. */ + padding { top: 4 ; left: TextSingleton.implicitHeight/3 ; right: TextSingleton.implicitHeight/3 ; bottom:4 } + + /*! The current font. */ + property font font + + /*! The text color. */ + property color textColor: __syspal.text + + /*! The text highlight color, used behind selections. */ + property color selectionColor: __syspal.highlight + + /*! The highlighted text color, used in selections. */ + property color selectedTextColor: __syspal.highlightedText + + /*! + \qmlproperty enumeration renderType + + Override the default rendering type for the control. + + Supported render types are: + \list + \li Text.QtRendering + \li Text.NativeRendering - the default + \endlist + + \sa Text::renderType + */ + property int renderType: Text.NativeRendering + + /*! The placeholder text color, used when the text field is empty. + \since 5.2 + */ + property color placeholderTextColor: Qt.rgba(0, 0, 0, 0.5) + + /*! The background of the text field. */ + property Component background: Item { + implicitWidth: Math.round(TextSingleton.implicitHeight * 8) + implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2)) + Rectangle { + anchors.fill: parent + anchors.bottomMargin: -1 + color: "#44ffffff" + radius: baserect.radius + } + Rectangle { + id: baserect + gradient: Gradient { + GradientStop {color: "#e0e0e0" ; position: 0} + GradientStop {color: "#fff" ; position: 0.1} + GradientStop {color: "#fff" ; position: 1} + } + radius: TextSingleton.implicitHeight * 0.16 + anchors.fill: parent + border.color: control.activeFocus ? "#47b" : "#999" + } + } + + /*! \internal */ + property Component panel: Item { + anchors.fill: parent + + property int topMargin: padding.top + property int leftMargin: padding.left + property int rightMargin: padding.right + property int bottomMargin: padding.bottom + + property color textColor: style.textColor + property color selectionColor: style.selectionColor + property color selectedTextColor: style.selectedTextColor + + implicitWidth: backgroundLoader.implicitWidth ? backgroundLoader.implicitWidth : 100 + implicitHeight: backgroundLoader.implicitHeight ? backgroundLoader.implicitHeight : 20 + + property color placeholderTextColor: style.placeholderTextColor + property font font: style.font + + Loader { + id: backgroundLoader + sourceComponent: background + anchors.fill: parent + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ToolBarStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ToolBarStyle.qml new file mode 100644 index 00000000000..ca5d93fbae0 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ToolBarStyle.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ToolBarStyle + \inqmlmodule QtQuick.Controls.Styles + \ingroup controlsstyling + \since 5.2 + \brief Provides custom styling for ToolBar + + The tool bar can be defined by overriding the background component and + setting the content padding. + + Example: + \qml + ToolBar { + style: ToolBarStyle { + padding { + left: 8 + right: 8 + top: 3 + bottom: 3 + } + background: Rectangle { + implicitWidth: 100 + implicitHeight: 40 + border.color: "#999" + gradient: Gradient { + GradientStop { position: 0 ; color: "#fff" } + GradientStop { position: 1 ; color: "#eee" } + } + } + } + } + \endqml +*/ + +Style { + + /*! The content padding inside the tool bar. */ + padding { + left: 6 + right: 6 + top: 3 + bottom: 3 + } + + /*! This defines the background of the tool bar. */ + property Component background: Item { + implicitHeight: 40 + implicitWidth: 200 + Rectangle { + anchors.fill: parent + gradient: Gradient{ + GradientStop{color: "#eee" ; position: 0} + GradientStop{color: "#ccc" ; position: 1} + } + Rectangle { + anchors.bottom: parent.bottom + width: parent.width + height: 1 + color: "#999" + } + } + } + + property Component panel: Loader { + sourceComponent: background + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ToolButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ToolButtonStyle.qml new file mode 100644 index 00000000000..dcdfe4dee8a --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Base/ToolButtonStyle.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ToolButtonStyle + \internal + \ingroup controlsstyling + \inqmlmodule QtQuick.Controls.Styles +*/ +Style { + readonly property ToolButton control: __control + property Component panel: Item { + id: styleitem + implicitWidth: (hasIcon ? 36 : Math.max(label.implicitWidth + frame.border.left + frame.border.right, 36)) + + (arrow.visible ? 10 : 0) + implicitHeight: hasIcon ? 36 : Math.max(label.implicitHeight, 36) + + readonly property bool hasIcon: icon.status === Image.Ready || icon.status === Image.Loading + + Rectangle { + anchors.fill: parent + visible: control.pressed || (control.checkable && control.checked) + color: "lightgray" + radius:4 + border.color: "#aaa" + } + Item { + anchors.left: parent.left + anchors.right: arrow.left + anchors.top: parent.top + anchors.bottom: parent.bottom + clip: true + Text { + id: label + visible: !hasIcon + anchors.centerIn: parent + text: control.text + } + Image { + id: icon + anchors.centerIn: parent + source: control.iconSource + } + } + + BorderImage { + id: frame + anchors.fill: parent + anchors.margins: -1 + anchors.topMargin: -2 + anchors.rightMargin: 0 + source: "images/focusframe.png" + visible: control.activeFocus + border.left: 4 + border.right: 4 + border.top: 4 + border.bottom: 4 + } + + Image { + id: arrow + visible: control.menu !== null + source: visible ? "images/arrow-down.png" : "" + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: visible ? 3 : 0 + opacity: control.enabled ? 0.7 : 0.5 + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/BusyIndicatorStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/BusyIndicatorStyle.qml new file mode 100644 index 00000000000..99f37919f91 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/BusyIndicatorStyle.qml @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick.Controls.Styles 1.1 + +BusyIndicatorStyle { } diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ButtonStyle.qml new file mode 100644 index 00000000000..33e8f0eeda3 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ButtonStyle.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + property Component panel: StyleItem { + id: styleitem + elementType: "button" + sunken: control.pressed || (control.checkable && control.checked) + raised: !(control.pressed || (control.checkable && control.checked)) + hover: control.hovered + text: control.iconSource === "" ? "" : control.text + hasFocus: control.activeFocus + hints: control.styleHints + // If no icon, let the style do the drawing + activeControl: control.isDefault ? "default" : "f" + + properties: { + "icon": control.__iconAction.__icon, + "menu": control.menu + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/CheckBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/CheckBoxStyle.qml new file mode 100644 index 00000000000..819c6a81988 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/CheckBoxStyle.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + property Component panel: Item { + anchors.fill: parent + + implicitWidth: styleitem.implicitWidth + implicitHeight: styleitem.implicitHeight + baselineOffset: styleitem.baselineOffset + StyleItem { + id: styleitem + elementType: "checkbox" + sunken: control.pressed + on: control.checked || control.pressed + hover: control.hovered + enabled: control.enabled + hasFocus: control.activeFocus && styleitem.style == "mac" + hints: control.styleHints + properties: {"partiallyChecked": (control.checkedState === Qt.PartiallyChecked) } + contentHeight: textitem.implicitHeight + contentWidth: textitem.implicitWidth + indicatorWidth + property int indicatorWidth: pixelMetric("indicatorwidth") + (macStyle ? 2 : 4) + property bool macStyle: (style === "mac") + + Text { + id: textitem + text: control.text + anchors.left: parent.left + anchors.leftMargin: parent.indicatorWidth + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: parent.macStyle ? 1 : 0 + anchors.right: parent.right + renderType: Text.NativeRendering + elide: Text.ElideRight + enabled: control.enabled + color: __syspal.windowText + StyleItem { + elementType: "focusrect" + anchors.margins: -1 + anchors.leftMargin: -2 + anchors.top: parent.top + anchors.left: parent.left + anchors.bottom: parent.bottom + width: textitem.implicitWidth + 3 + visible: control.activeFocus + } + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ComboBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ComboBoxStyle.qml new file mode 100644 index 00000000000..b36b4c1ddc8 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ComboBoxStyle.qml @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Window 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls.Private 1.0 +import "." as Desktop + +Style { + readonly property ComboBox control: __control + property int drowDownButtonWidth: 24 + property Component panel: Item { + property bool popup: !!styleItem.styleHint("comboboxpopup") + + implicitWidth: 125 + implicitHeight: styleItem.implicitHeight + baselineOffset: styleItem.baselineOffset + anchors.fill: parent + StyleItem { + id: styleItem + + height: parent.height + width: parent.width + elementType: "combobox" + sunken: control.pressed + raised: !sunken + hover: control.hovered + enabled: control.enabled + // The style makes sure the text rendering won't overlap the decoration. + // In that case, 35 pixels margin in this case looks good enough. Worst + // case, the ellipsis will be truncated (2nd worst, not visible at all). + text: elidedText(control.currentText, Text.ElideRight, parent.width - 35) + hasFocus: control.activeFocus + // contentHeight as in QComboBox + contentHeight: Math.max(Math.ceil(textHeight("")), 14) + 2 + + hints: control.styleHints + properties: { + "popup": control.__popup, + "editable" : control.editable + } + } + } + + property Component __popupStyle: MenuStyle { + __menuItemType: "comboboxitem" + } + + property Component __dropDownStyle: Style { + property Component frame: StyleItem { + elementType: "frame" + + width: (parent ? parent.contentWidth : 0) + height: (parent ? parent.contentHeight : 0) + 2 * pixelMetric("defaultframewidth") + property real maxHeight: 600 + property int margin: pixelMetric("menuvmargin") + pixelMetric("menupanelwidth") + } + + property Component menuItem: StyleItem { + elementType: "itemrow" + selected: parent ? parent.selected : false + + x: pixelMetric("defaultframewidth") + y: pixelMetric("defaultframewidth") + + implicitWidth: textItem.contentWidth + implicitHeight: textItem.contentHeight + + StyleItem { + id: textItem + elementType: "item" + contentWidth: textWidth(text) + contentHeight: textHeight(text) + text: parent && parent.parent ? parent.parent.text : "" + selected: parent ? parent.selected : false + } + } + + property Component scrollerStyle: Desktop.ScrollViewStyle { + property bool useScrollers: false + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/FocusFrameStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/FocusFrameStyle.qml new file mode 100644 index 00000000000..0bea860eee4 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/FocusFrameStyle.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype FocusFrameStyle + \internal + \inqmlmodule QtQuick.Controls.Styles +*/ +StyleItem { + property int margin: -3 + anchors.fill: parent + elementType: "focusframe" +} + + diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/GroupBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/GroupBoxStyle.qml new file mode 100644 index 00000000000..cfe02d3f178 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/GroupBoxStyle.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + + +Style { + readonly property GroupBox control: __control + + property var __style: StyleItem { id: style } + property int titleHeight: 18 + + Component.onCompleted: { + var stylename = __style.style + if (stylename.indexOf("windows") > -1) + titleHeight = 9 + } + + padding { + top: Math.round(Settings.dpiScaleFactor * (control.title.length > 0 || control.checkable ? titleHeight : 0) + (style.style == "mac" ? 9 : 6)) + left: Math.round(Settings.dpiScaleFactor * 8) + right: Math.round(Settings.dpiScaleFactor * 8) + bottom: Math.round(Settings.dpiScaleFactor * 7 + (style.style.indexOf("windows") > -1 ? 2 : 0)) + } + + property Component panel: StyleItem { + anchors.fill: parent + id: styleitem + elementType: "groupbox" + text: control.title + on: control.checked + hasFocus: control.__checkbox.activeFocus + activeControl: control.checkable ? "checkbox" : "" + properties: { "checkable" : control.checkable , "sunken" : !control.flat} + textureHeight: 128 + border {top: 32 ; bottom: 8} + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/MenuBarStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/MenuBarStyle.qml new file mode 100644 index 00000000000..a8b389c1a70 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/MenuBarStyle.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + + +Style { + property Component frame: StyleItem { + elementType: "menubar" + contentWidth: control.__contentItem.width + contentHeight: parent ? parent.contentHeight : 0 + width: implicitWidth + 2 * (pixelMetric("menubarhmargin") + pixelMetric("menubarpanelwidth")) + height: implicitHeight + 2 * (pixelMetric("menubarvmargin") + pixelMetric("menubarpanelwidth")) + + pixelMetric("spacebelowmenubar") + + Accessible.role: Accessible.MenuBar + } + + property Component menuItem: StyleItem { + elementType: "menubaritem" + x: pixelMetric("menubarhmargin") + pixelMetric("menubarpanelwidth") + y: pixelMetric("menubarvmargin") + pixelMetric("menubarpanelwidth") + + text: menuItem.title + contentWidth: textWidth(text) + contentHeight: textHeight(text) + width: implicitWidth + pixelMetric("menubaritemspacing") + + enabled: menuItem.enabled + selected: (parent && parent.selected) || sunken + sunken: parent && parent.sunken + + hints: { "showUnderlined": showUnderlined } + + Accessible.role: Accessible.MenuItem + Accessible.name: StyleHelpers.removeMnemonics(text) + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/MenuStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/MenuStyle.qml new file mode 100644 index 00000000000..ad04281de85 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/MenuStyle.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Window 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + id: styleRoot + + property string __menuItemType: "menuitem" + + property Component frame: StyleItem { + elementType: "menu" + + contentWidth: parent ? parent.contentWidth : 0 + contentHeight: parent ? parent.contentHeight : 0 + width: implicitWidth + height: implicitHeight + + property int subMenuOverlap: -2 * pixelMetric("menupanelwidth") + property real maxHeight: Screen.desktopAvailableHeight * 0.99 + property int margin: pixelMetric("menuvmargin") + pixelMetric("menupanelwidth") + + Rectangle { + visible: anchors.margins > 0 + anchors { + fill: parent + margins: pixelMetric("menupanelwidth") + } + color: __syspal.window + } + + Accessible.role: Accessible.PopupMenu + } + + property Component menuItem: StyleItem { + elementType: __menuItemType + x: pixelMetric("menuhmargin") + pixelMetric("menupanelwidth") + y: pixelMetric("menuvmargin") + + text: !!parent && parent.text + property string textAndShorcut: text + (properties.shortcut ? "\t" + properties.shortcut : "") + contentWidth: textWidth(textAndShorcut) + contentHeight: textHeight(textAndShorcut) + + enabled: !!parent && parent.enabled + selected: !!parent && parent.selected + on: !!menuItem && !!menuItem["checkable"] && menuItem.checked + + hints: { "showUnderlined": showUnderlined } + + properties: { + "checkable": !!menuItem && !!menuItem["checkable"], + "exclusive": !!menuItem && !!menuItem["exclusiveGroup"], + "shortcut": !!menuItem && menuItem["shortcut"] || "", + "isSubmenu": isSubmenu, + "scrollerDirection": scrollerDirection, + "icon": !!menuItem && menuItem.__icon + } + + Accessible.role: Accessible.MenuItem + Accessible.name: StyleHelpers.removeMnemonics(text) + } + + property Component scrollerStyle: Style { + padding { left: 0; right: 0; top: 0; bottom: 0 } + property bool scrollToClickedPosition: false + property Component frame: Item { visible: false } + property Component corner: Item { visible: false } + property Component __scrollbar: Item { visible: false } + property bool useScrollers: true + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ProgressBarStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ProgressBarStyle.qml new file mode 100644 index 00000000000..70fa0402476 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ProgressBarStyle.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + property Component panel: StyleItem { + anchors.fill: parent + elementType: "progressbar" + // XXX: since desktop uses int instead of real, the progressbar + // range [0..1] must be stretched to a good precision + property int factor : 1000 + property int decimals: 3 + value: indeterminate ? 0 : control.value.toFixed(decimals) * factor // does indeterminate value need to be 1 on windows? + minimum: indeterminate ? 0 : control.minimumValue.toFixed(decimals) * factor + maximum: indeterminate ? 0 : control.maximumValue.toFixed(decimals) * factor + enabled: control.enabled + horizontal: control.orientation === Qt.Horizontal + hints: control.styleHints + contentWidth: horizontal ? 200 : 23 + contentHeight: horizontal ? 23 : 200 + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/RadioButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/RadioButtonStyle.qml new file mode 100644 index 00000000000..4a00ee22a6d --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/RadioButtonStyle.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + readonly property RadioButton control: __control + property Component panel: Item { + anchors.fill: parent + + implicitWidth: styleitem.implicitWidth + implicitHeight: styleitem.implicitHeight + baselineOffset: styleitem.baselineOffset + + StyleItem { + id: styleitem + elementType: "radiobutton" + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: macStyle ? -1 : 0 + sunken: control.pressed + on: control.checked || control.pressed + hover: control.hovered + enabled: control.enabled + hasFocus: control.activeFocus && styleitem.style == "mac" + hints: control.styleHints + contentHeight: textitem.implicitHeight + contentWidth: textitem.implicitWidth + indicatorWidth + property int indicatorWidth: pixelMetric("indicatorwidth") + (macStyle ? 2 : 4) + property bool macStyle: (style === "mac") + + Text { + id: textitem + text: control.text + anchors.left: parent.left + anchors.leftMargin: parent.indicatorWidth + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: parent.macStyle ? 2 : 0 + anchors.right: parent.right + renderType: Text.NativeRendering + elide: Text.ElideRight + enabled: control.enabled + color: __syspal.windowText + StyleItem { + elementType: "focusrect" + anchors.margins: -1 + anchors.leftMargin: -2 + anchors.top: parent.top + anchors.left: parent.left + anchors.bottom: parent.bottom + width: textitem.implicitWidth + 3 + visible: control.activeFocus + } + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/RowItemSingleton.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/RowItemSingleton.qml new file mode 100644 index 00000000000..b78fc04335d --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/RowItemSingleton.qml @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +pragma Singleton +import QtQuick.Controls.Private 1.0 +StyleItem { + elementType: "itemrow" +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ScrollViewStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ScrollViewStyle.qml new file mode 100644 index 00000000000..22c28441643 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ScrollViewStyle.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + id: root + + padding { + property int frameWidth: __styleitem.pixelMetric("defaultframewidth") + left: frameWidth + top: frameWidth + bottom: frameWidth + right: frameWidth + } + + property StyleItem __styleitem: StyleItem { elementType: "frame" } + + property Component frame: StyleItem { + id: styleitem + elementType: "frame" + sunken: true + visible: control.frameVisible + textureHeight: 64 + textureWidth: 64 + border { + top: 16 + left: 16 + right: 16 + bottom: 16 + } + } + + property Component corner: StyleItem { elementType: "scrollareacorner" } + + readonly property bool __externalScrollBars: __styleitem.styleHint("externalScrollBars") + readonly property int __scrollBarSpacing: __styleitem.pixelMetric("scrollbarspacing") + readonly property bool scrollToClickedPosition: __styleitem.styleHint("scrollToClickPosition") !== 0 + + property Component __scrollbar: StyleItem { + anchors.fill:parent + elementType: "scrollbar" + hover: activeControl != "none" + activeControl: "none" + sunken: __styleData.upPressed | __styleData.downPressed | __styleData.handlePressed + minimum: __control.minimumValue + maximum: __control.maximumValue + value: __control.value + horizontal: __styleData.horizontal + enabled: __control.enabled + + implicitWidth: horizontal ? 200 : pixelMetric("scrollbarExtent") + implicitHeight: horizontal ? pixelMetric("scrollbarExtent") : 200 + } + +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SliderStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SliderStyle.qml new file mode 100644 index 00000000000..fd426e35b7e --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SliderStyle.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + readonly property Item control: __control + property Component panel: StyleItem { + elementType: "slider" + sunken: control.pressed + implicitWidth: 200 + contentHeight: horizontal ? 22 : 200 + contentWidth: horizontal ? 200 : 22 + + maximum: control.maximumValue*100 + minimum: control.minimumValue*100 + step: control.stepSize*100 + value: control.__handlePos*100 + horizontal: control.orientation === Qt.Horizontal + enabled: control.enabled + hasFocus: control.activeFocus + hints: control.styleHints + activeControl: control.tickmarksEnabled ? "ticks" : "" + property int handleWidth: 15 + property int handleHeight: 15 + } + padding { top: 0 ; left: 0 ; right: 0 ; bottom: 0 } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SpinBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SpinBoxStyle.qml new file mode 100644 index 00000000000..5cf13ea8fa2 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SpinBoxStyle.qml @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + readonly property SpinBox control: __control + + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + + padding { + top: control.__panel ? control.__panel.topPadding + (styleitem.style === "mac" ? 2 : 0) : 0 + left: control.__panel ? control.__panel.leftPadding : 0 + right: control.__panel ? control.__panel.rightPadding : 0 + bottom: control.__panel ? control.__panel.bottomPadding : 0 + } + StyleItem {id: styleitem ; visible: false} + + property int renderType: Text.NativeRendering + + property Component panel: Item { + id: style + + property rect upRect + property rect downRect + + property int horizontalAlignment: Qt.platform.os === "osx" ? Qt.AlignRight : Qt.AlignLeft + property int verticalAlignment: Qt.AlignVCenter + + property color foregroundColor: __syspal.text + property color backgroundColor: __syspal.base + property color selectionColor: __syspal.highlight + property color selectedTextColor: __syspal.highlightedText + + property int topPadding: edit.anchors.topMargin + property int leftPadding: 3 + edit.anchors.leftMargin + property int rightPadding: 3 + edit.anchors.rightMargin + property int bottomPadding: edit.anchors.bottomMargin + + width: 100 + height: styleitem.implicitHeight + + implicitWidth: 2 + styleitem.implicitWidth + implicitHeight: styleitem.implicitHeight + baselineOffset: styleitem.baselineOffset + + Item { + id: edit + anchors.fill: parent + Rectangle { + color: "white" + anchors.fill: parent + anchors.margins: -1 + } + FocusFrame { + anchors.fill: parent + focusMargin:-6 + visible: spinbox.activeFocus && styleitem.styleHint("focuswidget") + } + } + + function updateRect() { + style.upRect = styleitem.subControlRect("up"); + style.downRect = styleitem.subControlRect("down"); + var inputRect = styleitem.subControlRect("edit"); + edit.anchors.topMargin = inputRect.y + edit.anchors.leftMargin = inputRect.x + edit.anchors.rightMargin = style.width - inputRect.width - edit.anchors.leftMargin + edit.anchors.bottomMargin = style.height - inputRect.height - edit.anchors.topMargin + } + + Component.onCompleted: updateRect() + onWidthChanged: updateRect() + onHeightChanged: updateRect() + + StyleItem { + id: styleitem + elementType: "spinbox" + anchors.fill: parent + sunken: (styleData.downEnabled && styleData.downPressed) || (styleData.upEnabled && styleData.upPressed) + hover: control.hovered + hints: control.styleHints + hasFocus: control.activeFocus + enabled: control.enabled + value: (styleData.upPressed ? 1 : 0) | + (styleData.downPressed ? 1<<1 : 0) | + (styleData.upEnabled ? (1<<2) : 0) | + (styleData.downEnabled ? (1<<3) : 0) + contentWidth: styleData.contentWidth + contentHeight: styleData.contentHeight + textureHeight: implicitHeight + border {top: 6 ; bottom: 6} + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/StatusBarStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/StatusBarStyle.qml new file mode 100644 index 00000000000..1a1c687ea46 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/StatusBarStyle.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype StatusBarStyle + \internal + \inqmlmodule QtQuick.Controls.Styles +*/ +Style { + + padding.left: 4 + padding.right: 4 + padding.top: 3 + padding.bottom: 2 + + property Component panel: StyleItem { + implicitHeight: 16 + implicitWidth: 200 + anchors.fill: parent + elementType: "statusbar" + textureWidth: 64 + border {left: 16 ; right: 16} + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SwitchStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SwitchStyle.qml new file mode 100644 index 00000000000..df9dd5bf963 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/SwitchStyle.qml @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.1 + +SwitchStyle { +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TabViewStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TabViewStyle.qml new file mode 100644 index 00000000000..cf61a4d16ea --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TabViewStyle.qml @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.1 +Style { + id: root + + property bool tabsMovable: false + property int tabsAlignment: __barstyle.styleHint("tabbaralignment") === "center" ? Qt.AlignHCenter : Qt.AlignLeft; + property int tabOverlap: __barstyle.pixelMetric("taboverlap"); + property int frameOverlap: __barstyle.pixelMetric("tabbaseoverlap"); + + property StyleItem __barstyle: StyleItem { + elementType: "tab" + properties: { "tabposition" : (control.tabPosition === Qt.TopEdge ? "Top" : "Bottom") } + visible: false + } + + property Component frame: StyleItem { + id: styleitem + anchors.fill: parent + anchors.topMargin: 1//stack.baseOverlap + z: style == "oxygen" ? 1 : 0 + elementType: "tabframe" + value: tabbarItem && tabsVisible && tabbarItem.tab(currentIndex) ? tabbarItem.tab(currentIndex).x : 0 + minimum: tabbarItem && tabsVisible && tabbarItem.tab(currentIndex) ? tabbarItem.tab(currentIndex).width : 0 + maximum: tabbarItem && tabsVisible ? tabbarItem.width : width + properties: { "selectedTabRect" : tabbarItem.__selectedTabRect, "orientation" : control.tabPosition } + hints: control.styleHints + Component.onCompleted: { + stack.frameWidth = styleitem.pixelMetric("defaultframewidth"); + stack.style = style; + } + border{ + top: 16 + bottom: 16 + } + textureHeight: 64 + } + + property Component tab: Item { + id: item + property string tabpos: control.count === 1 ? "only" : index === 0 ? "beginning" : index === control.count - 1 ? "end" : "middle" + property string selectedpos: styleData.nextSelected ? "next" : styleData.previousSelected ? "previous" : "" + property string orientation: control.tabPosition === Qt.TopEdge ? "Top" : "Bottom" + property int tabHSpace: __barstyle.pixelMetric("tabhspace"); + property int tabVSpace: __barstyle.pixelMetric("tabvspace"); + property int totalOverlap: tabOverlap * (control.count - 1) + property real maxTabWidth: (control.width + totalOverlap) / control.count + implicitWidth: Math.min(maxTabWidth, Math.max(50, styleitem.textWidth(styleData.title)) + tabHSpace + 2) + implicitHeight: Math.max(styleitem.font.pixelSize + tabVSpace + 6, 0) + + StyleItem { + id: styleitem + + elementType: "tab" + paintMargins: style === "mac" ? 0 : 2 + + anchors.fill: parent + anchors.topMargin: style === "mac" ? 2 : 0 + anchors.rightMargin: -paintMargins + anchors.bottomMargin: -1 + anchors.leftMargin: -paintMargins + (style === "mac" && selected ? -1 : 0) + properties: { "hasFrame" : true, "orientation": orientation, "tabpos": tabpos, "selectedpos": selectedpos } + hints: control.styleHints + + selected: styleData.selected + text: elidedText(styleData.title, tabbarItem.elide, item.width - item.tabHSpace) + hover: styleData.hovered + hasFocus: tabbarItem.activeFocus && selected + } + } + + property Component leftCorner: null + property Component rightCorner: null +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml new file mode 100644 index 00000000000..88611ab5c76 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 +import "." + +ScrollViewStyle { + id: root + + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + readonly property TableView control: __control + property bool activateItemOnSingleClick: __styleitem.styleHint("activateItemOnSingleClick") + property color textColor: __styleitem.textColor + property color backgroundColor: __syspal.base + property color highlightedTextColor: __styleitem.highlightedTextColor + + property StyleItem __styleitem: StyleItem{ + property color textColor: styleHint("textColor") + property color highlightedTextColor: styleHint("highlightedTextColor") + elementType: "item" + visible: false + active: control.activeFocus + onActiveChanged: { + highlightedTextColor = styleHint("highlightedTextColor") + textColor = styleHint("textColor") + } + } + + property Component headerDelegate: StyleItem { + elementType: "header" + activeControl: itemSort + raised: true + sunken: styleData.pressed + text: styleData.value + hover: styleData.containsMouse + hints: control.styleHints + properties: {"headerpos": headerPosition} + property string itemSort: (control.sortIndicatorVisible && styleData.column === control.sortIndicatorColumn) ? (control.sortIndicatorOrder == Qt.AscendingOrder ? "up" : "down") : ""; + property string headerPosition: control.columnCount === 1 ? "only" : + styleData.column === control.columnCount-1 ? "end" : + styleData.column === 0 ? "beginning" : "" + } + + property Component rowDelegate: BorderImage { + visible: styleData.selected || styleData.alternate + source: "image://__tablerow/" + (styleData.alternate ? "alternate_" : "") + + (styleData.selected ? "selected_" : "") + + (styleData.hasActiveFocus ? "active" : "") + height: Math.max(16, RowItemSingleton.implicitHeight) + border.left: 4 ; border.right: 4 + } + + property Component itemDelegate: Item { + height: Math.max(16, label.implicitHeight) + property int implicitWidth: label.implicitWidth + 16 + + Text { + id: label + objectName: "label" + width: parent.width + anchors.leftMargin: 8 + font: __styleitem.font + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: styleData.textAlignment + anchors.verticalCenter: parent.verticalCenter + elide: styleData.elideMode + text: styleData.value !== undefined ? styleData.value : "" + color: styleData.textColor + renderType: Text.NativeRendering + } + } +} + diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TextAreaStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TextAreaStyle.qml new file mode 100644 index 00000000000..3f2904a350b --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TextAreaStyle.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +ScrollViewStyle { + property font font: __styleitem.font + property color textColor: __styleitem.textColor + property color selectionColor: __syspal.highlight + property color selectedTextColor: __syspal.highlightedText + property color backgroundColor: control.backgroundVisible ? __syspal.base : "transparent" + + property StyleItem __styleitem: StyleItem{ + property color textColor: styleHint("textColor") + elementType: "edit" + visible: false + active: control.activeFocus + onActiveChanged: textColor = styleHint("textColor") + } + + property int renderType: Text.NativeRendering +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TextFieldStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TextFieldStyle.qml new file mode 100644 index 00000000000..0ca0d743d60 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/TextFieldStyle.qml @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + property int renderType: Text.NativeRendering + + property Component panel: StyleItem { + id: textfieldstyle + elementType: "edit" + anchors.fill: parent + + sunken: true + hasFocus: control.activeFocus + hover: hovered + hints: control.styleHints + + SystemPalette { + id: syspal + colorGroup: control.enabled ? + SystemPalette.Active : + SystemPalette.Disabled + } + + property color textColor: syspal.text + property color placeholderTextColor: "darkGray" + property color selectionColor: syspal.highlight + property color selectedTextColor: syspal.highlightedText + + + property bool rounded: !!hints["rounded"] + property int topMargin: style === "mac" ? 3 : 2 + property int leftMargin: rounded ? 12 : 4 + property int rightMargin: leftMargin + property int bottomMargin: 2 + + contentWidth: 100 + // Form QLineEdit::sizeHint + contentHeight: Math.max(control.__contentHeight, 16) + + FocusFrame { + anchors.fill: parent + visible: textfield.activeFocus && textfieldstyle.styleHint("focuswidget") && !rounded + } + textureHeight: implicitHeight + textureWidth: 32 + border {top: 8 ; bottom: 8 ; left: 8 ; right: 8} + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ToolBarStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ToolBarStyle.qml new file mode 100644 index 00000000000..4f4b451e10f --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ToolBarStyle.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype StatusBarStyle + \internal + \inqmlmodule QtQuick.Controls.Styles +*/ +Style { + + padding.left: 6 + padding.right: 6 + padding.top: 1 + padding.bottom: style.style === "mac" ? 1 : style.style === "fusion" ? 3 : 2 + + StyleItem { id: style ; visible: false} + + property Component panel: StyleItem { + id: toolbar + anchors.fill: parent + elementType: "toolbar" + textureWidth: 64 + border {left: 16 ; right: 16} + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ToolButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ToolButtonStyle.qml new file mode 100644 index 00000000000..d690a5775e6 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/ToolButtonStyle.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + property Component panel: StyleItem { + id: styleitem + + anchors.fill: parent + elementType: "toolbutton" + on: control.checkable && control.checked + sunken: control.pressed + raised: !(control.checkable && control.checked) && control.hovered + hover: control.hovered + hasFocus: control.activeFocus + hints: control.styleHints + text: control.text + + properties: { + "icon": control.__iconAction.__icon, + "position": control.__position, + "menu" : control.menu !== null + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/qmldir b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/qmldir new file mode 100644 index 00000000000..ac80635cc2a --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/Desktop/qmldir @@ -0,0 +1,2 @@ +singleton RowItemSingleton 1.0 RowItemSingleton.qml + diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/qmldir b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/qmldir new file mode 100644 index 00000000000..5cd368ac881 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Styles/qmldir @@ -0,0 +1,17 @@ +module QtQuick.Controls.Styles +ButtonStyle 1.0 Base/ButtonStyle.qml +BusyIndicatorStyle 1.1 Base/BusyIndicatorStyle.qml +CheckBoxStyle 1.0 Base/CheckBoxStyle.qml +ComboBoxStyle 1.0 Base/ComboBoxStyle.qml +ProgressBarStyle 1.0 Base/ProgressBarStyle.qml +RadioButtonStyle 1.0 Base/RadioButtonStyle.qml +ScrollViewStyle 1.0 Base/ScrollViewStyle.qml +SliderStyle 1.0 Base/SliderStyle.qml +SpinBoxStyle 1.1 Base/SpinBoxStyle.qml +SwitchStyle 1.1 Base/SwitchStyle.qml +TabViewStyle 1.0 Base/TabViewStyle.qml +TableViewStyle 1.0 Base/TableViewStyle.qml +TextAreaStyle 1.1 Base/TextAreaStyle.qml +TextFieldStyle 1.0 Base/TextFieldStyle.qml +ToolBarStyle 1.0 Base/ToolBarStyle.qml +StatusBarStyle 1.0 Base/StatusBarStyle.qml diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Switch.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Switch.qml new file mode 100644 index 00000000000..bed46a84492 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Switch.qml @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype Switch + \inqmlmodule QtQuick.Controls + \since 5.2 + \ingroup controls + \brief A switch. + + A Switch is an option button that can be switched on (checked) or off + (unchecked). Switches are typically used to represent features in an + application that can be enabled or disabled without affecting others. + + On mobile platforms, switches are commonly used to enable or disable + features. + + \qml + Column { + Switch { checked: true } + Switch { checked: false } + } + \endqml + + You can create a custom appearance for a Switch by + assigning a \l {QtQuick.Controls.Styles::SwitchStyle}{SwitchStyle}. +*/ + +Control { + id: root + + /*! + This property is \c true if the control is checked. + The default value is \c false. + */ + property bool checked: false + + /*! + This property is \c true if the control takes the focus when it is + pressed; \l{QQuickItem::forceActiveFocus()}{forceActiveFocus()} will be + called on the control. + */ + property bool activeFocusOnPress: false + + /*! + This property stores the ExclusiveGroup that the control belongs to. + */ + property ExclusiveGroup exclusiveGroup: null + + Keys.onPressed: { + if (event.key === Qt.Key_Space && !event.isAutoRepeat) + checked = !checked; + } + + /*! \internal */ + onExclusiveGroupChanged: { + if (exclusiveGroup) + exclusiveGroup.bindCheckable(root) + } + + MouseArea { + id: internal + + property Item handle: __panel ? __panel.__handle : null + property int min: __style ? __style.padding.left : 0 + property int max: handle.parent.width - (handle ? handle.width : 0) - + ( __style ? __style.padding.right : 0) + focus: true + anchors.fill: parent + drag.threshold: 0 + drag.target: handle + drag.axis: Drag.XAxis + drag.minimumX: min + drag.maximumX: max + + onPressed: { + if (activeFocusOnPress) + root.forceActiveFocus() + } + + onReleased: { + if (drag.active) { + checked = (handle.x < max/2) ? false : true; + internal.handle.x = checked ? internal.max : internal.min + } else { + checked = (handle.x === max) ? false : true + } + } + } + + Component.onCompleted: { + internal.handle.x = checked ? internal.max : internal.min + __panel.enableAnimation = true + } + + onCheckedChanged: { + if (internal.handle) + internal.handle.x = checked ? internal.max : internal.min + } + + activeFocusOnTab: true + Accessible.role: Accessible.CheckBox + Accessible.name: "switch" + + /*! + The style that should be applied to the switch. Custom style + components can be created with: + + \codeline Qt.createComponent("path/to/style.qml", switchId); + */ + style: Qt.createComponent(Settings.style + "/SwitchStyle.qml", root) +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Tab.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Tab.qml new file mode 100644 index 00000000000..cfd757c9726 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Tab.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 + +/*! + \qmltype Tab + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup viewaddons + \brief Tab represents the content of a tab in a TabView. + + A Tab item inherits from Loader and provides a similar + api. +*/ + +Loader { + id: tab + anchors.fill: parent + + /*! This property holds the title of the tab. */ + property string title + + /*! \internal */ + property bool __inserted: false + + Accessible.role: Accessible.LayeredPane + active: false + visible: false + + activeFocusOnTab: false + + onVisibleChanged: if (visible) active = true + + /*! \internal */ + default property alias component: tab.sourceComponent +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TabView.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TabView.qml new file mode 100644 index 00000000000..e20bcf224ff --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TabView.qml @@ -0,0 +1,270 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype TabView + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup views + \brief A control that allows the user to select one of multiple stacked items. + + You can create a custom appearance for a TabView by + assigning a \l {QtQuick.Controls.Styles::TabViewStyle}{TabViewStyle}. +*/ + +FocusScope { + id: root + + implicitWidth: 240 + implicitHeight: 150 + + /*! The current tab index */ + property int currentIndex: 0 + + /*! The current tab count */ + property int count: 0 + + /*! The visibility of the tab frame around contents */ + property bool frameVisible: true + + /*! The visibility of the tab bar */ + property bool tabsVisible: true + + /*! + \qmlproperty enumeration TabView::tabPosition + + \list + \li Qt.TopEdge (default) + \li Qt.BottomEdge + \endlist + */ + property int tabPosition: Qt.TopEdge + + /*! \internal */ + default property alias data: stack.data + + /*! Adds a new tab page with title with and optional Component. + Returns the newly added tab. + */ + function addTab(title, component) { + return insertTab(__tabs.count, title, component) + } + + /*! Inserts a new tab with title at index, with an optional Component. + Returns the newly added tab. + */ + function insertTab(index, title, component) { + // 'loader' parent is a pending workaround while waiting for: + // https://codereview.qt-project.org/#change,65788 + var tab = tabcomp.createObject(loader) + tab.sourceComponent = component + tab.title = title + // insert at appropriate index first, then set the parent to + // avoid onChildrenChanged appending it to the end of the list + __tabs.insert(index, {tab: tab}) + tab.__inserted = true + tab.parent = stack + __setOpacities() + return tab + } + + /*! Removes and destroys a tab at the given \a index. */ + function removeTab(index) { + var tab = __tabs.get(index).tab + __tabs.remove(index, 1) + tab.destroy() + if (currentIndex > 0) + currentIndex-- + __setOpacities() + } + + /*! Moves a tab \a from index \a to another. */ + function moveTab(from, to) { + __tabs.move(from, to, 1) + + if (currentIndex == from) { + currentIndex = to + } else { + var start = Math.min(from, to) + var end = Math.max(from, to) + if (currentIndex >= start && currentIndex <= end) { + if (from < to) + --currentIndex + else + ++currentIndex + } + } + } + + /*! Returns the \l Tab item at \a index. */ + function getTab(index) { + return __tabs.get(index).tab + } + + /*! \internal */ + property ListModel __tabs: ListModel { } + + /*! \internal */ + property Component style: Qt.createComponent(Settings.style + "/TabViewStyle.qml", root) + + /*! \internal */ + property var __styleItem: loader.item + + onCurrentIndexChanged: __setOpacities() + + /*! \internal */ + function __setOpacities() { + for (var i = 0; i < __tabs.count; ++i) { + var child = __tabs.get(i).tab + child.visible = (i == currentIndex ? true : false) + } + count = __tabs.count + } + + activeFocusOnTab: false + + Component { + id: tabcomp + Tab {} + } + + TabBar { + id: tabbarItem + objectName: "tabbar" + tabView: root + style: loader.item + anchors.top: parent.top + anchors.left: root.left + anchors.right: root.right + } + + Loader { + id: loader + z: tabbarItem.z - 1 + sourceComponent: style + property var __control: root + } + + Loader { + id: frameLoader + z: tabbarItem.z - 1 + + anchors.fill: parent + anchors.topMargin: tabPosition === Qt.TopEdge && tabbarItem && tabsVisible ? Math.max(0, tabbarItem.height - baseOverlap) : 0 + anchors.bottomMargin: tabPosition === Qt.BottomEdge && tabbarItem && tabsVisible ? Math.max(0, tabbarItem.height -baseOverlap) : 0 + sourceComponent: frameVisible && loader.item ? loader.item.frame : null + + property int baseOverlap: __styleItem ? __styleItem.frameOverlap : 0 + + Item { + id: stack + + anchors.fill: parent + anchors.margins: (frameVisible ? frameWidth : 0) + anchors.topMargin: anchors.margins + (style =="mac" ? 6 : 0) + anchors.bottomMargin: anchors.margins + + property int frameWidth + property string style + property bool completed: false + + Component.onCompleted: { + addTabs(stack.children) + completed = true + } + + onChildrenChanged: { + if (completed) + stack.addTabs(stack.children) + } + + function addTabs(tabs) { + var tabAdded = false + for (var i = 0 ; i < tabs.length ; ++i) { + var tab = tabs[i] + if (!tab.__inserted && tab.Accessible.role === Accessible.LayeredPane) { + tab.__inserted = true + // reparent tabs created dynamically by createObject(tabView) + tab.parent = stack + // a dynamically added tab should also get automatically removed when destructed + if (completed) + tab.Component.onDestruction.connect(stack.onDynamicTabDestroyed.bind(tab)) + __tabs.append({tab: tab}) + tabAdded = true + } + } + if (tabAdded) + __setOpacities() + } + + function onDynamicTabDestroyed() { + for (var i = 0; i < __tabs.count; ++i) { + if (__tabs.get(i).tab === this) { + __tabs.remove(i, 1) + __setOpacities() + break + } + } + } + } + onLoaded: { item.z = -1 } + } + + onChildrenChanged: stack.addTabs(root.children) + + states: [ + State { + name: "Bottom" + when: tabPosition === Qt.BottomEdge && tabbarItem != undefined + PropertyChanges { + target: tabbarItem + anchors.topMargin: -frameLoader.baseOverlap + } + AnchorChanges { + target: tabbarItem + anchors.top: frameLoader.bottom + } + } + ] +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TableView.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TableView.qml new file mode 100644 index 00000000000..586f1211dfc --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TableView.qml @@ -0,0 +1,1016 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.1 + +/*! + \qmltype TableView + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup views + \brief Provides a list view with scroll bars, styling and header sections. + + \image tableview.png + + A TableView is similar to \l ListView, and adds scroll bars, selection, and + resizable header sections. As with \l ListView, data for each row is provided through a \l model: + + \code + ListModel { + id: libraryModel + ListElement{ title: "A Masterpiece" ; author: "Gabriel" } + ListElement{ title: "Brilliance" ; author: "Jens" } + ListElement{ title: "Outstanding" ; author: "Frederik" } + } + \endcode + + You provide title and size of a column header + by adding a \l TableViewColumn as demonstrated below. + \code + + TableView { + TableViewColumn{ role: "title" ; title: "Title" ; width: 100 } + TableViewColumn{ role: "author" ; title: "Author" ; width: 200 } + model: libraryModel + } + \endcode + + The header sections are attached to values in the \l model by defining + the model role they attach to. Each property in the model will + then be shown in their corresponding column. + + You can customize the look by overriding the \l itemDelegate, + \l rowDelegate, or \l headerDelegate properties. + + The view itself does not provide sorting. This has to + be done on the model itself. However you can provide sorting + on the model, and enable sort indicators on headers. + +\list + \li int sortIndicatorColumn - The index of the current sort column + \li bool sortIndicatorVisible - Whether the sort indicator should be enabled + \li enum sortIndicatorOrder - Qt.AscendingOrder or Qt.DescendingOrder depending on state +\endlist + + You can create a custom appearance for a TableView by + assigning a \l {QtQuick.Controls.Styles::TableViewStyle}{TableViewStyle}. +*/ + +ScrollView { + id: root + + /*! \qmlproperty model TableView::model + This property holds the model providing data for the table view. + + The model provides the set of data that is used to create the items in the view. + Models can be created directly in QML using ListModel, XmlListModel or VisualItemModel, + or provided by C++ model classes. \sa ListView::model + + Example model: + + \code + model: ListModel { + ListElement{ column1: "value 1" ; column2: "value 2" } + ListElement{ column1: "value 3" ; column2: "value 4" } + } + \endcode + \sa {qml-data-models}{Data Models} + */ + property var model + + /*! This property is set to \c true if the view alternates the row color. + The default value is \c true. */ + property bool alternatingRowColors: true + + /*! This property determines if the header is visible. + The default value is \c true. */ + property bool headerVisible: true + + /*! \qmlproperty bool TableView::backgroundVisible + + This property determines if the background should be filled or not. + + The default value is \c true. + + \note The rowDelegate is not affected by this property + */ + property alias backgroundVisible: colorRect.visible + + /*! This property defines a delegate to draw a specific cell. + + In the item delegate you have access to the following special properties: + \list + \li styleData.selected - if the item is currently selected + \li styleData.value - the value or text for this item + \li styleData.textColor - the default text color for an item + \li styleData.row - the index of the row + \li styleData.column - the index of the column + \li styleData.elideMode - the elide mode of the column + \li styleData.textAlignment - the horizontal text alignment of the column + \endlist + + Example: + \code + itemDelegate: Item { + Text { + anchors.verticalCenter: parent.verticalCenter + color: styleData.textColor + elide: styleData.elideMode + text: styleData.value + } + } + \endcode */ + property Component itemDelegate: __style ? __style.itemDelegate : null + + /*! This property defines a delegate to draw a row. + + In the row delegate you have access to the following special properties: + \list + \li styleData.alternate - true when the row uses the alternate background color + \li styleData.selected - true when the row is currently selected + \li styleData.row - the index of the row + \endlist + */ + property Component rowDelegate: __style ? __style.rowDelegate : null + + /*! This property defines a delegate to draw a header. + + In the header delegate you have access to the following special properties: + \list + \li styleData.value - the value or text for this item + \li styleData.column - the index of the column + \li styleData.pressed - true when the column is being pressed + \li styleData.containsMouse - true when the column is under the mouse + \li styleData.textAlignment - the horizontal text alignment of the column (since QtQuickControls 1.1) + \endlist + */ + property Component headerDelegate: __style ? __style.headerDelegate : null + + /*! Index of the current sort column. + The default value is \c {0}. */ + property int sortIndicatorColumn + + /*! This property shows or hides the sort indicator + The default value is \c false. + \note The view itself does not sort the data. */ + property bool sortIndicatorVisible: false + + /*! + \qmlproperty enumeration TableView::sortIndicatorOrder + + This sets the sorting order of the sort indicator + The allowed values are: + \list + \li Qt.AscendingOrder - the default + \li Qt.DescendingOrder + \endlist + */ + property int sortIndicatorOrder: Qt.AscendingOrder + + /*! \internal */ + default property alias __columns: root.data + + /*! \qmlproperty Component TableView::contentHeader + This is the content header of the TableView */ + property alias contentHeader: listView.header + + /*! \qmlproperty Component TableView::contentFooter + This is the content footer of the TableView */ + property alias contentFooter: listView.footer + + /*! \qmlproperty int TableView::rowCount + The current number of rows */ + readonly property alias rowCount: listView.count + + /*! \qmlproperty int TableView::columnCount + The current number of columns */ + readonly property alias columnCount: columnModel.count + + /*! \qmlproperty string TableView::section.property + \qmlproperty enumeration TableView::section.criteria + \qmlproperty Component TableView::section.delegate + \qmlproperty enumeration TableView::section.labelPositioning + These properties determine the section labels. + \sa ListView::section */ + property alias section: listView.section + + /*! \qmlproperty int TableView::currentRow + The current row index of the view. + The default value is \c -1 to indicate that no row is selected. + */ + property alias currentRow: listView.currentIndex + + /*! \internal */ + property alias __currentRowItem: listView.currentItem + + /*! \qmlsignal TableView::activated(int row) + + Emitted when the user activates an item by mouse or keyboard interaction. + Mouse activation is triggered by single- or double-clicking, depending on the platform. + + \a row int provides access to the activated row index. + + \note This signal is only emitted for mouse interaction that is not blocked in the row or item delegate. + */ + signal activated(int row) + + /*! \qmlsignal TableView::clicked(int row) + + Emitted when the user clicks a valid row by single clicking + + \a row int provides access to the clicked row index. + + \note This signal is only emitted if the row or item delegate does not accept mouse events. + */ + signal clicked(int row) + + /*! \qmlsignal TableView::doubleClicked(int row) + + Emitted when the user double clicks a valid row. + + \a row int provides access to the clicked row index. + + \note This signal is only emitted if the row or item delegate does not accept mouse events. + */ + signal doubleClicked(int row) + + /*! + \qmlmethod TableView::positionViewAtRow( int row, PositionMode mode ) + + Positions the view such that the specified \a row is at the position defined by \a mode: + \list + \li ListView.Beginning - position item at the top of the view. + \li ListView.Center - position item in the center of the view. + \li ListView.End - position item at bottom of the view. + \li ListView.Visible - if any part of the item is visible then take no action, otherwise bring the item into view. + \li ListView.Contain - ensure the entire item is visible. If the item is larger than the view the item is positioned + at the top of the view. + \endlist + + If positioning the \a row creates an empty space at the beginning + or end of the view, then the view is positioned at the boundary. + + For example, to position the view at the end at startup: + + \code + Component.onCompleted: table.positionViewAtRow(rowCount -1, ListView.Contain) + \endcode + + Depending on how the model is populated, the model may not be ready when + TableView Component.onCompleted is called. In that case you may need to + delay the call to positionViewAtRow by using a \l {QtQml::Timer}{Timer}. + + \note This method should only be called after the component has completed. + */ + + function positionViewAtRow(row, mode) { + listView.positionViewAtIndex(row, mode) + } + + /*! + \qmlmethod int TableView::rowAt( int x, int y ) + + Returns the index of the visible row at the point \a x, \a y in content + coordinates. If there is no visible row at the point specified, \c -1 is returned. + + \note This method should only be called after the component has completed. + */ + + function rowAt(x, y) { + var obj = root.mapToItem(listView.contentItem, x, y) + return listView.indexAt(obj.x, obj.y) + } + + /*! Adds a \a column and returns the added column. + + The \a column argument can be an instance of TableViewColumn, + or a Component. The component has to contain a TableViewColumn. + Otherwise \c null is returned. + */ + function addColumn(column) { + return insertColumn(columnCount, column) + } + + /*! Inserts a \a column at the given \a index and returns the inserted column. + + The \a column argument can be an instance of TableViewColumn, + or a Component. The component has to contain a TableViewColumn. + Otherwise \c null is returned. + */ + function insertColumn(index, column) { + var object = column + if (typeof column['createObject'] === 'function') + object = column.createObject(root) + + else if (object.__view) { + console.warn("TableView::insertColumn(): you cannot add a column to multiple views") + return null + } + if (index >= 0 && index <= columnCount && object.Accessible.role === Accessible.ColumnHeader) { + object.__view = root + columnModel.insert(index, {columnItem: object}) + return object + } + + if (object !== column) + object.destroy() + console.warn("TableView::insertColumn(): invalid argument") + return null + } + + /*! Removes and destroys a column at the given \a index. */ + function removeColumn(index) { + if (index < 0 || index >= columnCount) { + console.warn("TableView::removeColumn(): invalid argument") + return + } + var column = columnModel.get(index).columnItem + columnModel.remove(index, 1) + column.destroy() + } + + /*! Moves a column \a from index \a to another. */ + function moveColumn(from, to) { + if (from < 0 || from >= columnCount || to < 0 || to >= columnCount) { + console.warn("TableView::moveColumn(): invalid argument") + return + } + columnModel.move(from, to, 1) + } + + /*! Returns the column at the given \a index + or \c null if the \a index is invalid. */ + function getColumn(index) { + if (index < 0 || index >= columnCount) + return null + return columnModel.get(index).columnItem + } + + /*! \qmlproperty Selection TableView::selection + \since QtQuick.Controls 1.1 + + This property contains the current row-selection of the \l TableView. + The selection allows you to select, deselect or iterate over selected rows. + + \list + \li function \b clear() - deselects all rows + \li function \b selectAll() - selects all rows + \li function \b select(from, to) - select a range + \li functton \b deselect(from, to) - de-selects a range + \li function \b forEach(callback) - Allows you to iterate over selected rows + \li function \b contains(index) - Allows you to iterate over selected rows + \li signal \b selectionChanged() - The current row selection changed + \li readonly property int \b count - The number of selected rows + \endlist + + \b Example: + \code + tableview.selection.select(0) // select row index 0 + + tableview.selection.select(1, 3) // select row indexes 1, 2 and 3 + + tableview.selection.deselect(0, 1) // deselects row index 0 and 1 + + tableview.selection.deselect(2) // deselects row index 2 + \endcode + + \b Example: To iterate over selected indexes, you can pass a callback function. + \a rowIndex is passed as as an argument to the callback function. + \code + tableview.selection.forEach( function(rowIndex) {console.log(rowIndex)} ) + \endcode + + */ + + readonly property alias selection: selectionObject + + /*! + \qmlproperty enumeration TableView::selectionMode + \since QtQuick.Controls 1.1 + + This enum indicates how the view responds to user selections: + + The possible modes are: + + \list + + \li SelectionMode.NoSelection - Items cannot be selected. + + \li SelectionMode.SingleSelection - When the user selects an item, + any already-selected item becomes unselected, and the user cannot + unselect the selected item. (Default) + + \li SelectionMode.MultiSelection - When the user selects an item in the usual way, + the selection status of that item is toggled and the other items are left alone. + + \li SelectionMode.ExtendedSelection - When the user selects an item in the usual way, + the selection is cleared and the new item selected. However, if the user presses the + Ctrl key when clicking on an item, the clicked item gets toggled and all other items + are left untouched. If the user presses the Shift key while clicking + on an item, all items between the current item and the clicked item are selected or unselected, + depending on the state of the clicked item. Multiple items can be selected by dragging the + mouse over them. + + \li SelectionMode.ContiguousSelection - When the user selects an item in the usual way, + the selection is cleared and the new item selected. However, if the user presses the Shift key while + clicking on an item, all items between the current item and the clicked item are selected. + + \endlist + */ + property int selectionMode: SelectionMode.SingleSelection + + Component.onCompleted: { + for (var i = 0; i < __columns.length; ++i) { + var column = __columns[i] + if (column.Accessible.role === Accessible.ColumnHeader) + addColumn(column) + } + } + + style: Qt.createComponent(Settings.style + "/TableViewStyle.qml", root) + + + Accessible.role: Accessible.Table + + implicitWidth: 200 + implicitHeight: 150 + + frameVisible: true + __scrollBarTopMargin: (__style && __style.transientScrollBars || Qt.platform.os === "osx") ? headerrow.height : 0 + __viewTopMargin: headerrow.height + + /*! \internal */ + property bool __activateItemOnSingleClick: __style ? __style.activateItemOnSingleClick : false + + /*! \internal */ + function __decrementCurrentIndex() { + __scroller.blockUpdates = true; + listView.decrementCurrentIndex(); + __scroller.blockUpdates = false; + + var newIndex = listView.indexAt(0, listView.contentY) + if (newIndex !== -1) { + if (selectionMode > SelectionMode.SingleSelection) + mousearea.dragRow = newIndex + else if (selectionMode === SelectionMode.SingleSelection) + selection.__selectOne(newIndex) + } + } + + /*! \internal */ + function __incrementCurrentIndex() { + __scroller.blockUpdates = true; + listView.incrementCurrentIndex(); + __scroller.blockUpdates = false; + + var newIndex = Math.max(0, listView.indexAt(0, listView.height + listView.contentY)) + if (newIndex !== -1) { + if (selectionMode > SelectionMode.SingleSelection) + mousearea.dragRow = newIndex + else if (selectionMode === SelectionMode.SingleSelection) + selection.__selectOne(newIndex) + } + } + + onModelChanged: selection.clear() + + ListView { + id: listView + focus: true + activeFocusOnTab: true + anchors.topMargin: tableHeader.height + anchors.fill: parent + currentIndex: -1 + visible: columnCount > 0 + interactive: Settings.hasTouchScreen + + SystemPalette { + id: palette + colorGroup: enabled ? SystemPalette.Active : SystemPalette.Disabled + } + + Rectangle { + id: colorRect + parent: viewport + anchors.fill: parent + color: __style ? __style.backgroundColor : palette.base + z: -2 + } + + MouseArea { + id: mousearea + + z: -1 + anchors.fill: listView + propagateComposedEvents: true + + property bool autoincrement: false + property bool autodecrement: false + property int mouseModifiers: 0 + property int previousRow: 0 + property int clickedRow: -1 + property int dragRow: -1 + property int firstKeyRow: -1 + + onReleased: { + autoincrement = false + autodecrement = false + var clickIndex = listView.indexAt(0, mouseY + listView.contentY) + if (clickIndex > -1) { + if (Settings.hasTouchScreen) { + listView.currentIndex = clickIndex + mouseSelect(clickIndex, mouse.modifiers) + } + previousRow = clickIndex + } + + if (mousearea.dragRow >= 0) { + selection.__select(selection.contains(mousearea.clickedRow), mousearea.clickedRow, mousearea.dragRow) + mousearea.dragRow = -1 + } + } + + // Handle vertical scrolling whem dragging mouse outside boundraries + Timer { running: mousearea.autoincrement && __verticalScrollBar.visible; repeat: true; interval: 20 ; onTriggered: __incrementCurrentIndex()} + Timer { running: mousearea.autodecrement && __verticalScrollBar.visible; repeat: true; interval: 20 ; onTriggered: __decrementCurrentIndex()} + + onPositionChanged: { + if (mouseY > listView.height && pressed) { + if (autoincrement) return; + autodecrement = false; + autoincrement = true; + } else if (mouseY < 0 && pressed) { + if (autodecrement) return; + autoincrement = false; + autodecrement = true; + } else { + autoincrement = false; + autodecrement = false; + } + + if (pressed && !Settings.hasTouchScreen) { + var newIndex = Math.max(0, listView.indexAt(0, mouseY + listView.contentY)) + if (newIndex >= 0 && newIndex != currentRow) { + listView.currentIndex = newIndex; + if (selectionMode === SelectionMode.SingleSelection) { + selection.__selectOne(newIndex) + } else if (selectionMode > 1) { + dragRow = newIndex + } + } + } + mouseModifiers = mouse.modifiers + } + + onClicked: { + var clickIndex = listView.indexAt(0, mouseY + listView.contentY) + if (clickIndex > -1) { + if (root.__activateItemOnSingleClick) + root.activated(clickIndex) + root.clicked(clickIndex) + } + } + + onPressed: { + var newIndex = listView.indexAt(0, mouseY + listView.contentY) + listView.forceActiveFocus() + if (newIndex > -1 && !Settings.hasTouchScreen) { + listView.currentIndex = newIndex + mouseSelect(newIndex, mouse.modifiers) + mousearea.clickedRow = newIndex + } + mouseModifiers = mouse.modifiers + } + + function mouseSelect(index, modifiers) { + if (selectionMode) { + if (modifiers & Qt.ShiftModifier && (selectionMode === SelectionMode.ExtendedSelection)) { + selection.select(previousRow, index) + } else if (selectionMode === SelectionMode.MultiSelection || + (selectionMode === SelectionMode.ExtendedSelection && modifiers & Qt.ControlModifier)) { + selection.__select(!selection.contains(index) , index) + } else { + selection.__selectOne(index) + } + } + } + + onDoubleClicked: { + var clickIndex = listView.indexAt(0, mouseY + listView.contentY) + if (clickIndex > -1) { + if (!root.__activateItemOnSingleClick) + root.activated(clickIndex) + root.doubleClicked(clickIndex) + } + } + + // Note: with boolean preventStealing we are keeping the flickable from + // eating our mouse press events + preventStealing: !Settings.hasTouchScreen + + TableViewSelection { id: selectionObject } + } + + // Fills extra rows with alternate color + Column { + id: rowfiller + Loader { + id: rowSizeItem + sourceComponent: root.rowDelegate + visible: false + property QtObject styleData: QtObject { + property bool alternate: false + property bool selected: false + property bool hasActiveFocus: false + } + } + property int rowHeight: rowSizeItem.implicitHeight + property int paddedRowCount: height/rowHeight + property int count: listView.count + y: listView.contentHeight + width: parent.width + visible: alternatingRowColors + height: viewport.height - listView.contentHeight + Repeater { + model: visible ? parent.paddedRowCount : 0 + Loader { + width: rowfiller.width + height: rowfiller.rowHeight + sourceComponent: root.rowDelegate + property QtObject styleData: QtObject { + readonly property bool alternate: (index + rowCount) % 2 === 1 + readonly property bool selected: false + readonly property bool hasActiveFocus: root.activeFocus + } + readonly property var model: listView.model + readonly property var modelData: null + } + } + } + + ListModel { + id: columnModel + } + + highlightFollowsCurrentItem: true + model: root.model + + function keySelect(shiftPressed, row) { + if (row < 0 || row === rowCount - 1) + return + if (shiftPressed && (selectionMode >= SelectionMode.ExtendedSelection)) { + selection.__ranges = new Array() + selection.select(mousearea.firstKeyRow, row) + } else { + selection.__selectOne(row) + } + } + + Keys.onUpPressed: { + event.accepted = false + __scroller.blockUpdates = true; + listView.decrementCurrentIndex(); + __scroller.blockUpdates = false; + if (selectionMode) + keySelect(event.modifiers & Qt.ShiftModifier, currentRow) + } + + Keys.onDownPressed: { + event.accepted = false + __scroller.blockUpdates = true; + listView.incrementCurrentIndex(); + __scroller.blockUpdates = false; + if (selectionMode) + keySelect(event.modifiers & Qt.ShiftModifier, currentRow) + } + + Keys.onPressed: { + if (event.key === Qt.Key_PageUp) { + __verticalScrollBar.value = __verticalScrollBar.value - listView.height + } else if (event.key === Qt.Key_PageDown) + __verticalScrollBar.value = __verticalScrollBar.value + listView.height + + if (event.key === Qt.Key_Shift) { + mousearea.firstKeyRow = currentRow + } + + if (event.key === Qt.Key_A && event.modifiers & Qt.ControlModifier) { + if (selectionMode > 1) + selection.selectAll() + } + } + + Keys.onReleased: { + if (event.key === Qt.Key_Shift) + mousearea.firstKeyRow = -1 + } + + Keys.onReturnPressed: { + event.accepted = false + if (currentRow > -1) + root.activated(currentRow); + } + + delegate: FocusScope { + id: rowitem + width: itemrow.width + height: rowstyle.height + + function selected() { + if (mousearea.dragRow > -1 && (rowIndex >= mousearea.clickedRow && rowIndex <= mousearea.dragRow + || rowIndex <= mousearea.clickedRow && rowIndex >=mousearea.dragRow)) + return selection.contains(mousearea.clickedRow) + + return selection.count && selection.contains(rowIndex) + } + readonly property int rowIndex: model.index + readonly property bool alternate: alternatingRowColors && rowIndex % 2 == 1 + readonly property var itemModelData: typeof modelData == "undefined" ? null : modelData + readonly property var itemModel: model + readonly property bool itemSelected: selected() + readonly property color itemTextColor: itemSelected ? __style.highlightedTextColor : __style.textColor + + onActiveFocusChanged: { + if (activeFocus) + listView.currentIndex = rowIndex + } + + Loader { + id: rowstyle + // row delegate + sourceComponent: root.rowDelegate + // Row fills the view width regardless of item size + // But scrollbar should not adjust to it + height: item ? item.height : 16 + width: parent.width + __horizontalScrollBar.width + x: listView.contentX + + // these properties are exposed to the row delegate + // Note: these properties should be mirrored in the row filler as well + property QtObject styleData: QtObject { + readonly property int row: rowitem.rowIndex + readonly property bool alternate: rowitem.alternate + readonly property bool selected: rowitem.itemSelected + readonly property bool hasActiveFocus: root.activeFocus + } + readonly property var model: listView.model + readonly property var modelData: rowitem.itemModelData + } + Row { + id: itemrow + height: parent.height + Repeater { + id: repeater + model: columnModel + + Loader { + id: itemDelegateLoader + width: columnItem.width + height: parent ? parent.height : 0 + visible: columnItem.visible + sourceComponent: columnItem.delegate ? columnItem.delegate : itemDelegate + + // these properties are exposed to the item delegate + readonly property var model: listView.model + readonly property var modelData: itemModelData + + property QtObject styleData: QtObject { + readonly property int row: rowitem.rowIndex + readonly property int column: index + readonly property int elideMode: columnItem.elideMode + readonly property int textAlignment: columnItem.horizontalAlignment + readonly property bool selected: rowitem.itemSelected + readonly property color textColor: rowitem.itemTextColor + readonly property string role: columnItem.role + readonly property var value: itemModel.hasOwnProperty(role) + ? itemModel[role] // Qml ListModel and QAbstractItemModel + : modelData && modelData.hasOwnProperty(role) + ? modelData[role] // QObjectList / QObject + : modelData != undefined ? modelData : "" // Models without role + } + } + } + onWidthChanged: listView.contentWidth = width + } + } + + Text{ id:text } + + Item { + id: tableHeader + clip: true + parent: __scroller + visible: headerVisible + anchors.top: parent.top + anchors.topMargin: viewport.anchors.topMargin + anchors.leftMargin: viewport.anchors.leftMargin + anchors.margins: viewport.anchors.margins + anchors.rightMargin: (frameVisible ? __scroller.rightMargin : 0) + + (__scroller.outerFrame && __scrollBarTopMargin ? 0 : __verticalScrollBar.width + + __scroller.scrollBarSpacing + root.__style.padding.right) + + anchors.left: parent.left + anchors.right: parent.right + + height: headerrow.height + + Row { + id: headerrow + x: -listView.contentX + + Repeater { + id: repeater + + property int targetIndex: -1 + property int dragIndex: -1 + + model: columnModel + + delegate: Item { + z:-index + width: columnCount == 1 ? viewport.width + __verticalScrollBar.width : modelData.width + visible: modelData.visible + height: headerVisible ? headerStyle.height : 0 + + Loader { + id: headerStyle + sourceComponent: root.headerDelegate + anchors.left: parent.left + anchors.right: parent.right + property QtObject styleData: QtObject { + readonly property string value: modelData.title + readonly property bool pressed: headerClickArea.pressed + readonly property bool containsMouse: headerClickArea.containsMouse + readonly property int column: index + readonly property int textAlignment: modelData.horizontalAlignment + } + } + Rectangle{ + id: targetmark + width: parent.width + height:parent.height + opacity: (index == repeater.targetIndex && repeater.targetIndex != repeater.dragIndex) ? 0.5 : 0 + Behavior on opacity { NumberAnimation{duration:160}} + color: palette.highlight + visible: modelData.movable + } + + MouseArea{ + id: headerClickArea + drag.axis: Qt.YAxis + hoverEnabled: true + anchors.fill: parent + onClicked: { + if (sortIndicatorColumn == index) + sortIndicatorOrder = sortIndicatorOrder == Qt.AscendingOrder ? Qt.DescendingOrder : Qt.AscendingOrder + sortIndicatorColumn = index + } + // Here we handle moving header sections + // NOTE: the direction is different from the master branch + // so this indicates that I am using an invalid assumption on item ordering + onPositionChanged: { + if (modelData.movable && pressed && columnCount > 1) { // only do this while dragging + for (var h = columnCount-1 ; h >= 0 ; --h) { + if (drag.target.x > headerrow.children[h].x) { + repeater.targetIndex = h + break + } + } + } + } + + onPressed: { + repeater.dragIndex = index + draghandle.x = parent.x + } + + onReleased: { + if (repeater.targetIndex >= 0 && repeater.targetIndex != index ) { + var targetColumn = columnModel.get(repeater.targetIndex).columnItem + if (targetColumn.movable) { + columnModel.move(index, repeater.targetIndex, 1) + if (sortIndicatorColumn == index) + sortIndicatorColumn = repeater.targetIndex + } + } + repeater.targetIndex = -1 + } + drag.maximumX: 1000 + drag.minimumX: -1000 + drag.target: modelData.movable && columnCount > 1 ? draghandle : null + } + + Loader { + id: draghandle + property QtObject styleData: QtObject{ + readonly property string value: modelData.title + readonly property bool pressed: headerClickArea.pressed + readonly property bool containsMouse: headerClickArea.containsMouse + readonly property int column: index + readonly property int textAlignment: modelData.horizontalAlignment + } + + parent: tableHeader + width: modelData.width + height: parent.height + sourceComponent: root.headerDelegate + visible: headerClickArea.pressed + opacity: 0.5 + } + + + MouseArea { + id: headerResizeHandle + property int offset: 0 + property int minimumSize: 20 + anchors.rightMargin: -width/2 + width: 16 ; height: parent.height + anchors.right: parent.right + enabled: modelData.resizable && columnCount > 1 + onPositionChanged: { + var newHeaderWidth = modelData.width + (mouseX - offset) + modelData.width = Math.max(minimumSize, newHeaderWidth) + } + property bool found:false + + onDoubleClicked: { + var row + var minWidth = 0 + var listdata = listView.children[0] + for (row = 0 ; row < listdata.children.length ; ++row){ + var item = listdata.children[row+1] + if (item && item.children[1] && item.children[1].children[index] && + item.children[1].children[index].children[0].hasOwnProperty("implicitWidth")) + minWidth = Math.max(minWidth, item.children[1].children[index].children[0].implicitWidth) + } + if (minWidth) + modelData.width = minWidth + } + onPressedChanged: if (pressed) offset=mouseX + cursorShape: enabled ? Qt.SplitHCursor : Qt.ArrowCursor + } + } + } + } + Loader { + id: loader + property QtObject styleData: QtObject{ + readonly property string value: "" + readonly property bool pressed: false + readonly property bool containsMouse: false + readonly property int column: -1 + readonly property int textAlignment: Text.AlignLeft + } + + anchors.top: parent.top + anchors.right: parent.right + anchors.bottom: headerrow.bottom + anchors.rightMargin: -2 + sourceComponent: root.headerDelegate + width: root.width - headerrow.width + 2 + visible: root.columnCount + z:-1 + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TableViewColumn.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TableViewColumn.qml new file mode 100644 index 00000000000..cbf20945638 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TableViewColumn.qml @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 + +/*! + \qmltype TableViewColumn + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup viewitems + \brief Used to define columns in a \l TableView. +*/ + +QtObject { + + /*! \internal */ + property Item __view: null + + /*! The title text of the column. */ + property string title + + /*! The model \c role of the column. */ + property string role + + /*! The current width of the column + The default value depends on platform. If only one + column is defined, the width expands to the viewport. + */ + property int width: (__view && __view.columnCount === 1) ? __view.viewport.width : 160 + + /*! The visible status of the column. */ + property bool visible: true + + /*! Determines if the column should be resizable. + \since QtQuick.Controls 1.1 */ + property bool resizable: true + + /*! Determines if the column should be movable. + The default value is \c true. + \note A non-movable column may get indirectly moved if adjacent columns are movable. + \since QtQuick.Controls 1.1 */ + property bool movable: true + + /*! \qmlproperty enumeration TableViewColumn::elideMode + The text elide mode of the column. + Allowed values are: + \list + \li Text.ElideNone + \li Text.ElideLeft + \li Text.ElideMiddle + \li Text.ElideRight - the default + \endlist + \sa {QtQuick2::}{Text::elide} */ + property int elideMode: Text.ElideRight + + /*! \qmlproperty enumeration TableViewColumn::horizontalAlignment + The horizontal text alignment of the column. + Allowed values are: + \list + \li Text.AlignLeft - the default + \li Text.AlignRight + \li Text.AlignHCenter + \li Text.AlignJustify + \endlist + \sa {QtQuick2::}{Text::horizontalAlignment} */ + property int horizontalAlignment: Text.AlignLeft + + /*! The delegate of the column. This can be used to set the + \l TableView::itemDelegate for a specific column. + + In the delegate you have access to the following special properties: + \list + \li styleData.selected - if the item is currently selected + \li styleData.value - the value or text for this item + \li styleData.textColor - the default text color for an item + \li styleData.row - the index of the row + \li styleData.column - the index of the column + \li styleData.elideMode - the elide mode of the column + \li styleData.textAlignment - the horizontal text alignment of the column + \endlist + */ + property Component delegate + + Accessible.role: Accessible.ColumnHeader +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TextArea.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TextArea.qml new file mode 100644 index 00000000000..7269791962b --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TextArea.qml @@ -0,0 +1,764 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.2 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 +/*! + \qmltype TextArea + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief Displays multiple lines of editable formatted text. + + It can display both plain and rich text. For example: + + \qml + TextArea { + width: 240 + text: "Hello World!" + } + \endqml + + Clipboard support is provided by the cut(), copy(), and paste() functions, and the selection can + be handled in a traditional "mouse" mechanism by setting selectByMouse, or handled completely + from QML by manipulating selectionStart and selectionEnd, or using selectAll() or selectWord(). + + You can translate between cursor positions (characters from the start of the document) and pixel + points using positionAt() and positionToRectangle(). + + You can create a custom appearance for a TextArea by + assigning a \l{QtQuick.Controls.Styles::TextAreaStyle}{TextAreaStyle}. + + \sa TextField, TextEdit +*/ + +ScrollView { + id: area + + /*! + \qmlproperty bool TextArea::activeFocusOnPress + + Whether the TextEdit should gain active focus on a mouse press. By default this is + set to true. + */ + property alias activeFocusOnPress: edit.activeFocusOnPress + + /*! + \qmlproperty url TextArea::baseUrl + + This property specifies a base URL which is used to resolve relative URLs + within the text. + + The default value is the url of the QML file instantiating the TextArea item. + */ + property alias baseUrl: edit.baseUrl + + /*! + \qmlproperty bool TextArea::canPaste + + Returns true if the TextArea is writable and the content of the clipboard is + suitable for pasting into the TextArea. + */ + readonly property alias canPaste: edit.canPaste + + /*! + \qmlproperty bool TextArea::canRedo + + Returns true if the TextArea is writable and there are \l {undo}{undone} + operations that can be redone. + */ + readonly property alias canRedo: edit.canRedo + + /*! + \qmlproperty bool TextArea::canUndo + + Returns true if the TextArea is writable and there are previous operations + that can be undone. + */ + readonly property alias canUndo: edit.canUndo + + /*! + \qmlproperty color TextArea::textColor + + The text color. + + \qml + TextArea { textColor: "orange" } + \endqml + */ + property alias textColor: edit.color + + /*! + \qmlproperty int TextArea::cursorPosition + The position of the cursor in the TextArea. + */ + property alias cursorPosition: edit.cursorPosition + + /*! \qmlproperty font TextArea::font + + The font of the TextArea. + */ + property alias font: edit.font + + /*! + \qmlproperty enumeration TextArea::horizontalAlignment + + Sets the alignment of the text within the TextArea item's width. + + By default, the horizontal text alignment follows the natural alignment of the text, + for example, text that is read from left to right will be aligned to the left. + + The valid values for \c horizontalAlignment are: + \list + \li TextEdit.AlignLeft (Default) + \li TextEdit.AlignRight + \li TextEdit.AlignHCenter + \endlist + + When using the attached property LayoutMirroring::enabled to mirror application + layouts, the horizontal alignment of text will also be mirrored. However, the property + \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment + of TextArea, use the read-only property \c effectiveHorizontalAlignment. + */ + property alias horizontalAlignment: edit.horizontalAlignment + + /*! + \qmlproperty enumeration TextArea::effectiveHorizontalAlignment + + Gets the effective horizontal alignment of the text within the TextArea item's width. + + To set/get the default horizontal alignment of TextArea, use the property \c horizontalAlignment. + + */ + readonly property alias effectiveHorizontalAlignment: edit.effectiveHorizontalAlignment + + /*! + \qmlproperty enumeration TextArea::verticalAlignment + + Sets the alignment of the text within the TextArea item's height. + + The valid values for \c verticalAlignment are: + \list + \li TextEdit.AlignTop + \li TextEdit.AlignBottom + \li TextEdit.AlignVCenter (Default) + \endlist + */ + property alias verticalAlignment: edit.verticalAlignment + + /*! + \qmlproperty enumeration TextArea::inputMethodHints + + Provides hints to the input method about the expected content of the text edit, and how it + should operate. + + The value is a bit-wise combination of flags or Qt.ImhNone if no hints are set. + + The default value is \c Qt.ImhNone. + + Flags that alter behavior are: + + \list + \li Qt.ImhHiddenText - Characters should be hidden, as is typically used when entering passwords. + \li Qt.ImhSensitiveData - Typed text should not be stored by the active input method + in any persistent storage like predictive user dictionary. + \li Qt.ImhNoAutoUppercase - The input method should not try to automatically switch to upper case + when a sentence ends. + \li Qt.ImhPreferNumbers - Numbers are preferred (but not required). + \li Qt.ImhPreferUppercase - Upper case letters are preferred (but not required). + \li Qt.ImhPreferLowercase - Lower case letters are preferred (but not required). + \li Qt.ImhNoPredictiveText - Do not use predictive text (i.e. dictionary lookup) while typing. + + \li Qt.ImhDate - The text editor functions as a date field. + \li Qt.ImhTime - The text editor functions as a time field. + \endlist + + Flags that restrict input (exclusive flags) are: + + \list + \li Qt.ImhDigitsOnly - Only digits are allowed. + \li Qt.ImhFormattedNumbersOnly - Only number input is allowed. This includes decimal point and minus sign. + \li Qt.ImhUppercaseOnly - Only upper case letter input is allowed. + \li Qt.ImhLowercaseOnly - Only lower case letter input is allowed. + \li Qt.ImhDialableCharactersOnly - Only characters suitable for phone dialing are allowed. + \li Qt.ImhEmailCharactersOnly - Only characters suitable for email addresses are allowed. + \li Qt.ImhUrlCharactersOnly - Only characters suitable for URLs are allowed. + \endlist + + Masks: + + \list + \li Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used. + \endlist + */ + property alias inputMethodHints: edit.inputMethodHints + + /*! + \qmlproperty int TextArea::length + + Returns the total number of plain text characters in the TextArea item. + + As this number doesn't include any formatting markup, it may not be the same as the + length of the string returned by the \l text property. + + This property can be faster than querying the length the \l text property as it doesn't + require any copying or conversion of the TextArea's internal string data. + */ + readonly property alias length: edit.length + + /*! + \qmlproperty int TextArea::lineCount + + Returns the total number of lines in the TextArea item. + */ + readonly property alias lineCount: edit.lineCount + + /*! + \qmlproperty bool TextArea::readOnly + + Whether the user can interact with the TextArea item. + + The difference from a disabled text field is that it will appear + to be active, and text can be selected and copied. + + If this property is set to \c true, the text cannot be edited by user interaction. + + By default this property is \c false. + */ + property alias readOnly: edit.readOnly + + /*! + \qmlproperty string TextArea::selectedText + + This read-only property provides the text currently selected in the + text edit. + */ + readonly property alias selectedText: edit.selectedText + + /*! + \qmlproperty int TextArea::selectionEnd + + The cursor position after the last character in the current selection. + + This property is read-only. To change the selection, use select(start,end), + selectAll(), or selectWord(). + + \sa selectionStart, cursorPosition, selectedText + */ + readonly property alias selectionEnd: edit.selectionEnd + + /*! + \qmlproperty int TextArea::selectionStart + + The cursor position before the first character in the current selection. + + This property is read-only. To change the selection, use select(start,end), + selectAll(), or selectWord(). + + \sa selectionEnd, cursorPosition, selectedText + */ + readonly property alias selectionStart: edit.selectionStart + + /*! + \qmlproperty bool TextArea::tabChangesFocus + + This property holds whether Tab changes focus, or is accepted as input. + + Defaults to \c false. + */ + property bool tabChangesFocus: false + + /*! + \qmlproperty string TextArea::text + + The text to display. If the text format is AutoText the text edit will + automatically determine whether the text should be treated as + rich text. This determination is made using Qt::mightBeRichText(). + */ + property alias text: edit.text + + /*! + \qmlproperty enumeration TextArea::textFormat + + The way the text property should be displayed. + + \list + \li TextEdit.AutoText + \li TextEdit.PlainText + \li TextEdit.RichText + \endlist + + The default is TextEdit.PlainText. If the text format is TextEdit.AutoText the text edit + will automatically determine whether the text should be treated as + rich text. This determination is made using Qt::mightBeRichText(). + */ + property alias textFormat: edit.textFormat + + /*! + \qmlproperty enumeration TextArea::wrapMode + + Set this property to wrap the text to the TextArea item's width. + The text will only wrap if an explicit width has been set. + + \list + \li TextEdit.NoWrap - no wrapping will be performed. If the text contains insufficient newlines, then implicitWidth will exceed a set width. + \li TextEdit.WordWrap - wrapping is done on word boundaries only. If a word is too long, implicitWidth will exceed a set width. + \li TextEdit.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word. + \li TextEdit.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word. + \endlist + + The default is \c TextEdit.NoWrap. If you set a width, consider using TextEdit.Wrap. + */ + property alias wrapMode: edit.wrapMode + + /*! + \qmlproperty bool TextArea::selectByMouse + + This property determines if the user can select the text with the + mouse. + + The default value is \c true. + */ + property alias selectByMouse: edit.selectByMouse + + /*! + \qmlproperty bool TextArea::selectByKeyboard + + This property determines if the user can select the text with the + keyboard. + + If set to \c true, the user can use the keyboard to select the text + even if the editor is read-only. If set to \c false, the user cannot + use the keyboard to select the text even if the editor is editable. + + The default value is \c true when the editor is editable, + and \c false when read-only. + + \sa readOnly + */ + property alias selectByKeyboard: edit.selectByKeyboard + + /*! + \qmlsignal TextArea::linkActivated(string link) + + This signal is emitted when the user clicks on a link embedded in the text. + The link must be in rich text or HTML format and the + \a link string provides access to the particular link. + */ + signal linkActivated(string link) + + /*! + \qmlsignal TextArea::linkHovered(string link) + \since 5.2 + + This signal is emitted when the user hovers a link embedded in the text. + The link must be in rich text or HTML format and the + \a link string provides access to the particular link. + + \sa hoveredLink + */ + signal linkHovered(string link) + + /*! + \qmlproperty string TextArea::hoveredLink + \since QtQuick.Controls 1.1 + + This property contains the link string when user hovers a link + embedded in the text. The link must be in rich text or HTML format + and the link string provides access to the particular link. + + \sa onLinkHovered + */ + readonly property alias hoveredLink: edit.hoveredLink + + /*! + \qmlmethod TextArea::append(string) + + Appends \a string as a new line to the end of the text area. + */ + function append (string) { + edit.append(string) + __verticalScrollBar.value = __verticalScrollBar.maximumValue + } + + /*! + \qmlmethod TextArea::copy() + + Copies the currently selected text to the system clipboard. + */ + function copy() { + edit.copy(); + } + + /*! + \qmlmethod TextArea::cut() + + Moves the currently selected text to the system clipboard. + */ + function cut() { + edit.cut(); + } + + /*! + \qmlmethod TextArea::deselect() + + Removes active text selection. + */ + function deselect() { + edit.deselect(); + } + + /*! + \qmlmethod string TextArea::getFormattedText(int start, int end) + + Returns the section of text that is between the \a start and \a end positions. + + The returned text will be formatted according to the \l textFormat property. + */ + function getFormattedText(start, end) { + return edit.getFormattedText(start, end); + } + + /*! + \qmlmethod string TextArea::getText(int start, int end) + + Returns the section of text that is between the \a start and \a end positions. + + The returned text does not include any rich text formatting. + */ + function getText(start, end) { + return edit.getText(start, end); + } + + /*! + \qmlmethod TextArea::insert(int position, string text) + + Inserts \a text into the TextArea at position. + */ + function insert(position, text) { + edit.insert(position, text); + } + + /*! + \qmlmethod TextArea::isRightToLeft(int start, int end) + + Returns true if the natural reading direction of the editor text + found between positions \a start and \a end is right to left. + */ + function isRightToLeft(start, end) { + return edit.isRightToLeft(start, end); + } + + /*! + \qmlmethod TextArea::moveCursorSelection(int position, SelectionMode mode = TextEdit.SelectCharacters) + + Moves the cursor to \a position and updates the selection according to the optional \a mode + parameter. (To only move the cursor, set the \l cursorPosition property.) + + When this method is called it additionally sets either the + selectionStart or the selectionEnd (whichever was at the previous cursor position) + to the specified position. This allows you to easily extend and contract the selected + text range. + + The selection mode specifies whether the selection is updated on a per character or a per word + basis. If not specified the selection mode will default to TextEdit.SelectCharacters. + + \list + \li TextEdit.SelectCharacters - Sets either the selectionStart or selectionEnd (whichever was at + the previous cursor position) to the specified position. + \li TextEdit.SelectWords - Sets the selectionStart and selectionEnd to include all + words between the specified position and the previous cursor position. Words partially in the + range are included. + \endlist + + For example, take this sequence of calls: + + \code + cursorPosition = 5 + moveCursorSelection(9, TextEdit.SelectCharacters) + moveCursorSelection(7, TextEdit.SelectCharacters) + \endcode + + This moves the cursor to the 5th position, extends the selection end from 5 to 9, + and then retracts the selection end from 9 to 7, leaving the text from the 5th + position to the 7th position selected (the 6th and 7th characters). + + The same sequence with TextEdit.SelectWords will extend the selection start to a word boundary + before or on the 5th position, and extend the selection end to a word boundary on or past the 9th position. + */ + function moveCursorSelection(position, mode) { + edit.moveCursorSelection(position, mode); + } + + /*! + \qmlmethod TextArea::paste() + + Replaces the currently selected text by the contents of the system clipboard. + */ + function paste() { + edit.paste(); + } + + /*! + \qmlmethod int TextArea::positionAt(int x, int y) + + Returns the text position closest to pixel position (\a x, \a y). + + Position 0 is before the first character, position 1 is after the first character + but before the second, and so on until position \l {text}.length, which is after all characters. + */ + function positionAt(x, y) { + return edit.positionAt(x, y); + } + + /*! + \qmlmethod rectangle TextArea::positionToRectangle(position) + + Returns the rectangle at the given \a position in the text. The x, y, + and height properties correspond to the cursor that would describe + that position. + */ + function positionToRectangle(position) { + return edit.positionToRectangle(position); + } + + /*! + \qmlmethod TextArea::redo() + + Redoes the last operation if redo is \l {canRedo}{available}. + */ + function redo() { + edit.redo(); + } + + /*! + \qmlmethod string TextArea::remove(int start, int end) + + Removes the section of text that is between the \a start and \a end positions from the TextArea. + */ + function remove(start, end) { + return edit.remove(start, end); + } + + /*! + \qmlmethod TextArea::select(int start, int end) + + Causes the text from \a start to \a end to be selected. + + If either start or end is out of range, the selection is not changed. + + After calling this, selectionStart will become the lesser + and selectionEnd will become the greater (regardless of the order passed + to this method). + + \sa selectionStart, selectionEnd + */ + function select(start, end) { + edit.select(start, end); + } + + /*! + \qmlmethod TextArea::selectAll() + + Causes all text to be selected. + */ + function selectAll() { + edit.selectAll(); + } + + /*! + \qmlmethod TextArea::selectWord() + + Causes the word closest to the current cursor position to be selected. + */ + function selectWord() { + edit.selectWord(); + } + + /*! + \qmlmethod TextArea::undo() + + Undoes the last operation if undo is \l {canUndo}{available}. Deselects any + current selection, and updates the selection start to the current cursor + position. + */ + function undo() { + edit.undo(); + } + + /*! \qmlproperty bool TextArea::backgroundVisible + + This property determines if the background should be filled or not. + + The default value is \c true. + */ + property alias backgroundVisible: colorRect.visible + + /*! \internal */ + default property alias data: area.data + + /*! \qmlproperty real TextArea::textMargin + \since QtQuick.Controls 1.1 + + The margin, in pixels, around the text in the TextArea. + */ + property alias textMargin: edit.textMargin + + frameVisible: true + + activeFocusOnTab: true + + Accessible.role: Accessible.EditableText + + style: Qt.createComponent(Settings.style + "/TextAreaStyle.qml", area) + + /*! + \qmlproperty TextDocument TextArea::textDocument + + This property exposes the \l QQuickTextDocument of this TextArea. + \sa TextEdit::textDocument + */ + property alias textDocument: edit.textDocument + + Flickable { + id: flickable + + interactive: false + anchors.fill: parent + + TextEdit { + id: edit + focus: true + + Rectangle { + id: colorRect + parent: viewport + anchors.fill: parent + color: __style ? __style.backgroundColor : "white" + z: -1 + } + + property int layoutRecursionDepth: 0 + + function doLayout() { + // scrollbars affect the document/viewport size and vice versa, so we + // must allow the layout loop to recurse twice until the sizes stabilize + if (layoutRecursionDepth <= 2) { + layoutRecursionDepth++ + + if (wrapMode == TextEdit.NoWrap) { + __horizontalScrollBar.visible = edit.contentWidth > viewport.width + edit.width = Math.max(viewport.width, edit.contentWidth) + } else { + __horizontalScrollBar.visible = false + edit.width = viewport.width + } + edit.height = Math.max(viewport.height, edit.contentHeight) + + flickable.contentWidth = edit.contentWidth + flickable.contentHeight = edit.contentHeight + + layoutRecursionDepth-- + } + } + + Connections { + target: area.viewport + onWidthChanged: edit.doLayout() + onHeightChanged: edit.doLayout() + } + onContentWidthChanged: edit.doLayout() + onContentHeightChanged: edit.doLayout() + onWrapModeChanged: edit.doLayout() + + renderType: __style ? __style.renderType : Text.NativeRendering + font: __style ? __style.font : font + color: __style ? __style.textColor : "darkgray" + selectionColor: __style ? __style.selectionColor : "darkred" + selectedTextColor: __style ? __style.selectedTextColor : "white" + wrapMode: TextEdit.WordWrap + textMargin: 4 + + selectByMouse: true + readOnly: false + + KeyNavigation.priority: KeyNavigation.BeforeItem + KeyNavigation.tab: area.tabChangesFocus ? area.KeyNavigation.tab : null + KeyNavigation.backtab: area.tabChangesFocus ? area.KeyNavigation.backtab : null + + // keep textcursor within scroll view + onCursorPositionChanged: { + if (cursorRectangle.y >= flickableItem.contentY + viewport.height - cursorRectangle.height - textMargin) { + // moving down + flickableItem.contentY = cursorRectangle.y - viewport.height + cursorRectangle.height + textMargin + } else if (cursorRectangle.y < flickableItem.contentY) { + // moving up + flickableItem.contentY = cursorRectangle.y - textMargin + } + + if (cursorRectangle.x >= flickableItem.contentX + viewport.width - textMargin) { + // moving right + flickableItem.contentX = cursorRectangle.x - viewport.width + textMargin + } else if (cursorRectangle.x < flickableItem.contentX) { + // moving left + flickableItem.contentX = cursorRectangle.x - textMargin + } + } + onLinkActivated: area.linkActivated(link) + onLinkHovered: area.linkHovered(link) + + MouseArea { + parent: area.viewport + anchors.fill: parent + cursorShape: edit.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor + acceptedButtons: Qt.NoButton + } + } + } + + Keys.onPressed: { + if (event.key == Qt.Key_PageUp) { + __verticalScrollBar.value -= area.height + } else if (event.key == Qt.Key_PageDown) + __verticalScrollBar.value += area.height + } + +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TextField.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TextField.qml new file mode 100644 index 00000000000..0961430d524 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/TextField.qml @@ -0,0 +1,609 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.2 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype TextField + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief Displays a single line of editable plain text. + + TextField is used to accept a line of text input. Input constraints can be + placed on a TextField item (for example, through a \l validator or \l + inputMask). Setting \l echoMode to an appropriate value enables + TextField to be used for a password input field. + + You can create a custom appearance for a TextField by + assigning a \l {QtQuick.Controls.Styles::TextFieldStyle}{TextFieldStyle}. + + \sa TextArea, TextInput +*/ + +Control { + id: textfield + + /*! + \qmlproperty bool TextField::acceptableInput + + Returns \c true if the text field contains acceptable + text. + + If a validator or input mask was set, this property will return \c + true if the current text satisfies the validator or mask as + a final string (not as an intermediate string). + + The default value is \c true. + + \sa validator, inputMask, accepted + + */ + readonly property alias acceptableInput: textInput.acceptableInput // read only + + /*! + \qmlproperty bool TextField::activeFocusOnPress + + This property is set to \c true if the TextField should gain active + focus on a mouse press. + + The default value is \c true. + */ + property alias activeFocusOnPress: textInput.activeFocusOnPress + + /*! + \qmlproperty bool TextField::canPaste + + Returns \c true if the TextField is writable and the content of the + clipboard is suitable for pasting into the TextField. + */ + readonly property alias canPaste: textInput.canPaste + + /*! + \qmlproperty bool TextField::canRedo + + Returns \c true if the TextField is writable and there are \l + {undo}{undone} operations that can be redone. + */ + readonly property alias canRedo: textInput.canRedo + + /*! + \qmlproperty bool TextField::canUndo + + Returns \c true if the TextField is writable and there are previous + operations that can be undone. + */ + readonly property alias canUndo: textInput.canUndo + + /*! + \qmlproperty color TextField::textColor + + This property holds the text color. + */ + property alias textColor: textInput.color + + /*! + \qmlproperty int TextField::cursorPosition + + This property holds the position of the cursor in the TextField. + */ + property alias cursorPosition: textInput.cursorPosition + + /*! + \qmlproperty string TextField::displayText + + This property holds the text displayed in the TextField. + + If \l echoMode is set to TextInput::Normal, this holds the + same value as the TextField::text property. Otherwise, + this property holds the text visible to the user, while + the \l text property holds the actual entered text. + */ + readonly property alias displayText: textInput.displayText + + /*! + \qmlproperty enumeration TextField::echoMode + + Specifies how the text should be displayed in the + TextField. + + The possible modes are: + \list + \li TextInput.Normal - Displays the text as it is. (Default) + \li TextInput.Password - Displays asterisks instead of characters. + \li TextInput.NoEcho - Displays nothing. + \li TextInput.PasswordEchoOnEdit - Displays characters as they are + entered while editing, otherwise displays asterisks. + \endlist + */ + property alias echoMode: textInput.echoMode + + /*! + \qmlproperty font TextField::font + + Sets the font of the TextField. + */ + property alias font: textInput.font + + /*! + \qmlproperty enumeration TextField::horizontalAlignment + + Sets the alignment of the text within the TextField item's width. + + By default, the horizontal text alignment follows the natural alignment + of the text, for example text that is read from left to right will be + aligned to the left. + + The possible alignment values are: + \list + \li TextInput.AlignLeft + \li TextInput.AlignRight + \li TextInput.AlignHCenter + \endlist + + When using the attached property, LayoutMirroring::enabled, to mirror + application layouts, the horizontal alignment of text will also be + mirrored. However, the property \c horizontalAlignment will remain + unchanged. To query the effective horizontal alignment of TextField, use + the read-only property \c effectiveHorizontalAlignment. + */ + property alias horizontalAlignment: textInput.horizontalAlignment + + /*! + \qmlproperty enumeration TextField::effectiveHorizontalAlignment + + Gets the effective horizontal alignment of the text within the TextField + item's width. + + \l horizontalAlignment contains the default horizontal alignment. + + \sa horizontalAlignment + + */ + readonly property alias effectiveHorizontalAlignment: textInput.effectiveHorizontalAlignment + + /*! + \qmlproperty enumeration TextField::verticalAlignment + + Sets the alignment of the text within the TextField item's height. + + The possible alignment values are: + \list + \li TextInput.AlignTop + \li TextInput.AlignBottom + \li TextInput.AlignVCenter (default). + \endlist + */ + property alias verticalAlignment: textInput.verticalAlignment + + /*! + \qmlproperty string TextField::inputMask + + Sets an input mask on the TextField, restricting the allowable text + inputs. See QLineEdit::inputMask for further details, as the exact same + mask strings are used by TextField. + + \sa acceptableInput, validator + */ + property alias inputMask: textInput.inputMask + + /*! + \qmlproperty enumeration TextField::inputMethodHints + + Provides hints to the input method about the expected content of the + text field and how it should operate. + + The value is a bit-wise combination of flags, or \c Qt.ImhNone if no + hints are set. + + The default value is \c Qt.ImhNone. + + Flags that alter behavior are: + + \list + \li Qt.ImhHiddenText - Characters should be hidden, as is typically used when entering passwords. + This is automatically set when setting echoMode to \c TextInput.Password. + \li Qt.ImhSensitiveData - Typed text should not be stored by the active input method + in any persistent storage like predictive user dictionary. + \li Qt.ImhNoAutoUppercase - The input method should not try to automatically switch to upper case + when a sentence ends. + \li Qt.ImhPreferNumbers - Numbers are preferred (but not required). + \li Qt.ImhPreferUppercase - Uppercase letters are preferred (but not required). + \li Qt.ImhPreferLowercase - Lowercase letters are preferred (but not required). + \li Qt.ImhNoPredictiveText - Do not use predictive text (for example, dictionary lookup) while typing. + + \li Qt.ImhDate - The text editor functions as a date field. + \li Qt.ImhTime - The text editor functions as a time field. + \endlist + + Flags that restrict input (exclusive flags) are: + + \list + \li Qt.ImhDigitsOnly - Only digits are allowed. + \li Qt.ImhFormattedNumbersOnly - Only number input is allowed. This includes decimal point and minus sign. + \li Qt.ImhUppercaseOnly - Only uppercase letter input is allowed. + \li Qt.ImhLowercaseOnly - Only lowercase letter input is allowed. + \li Qt.ImhDialableCharactersOnly - Only characters suitable for phone dialing are allowed. + \li Qt.ImhEmailCharactersOnly - Only characters suitable for email addresses are allowed. + \li Qt.ImhUrlCharactersOnly - Only characters suitable for URLs are allowed. + \endlist + + Masks: + \list + \li Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used. + \endlist + */ + property alias inputMethodHints: textInput.inputMethodHints + + /*! + \qmlproperty int TextField::length + + Returns the total number of characters in the TextField item. + + If the TextField has an input mask, the length will include mask + characters and may differ from the length of the string returned by the + \l text property. + + This property can be faster than querying the length of the \l text + property as it doesn't require any copying or conversion of the + TextField's internal string data. + */ + readonly property alias length: textInput.length + + /*! + \qmlproperty int TextField::maximumLength + + This property holds the maximum permitted length of the text in the + TextField. + + If the text is too long, it is truncated at the limit. + */ + property alias maximumLength: textInput.maximumLength + + /*! + \qmlproperty string TextField::placeholderText + + This property contains the text that is shown in the text field when the + text field is empty and has no focus. + */ + property alias placeholderText: placeholderTextComponent.text + + /*! + \qmlproperty bool TextField::readOnly + + Sets whether user input can modify the contents of the TextField. Read- + only is different from a disabled text field in that the text field will + appear to be active and text can still be selected and copied. + + If readOnly is set to \c true, then user input will not affect the text. + Any bindings or attempts to set the text property will still + work, however. + */ + property alias readOnly: textInput.readOnly + + /*! + \qmlproperty string TextField::selectedText + + Provides the text currently selected in the text input. + + It is equivalent to the following snippet, but is faster and easier + to use. + + \code + myTextField.text.toString().substring(myTextField.selectionStart, myTextField.selectionEnd); + \endcode + */ + readonly property alias selectedText: textInput.selectedText + + /*! + \qmlproperty int TextField::selectionEnd + + The cursor position after the last character in the current selection. + + This property is read-only. To change the selection, use + select(start,end), selectAll(), or selectWord(). + + \sa selectionStart, cursorPosition, selectedText + */ + readonly property alias selectionEnd: textInput.selectionEnd + + /*! + \qmlproperty int TextField::selectionStart + + The cursor position before the first character in the current selection. + + This property is read-only. To change the selection, use select(start,end), + selectAll(), or selectWord(). + + \sa selectionEnd, cursorPosition, selectedText + */ + readonly property alias selectionStart: textInput.selectionStart + + /*! + \qmlproperty string TextField::text + + This property contains the text in the TextField. + */ + property alias text: textInput.text + + /*! + \qmlproperty Validator TextField::validator + + Allows you to set a validator on the TextField. When a validator is set, + the TextField will only accept input which leaves the text property in + an intermediate state. The accepted signal will only be sent + if the text is in an acceptable state when enter is pressed. + + Currently supported validators are \l{QtQuick2::IntValidator}, + \l{QtQuick2::DoubleValidator}, and \l{QtQuick2::RegExpValidator}. An + example of using validators is shown below, which allows input of + integers between 11 and 31 into the text input: + + \code + import QtQuick 2.1 + import QtQuick.Controls 1.1 + + TextField { + validator: IntValidator {bottom: 11; top: 31;} + focus: true + } + \endcode + + \sa acceptableInput, inputMask, accepted + */ + property alias validator: textInput.validator + + /*! + \qmlsignal TextField::accepted() + + This signal is emitted when the Return or Enter key is pressed. + Note that if there is a \l validator or \l inputMask set on the text + field, the signal will only be emitted if the input is in an acceptable + state. + */ + signal accepted() + + /*! + \qmlsignal TextField::editingFinished() + \since 5.2 + + This signal is emitted when the Return or Enter key is pressed or + the text field loses focus. Note that if there is a validator or + inputMask set on the text field and enter/return is pressed, this + signal will only be emitted if the input follows + the inputMask and the validator returns an acceptable state. + */ + signal editingFinished() + + /*! + \qmlmethod TextField::copy() + + Copies the currently selected text to the system clipboard. + */ + function copy() { + textInput.copy() + } + + /*! + \qmlmethod TextField::cut() + + Moves the currently selected text to the system clipboard. + */ + function cut() { + textInput.cut() + } + + /*! + \qmlmethod TextField::deselect() + + Removes active text selection. + */ + function deselect() { + textInput.deselect(); + } + + /*! + \qmlmethod string TextField::getText(int start, int end) + + Removes the section of text that is between the \a start and \a end + positions from the TextField. + */ + function getText(start, end) { + return textInput.getText(start, end); + } + + /*! + \qmlmethod TextField::insert(int position, string text) + + Inserts \a text into the TextField at \a position. + */ + function insert(position, text) { + textInput.insert(position, text); + } + + /*! + \qmlmethod bool TextField::isRightToLeft(int start, int end) + + Returns \c true if the natural reading direction of the editor text + found between positions \a start and \a end is right to left. + */ + function isRightToLeft(start, end) { + return textInput.isRightToLeft(start, end); + } + + /*! + \qmlmethod TextField::paste() + + Replaces the currently selected text by the contents of the system + clipboard. + */ + function paste() { + textInput.paste() + } + + /*! + \qmlmethod TextField::redo() + + Performs the last operation if redo is \l {canRedo}{available}. + */ + function redo() { + textInput.redo(); + } + + /*! + \qmlmethod TextField::select(int start, int end) + + Causes the text from \a start to \a end to be selected. + + If either start or end is out of range, the selection is not changed. + + After calling select, selectionStart will become the lesser + and selectionEnd will become the greater (regardless of the order passed + to this method). + + \sa selectionStart, selectionEnd + */ + function select(start, end) { + textInput.select(start, end) + } + + /*! + \qmlmethod TextField::selectAll() + + Causes all text to be selected. + */ + function selectAll() { + textInput.selectAll() + } + + /*! + \qmlmethod TextField::selectWord() + + Causes the word closest to the current cursor position to be selected. + */ + function selectWord() { + textInput.selectWord() + } + + /*! + \qmlmethod TextField::undo() + + Reverts the last operation if undo is \l {canUndo}{available}. undo() + deselects any current selection and updates the selection start to the + current cursor position. + */ + function undo() { + textInput.undo(); + } + + /*! \qmlproperty bool TextField::hovered + + This property holds whether the control is being hovered. + */ + readonly property alias hovered: mouseArea.containsMouse + + /*! \internal */ + property alias __contentHeight: textInput.contentHeight + + /*! \internal */ + property alias __contentWidth: textInput.contentWidth + + style: Qt.createComponent(Settings.style + "/TextFieldStyle.qml", textInput) + + activeFocusOnTab: true + + Accessible.name: text + Accessible.role: Accessible.EditableText + Accessible.description: placeholderText + + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.IBeamCursor + onClicked: textfield.forceActiveFocus() + } + + Text { + id: placeholderTextComponent + anchors.fill: textInput + font: textInput.font + horizontalAlignment: textInput.horizontalAlignment + verticalAlignment: textInput.verticalAlignment + opacity: !textInput.text.length && !textInput.inputMethodComposing ? 1 : 0 + color: __panel ? __panel.placeholderTextColor : "darkgray" + clip: contentWidth > width; + elide: Text.ElideRight + renderType: __style ? __style.renderType : Text.NativeRendering + Behavior on opacity { NumberAnimation { duration: 90 } } + } + + TextInput { + id: textInput + focus: true + selectByMouse: true + selectionColor: __panel ? __panel.selectionColor : "darkred" + selectedTextColor: __panel ? __panel.selectedTextColor : "white" + + font: __panel ? __panel.font : font + anchors.leftMargin: __panel ? __panel.leftMargin : 0 + anchors.topMargin: __panel ? __panel.topMargin : 0 + anchors.rightMargin: __panel ? __panel.rightMargin : 0 + anchors.bottomMargin: __panel ? __panel.bottomMargin : 0 + + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + + color: __panel ? __panel.textColor : "darkgray" + clip: contentWidth > width + + renderType: __style ? __style.renderType : Text.NativeRendering + + onAccepted: { + Qt.inputMethod.commit() + Qt.inputMethod.hide() + textfield.accepted() + } + + onEditingFinished: textfield.editingFinished() + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ToolBar.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ToolBar.qml new file mode 100644 index 00000000000..1a4c7cb65f1 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ToolBar.qml @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ToolBar + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup applicationwindow + \brief Contains ToolButton and related controls. + + The common way of using ToolBar is in relation to \l ApplicationWindow. It + provides styling and is generally designed to work well with ToolButton as + well as other controls. + + Note that the ToolBar does not provide a layout of its own, but requires + you to position its contents, for instance by creating a \l RowLayout. + + If only a single item is used within the ToolBar, it will resize to fit the implicitHeight + of its contained item. This makes it particularly suitable for use together with layouts. + Otherwise the height is platform dependent. + + \code + import QtQuick.Controls 1.1 + import QtQuick.Layouts 1.0 + + ApplicationWindow { + toolBar: ToolBar { + RowLayout { + ToolButton { ... } + ToolButton { ... } + ToolButton { ... } + } + } + } + \endcode +*/ + +Item { + id: toolbar + + activeFocusOnTab: false + Accessible.role: Accessible.ToolBar + LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft + LayoutMirroring.childrenInherit: true + + width: parent ? parent.width : implicitWidth + implicitWidth: container.leftMargin + container.rightMargin + container.calcWidth() + implicitHeight: container.topMargin + container.bottomMargin + container.calcHeight() + + /*! \internal */ + property Component style: Qt.createComponent(Settings.style + "/ToolBarStyle.qml", toolbar) + + /*! \internal */ + property alias __style: styleLoader.item + + /*! \internal */ + default property alias __content: container.data + + /*! + \qmlproperty Item ToolBar::contentItem + + This property holds the content Item of the tool bar. + + Items declared as children of a ToolBar are automatically parented to the ToolBar's contentItem. + Items created dynamically need to be explicitly parented to the contentItem: + + \note The implicit size of the ToolBar is calculated based on the size of its content. If you want to anchor + items inside the tool bar, you must specify an explicit width and height on the ToolBar itself. + */ + readonly property alias contentItem: container + + data: [ + Loader { + id: loader + anchors.fill: parent + sourceComponent: styleLoader.item ? styleLoader.item.panel : null + onLoaded: item.z = -1 + Loader { + id: styleLoader + property alias __control: toolbar + sourceComponent: style + } + }, + Item { + id: container + z: 1 + focus: true + anchors.fill: parent + + anchors.topMargin: topMargin + anchors.leftMargin: leftMargin + anchors.rightMargin: rightMargin + anchors.bottomMargin: bottomMargin + + property int topMargin: __style ? __style.padding.top : 0 + property int bottomMargin: __style ? __style.padding.bottom : 0 + property int leftMargin: __style ? __style.padding.left : 0 + property int rightMargin: __style ? __style.padding.right : 0 + + property Item layoutItem: container.children.length === 1 ? container.children[0] : null + function calcWidth() { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) + + (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin + + layoutItem.anchors.rightMargin : 0) : + loader.item ? loader.item.implicitWidth : 0) } + function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) + + (layoutItem.anchors.fill ? layoutItem.anchors.topMargin + + layoutItem.anchors.bottomMargin : 0) : + loader.item ? loader.item.implicitHeight : 0) } + }] +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ToolButton.qml b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ToolButton.qml new file mode 100644 index 00000000000..0ff62ec45a9 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/ToolButton.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ToolButton + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief Provides a button type that is typically used within a ToolBar. + + ToolButton is functionally similar to \l Button, but can provide a look that is more + suitable within a \l ToolBar. + + \code + ToolButton { + iconSource: "edit-cut.png" + } + \endcode + + You can create a custom appearance for a ToolButton by + assigning a \l {QtQuick.Controls.Styles::ButtonStyle}{ButtonStyle}. +*/ + +Button { + id: button + style: Qt.createComponent(Settings.style + "/ToolButtonStyle.qml", button) +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/plugins.qmltypes b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/plugins.qmltypes new file mode 100644 index 00000000000..eadb72efb7a --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/plugins.qmltypes @@ -0,0 +1,1889 @@ +import QtQuick.tooling 1.1 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. +// +// This file was auto-generated with the command 'qmlplugindump -nonrelocatable QtQuick.Controls 1.1'. + +Module { + Component { + name: "QQuickAbstractStyle" + defaultProperty: "data" + prototype: "QObject" + exports: ["QtQuick.Controls.Private/AbstractStyle 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "padding"; type: "QQuickPadding"; isReadonly: true; isPointer: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + } + Component { + name: "QQuickAction" + prototype: "QObject" + exports: ["QtQuick.Controls/Action 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "text"; type: "string" } + Property { name: "iconSource"; type: "QUrl" } + Property { name: "iconName"; type: "string" } + Property { name: "__icon"; type: "QVariant"; isReadonly: true } + Property { name: "tooltip"; type: "string" } + Property { name: "enabled"; type: "bool" } + Property { name: "checkable"; type: "bool" } + Property { name: "checked"; type: "bool" } + Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true } + Property { name: "shortcut"; type: "QVariant" } + Signal { name: "triggered" } + Signal { + name: "toggled" + Parameter { name: "checked"; type: "bool" } + } + Signal { + name: "shortcutChanged" + Parameter { name: "shortcut"; type: "QVariant" } + } + Signal { name: "iconChanged" } + Signal { + name: "tooltipChanged" + Parameter { name: "arg"; type: "string" } + } + Method { name: "trigger" } + } + Component { + name: "QQuickControlSettings" + prototype: "QObject" + exports: ["QtQuick.Controls.Private/Settings 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "style"; type: "QUrl"; isReadonly: true } + Property { name: "styleName"; type: "string" } + Property { name: "stylePath"; type: "string" } + Property { name: "dpiScaleFactor"; type: "double"; isReadonly: true } + } + Component { + name: "QQuickExclusiveGroup" + defaultProperty: "__actions" + prototype: "QObject" + exports: ["QtQuick.Controls/ExclusiveGroup 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "current"; type: "QObject"; isPointer: true } + Property { name: "__actions"; type: "QQuickAction"; isList: true; isReadonly: true } + Method { + name: "bindCheckable" + Parameter { name: "o"; type: "QObject"; isPointer: true } + } + Method { + name: "unbindCheckable" + Parameter { name: "o"; type: "QObject"; isPointer: true } + } + } + Component { + name: "QQuickMenu" + defaultProperty: "items" + prototype: "QQuickMenuText" + exports: ["QtQuick.Controls/MenuPrivate 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "title"; type: "string" } + Property { name: "items"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "__selectedIndex"; type: "int" } + Property { name: "__popupVisible"; type: "bool"; isReadonly: true } + Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__minimumWidth"; type: "int" } + Property { name: "__font"; type: "QFont" } + Property { name: "__xOffset"; type: "double" } + Property { name: "__yOffset"; type: "double" } + Signal { name: "__menuClosed" } + Signal { name: "popupVisibleChanged" } + Method { name: "__closeMenu" } + Method { name: "__dismissMenu" } + Method { name: "popup" } + Method { + name: "addItem" + type: "QQuickMenuItem*" + Parameter { type: "string" } + } + Method { + name: "insertItem" + type: "QQuickMenuItem*" + Parameter { type: "int" } + Parameter { type: "string" } + } + Method { name: "addSeparator" } + Method { + name: "insertSeparator" + Parameter { type: "int" } + } + Method { + name: "insertItem" + Parameter { type: "int" } + Parameter { type: "QQuickMenuBase"; isPointer: true } + } + Method { + name: "removeItem" + Parameter { type: "QQuickMenuBase"; isPointer: true } + } + Method { name: "clear" } + Method { + name: "__popup" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + Parameter { name: "atActionIndex"; type: "int" } + } + Method { + name: "__popup" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } + Component { + name: "QQuickMenuBar" + defaultProperty: "menus" + prototype: "QObject" + exports: ["QtQuick.Controls/MenuBarPrivate 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "menus"; type: "QQuickMenu"; isList: true; isReadonly: true } + Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__parentWindow"; type: "QQuickWindow"; isPointer: true } + Property { name: "__isNative"; type: "bool"; isReadonly: true } + Signal { name: "contentItemChanged" } + } + Component { + name: "QQuickMenuBase" + prototype: "QObject" + exports: ["QtQuick.Controls/MenuBase 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "visible"; type: "bool" } + Property { name: "type"; type: "QQuickMenuItemType::MenuItemType"; isReadonly: true } + Property { name: "__parentMenu"; type: "QQuickMenu"; isReadonly: true; isPointer: true } + Property { name: "__isNative"; type: "bool"; isReadonly: true } + Property { name: "__visualItem"; type: "QQuickItem"; isPointer: true } + } + Component { + name: "QQuickMenuItem" + prototype: "QQuickMenuText" + exports: ["QtQuick.Controls/MenuItem 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "text"; type: "string" } + Property { name: "checkable"; type: "bool" } + Property { name: "checked"; type: "bool" } + Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true } + Property { name: "shortcut"; type: "QVariant" } + Property { name: "action"; type: "QQuickAction"; isPointer: true } + Signal { name: "triggered" } + Signal { + name: "toggled" + Parameter { name: "checked"; type: "bool" } + } + Method { name: "trigger" } + } + Component { + name: "QQuickMenuItemType" + exports: ["QtQuick.Controls/MenuItemType 1.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "MenuItemType" + values: { + "Separator": 0, + "Item": 1, + "Menu": 2 + } + } + } + Component { + name: "QQuickMenuSeparator" + prototype: "QQuickMenuBase" + exports: ["QtQuick.Controls/MenuSeparator 1.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickMenuText" + prototype: "QQuickMenuBase" + Property { name: "enabled"; type: "bool" } + Property { name: "iconSource"; type: "QUrl" } + Property { name: "iconName"; type: "string" } + Property { name: "__icon"; type: "QVariant"; isReadonly: true } + Signal { name: "__textChanged" } + } + Component { + name: "QQuickPadding" + prototype: "QObject" + Property { name: "left"; type: "int" } + Property { name: "top"; type: "int" } + Property { name: "right"; type: "int" } + Property { name: "bottom"; type: "int" } + Method { + name: "setLeft" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setTop" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setRight" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setBottom" + Parameter { name: "arg"; type: "int" } + } + } + Component { + name: "QQuickRangeModel" + prototype: "QObject" + exports: ["QtQuick.Controls.Private/RangeModel 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "value"; type: "double" } + Property { name: "minimumValue"; type: "double" } + Property { name: "maximumValue"; type: "double" } + Property { name: "stepSize"; type: "double" } + Property { name: "position"; type: "double" } + Property { name: "positionAtMinimum"; type: "double" } + Property { name: "positionAtMaximum"; type: "double" } + Property { name: "inverted"; type: "bool" } + Signal { + name: "valueChanged" + Parameter { name: "value"; type: "double" } + } + Signal { + name: "positionChanged" + Parameter { name: "position"; type: "double" } + } + Signal { + name: "stepSizeChanged" + Parameter { name: "stepSize"; type: "double" } + } + Signal { + name: "invertedChanged" + Parameter { name: "inverted"; type: "bool" } + } + Signal { + name: "minimumChanged" + Parameter { name: "min"; type: "double" } + } + Signal { + name: "maximumChanged" + Parameter { name: "max"; type: "double" } + } + Signal { + name: "positionAtMinimumChanged" + Parameter { name: "min"; type: "double" } + } + Signal { + name: "positionAtMaximumChanged" + Parameter { name: "max"; type: "double" } + } + Method { name: "toMinimum" } + Method { name: "toMaximum" } + Method { + name: "setValue" + Parameter { name: "value"; type: "double" } + } + Method { + name: "setPosition" + Parameter { name: "position"; type: "double" } + } + Method { + name: "valueForPosition" + type: "double" + Parameter { name: "position"; type: "double" } + } + Method { + name: "positionForValue" + type: "double" + Parameter { name: "value"; type: "double" } + } + } + Component { + name: "QQuickSpinBoxValidator" + prototype: "QValidator" + exports: ["QtQuick.Controls.Private/SpinBoxValidator 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "text"; type: "string"; isReadonly: true } + Property { name: "value"; type: "double" } + Property { name: "minimumValue"; type: "double" } + Property { name: "maximumValue"; type: "double" } + Property { name: "decimals"; type: "int" } + Property { name: "stepSize"; type: "double" } + Property { name: "prefix"; type: "string" } + Property { name: "suffix"; type: "string" } + Method { name: "increment" } + Method { name: "decrement" } + } + Component { + name: "QQuickStack" + prototype: "QObject" + exports: ["QtQuick.Controls/Stack 1.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Status" + values: { + "Inactive": 0, + "Deactivating": 1, + "Activating": 2, + "Active": 3 + } + } + Property { name: "index"; type: "int"; isReadonly: true } + Property { name: "__index"; type: "int" } + Property { name: "status"; type: "Status"; isReadonly: true } + Property { name: "__status"; type: "Status" } + Property { name: "view"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "__view"; type: "QQuickItem"; isPointer: true } + } + Component { + name: "QQuickStyleItem" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick.Controls.Private/StyleItem 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "sunken"; type: "bool" } + Property { name: "raised"; type: "bool" } + Property { name: "active"; type: "bool" } + Property { name: "selected"; type: "bool" } + Property { name: "hasFocus"; type: "bool" } + Property { name: "on"; type: "bool" } + Property { name: "hover"; type: "bool" } + Property { name: "horizontal"; type: "bool" } + Property { name: "transient"; type: "bool" } + Property { name: "elementType"; type: "string" } + Property { name: "text"; type: "string" } + Property { name: "activeControl"; type: "string" } + Property { name: "style"; type: "string"; isReadonly: true } + Property { name: "hints"; type: "QVariantMap" } + Property { name: "properties"; type: "QVariantMap" } + Property { name: "font"; type: "QFont"; isReadonly: true } + Property { name: "minimum"; type: "int" } + Property { name: "maximum"; type: "int" } + Property { name: "value"; type: "int" } + Property { name: "step"; type: "int" } + Property { name: "paintMargins"; type: "int" } + Property { name: "contentWidth"; type: "int" } + Property { name: "contentHeight"; type: "int" } + Signal { name: "infoChanged" } + Signal { name: "hintChanged" } + Signal { + name: "contentWidthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "contentHeightChanged" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "pixelMetric" + type: "int" + Parameter { type: "string" } + } + Method { + name: "styleHint" + type: "QVariant" + Parameter { type: "string" } + } + Method { name: "updateSizeHint" } + Method { name: "updateRect" } + Method { name: "updateItem" } + Method { + name: "hitTest" + type: "string" + Parameter { name: "x"; type: "int" } + Parameter { name: "y"; type: "int" } + } + Method { + name: "subControlRect" + type: "QRectF" + Parameter { name: "subcontrolString"; type: "string" } + } + Method { + name: "elidedText" + type: "string" + Parameter { name: "text"; type: "string" } + Parameter { name: "elideMode"; type: "int" } + Parameter { name: "width"; type: "int" } + } + Method { + name: "hasThemeIcon" + type: "bool" + Parameter { type: "string" } + } + Method { + name: "textWidth" + type: "double" + Parameter { type: "string" } + } + Method { + name: "textHeight" + type: "double" + Parameter { type: "string" } + } + } + Component { + name: "QQuickTooltip" + prototype: "QObject" + exports: ["QtQuick.Controls.Private/Tooltip 1.0"] + exportMetaObjectRevisions: [0] + Method { + name: "showText" + Parameter { name: "item"; type: "QQuickItem"; isPointer: true } + Parameter { name: "pos"; type: "QPointF" } + Parameter { name: "text"; type: "string" } + } + Method { name: "hideText" } + } + Component { + name: "QQuickWheelArea" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick.Controls.Private/WheelArea 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "verticalDelta"; type: "double" } + Property { name: "horizontalDelta"; type: "double" } + Property { name: "horizontalMinimumValue"; type: "double" } + Property { name: "horizontalMaximumValue"; type: "double" } + Property { name: "verticalMinimumValue"; type: "double" } + Property { name: "verticalMaximumValue"; type: "double" } + Property { name: "horizontalValue"; type: "double" } + Property { name: "verticalValue"; type: "double" } + Property { name: "scrollSpeed"; type: "double" } + Property { name: "active"; type: "bool" } + Signal { name: "verticalWheelMoved" } + Signal { name: "horizontalWheelMoved" } + } + Component { + name: "QQuickWindow" + defaultProperty: "data" + prototype: "QWindow" + exports: ["QtQuick.Window/Window 2.0", "QtQuick.Window/Window 2.1"] + exportMetaObjectRevisions: [0, 1] + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "color"; type: "QColor" } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { + name: "activeFocusItem" + revision: 1 + type: "QQuickItem" + isReadonly: true + isPointer: true + } + Signal { name: "frameSwapped" } + Signal { name: "sceneGraphInitialized" } + Signal { name: "sceneGraphInvalidated" } + Signal { name: "beforeSynchronizing" } + Signal { name: "beforeRendering" } + Signal { name: "afterRendering" } + Signal { + name: "closing" + revision: 1 + Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true } + } + Signal { + name: "colorChanged" + Parameter { type: "QColor" } + } + Signal { name: "activeFocusItemChanged"; revision: 1 } + Method { name: "update" } + Method { name: "releaseResources" } + } + Component { + name: "QWindow" + prototype: "QObject" + Enum { + name: "Visibility" + values: { + "Hidden": 0, + "AutomaticVisibility": 1, + "Windowed": 2, + "Minimized": 3, + "Maximized": 4, + "FullScreen": 5 + } + } + Property { name: "title"; type: "string" } + Property { name: "modality"; type: "Qt::WindowModality" } + Property { name: "flags"; type: "Qt::WindowFlags" } + Property { name: "x"; type: "int" } + Property { name: "y"; type: "int" } + Property { name: "width"; type: "int" } + Property { name: "height"; type: "int" } + Property { name: "minimumWidth"; revision: 1; type: "int" } + Property { name: "minimumHeight"; revision: 1; type: "int" } + Property { name: "maximumWidth"; revision: 1; type: "int" } + Property { name: "maximumHeight"; revision: 1; type: "int" } + Property { name: "visible"; type: "bool" } + Property { name: "active"; revision: 1; type: "bool"; isReadonly: true } + Property { name: "visibility"; revision: 1; type: "Visibility" } + Property { name: "contentOrientation"; revision: 1; type: "Qt::ScreenOrientation" } + Property { name: "opacity"; revision: 1; type: "double" } + Signal { + name: "screenChanged" + Parameter { name: "screen"; type: "QScreen"; isPointer: true } + } + Signal { + name: "modalityChanged" + Parameter { name: "modality"; type: "Qt::WindowModality" } + } + Signal { + name: "windowStateChanged" + Parameter { name: "windowState"; type: "Qt::WindowState" } + } + Signal { + name: "xChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "yChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "widthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "heightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "minimumWidthChanged" + revision: 1 + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "minimumHeightChanged" + revision: 1 + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "maximumWidthChanged" + revision: 1 + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "maximumHeightChanged" + revision: 1 + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "visibleChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "visibilityChanged" + revision: 1 + Parameter { name: "visibility"; type: "QWindow::Visibility" } + } + Signal { name: "activeChanged"; revision: 1 } + Signal { + name: "contentOrientationChanged" + revision: 1 + Parameter { name: "orientation"; type: "Qt::ScreenOrientation" } + } + Signal { + name: "focusObjectChanged" + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "opacityChanged" + revision: 1 + Parameter { name: "opacity"; type: "double" } + } + Method { name: "requestActivate"; revision: 1 } + Method { + name: "setVisible" + Parameter { name: "visible"; type: "bool" } + } + Method { name: "show" } + Method { name: "hide" } + Method { name: "showMinimized" } + Method { name: "showMaximized" } + Method { name: "showFullScreen" } + Method { name: "showNormal" } + Method { name: "close"; type: "bool" } + Method { name: "raise" } + Method { name: "lower" } + Method { + name: "setTitle" + Parameter { type: "string" } + } + Method { + name: "setX" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setY" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setWidth" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setHeight" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setMinimumWidth" + revision: 1 + Parameter { name: "w"; type: "int" } + } + Method { + name: "setMinimumHeight" + revision: 1 + Parameter { name: "h"; type: "int" } + } + Method { + name: "setMaximumWidth" + revision: 1 + Parameter { name: "w"; type: "int" } + } + Method { + name: "setMaximumHeight" + revision: 1 + Parameter { name: "h"; type: "int" } + } + Method { + name: "alert" + Parameter { name: "msec"; type: "int" } + } + } + Component { + prototype: "QQuickWindow" + name: "QtQuick.Controls/ApplicationWindow" + exports: ["QtQuick.Controls/ApplicationWindow 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "menuBar"; type: "MenuBar_QMLTYPE_1"; isPointer: true } + Property { name: "toolBar"; type: "QQuickItem"; isPointer: true } + Property { name: "statusBar"; type: "QQuickItem"; isPointer: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "color"; type: "QColor" } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { + name: "activeFocusItem" + revision: 1 + type: "QQuickItem" + isReadonly: true + isPointer: true + } + Signal { name: "frameSwapped" } + Signal { name: "sceneGraphInitialized" } + Signal { name: "sceneGraphInvalidated" } + Signal { name: "beforeSynchronizing" } + Signal { name: "beforeRendering" } + Signal { name: "afterRendering" } + Signal { + name: "closing" + revision: 1 + Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true } + } + Signal { + name: "colorChanged" + Parameter { type: "QColor" } + } + Signal { name: "activeFocusItemChanged"; revision: 1 } + Method { name: "update" } + Method { name: "forcePolish" } + Method { name: "releaseResources" } + Property { name: "title"; type: "string" } + Property { name: "modality"; type: "Qt::WindowModality" } + Property { name: "flags"; type: "Qt::WindowFlags" } + Property { name: "x"; type: "int" } + Property { name: "y"; type: "int" } + Property { name: "width"; type: "int" } + Property { name: "height"; type: "int" } + Property { name: "minimumWidth"; type: "int" } + Property { name: "minimumHeight"; type: "int" } + Property { name: "maximumWidth"; type: "int" } + Property { name: "maximumHeight"; type: "int" } + Property { name: "visible"; type: "bool" } + Property { name: "active"; revision: 1; type: "bool"; isReadonly: true } + Property { name: "visibility"; revision: 1; type: "Visibility" } + Property { name: "contentOrientation"; type: "Qt::ScreenOrientation" } + Property { name: "opacity"; revision: 1; type: "double" } + Signal { + name: "screenChanged" + Parameter { name: "screen"; type: "QScreen"; isPointer: true } + } + Signal { + name: "modalityChanged" + Parameter { name: "modality"; type: "Qt::WindowModality" } + } + Signal { + name: "windowStateChanged" + Parameter { name: "windowState"; type: "Qt::WindowState" } + } + Signal { + name: "xChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "yChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "widthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "heightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "minimumWidthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "minimumHeightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "maximumWidthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "maximumHeightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "visibleChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "visibilityChanged" + revision: 1 + Parameter { name: "visibility"; type: "QWindow::Visibility" } + } + Signal { name: "activeChanged"; revision: 1 } + Signal { + name: "contentOrientationChanged" + Parameter { name: "orientation"; type: "Qt::ScreenOrientation" } + } + Signal { + name: "focusObjectChanged" + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "opacityChanged" + revision: 1 + Parameter { name: "opacity"; type: "double" } + } + Method { name: "requestActivate"; revision: 1 } + Method { + name: "setVisible" + Parameter { name: "visible"; type: "bool" } + } + Method { name: "show" } + Method { name: "hide" } + Method { name: "showMinimized" } + Method { name: "showMaximized" } + Method { name: "showFullScreen" } + Method { name: "showNormal" } + Method { name: "close"; type: "bool" } + Method { name: "raise" } + Method { name: "lower" } + Method { + name: "setTitle" + Parameter { type: "string" } + } + Method { + name: "setX" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setY" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setWidth" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setHeight" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setMinimumWidth" + Parameter { name: "w"; type: "int" } + } + Method { + name: "setMinimumHeight" + Parameter { name: "h"; type: "int" } + } + Method { + name: "setMaximumWidth" + Parameter { name: "w"; type: "int" } + } + Method { + name: "setMaximumHeight" + Parameter { name: "h"; type: "int" } + } + Method { + name: "alert" + revision: 1 + Parameter { name: "msec"; type: "int" } + } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/BusyIndicator" + exports: ["QtQuick.Controls/BusyIndicator 1.1"] + exportMetaObjectRevisions: [1] + defaultProperty: "data" + Property { name: "running"; type: "bool" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/Button" + exports: ["QtQuick.Controls/Button 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "checkable"; type: "bool" } + Property { name: "checked"; type: "bool" } + Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true } + Property { name: "action"; type: "QQuickAction"; isPointer: true } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "text"; type: "string" } + Property { name: "tooltip"; type: "string" } + Property { name: "iconSource"; type: "QUrl" } + Property { name: "iconName"; type: "string" } + Property { name: "__textColor"; type: "QColor" } + Property { name: "__position"; type: "string" } + Property { name: "__iconOverriden"; type: "bool"; isReadonly: true } + Property { name: "__action"; type: "QQuickAction"; isPointer: true } + Property { name: "__iconAction"; type: "QQuickAction"; isReadonly: true; isPointer: true } + Property { name: "__effectivePressed"; type: "bool" } + Property { name: "__behavior"; type: "QVariant" } + Property { name: "pressed"; type: "bool"; isReadonly: true } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Signal { name: "clicked" } + Method { name: "accessiblePressAction"; type: "QVariant" } + Property { name: "isDefault"; type: "bool" } + Property { name: "menu"; type: "Menu_QMLTYPE_16"; isPointer: true } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/CheckBox" + exports: ["QtQuick.Controls/CheckBox 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "checked"; type: "bool" } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true } + Property { name: "text"; type: "string" } + Property { name: "__cycleStatesHandler"; type: "QVariant" } + Property { name: "pressed"; type: "bool" } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Signal { name: "clicked" } + Property { name: "checkedState"; type: "int" } + Property { name: "partiallyCheckedEnabled"; type: "bool" } + Property { name: "__ignoreChecked"; type: "bool" } + Method { name: "__cycleCheckBoxStates"; type: "QVariant" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/ComboBox" + exports: ["QtQuick.Controls/ComboBox 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "textRole"; type: "string" } + Property { name: "editable"; type: "bool" } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "pressed"; type: "bool"; isReadonly: true } + Property { name: "__popup"; type: "QVariant" } + Property { name: "model"; type: "QVariant" } + Property { name: "currentIndex"; type: "int" } + Property { name: "currentText"; type: "string"; isReadonly: true } + Property { name: "editText"; type: "string" } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "validator"; type: "QValidator"; isPointer: true } + Property { name: "acceptableInput"; type: "bool"; isReadonly: true } + Signal { name: "accepted" } + Signal { + name: "activated" + Parameter { name: "index"; type: "int" } + } + Method { + name: "textAt" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + } + Method { + name: "find" + type: "QVariant" + Parameter { name: "text"; type: "QVariant" } + } + Method { name: "selectAll"; type: "QVariant" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/GroupBox" + exports: ["QtQuick.Controls/GroupBox 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "__content" + Property { name: "title"; type: "string" } + Property { name: "flat"; type: "bool" } + Property { name: "checkable"; type: "bool" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "checked"; type: "bool" } + Property { name: "__content"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "__checkbox"; type: "CheckBox_QMLTYPE_25"; isReadonly: true; isPointer: true } + Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true } + } + Component { + name: "QQuickText" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + exports: ["QtQuick/Text 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4, + "AlignJustify": 8 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Enum { + name: "TextStyle" + values: { + "Normal": 0, + "Outline": 1, + "Raised": 2, + "Sunken": 3 + } + } + Enum { + name: "TextFormat" + values: { + "PlainText": 0, + "RichText": 1, + "AutoText": 2, + "StyledText": 4 + } + } + Enum { + name: "TextElideMode" + values: { + "ElideLeft": 0, + "ElideRight": 1, + "ElideMiddle": 2, + "ElideNone": 3 + } + } + Enum { + name: "WrapMode" + values: { + "NoWrap": 0, + "WordWrap": 1, + "WrapAnywhere": 3, + "WrapAtWordBoundaryOrAnywhere": 4, + "Wrap": 4 + } + } + Enum { + name: "RenderType" + values: { + "QtRendering": 0, + "NativeRendering": 1 + } + } + Enum { + name: "LineHeightMode" + values: { + "ProportionalHeight": 0, + "FixedHeight": 1 + } + } + Enum { + name: "FontSizeMode" + values: { + "FixedSize": 0, + "HorizontalFit": 1, + "VerticalFit": 2, + "Fit": 3 + } + } + Property { name: "text"; type: "string" } + Property { name: "font"; type: "QFont" } + Property { name: "color"; type: "QColor" } + Property { name: "linkColor"; type: "QColor" } + Property { name: "style"; type: "TextStyle" } + Property { name: "styleColor"; type: "QColor" } + Property { name: "horizontalAlignment"; type: "HAlignment" } + Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true } + Property { name: "verticalAlignment"; type: "VAlignment" } + Property { name: "wrapMode"; type: "WrapMode" } + Property { name: "lineCount"; type: "int"; isReadonly: true } + Property { name: "truncated"; type: "bool"; isReadonly: true } + Property { name: "maximumLineCount"; type: "int" } + Property { name: "textFormat"; type: "TextFormat" } + Property { name: "elide"; type: "TextElideMode" } + Property { name: "contentWidth"; type: "double"; isReadonly: true } + Property { name: "contentHeight"; type: "double"; isReadonly: true } + Property { name: "paintedWidth"; type: "double"; isReadonly: true } + Property { name: "paintedHeight"; type: "double"; isReadonly: true } + Property { name: "lineHeight"; type: "double" } + Property { name: "lineHeightMode"; type: "LineHeightMode" } + Property { name: "baseUrl"; type: "QUrl" } + Property { name: "minimumPixelSize"; type: "int" } + Property { name: "minimumPointSize"; type: "int" } + Property { name: "fontSizeMode"; type: "FontSizeMode" } + Property { name: "renderType"; type: "RenderType" } + Signal { + name: "textChanged" + Parameter { name: "text"; type: "string" } + } + Signal { + name: "linkActivated" + Parameter { name: "link"; type: "string" } + } + Signal { + name: "fontChanged" + Parameter { name: "font"; type: "QFont" } + } + Signal { + name: "styleChanged" + Parameter { name: "style"; type: "TextStyle" } + } + Signal { + name: "horizontalAlignmentChanged" + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + Parameter { name: "alignment"; type: "VAlignment" } + } + Signal { + name: "textFormatChanged" + Parameter { name: "textFormat"; type: "TextFormat" } + } + Signal { + name: "elideModeChanged" + Parameter { name: "mode"; type: "TextElideMode" } + } + Signal { name: "contentSizeChanged" } + Signal { + name: "lineHeightChanged" + Parameter { name: "lineHeight"; type: "double" } + } + Signal { + name: "lineHeightModeChanged" + Parameter { name: "mode"; type: "LineHeightMode" } + } + Signal { + name: "lineLaidOut" + Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true } + } + Method { name: "doLayout" } + } + + Component { + prototype: "QQuickText" + name: "QtQuick.Controls/Label" + exports: ["QtQuick.Controls/Label 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + } + Component { + prototype: "QQuickMenu" + name: "QtQuick.Controls/Menu" + exports: ["QtQuick.Controls/Menu 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "items" + Property { name: "__selfComponent"; type: "QQmlComponent"; isPointer: true } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__currentIndex"; type: "int" } + Property { name: "__menuComponent"; type: "QQmlComponent"; isPointer: true } + Property { name: "__menuBar"; type: "QVariant" } + Method { + name: "addMenu" + type: "QVariant" + Parameter { name: "title"; type: "QVariant" } + } + Method { + name: "insertMenu" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + Parameter { name: "title"; type: "QVariant" } + } + Property { name: "title"; type: "string" } + Property { name: "items"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "__selectedIndex"; type: "int" } + Property { name: "__popupVisible"; type: "bool"; isReadonly: true } + Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__minimumWidth"; type: "int" } + Property { name: "__font"; type: "QFont" } + Property { name: "__xOffset"; type: "double" } + Property { name: "__yOffset"; type: "double" } + Signal { name: "__menuClosed" } + Signal { name: "popupVisibleChanged" } + Method { name: "__closeMenu" } + Method { name: "__dismissMenu" } + Method { name: "popup" } + Method { + name: "addItem" + type: "QQuickMenuItem*" + Parameter { type: "string" } + } + Method { + name: "insertItem" + type: "QQuickMenuItem*" + Parameter { type: "int" } + Parameter { type: "string" } + } + Method { name: "addSeparator" } + Method { + name: "insertSeparator" + Parameter { type: "int" } + } + Method { + name: "insertItem" + Parameter { type: "int" } + Parameter { type: "QQuickMenuBase"; isPointer: true } + } + Method { + name: "removeItem" + Parameter { type: "QQuickMenuBase"; isPointer: true } + } + Method { name: "clear" } + Method { + name: "__popup" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + Parameter { name: "atActionIndex"; type: "int" } + } + Method { + name: "__popup" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + Property { name: "visible"; type: "bool" } + Property { name: "type"; type: "QQuickMenuItemType::MenuItemType"; isReadonly: true } + Property { name: "__parentMenu"; type: "QQuickMenu"; isReadonly: true; isPointer: true } + Property { name: "__isNative"; type: "bool"; isReadonly: true } + Property { name: "__visualItem"; type: "QQuickItem"; isPointer: true } + Property { name: "enabled"; type: "bool" } + Property { name: "iconSource"; type: "QUrl" } + Property { name: "iconName"; type: "string" } + Property { name: "__icon"; type: "QVariant"; isReadonly: true } + Signal { name: "__textChanged" } + } + Component { + prototype: "QQuickMenuBar" + name: "QtQuick.Controls/MenuBar" + exports: ["QtQuick.Controls/MenuBar 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "menus" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__menuBarComponent"; type: "QQmlComponent"; isPointer: true } + Property { name: "menus"; type: "QQuickMenu"; isList: true; isReadonly: true } + Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__parentWindow"; type: "QQuickWindow"; isPointer: true } + Property { name: "__isNative"; type: "bool"; isReadonly: true } + Signal { name: "contentItemChanged" } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/ProgressBar" + exports: ["QtQuick.Controls/ProgressBar 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + Property { name: "value"; type: "double" } + Property { name: "minimumValue"; type: "double" } + Property { name: "maximumValue"; type: "double" } + Property { name: "indeterminate"; type: "bool" } + Property { name: "orientation"; type: "int" } + Property { name: "__initialized"; type: "bool" } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Method { + name: "setValue" + type: "QVariant" + Parameter { name: "v"; type: "QVariant" } + } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/RadioButton" + exports: ["QtQuick.Controls/RadioButton 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "checked"; type: "bool" } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true } + Property { name: "text"; type: "string" } + Property { name: "__cycleStatesHandler"; type: "QVariant" } + Property { name: "pressed"; type: "bool" } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Signal { name: "clicked" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/ScrollView" + exports: ["QtQuick.Controls/ScrollView 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "contentItem" + Property { name: "frameVisible"; type: "bool" } + Property { name: "highlightOnFocus"; type: "bool" } + Property { name: "contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__scroller"; type: "QQuickItem"; isPointer: true } + Property { name: "__scrollBarTopMargin"; type: "int" } + Property { name: "__viewTopMargin"; type: "int" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "Style_QMLTYPE_0"; isPointer: true } + Property { name: "viewport"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "flickableItem"; type: "QQuickFlickable"; isReadonly: true; isPointer: true } + Property { + name: "__horizontalScrollBar" + type: "ScrollBar_QMLTYPE_51" + isReadonly: true + isPointer: true + } + Property { + name: "__verticalScrollBar" + type: "ScrollBar_QMLTYPE_51" + isReadonly: true + isPointer: true + } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/Slider" + exports: ["QtQuick.Controls/Slider 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + Property { name: "orientation"; type: "int" } + Property { name: "updateValueWhileDragging"; type: "bool" } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "tickmarksEnabled"; type: "bool" } + Property { name: "__horizontal"; type: "bool" } + Property { name: "__handlePos"; type: "double" } + Property { name: "minimumValue"; type: "double" } + Property { name: "maximumValue"; type: "double" } + Property { name: "pressed"; type: "bool"; isReadonly: true } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Property { name: "stepSize"; type: "double" } + Property { name: "value"; type: "double" } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/SpinBox" + exports: ["QtQuick.Controls/SpinBox 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "value"; type: "double" } + Property { name: "minimumValue"; type: "double" } + Property { name: "maximumValue"; type: "double" } + Property { name: "stepSize"; type: "double" } + Property { name: "suffix"; type: "string" } + Property { name: "prefix"; type: "string" } + Property { name: "decimals"; type: "int" } + Property { name: "font"; type: "QFont" } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Property { name: "__text"; type: "string" } + Method { name: "__increment"; type: "QVariant" } + Method { name: "__decrement"; type: "QVariant" } + } + Component { + prototype: "QQuickItem" + name: "QtQuick.Controls/SplitView" + exports: ["QtQuick.Controls/SplitView 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "__contents" + Property { name: "orientation"; type: "int" } + Property { name: "handleDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "resizing"; type: "bool" } + Property { name: "__contents"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "__items"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "__handles"; type: "QQuickItem"; isList: true; isReadonly: true } + } + Component { + prototype: "QQuickItem" + name: "QtQuick.Controls/StackView" + exports: ["QtQuick.Controls/StackView 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "busy"; type: "bool"; isReadonly: true } + Property { name: "delegate"; type: "StackViewDelegate_QMLTYPE_97"; isPointer: true } + Property { name: "__currentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__depth"; type: "int" } + Property { name: "__guard"; type: "bool" } + Property { name: "invalidItemReplacement"; type: "QQmlComponent"; isPointer: true } + Property { name: "initialItem"; type: "QVariant" } + Property { name: "__currentTransition"; type: "QVariant" } + Property { name: "depth"; type: "int"; isReadonly: true } + Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Method { + name: "push" + type: "QVariant" + Parameter { name: "item"; type: "QVariant" } + } + Method { + name: "pop" + type: "QVariant" + Parameter { name: "item"; type: "QVariant" } + } + Method { name: "clear"; type: "QVariant" } + Method { + name: "find" + type: "QVariant" + Parameter { name: "func"; type: "QVariant" } + Parameter { name: "onlySearchLoadedItems"; type: "QVariant" } + } + Method { + name: "get" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + Parameter { name: "dontLoad"; type: "QVariant" } + } + Method { name: "completeTransition"; type: "QVariant" } + Method { + name: "replace" + type: "QVariant" + Parameter { name: "item"; type: "QVariant" } + Parameter { name: "properties"; type: "QVariant" } + Parameter { name: "immediate"; type: "QVariant" } + } + Method { + name: "__recursionGuard" + type: "QVariant" + Parameter { name: "use"; type: "QVariant" } + } + Method { + name: "__loadElement" + type: "QVariant" + Parameter { name: "element"; type: "QVariant" } + } + Method { + name: "__resolveComponent" + type: "QVariant" + Parameter { name: "unknownObjectType"; type: "QVariant" } + Parameter { name: "element"; type: "QVariant" } + } + Method { + name: "__cleanup" + type: "QVariant" + Parameter { name: "element"; type: "QVariant" } + } + Method { + name: "__setStatus" + type: "QVariant" + Parameter { name: "item"; type: "QVariant" } + Parameter { name: "status"; type: "QVariant" } + } + Method { + name: "__performTransition" + type: "QVariant" + Parameter { name: "transition"; type: "QVariant" } + } + Method { name: "animationFinished"; type: "QVariant" } + } + Component { + prototype: "QObject" + name: "QtQuick.Controls/StackViewDelegate" + exports: ["QtQuick.Controls/StackViewDelegate 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "pushTransition"; type: "QQmlComponent"; isPointer: true } + Property { name: "popTransition"; type: "QQmlComponent"; isPointer: true } + Property { name: "replaceTransition"; type: "QQmlComponent"; isPointer: true } + Method { + name: "getTransition" + type: "QVariant" + Parameter { name: "properties"; type: "QVariant" } + } + Method { + name: "transitionFinished" + type: "QVariant" + Parameter { name: "properties"; type: "QVariant" } + } + } + Component { + prototype: "QQuickParallelAnimation" + name: "QtQuick.Controls/StackViewTransition" + exports: ["QtQuick.Controls/StackViewTransition 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "animations" + Property { name: "name"; type: "string" } + Property { name: "enterItem"; type: "QQuickItem"; isPointer: true } + Property { name: "exitItem"; type: "QQuickItem"; isPointer: true } + Property { name: "immediate"; type: "bool" } + } + Component { + prototype: "QQuickItem" + name: "QtQuick.Controls/StatusBar" + exports: ["QtQuick.Controls/StatusBar 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "__content" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true } + Property { name: "__content"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + } + Component { + prototype: "QQuickLoader" + name: "QtQuick.Controls/Tab" + exports: ["QtQuick.Controls/Tab 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "component" + Property { name: "title"; type: "string" } + Property { name: "__inserted"; type: "bool" } + Property { name: "component"; type: "QQmlComponent"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/TabView" + exports: ["QtQuick.Controls/TabView 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "currentIndex"; type: "int" } + Property { name: "count"; type: "int" } + Property { name: "frameVisible"; type: "bool" } + Property { name: "tabsVisible"; type: "bool" } + Property { name: "tabPosition"; type: "int" } + Property { name: "__tabs"; type: "QQmlListModel"; isPointer: true } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__styleItem"; type: "QVariant" } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Method { + name: "addTab" + type: "QVariant" + Parameter { name: "title"; type: "QVariant" } + Parameter { name: "component"; type: "QVariant" } + } + Method { + name: "insertTab" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + Parameter { name: "title"; type: "QVariant" } + Parameter { name: "component"; type: "QVariant" } + } + Method { + name: "removeTab" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + } + Method { + name: "moveTab" + type: "QVariant" + Parameter { name: "from"; type: "QVariant" } + Parameter { name: "to"; type: "QVariant" } + } + Method { + name: "getTab" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + } + Method { name: "__setOpacities"; type: "QVariant" } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/TableView" + exports: ["QtQuick.Controls/TableView 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "__columns" + Property { name: "frameVisible"; type: "bool" } + Property { name: "highlightOnFocus"; type: "bool" } + Property { name: "contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__scroller"; type: "QQuickItem"; isPointer: true } + Property { name: "__scrollBarTopMargin"; type: "int" } + Property { name: "__viewTopMargin"; type: "int" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "Style_QMLTYPE_0"; isPointer: true } + Property { name: "viewport"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "flickableItem"; type: "QQuickFlickable"; isReadonly: true; isPointer: true } + Property { + name: "__horizontalScrollBar" + type: "ScrollBar_QMLTYPE_51" + isReadonly: true + isPointer: true + } + Property { + name: "__verticalScrollBar" + type: "ScrollBar_QMLTYPE_51" + isReadonly: true + isPointer: true + } + Property { name: "alternatingRowColors"; type: "bool" } + Property { name: "headerVisible"; type: "bool" } + Property { name: "itemDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "rowDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "headerDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "sortIndicatorColumn"; type: "int" } + Property { name: "sortIndicatorVisible"; type: "bool" } + Property { name: "sortIndicatorOrder"; type: "int" } + Property { name: "__activateItemOnSingleClick"; type: "bool" } + Property { name: "model"; type: "QVariant" } + Property { name: "backgroundVisible"; type: "bool" } + Property { name: "__columns"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "contentHeader"; type: "QQmlComponent"; isPointer: true } + Property { name: "contentFooter"; type: "QQmlComponent"; isPointer: true } + Property { name: "rowCount"; type: "int"; isReadonly: true } + Property { name: "columnCount"; type: "int"; isReadonly: true } + Property { name: "section"; type: "QQuickViewSection"; isReadonly: true; isPointer: true } + Property { name: "currentRow"; type: "int" } + Property { name: "__currentRowItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Signal { + name: "activated" + Parameter { name: "row"; type: "int" } + } + Signal { + name: "clicked" + Parameter { name: "row"; type: "int" } + } + Signal { + name: "doubleClicked" + Parameter { name: "row"; type: "int" } + } + Method { + name: "positionViewAtRow" + type: "QVariant" + Parameter { name: "row"; type: "QVariant" } + Parameter { name: "mode"; type: "QVariant" } + } + Method { + name: "rowAt" + type: "QVariant" + Parameter { name: "x"; type: "QVariant" } + Parameter { name: "y"; type: "QVariant" } + } + Method { + name: "addColumn" + type: "QVariant" + Parameter { name: "column"; type: "QVariant" } + } + Method { + name: "insertColumn" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + Parameter { name: "column"; type: "QVariant" } + } + Method { + name: "removeColumn" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + } + Method { + name: "moveColumn" + type: "QVariant" + Parameter { name: "from"; type: "QVariant" } + Parameter { name: "to"; type: "QVariant" } + } + Method { + name: "getColumn" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + } + Method { name: "__decrementCurrentIndex"; type: "QVariant" } + Method { name: "__incrementCurrentIndex"; type: "QVariant" } + } + Component { + prototype: "QObject" + name: "QtQuick.Controls/TableViewColumn" + exports: ["QtQuick.Controls/TableViewColumn 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "__view"; type: "QQuickItem"; isPointer: true } + Property { name: "title"; type: "string" } + Property { name: "role"; type: "string" } + Property { name: "width"; type: "int" } + Property { name: "visible"; type: "bool" } + Property { name: "resizable"; type: "bool" } + Property { name: "movable"; type: "bool" } + Property { name: "elideMode"; type: "int" } + Property { name: "horizontalAlignment"; type: "int" } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/TextArea" + exports: ["QtQuick.Controls/TextArea 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "frameVisible"; type: "bool" } + Property { name: "highlightOnFocus"; type: "bool" } + Property { name: "contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__scroller"; type: "QQuickItem"; isPointer: true } + Property { name: "__scrollBarTopMargin"; type: "int" } + Property { name: "__viewTopMargin"; type: "int" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "Style_QMLTYPE_0"; isPointer: true } + Property { name: "viewport"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "flickableItem"; type: "QQuickFlickable"; isReadonly: true; isPointer: true } + Property { + name: "__horizontalScrollBar" + type: "ScrollBar_QMLTYPE_51" + isReadonly: true + isPointer: true + } + Property { + name: "__verticalScrollBar" + type: "ScrollBar_QMLTYPE_51" + isReadonly: true + isPointer: true + } + Property { name: "tabChangesFocus"; type: "bool" } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "baseUrl"; type: "QUrl" } + Property { name: "canPaste"; type: "bool"; isReadonly: true } + Property { name: "canRedo"; type: "bool"; isReadonly: true } + Property { name: "canUndo"; type: "bool"; isReadonly: true } + Property { name: "textColor"; type: "QColor" } + Property { name: "cursorPosition"; type: "int" } + Property { name: "font"; type: "QFont" } + Property { name: "horizontalAlignment"; type: "int" } + Property { name: "effectiveHorizontalAlignment"; type: "int"; isReadonly: true } + Property { name: "verticalAlignment"; type: "int" } + Property { name: "inputMethodHints"; type: "int" } + Property { name: "length"; type: "int"; isReadonly: true } + Property { name: "lineCount"; type: "int"; isReadonly: true } + Property { name: "readOnly"; type: "bool" } + Property { name: "selectedText"; type: "string"; isReadonly: true } + Property { name: "selectionEnd"; type: "int"; isReadonly: true } + Property { name: "selectionStart"; type: "int"; isReadonly: true } + Property { name: "text"; type: "string" } + Property { name: "textFormat"; type: "int" } + Property { name: "wrapMode"; type: "int" } + Property { name: "selectByMouse"; type: "bool" } + Property { name: "selectByKeyboard"; type: "bool" } + Property { name: "hoveredLink"; type: "string"; isReadonly: true } + Property { name: "backgroundVisible"; type: "bool" } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "textMargin"; type: "double" } + Property { name: "textDocument"; type: "QQuickTextDocument"; isReadonly: true; isPointer: true } + Signal { + name: "linkActivated" + Parameter { name: "link"; type: "string" } + } + Signal { + name: "linkHovered" + Parameter { name: "link"; type: "string" } + } + Method { + name: "append" + type: "QVariant" + Parameter { name: "string"; type: "QVariant" } + } + Method { name: "copy"; type: "QVariant" } + Method { name: "cut"; type: "QVariant" } + Method { name: "deselect"; type: "QVariant" } + Method { + name: "getFormattedText" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { + name: "getText" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { + name: "insert" + type: "QVariant" + Parameter { name: "position"; type: "QVariant" } + Parameter { name: "text"; type: "QVariant" } + } + Method { + name: "isRightToLeft" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { + name: "moveCursorSelection" + type: "QVariant" + Parameter { name: "position"; type: "QVariant" } + Parameter { name: "mode"; type: "QVariant" } + } + Method { name: "paste"; type: "QVariant" } + Method { + name: "positionAt" + type: "QVariant" + Parameter { name: "x"; type: "QVariant" } + Parameter { name: "y"; type: "QVariant" } + } + Method { + name: "positionToRectangle" + type: "QVariant" + Parameter { name: "position"; type: "QVariant" } + } + Method { name: "redo"; type: "QVariant" } + Method { + name: "remove" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { + name: "select" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { name: "selectAll"; type: "QVariant" } + Method { name: "selectWord"; type: "QVariant" } + Method { name: "undo"; type: "QVariant" } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/TextField" + exports: ["QtQuick.Controls/TextField 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + Property { name: "acceptableInput"; type: "bool"; isReadonly: true } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "canPaste"; type: "bool"; isReadonly: true } + Property { name: "canRedo"; type: "bool"; isReadonly: true } + Property { name: "canUndo"; type: "bool"; isReadonly: true } + Property { name: "textColor"; type: "QColor" } + Property { name: "cursorPosition"; type: "int" } + Property { name: "displayText"; type: "string"; isReadonly: true } + Property { name: "echoMode"; type: "int" } + Property { name: "font"; type: "QFont" } + Property { name: "horizontalAlignment"; type: "int" } + Property { name: "effectiveHorizontalAlignment"; type: "int"; isReadonly: true } + Property { name: "verticalAlignment"; type: "int" } + Property { name: "inputMask"; type: "string" } + Property { name: "inputMethodHints"; type: "int" } + Property { name: "length"; type: "int"; isReadonly: true } + Property { name: "maximumLength"; type: "int" } + Property { name: "placeholderText"; type: "string" } + Property { name: "readOnly"; type: "bool" } + Property { name: "selectedText"; type: "string"; isReadonly: true } + Property { name: "selectionEnd"; type: "int"; isReadonly: true } + Property { name: "selectionStart"; type: "int"; isReadonly: true } + Property { name: "text"; type: "string" } + Property { name: "validator"; type: "QValidator"; isPointer: true } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Property { name: "__contentHeight"; type: "double"; isReadonly: true } + Property { name: "__contentWidth"; type: "double"; isReadonly: true } + Signal { name: "accepted" } + Method { name: "copy"; type: "QVariant" } + Method { name: "cut"; type: "QVariant" } + Method { name: "deselect"; type: "QVariant" } + Method { + name: "getText" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { + name: "insert" + type: "QVariant" + Parameter { name: "position"; type: "QVariant" } + Parameter { name: "text"; type: "QVariant" } + } + Method { + name: "isRightToLeft" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { name: "paste"; type: "QVariant" } + Method { name: "redo"; type: "QVariant" } + Method { + name: "select" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { name: "selectAll"; type: "QVariant" } + Method { name: "selectWord"; type: "QVariant" } + Method { name: "undo"; type: "QVariant" } + } + Component { + prototype: "QQuickItem" + name: "QtQuick.Controls/ToolBar" + exports: ["QtQuick.Controls/ToolBar 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "__content" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true } + Property { name: "__content"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/ToolButton" + exports: ["QtQuick.Controls/ToolButton 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "checkable"; type: "bool" } + Property { name: "checked"; type: "bool" } + Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true } + Property { name: "action"; type: "QQuickAction"; isPointer: true } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "text"; type: "string" } + Property { name: "tooltip"; type: "string" } + Property { name: "iconSource"; type: "QUrl" } + Property { name: "iconName"; type: "string" } + Property { name: "__textColor"; type: "QColor" } + Property { name: "__position"; type: "string" } + Property { name: "__iconOverriden"; type: "bool"; isReadonly: true } + Property { name: "__action"; type: "QQuickAction"; isPointer: true } + Property { name: "__iconAction"; type: "QQuickAction"; isReadonly: true; isPointer: true } + Property { name: "__effectivePressed"; type: "bool" } + Property { name: "__behavior"; type: "QVariant" } + Property { name: "pressed"; type: "bool"; isReadonly: true } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Signal { name: "clicked" } + Method { name: "accessiblePressAction"; type: "QVariant" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/qmldir b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/qmldir new file mode 100644 index 00000000000..f51b0553232 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/qmldir @@ -0,0 +1,4 @@ +module QtQuick.Controls +plugin qtquickcontrolsplugin +classname QtQuickControlsPlugin +typeinfo plugins.qmltypes diff --git a/tests/auto/qml/codemodel/importscheck/006_loneCompositeAndCpp/Controls/plugins.qmltypes b/tests/auto/qml/codemodel/importscheck/006_loneCompositeAndCpp/Controls/plugins.qmltypes new file mode 100644 index 00000000000..eadb72efb7a --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/006_loneCompositeAndCpp/Controls/plugins.qmltypes @@ -0,0 +1,1889 @@ +import QtQuick.tooling 1.1 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. +// +// This file was auto-generated with the command 'qmlplugindump -nonrelocatable QtQuick.Controls 1.1'. + +Module { + Component { + name: "QQuickAbstractStyle" + defaultProperty: "data" + prototype: "QObject" + exports: ["QtQuick.Controls.Private/AbstractStyle 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "padding"; type: "QQuickPadding"; isReadonly: true; isPointer: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + } + Component { + name: "QQuickAction" + prototype: "QObject" + exports: ["QtQuick.Controls/Action 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "text"; type: "string" } + Property { name: "iconSource"; type: "QUrl" } + Property { name: "iconName"; type: "string" } + Property { name: "__icon"; type: "QVariant"; isReadonly: true } + Property { name: "tooltip"; type: "string" } + Property { name: "enabled"; type: "bool" } + Property { name: "checkable"; type: "bool" } + Property { name: "checked"; type: "bool" } + Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true } + Property { name: "shortcut"; type: "QVariant" } + Signal { name: "triggered" } + Signal { + name: "toggled" + Parameter { name: "checked"; type: "bool" } + } + Signal { + name: "shortcutChanged" + Parameter { name: "shortcut"; type: "QVariant" } + } + Signal { name: "iconChanged" } + Signal { + name: "tooltipChanged" + Parameter { name: "arg"; type: "string" } + } + Method { name: "trigger" } + } + Component { + name: "QQuickControlSettings" + prototype: "QObject" + exports: ["QtQuick.Controls.Private/Settings 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "style"; type: "QUrl"; isReadonly: true } + Property { name: "styleName"; type: "string" } + Property { name: "stylePath"; type: "string" } + Property { name: "dpiScaleFactor"; type: "double"; isReadonly: true } + } + Component { + name: "QQuickExclusiveGroup" + defaultProperty: "__actions" + prototype: "QObject" + exports: ["QtQuick.Controls/ExclusiveGroup 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "current"; type: "QObject"; isPointer: true } + Property { name: "__actions"; type: "QQuickAction"; isList: true; isReadonly: true } + Method { + name: "bindCheckable" + Parameter { name: "o"; type: "QObject"; isPointer: true } + } + Method { + name: "unbindCheckable" + Parameter { name: "o"; type: "QObject"; isPointer: true } + } + } + Component { + name: "QQuickMenu" + defaultProperty: "items" + prototype: "QQuickMenuText" + exports: ["QtQuick.Controls/MenuPrivate 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "title"; type: "string" } + Property { name: "items"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "__selectedIndex"; type: "int" } + Property { name: "__popupVisible"; type: "bool"; isReadonly: true } + Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__minimumWidth"; type: "int" } + Property { name: "__font"; type: "QFont" } + Property { name: "__xOffset"; type: "double" } + Property { name: "__yOffset"; type: "double" } + Signal { name: "__menuClosed" } + Signal { name: "popupVisibleChanged" } + Method { name: "__closeMenu" } + Method { name: "__dismissMenu" } + Method { name: "popup" } + Method { + name: "addItem" + type: "QQuickMenuItem*" + Parameter { type: "string" } + } + Method { + name: "insertItem" + type: "QQuickMenuItem*" + Parameter { type: "int" } + Parameter { type: "string" } + } + Method { name: "addSeparator" } + Method { + name: "insertSeparator" + Parameter { type: "int" } + } + Method { + name: "insertItem" + Parameter { type: "int" } + Parameter { type: "QQuickMenuBase"; isPointer: true } + } + Method { + name: "removeItem" + Parameter { type: "QQuickMenuBase"; isPointer: true } + } + Method { name: "clear" } + Method { + name: "__popup" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + Parameter { name: "atActionIndex"; type: "int" } + } + Method { + name: "__popup" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } + Component { + name: "QQuickMenuBar" + defaultProperty: "menus" + prototype: "QObject" + exports: ["QtQuick.Controls/MenuBarPrivate 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "menus"; type: "QQuickMenu"; isList: true; isReadonly: true } + Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__parentWindow"; type: "QQuickWindow"; isPointer: true } + Property { name: "__isNative"; type: "bool"; isReadonly: true } + Signal { name: "contentItemChanged" } + } + Component { + name: "QQuickMenuBase" + prototype: "QObject" + exports: ["QtQuick.Controls/MenuBase 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "visible"; type: "bool" } + Property { name: "type"; type: "QQuickMenuItemType::MenuItemType"; isReadonly: true } + Property { name: "__parentMenu"; type: "QQuickMenu"; isReadonly: true; isPointer: true } + Property { name: "__isNative"; type: "bool"; isReadonly: true } + Property { name: "__visualItem"; type: "QQuickItem"; isPointer: true } + } + Component { + name: "QQuickMenuItem" + prototype: "QQuickMenuText" + exports: ["QtQuick.Controls/MenuItem 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "text"; type: "string" } + Property { name: "checkable"; type: "bool" } + Property { name: "checked"; type: "bool" } + Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true } + Property { name: "shortcut"; type: "QVariant" } + Property { name: "action"; type: "QQuickAction"; isPointer: true } + Signal { name: "triggered" } + Signal { + name: "toggled" + Parameter { name: "checked"; type: "bool" } + } + Method { name: "trigger" } + } + Component { + name: "QQuickMenuItemType" + exports: ["QtQuick.Controls/MenuItemType 1.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "MenuItemType" + values: { + "Separator": 0, + "Item": 1, + "Menu": 2 + } + } + } + Component { + name: "QQuickMenuSeparator" + prototype: "QQuickMenuBase" + exports: ["QtQuick.Controls/MenuSeparator 1.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickMenuText" + prototype: "QQuickMenuBase" + Property { name: "enabled"; type: "bool" } + Property { name: "iconSource"; type: "QUrl" } + Property { name: "iconName"; type: "string" } + Property { name: "__icon"; type: "QVariant"; isReadonly: true } + Signal { name: "__textChanged" } + } + Component { + name: "QQuickPadding" + prototype: "QObject" + Property { name: "left"; type: "int" } + Property { name: "top"; type: "int" } + Property { name: "right"; type: "int" } + Property { name: "bottom"; type: "int" } + Method { + name: "setLeft" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setTop" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setRight" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setBottom" + Parameter { name: "arg"; type: "int" } + } + } + Component { + name: "QQuickRangeModel" + prototype: "QObject" + exports: ["QtQuick.Controls.Private/RangeModel 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "value"; type: "double" } + Property { name: "minimumValue"; type: "double" } + Property { name: "maximumValue"; type: "double" } + Property { name: "stepSize"; type: "double" } + Property { name: "position"; type: "double" } + Property { name: "positionAtMinimum"; type: "double" } + Property { name: "positionAtMaximum"; type: "double" } + Property { name: "inverted"; type: "bool" } + Signal { + name: "valueChanged" + Parameter { name: "value"; type: "double" } + } + Signal { + name: "positionChanged" + Parameter { name: "position"; type: "double" } + } + Signal { + name: "stepSizeChanged" + Parameter { name: "stepSize"; type: "double" } + } + Signal { + name: "invertedChanged" + Parameter { name: "inverted"; type: "bool" } + } + Signal { + name: "minimumChanged" + Parameter { name: "min"; type: "double" } + } + Signal { + name: "maximumChanged" + Parameter { name: "max"; type: "double" } + } + Signal { + name: "positionAtMinimumChanged" + Parameter { name: "min"; type: "double" } + } + Signal { + name: "positionAtMaximumChanged" + Parameter { name: "max"; type: "double" } + } + Method { name: "toMinimum" } + Method { name: "toMaximum" } + Method { + name: "setValue" + Parameter { name: "value"; type: "double" } + } + Method { + name: "setPosition" + Parameter { name: "position"; type: "double" } + } + Method { + name: "valueForPosition" + type: "double" + Parameter { name: "position"; type: "double" } + } + Method { + name: "positionForValue" + type: "double" + Parameter { name: "value"; type: "double" } + } + } + Component { + name: "QQuickSpinBoxValidator" + prototype: "QValidator" + exports: ["QtQuick.Controls.Private/SpinBoxValidator 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "text"; type: "string"; isReadonly: true } + Property { name: "value"; type: "double" } + Property { name: "minimumValue"; type: "double" } + Property { name: "maximumValue"; type: "double" } + Property { name: "decimals"; type: "int" } + Property { name: "stepSize"; type: "double" } + Property { name: "prefix"; type: "string" } + Property { name: "suffix"; type: "string" } + Method { name: "increment" } + Method { name: "decrement" } + } + Component { + name: "QQuickStack" + prototype: "QObject" + exports: ["QtQuick.Controls/Stack 1.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Status" + values: { + "Inactive": 0, + "Deactivating": 1, + "Activating": 2, + "Active": 3 + } + } + Property { name: "index"; type: "int"; isReadonly: true } + Property { name: "__index"; type: "int" } + Property { name: "status"; type: "Status"; isReadonly: true } + Property { name: "__status"; type: "Status" } + Property { name: "view"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "__view"; type: "QQuickItem"; isPointer: true } + } + Component { + name: "QQuickStyleItem" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick.Controls.Private/StyleItem 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "sunken"; type: "bool" } + Property { name: "raised"; type: "bool" } + Property { name: "active"; type: "bool" } + Property { name: "selected"; type: "bool" } + Property { name: "hasFocus"; type: "bool" } + Property { name: "on"; type: "bool" } + Property { name: "hover"; type: "bool" } + Property { name: "horizontal"; type: "bool" } + Property { name: "transient"; type: "bool" } + Property { name: "elementType"; type: "string" } + Property { name: "text"; type: "string" } + Property { name: "activeControl"; type: "string" } + Property { name: "style"; type: "string"; isReadonly: true } + Property { name: "hints"; type: "QVariantMap" } + Property { name: "properties"; type: "QVariantMap" } + Property { name: "font"; type: "QFont"; isReadonly: true } + Property { name: "minimum"; type: "int" } + Property { name: "maximum"; type: "int" } + Property { name: "value"; type: "int" } + Property { name: "step"; type: "int" } + Property { name: "paintMargins"; type: "int" } + Property { name: "contentWidth"; type: "int" } + Property { name: "contentHeight"; type: "int" } + Signal { name: "infoChanged" } + Signal { name: "hintChanged" } + Signal { + name: "contentWidthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "contentHeightChanged" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "pixelMetric" + type: "int" + Parameter { type: "string" } + } + Method { + name: "styleHint" + type: "QVariant" + Parameter { type: "string" } + } + Method { name: "updateSizeHint" } + Method { name: "updateRect" } + Method { name: "updateItem" } + Method { + name: "hitTest" + type: "string" + Parameter { name: "x"; type: "int" } + Parameter { name: "y"; type: "int" } + } + Method { + name: "subControlRect" + type: "QRectF" + Parameter { name: "subcontrolString"; type: "string" } + } + Method { + name: "elidedText" + type: "string" + Parameter { name: "text"; type: "string" } + Parameter { name: "elideMode"; type: "int" } + Parameter { name: "width"; type: "int" } + } + Method { + name: "hasThemeIcon" + type: "bool" + Parameter { type: "string" } + } + Method { + name: "textWidth" + type: "double" + Parameter { type: "string" } + } + Method { + name: "textHeight" + type: "double" + Parameter { type: "string" } + } + } + Component { + name: "QQuickTooltip" + prototype: "QObject" + exports: ["QtQuick.Controls.Private/Tooltip 1.0"] + exportMetaObjectRevisions: [0] + Method { + name: "showText" + Parameter { name: "item"; type: "QQuickItem"; isPointer: true } + Parameter { name: "pos"; type: "QPointF" } + Parameter { name: "text"; type: "string" } + } + Method { name: "hideText" } + } + Component { + name: "QQuickWheelArea" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick.Controls.Private/WheelArea 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "verticalDelta"; type: "double" } + Property { name: "horizontalDelta"; type: "double" } + Property { name: "horizontalMinimumValue"; type: "double" } + Property { name: "horizontalMaximumValue"; type: "double" } + Property { name: "verticalMinimumValue"; type: "double" } + Property { name: "verticalMaximumValue"; type: "double" } + Property { name: "horizontalValue"; type: "double" } + Property { name: "verticalValue"; type: "double" } + Property { name: "scrollSpeed"; type: "double" } + Property { name: "active"; type: "bool" } + Signal { name: "verticalWheelMoved" } + Signal { name: "horizontalWheelMoved" } + } + Component { + name: "QQuickWindow" + defaultProperty: "data" + prototype: "QWindow" + exports: ["QtQuick.Window/Window 2.0", "QtQuick.Window/Window 2.1"] + exportMetaObjectRevisions: [0, 1] + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "color"; type: "QColor" } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { + name: "activeFocusItem" + revision: 1 + type: "QQuickItem" + isReadonly: true + isPointer: true + } + Signal { name: "frameSwapped" } + Signal { name: "sceneGraphInitialized" } + Signal { name: "sceneGraphInvalidated" } + Signal { name: "beforeSynchronizing" } + Signal { name: "beforeRendering" } + Signal { name: "afterRendering" } + Signal { + name: "closing" + revision: 1 + Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true } + } + Signal { + name: "colorChanged" + Parameter { type: "QColor" } + } + Signal { name: "activeFocusItemChanged"; revision: 1 } + Method { name: "update" } + Method { name: "releaseResources" } + } + Component { + name: "QWindow" + prototype: "QObject" + Enum { + name: "Visibility" + values: { + "Hidden": 0, + "AutomaticVisibility": 1, + "Windowed": 2, + "Minimized": 3, + "Maximized": 4, + "FullScreen": 5 + } + } + Property { name: "title"; type: "string" } + Property { name: "modality"; type: "Qt::WindowModality" } + Property { name: "flags"; type: "Qt::WindowFlags" } + Property { name: "x"; type: "int" } + Property { name: "y"; type: "int" } + Property { name: "width"; type: "int" } + Property { name: "height"; type: "int" } + Property { name: "minimumWidth"; revision: 1; type: "int" } + Property { name: "minimumHeight"; revision: 1; type: "int" } + Property { name: "maximumWidth"; revision: 1; type: "int" } + Property { name: "maximumHeight"; revision: 1; type: "int" } + Property { name: "visible"; type: "bool" } + Property { name: "active"; revision: 1; type: "bool"; isReadonly: true } + Property { name: "visibility"; revision: 1; type: "Visibility" } + Property { name: "contentOrientation"; revision: 1; type: "Qt::ScreenOrientation" } + Property { name: "opacity"; revision: 1; type: "double" } + Signal { + name: "screenChanged" + Parameter { name: "screen"; type: "QScreen"; isPointer: true } + } + Signal { + name: "modalityChanged" + Parameter { name: "modality"; type: "Qt::WindowModality" } + } + Signal { + name: "windowStateChanged" + Parameter { name: "windowState"; type: "Qt::WindowState" } + } + Signal { + name: "xChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "yChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "widthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "heightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "minimumWidthChanged" + revision: 1 + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "minimumHeightChanged" + revision: 1 + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "maximumWidthChanged" + revision: 1 + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "maximumHeightChanged" + revision: 1 + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "visibleChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "visibilityChanged" + revision: 1 + Parameter { name: "visibility"; type: "QWindow::Visibility" } + } + Signal { name: "activeChanged"; revision: 1 } + Signal { + name: "contentOrientationChanged" + revision: 1 + Parameter { name: "orientation"; type: "Qt::ScreenOrientation" } + } + Signal { + name: "focusObjectChanged" + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "opacityChanged" + revision: 1 + Parameter { name: "opacity"; type: "double" } + } + Method { name: "requestActivate"; revision: 1 } + Method { + name: "setVisible" + Parameter { name: "visible"; type: "bool" } + } + Method { name: "show" } + Method { name: "hide" } + Method { name: "showMinimized" } + Method { name: "showMaximized" } + Method { name: "showFullScreen" } + Method { name: "showNormal" } + Method { name: "close"; type: "bool" } + Method { name: "raise" } + Method { name: "lower" } + Method { + name: "setTitle" + Parameter { type: "string" } + } + Method { + name: "setX" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setY" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setWidth" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setHeight" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setMinimumWidth" + revision: 1 + Parameter { name: "w"; type: "int" } + } + Method { + name: "setMinimumHeight" + revision: 1 + Parameter { name: "h"; type: "int" } + } + Method { + name: "setMaximumWidth" + revision: 1 + Parameter { name: "w"; type: "int" } + } + Method { + name: "setMaximumHeight" + revision: 1 + Parameter { name: "h"; type: "int" } + } + Method { + name: "alert" + Parameter { name: "msec"; type: "int" } + } + } + Component { + prototype: "QQuickWindow" + name: "QtQuick.Controls/ApplicationWindow" + exports: ["QtQuick.Controls/ApplicationWindow 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "menuBar"; type: "MenuBar_QMLTYPE_1"; isPointer: true } + Property { name: "toolBar"; type: "QQuickItem"; isPointer: true } + Property { name: "statusBar"; type: "QQuickItem"; isPointer: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "color"; type: "QColor" } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { + name: "activeFocusItem" + revision: 1 + type: "QQuickItem" + isReadonly: true + isPointer: true + } + Signal { name: "frameSwapped" } + Signal { name: "sceneGraphInitialized" } + Signal { name: "sceneGraphInvalidated" } + Signal { name: "beforeSynchronizing" } + Signal { name: "beforeRendering" } + Signal { name: "afterRendering" } + Signal { + name: "closing" + revision: 1 + Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true } + } + Signal { + name: "colorChanged" + Parameter { type: "QColor" } + } + Signal { name: "activeFocusItemChanged"; revision: 1 } + Method { name: "update" } + Method { name: "forcePolish" } + Method { name: "releaseResources" } + Property { name: "title"; type: "string" } + Property { name: "modality"; type: "Qt::WindowModality" } + Property { name: "flags"; type: "Qt::WindowFlags" } + Property { name: "x"; type: "int" } + Property { name: "y"; type: "int" } + Property { name: "width"; type: "int" } + Property { name: "height"; type: "int" } + Property { name: "minimumWidth"; type: "int" } + Property { name: "minimumHeight"; type: "int" } + Property { name: "maximumWidth"; type: "int" } + Property { name: "maximumHeight"; type: "int" } + Property { name: "visible"; type: "bool" } + Property { name: "active"; revision: 1; type: "bool"; isReadonly: true } + Property { name: "visibility"; revision: 1; type: "Visibility" } + Property { name: "contentOrientation"; type: "Qt::ScreenOrientation" } + Property { name: "opacity"; revision: 1; type: "double" } + Signal { + name: "screenChanged" + Parameter { name: "screen"; type: "QScreen"; isPointer: true } + } + Signal { + name: "modalityChanged" + Parameter { name: "modality"; type: "Qt::WindowModality" } + } + Signal { + name: "windowStateChanged" + Parameter { name: "windowState"; type: "Qt::WindowState" } + } + Signal { + name: "xChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "yChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "widthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "heightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "minimumWidthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "minimumHeightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "maximumWidthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "maximumHeightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "visibleChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "visibilityChanged" + revision: 1 + Parameter { name: "visibility"; type: "QWindow::Visibility" } + } + Signal { name: "activeChanged"; revision: 1 } + Signal { + name: "contentOrientationChanged" + Parameter { name: "orientation"; type: "Qt::ScreenOrientation" } + } + Signal { + name: "focusObjectChanged" + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "opacityChanged" + revision: 1 + Parameter { name: "opacity"; type: "double" } + } + Method { name: "requestActivate"; revision: 1 } + Method { + name: "setVisible" + Parameter { name: "visible"; type: "bool" } + } + Method { name: "show" } + Method { name: "hide" } + Method { name: "showMinimized" } + Method { name: "showMaximized" } + Method { name: "showFullScreen" } + Method { name: "showNormal" } + Method { name: "close"; type: "bool" } + Method { name: "raise" } + Method { name: "lower" } + Method { + name: "setTitle" + Parameter { type: "string" } + } + Method { + name: "setX" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setY" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setWidth" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setHeight" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setMinimumWidth" + Parameter { name: "w"; type: "int" } + } + Method { + name: "setMinimumHeight" + Parameter { name: "h"; type: "int" } + } + Method { + name: "setMaximumWidth" + Parameter { name: "w"; type: "int" } + } + Method { + name: "setMaximumHeight" + Parameter { name: "h"; type: "int" } + } + Method { + name: "alert" + revision: 1 + Parameter { name: "msec"; type: "int" } + } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/BusyIndicator" + exports: ["QtQuick.Controls/BusyIndicator 1.1"] + exportMetaObjectRevisions: [1] + defaultProperty: "data" + Property { name: "running"; type: "bool" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/Button" + exports: ["QtQuick.Controls/Button 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "checkable"; type: "bool" } + Property { name: "checked"; type: "bool" } + Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true } + Property { name: "action"; type: "QQuickAction"; isPointer: true } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "text"; type: "string" } + Property { name: "tooltip"; type: "string" } + Property { name: "iconSource"; type: "QUrl" } + Property { name: "iconName"; type: "string" } + Property { name: "__textColor"; type: "QColor" } + Property { name: "__position"; type: "string" } + Property { name: "__iconOverriden"; type: "bool"; isReadonly: true } + Property { name: "__action"; type: "QQuickAction"; isPointer: true } + Property { name: "__iconAction"; type: "QQuickAction"; isReadonly: true; isPointer: true } + Property { name: "__effectivePressed"; type: "bool" } + Property { name: "__behavior"; type: "QVariant" } + Property { name: "pressed"; type: "bool"; isReadonly: true } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Signal { name: "clicked" } + Method { name: "accessiblePressAction"; type: "QVariant" } + Property { name: "isDefault"; type: "bool" } + Property { name: "menu"; type: "Menu_QMLTYPE_16"; isPointer: true } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/CheckBox" + exports: ["QtQuick.Controls/CheckBox 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "checked"; type: "bool" } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true } + Property { name: "text"; type: "string" } + Property { name: "__cycleStatesHandler"; type: "QVariant" } + Property { name: "pressed"; type: "bool" } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Signal { name: "clicked" } + Property { name: "checkedState"; type: "int" } + Property { name: "partiallyCheckedEnabled"; type: "bool" } + Property { name: "__ignoreChecked"; type: "bool" } + Method { name: "__cycleCheckBoxStates"; type: "QVariant" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/ComboBox" + exports: ["QtQuick.Controls/ComboBox 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "textRole"; type: "string" } + Property { name: "editable"; type: "bool" } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "pressed"; type: "bool"; isReadonly: true } + Property { name: "__popup"; type: "QVariant" } + Property { name: "model"; type: "QVariant" } + Property { name: "currentIndex"; type: "int" } + Property { name: "currentText"; type: "string"; isReadonly: true } + Property { name: "editText"; type: "string" } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "validator"; type: "QValidator"; isPointer: true } + Property { name: "acceptableInput"; type: "bool"; isReadonly: true } + Signal { name: "accepted" } + Signal { + name: "activated" + Parameter { name: "index"; type: "int" } + } + Method { + name: "textAt" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + } + Method { + name: "find" + type: "QVariant" + Parameter { name: "text"; type: "QVariant" } + } + Method { name: "selectAll"; type: "QVariant" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/GroupBox" + exports: ["QtQuick.Controls/GroupBox 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "__content" + Property { name: "title"; type: "string" } + Property { name: "flat"; type: "bool" } + Property { name: "checkable"; type: "bool" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "checked"; type: "bool" } + Property { name: "__content"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "__checkbox"; type: "CheckBox_QMLTYPE_25"; isReadonly: true; isPointer: true } + Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true } + } + Component { + name: "QQuickText" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + exports: ["QtQuick/Text 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4, + "AlignJustify": 8 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Enum { + name: "TextStyle" + values: { + "Normal": 0, + "Outline": 1, + "Raised": 2, + "Sunken": 3 + } + } + Enum { + name: "TextFormat" + values: { + "PlainText": 0, + "RichText": 1, + "AutoText": 2, + "StyledText": 4 + } + } + Enum { + name: "TextElideMode" + values: { + "ElideLeft": 0, + "ElideRight": 1, + "ElideMiddle": 2, + "ElideNone": 3 + } + } + Enum { + name: "WrapMode" + values: { + "NoWrap": 0, + "WordWrap": 1, + "WrapAnywhere": 3, + "WrapAtWordBoundaryOrAnywhere": 4, + "Wrap": 4 + } + } + Enum { + name: "RenderType" + values: { + "QtRendering": 0, + "NativeRendering": 1 + } + } + Enum { + name: "LineHeightMode" + values: { + "ProportionalHeight": 0, + "FixedHeight": 1 + } + } + Enum { + name: "FontSizeMode" + values: { + "FixedSize": 0, + "HorizontalFit": 1, + "VerticalFit": 2, + "Fit": 3 + } + } + Property { name: "text"; type: "string" } + Property { name: "font"; type: "QFont" } + Property { name: "color"; type: "QColor" } + Property { name: "linkColor"; type: "QColor" } + Property { name: "style"; type: "TextStyle" } + Property { name: "styleColor"; type: "QColor" } + Property { name: "horizontalAlignment"; type: "HAlignment" } + Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true } + Property { name: "verticalAlignment"; type: "VAlignment" } + Property { name: "wrapMode"; type: "WrapMode" } + Property { name: "lineCount"; type: "int"; isReadonly: true } + Property { name: "truncated"; type: "bool"; isReadonly: true } + Property { name: "maximumLineCount"; type: "int" } + Property { name: "textFormat"; type: "TextFormat" } + Property { name: "elide"; type: "TextElideMode" } + Property { name: "contentWidth"; type: "double"; isReadonly: true } + Property { name: "contentHeight"; type: "double"; isReadonly: true } + Property { name: "paintedWidth"; type: "double"; isReadonly: true } + Property { name: "paintedHeight"; type: "double"; isReadonly: true } + Property { name: "lineHeight"; type: "double" } + Property { name: "lineHeightMode"; type: "LineHeightMode" } + Property { name: "baseUrl"; type: "QUrl" } + Property { name: "minimumPixelSize"; type: "int" } + Property { name: "minimumPointSize"; type: "int" } + Property { name: "fontSizeMode"; type: "FontSizeMode" } + Property { name: "renderType"; type: "RenderType" } + Signal { + name: "textChanged" + Parameter { name: "text"; type: "string" } + } + Signal { + name: "linkActivated" + Parameter { name: "link"; type: "string" } + } + Signal { + name: "fontChanged" + Parameter { name: "font"; type: "QFont" } + } + Signal { + name: "styleChanged" + Parameter { name: "style"; type: "TextStyle" } + } + Signal { + name: "horizontalAlignmentChanged" + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + Parameter { name: "alignment"; type: "VAlignment" } + } + Signal { + name: "textFormatChanged" + Parameter { name: "textFormat"; type: "TextFormat" } + } + Signal { + name: "elideModeChanged" + Parameter { name: "mode"; type: "TextElideMode" } + } + Signal { name: "contentSizeChanged" } + Signal { + name: "lineHeightChanged" + Parameter { name: "lineHeight"; type: "double" } + } + Signal { + name: "lineHeightModeChanged" + Parameter { name: "mode"; type: "LineHeightMode" } + } + Signal { + name: "lineLaidOut" + Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true } + } + Method { name: "doLayout" } + } + + Component { + prototype: "QQuickText" + name: "QtQuick.Controls/Label" + exports: ["QtQuick.Controls/Label 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + } + Component { + prototype: "QQuickMenu" + name: "QtQuick.Controls/Menu" + exports: ["QtQuick.Controls/Menu 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "items" + Property { name: "__selfComponent"; type: "QQmlComponent"; isPointer: true } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__currentIndex"; type: "int" } + Property { name: "__menuComponent"; type: "QQmlComponent"; isPointer: true } + Property { name: "__menuBar"; type: "QVariant" } + Method { + name: "addMenu" + type: "QVariant" + Parameter { name: "title"; type: "QVariant" } + } + Method { + name: "insertMenu" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + Parameter { name: "title"; type: "QVariant" } + } + Property { name: "title"; type: "string" } + Property { name: "items"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "__selectedIndex"; type: "int" } + Property { name: "__popupVisible"; type: "bool"; isReadonly: true } + Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__minimumWidth"; type: "int" } + Property { name: "__font"; type: "QFont" } + Property { name: "__xOffset"; type: "double" } + Property { name: "__yOffset"; type: "double" } + Signal { name: "__menuClosed" } + Signal { name: "popupVisibleChanged" } + Method { name: "__closeMenu" } + Method { name: "__dismissMenu" } + Method { name: "popup" } + Method { + name: "addItem" + type: "QQuickMenuItem*" + Parameter { type: "string" } + } + Method { + name: "insertItem" + type: "QQuickMenuItem*" + Parameter { type: "int" } + Parameter { type: "string" } + } + Method { name: "addSeparator" } + Method { + name: "insertSeparator" + Parameter { type: "int" } + } + Method { + name: "insertItem" + Parameter { type: "int" } + Parameter { type: "QQuickMenuBase"; isPointer: true } + } + Method { + name: "removeItem" + Parameter { type: "QQuickMenuBase"; isPointer: true } + } + Method { name: "clear" } + Method { + name: "__popup" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + Parameter { name: "atActionIndex"; type: "int" } + } + Method { + name: "__popup" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + Property { name: "visible"; type: "bool" } + Property { name: "type"; type: "QQuickMenuItemType::MenuItemType"; isReadonly: true } + Property { name: "__parentMenu"; type: "QQuickMenu"; isReadonly: true; isPointer: true } + Property { name: "__isNative"; type: "bool"; isReadonly: true } + Property { name: "__visualItem"; type: "QQuickItem"; isPointer: true } + Property { name: "enabled"; type: "bool" } + Property { name: "iconSource"; type: "QUrl" } + Property { name: "iconName"; type: "string" } + Property { name: "__icon"; type: "QVariant"; isReadonly: true } + Signal { name: "__textChanged" } + } + Component { + prototype: "QQuickMenuBar" + name: "QtQuick.Controls/MenuBar" + exports: ["QtQuick.Controls/MenuBar 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "menus" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__menuBarComponent"; type: "QQmlComponent"; isPointer: true } + Property { name: "menus"; type: "QQuickMenu"; isList: true; isReadonly: true } + Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__parentWindow"; type: "QQuickWindow"; isPointer: true } + Property { name: "__isNative"; type: "bool"; isReadonly: true } + Signal { name: "contentItemChanged" } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/ProgressBar" + exports: ["QtQuick.Controls/ProgressBar 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + Property { name: "value"; type: "double" } + Property { name: "minimumValue"; type: "double" } + Property { name: "maximumValue"; type: "double" } + Property { name: "indeterminate"; type: "bool" } + Property { name: "orientation"; type: "int" } + Property { name: "__initialized"; type: "bool" } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Method { + name: "setValue" + type: "QVariant" + Parameter { name: "v"; type: "QVariant" } + } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/RadioButton" + exports: ["QtQuick.Controls/RadioButton 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "checked"; type: "bool" } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true } + Property { name: "text"; type: "string" } + Property { name: "__cycleStatesHandler"; type: "QVariant" } + Property { name: "pressed"; type: "bool" } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Signal { name: "clicked" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/ScrollView" + exports: ["QtQuick.Controls/ScrollView 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "contentItem" + Property { name: "frameVisible"; type: "bool" } + Property { name: "highlightOnFocus"; type: "bool" } + Property { name: "contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__scroller"; type: "QQuickItem"; isPointer: true } + Property { name: "__scrollBarTopMargin"; type: "int" } + Property { name: "__viewTopMargin"; type: "int" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "Style_QMLTYPE_0"; isPointer: true } + Property { name: "viewport"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "flickableItem"; type: "QQuickFlickable"; isReadonly: true; isPointer: true } + Property { + name: "__horizontalScrollBar" + type: "ScrollBar_QMLTYPE_51" + isReadonly: true + isPointer: true + } + Property { + name: "__verticalScrollBar" + type: "ScrollBar_QMLTYPE_51" + isReadonly: true + isPointer: true + } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/Slider" + exports: ["QtQuick.Controls/Slider 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + Property { name: "orientation"; type: "int" } + Property { name: "updateValueWhileDragging"; type: "bool" } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "tickmarksEnabled"; type: "bool" } + Property { name: "__horizontal"; type: "bool" } + Property { name: "__handlePos"; type: "double" } + Property { name: "minimumValue"; type: "double" } + Property { name: "maximumValue"; type: "double" } + Property { name: "pressed"; type: "bool"; isReadonly: true } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Property { name: "stepSize"; type: "double" } + Property { name: "value"; type: "double" } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/SpinBox" + exports: ["QtQuick.Controls/SpinBox 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "value"; type: "double" } + Property { name: "minimumValue"; type: "double" } + Property { name: "maximumValue"; type: "double" } + Property { name: "stepSize"; type: "double" } + Property { name: "suffix"; type: "string" } + Property { name: "prefix"; type: "string" } + Property { name: "decimals"; type: "int" } + Property { name: "font"; type: "QFont" } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Property { name: "__text"; type: "string" } + Method { name: "__increment"; type: "QVariant" } + Method { name: "__decrement"; type: "QVariant" } + } + Component { + prototype: "QQuickItem" + name: "QtQuick.Controls/SplitView" + exports: ["QtQuick.Controls/SplitView 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "__contents" + Property { name: "orientation"; type: "int" } + Property { name: "handleDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "resizing"; type: "bool" } + Property { name: "__contents"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "__items"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "__handles"; type: "QQuickItem"; isList: true; isReadonly: true } + } + Component { + prototype: "QQuickItem" + name: "QtQuick.Controls/StackView" + exports: ["QtQuick.Controls/StackView 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "busy"; type: "bool"; isReadonly: true } + Property { name: "delegate"; type: "StackViewDelegate_QMLTYPE_97"; isPointer: true } + Property { name: "__currentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__depth"; type: "int" } + Property { name: "__guard"; type: "bool" } + Property { name: "invalidItemReplacement"; type: "QQmlComponent"; isPointer: true } + Property { name: "initialItem"; type: "QVariant" } + Property { name: "__currentTransition"; type: "QVariant" } + Property { name: "depth"; type: "int"; isReadonly: true } + Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Method { + name: "push" + type: "QVariant" + Parameter { name: "item"; type: "QVariant" } + } + Method { + name: "pop" + type: "QVariant" + Parameter { name: "item"; type: "QVariant" } + } + Method { name: "clear"; type: "QVariant" } + Method { + name: "find" + type: "QVariant" + Parameter { name: "func"; type: "QVariant" } + Parameter { name: "onlySearchLoadedItems"; type: "QVariant" } + } + Method { + name: "get" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + Parameter { name: "dontLoad"; type: "QVariant" } + } + Method { name: "completeTransition"; type: "QVariant" } + Method { + name: "replace" + type: "QVariant" + Parameter { name: "item"; type: "QVariant" } + Parameter { name: "properties"; type: "QVariant" } + Parameter { name: "immediate"; type: "QVariant" } + } + Method { + name: "__recursionGuard" + type: "QVariant" + Parameter { name: "use"; type: "QVariant" } + } + Method { + name: "__loadElement" + type: "QVariant" + Parameter { name: "element"; type: "QVariant" } + } + Method { + name: "__resolveComponent" + type: "QVariant" + Parameter { name: "unknownObjectType"; type: "QVariant" } + Parameter { name: "element"; type: "QVariant" } + } + Method { + name: "__cleanup" + type: "QVariant" + Parameter { name: "element"; type: "QVariant" } + } + Method { + name: "__setStatus" + type: "QVariant" + Parameter { name: "item"; type: "QVariant" } + Parameter { name: "status"; type: "QVariant" } + } + Method { + name: "__performTransition" + type: "QVariant" + Parameter { name: "transition"; type: "QVariant" } + } + Method { name: "animationFinished"; type: "QVariant" } + } + Component { + prototype: "QObject" + name: "QtQuick.Controls/StackViewDelegate" + exports: ["QtQuick.Controls/StackViewDelegate 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "pushTransition"; type: "QQmlComponent"; isPointer: true } + Property { name: "popTransition"; type: "QQmlComponent"; isPointer: true } + Property { name: "replaceTransition"; type: "QQmlComponent"; isPointer: true } + Method { + name: "getTransition" + type: "QVariant" + Parameter { name: "properties"; type: "QVariant" } + } + Method { + name: "transitionFinished" + type: "QVariant" + Parameter { name: "properties"; type: "QVariant" } + } + } + Component { + prototype: "QQuickParallelAnimation" + name: "QtQuick.Controls/StackViewTransition" + exports: ["QtQuick.Controls/StackViewTransition 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "animations" + Property { name: "name"; type: "string" } + Property { name: "enterItem"; type: "QQuickItem"; isPointer: true } + Property { name: "exitItem"; type: "QQuickItem"; isPointer: true } + Property { name: "immediate"; type: "bool" } + } + Component { + prototype: "QQuickItem" + name: "QtQuick.Controls/StatusBar" + exports: ["QtQuick.Controls/StatusBar 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "__content" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true } + Property { name: "__content"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + } + Component { + prototype: "QQuickLoader" + name: "QtQuick.Controls/Tab" + exports: ["QtQuick.Controls/Tab 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "component" + Property { name: "title"; type: "string" } + Property { name: "__inserted"; type: "bool" } + Property { name: "component"; type: "QQmlComponent"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/TabView" + exports: ["QtQuick.Controls/TabView 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "currentIndex"; type: "int" } + Property { name: "count"; type: "int" } + Property { name: "frameVisible"; type: "bool" } + Property { name: "tabsVisible"; type: "bool" } + Property { name: "tabPosition"; type: "int" } + Property { name: "__tabs"; type: "QQmlListModel"; isPointer: true } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__styleItem"; type: "QVariant" } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Method { + name: "addTab" + type: "QVariant" + Parameter { name: "title"; type: "QVariant" } + Parameter { name: "component"; type: "QVariant" } + } + Method { + name: "insertTab" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + Parameter { name: "title"; type: "QVariant" } + Parameter { name: "component"; type: "QVariant" } + } + Method { + name: "removeTab" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + } + Method { + name: "moveTab" + type: "QVariant" + Parameter { name: "from"; type: "QVariant" } + Parameter { name: "to"; type: "QVariant" } + } + Method { + name: "getTab" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + } + Method { name: "__setOpacities"; type: "QVariant" } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/TableView" + exports: ["QtQuick.Controls/TableView 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "__columns" + Property { name: "frameVisible"; type: "bool" } + Property { name: "highlightOnFocus"; type: "bool" } + Property { name: "contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__scroller"; type: "QQuickItem"; isPointer: true } + Property { name: "__scrollBarTopMargin"; type: "int" } + Property { name: "__viewTopMargin"; type: "int" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "Style_QMLTYPE_0"; isPointer: true } + Property { name: "viewport"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "flickableItem"; type: "QQuickFlickable"; isReadonly: true; isPointer: true } + Property { + name: "__horizontalScrollBar" + type: "ScrollBar_QMLTYPE_51" + isReadonly: true + isPointer: true + } + Property { + name: "__verticalScrollBar" + type: "ScrollBar_QMLTYPE_51" + isReadonly: true + isPointer: true + } + Property { name: "alternatingRowColors"; type: "bool" } + Property { name: "headerVisible"; type: "bool" } + Property { name: "itemDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "rowDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "headerDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "sortIndicatorColumn"; type: "int" } + Property { name: "sortIndicatorVisible"; type: "bool" } + Property { name: "sortIndicatorOrder"; type: "int" } + Property { name: "__activateItemOnSingleClick"; type: "bool" } + Property { name: "model"; type: "QVariant" } + Property { name: "backgroundVisible"; type: "bool" } + Property { name: "__columns"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "contentHeader"; type: "QQmlComponent"; isPointer: true } + Property { name: "contentFooter"; type: "QQmlComponent"; isPointer: true } + Property { name: "rowCount"; type: "int"; isReadonly: true } + Property { name: "columnCount"; type: "int"; isReadonly: true } + Property { name: "section"; type: "QQuickViewSection"; isReadonly: true; isPointer: true } + Property { name: "currentRow"; type: "int" } + Property { name: "__currentRowItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Signal { + name: "activated" + Parameter { name: "row"; type: "int" } + } + Signal { + name: "clicked" + Parameter { name: "row"; type: "int" } + } + Signal { + name: "doubleClicked" + Parameter { name: "row"; type: "int" } + } + Method { + name: "positionViewAtRow" + type: "QVariant" + Parameter { name: "row"; type: "QVariant" } + Parameter { name: "mode"; type: "QVariant" } + } + Method { + name: "rowAt" + type: "QVariant" + Parameter { name: "x"; type: "QVariant" } + Parameter { name: "y"; type: "QVariant" } + } + Method { + name: "addColumn" + type: "QVariant" + Parameter { name: "column"; type: "QVariant" } + } + Method { + name: "insertColumn" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + Parameter { name: "column"; type: "QVariant" } + } + Method { + name: "removeColumn" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + } + Method { + name: "moveColumn" + type: "QVariant" + Parameter { name: "from"; type: "QVariant" } + Parameter { name: "to"; type: "QVariant" } + } + Method { + name: "getColumn" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + } + Method { name: "__decrementCurrentIndex"; type: "QVariant" } + Method { name: "__incrementCurrentIndex"; type: "QVariant" } + } + Component { + prototype: "QObject" + name: "QtQuick.Controls/TableViewColumn" + exports: ["QtQuick.Controls/TableViewColumn 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "__view"; type: "QQuickItem"; isPointer: true } + Property { name: "title"; type: "string" } + Property { name: "role"; type: "string" } + Property { name: "width"; type: "int" } + Property { name: "visible"; type: "bool" } + Property { name: "resizable"; type: "bool" } + Property { name: "movable"; type: "bool" } + Property { name: "elideMode"; type: "int" } + Property { name: "horizontalAlignment"; type: "int" } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/TextArea" + exports: ["QtQuick.Controls/TextArea 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "frameVisible"; type: "bool" } + Property { name: "highlightOnFocus"; type: "bool" } + Property { name: "contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__scroller"; type: "QQuickItem"; isPointer: true } + Property { name: "__scrollBarTopMargin"; type: "int" } + Property { name: "__viewTopMargin"; type: "int" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "Style_QMLTYPE_0"; isPointer: true } + Property { name: "viewport"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "flickableItem"; type: "QQuickFlickable"; isReadonly: true; isPointer: true } + Property { + name: "__horizontalScrollBar" + type: "ScrollBar_QMLTYPE_51" + isReadonly: true + isPointer: true + } + Property { + name: "__verticalScrollBar" + type: "ScrollBar_QMLTYPE_51" + isReadonly: true + isPointer: true + } + Property { name: "tabChangesFocus"; type: "bool" } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "baseUrl"; type: "QUrl" } + Property { name: "canPaste"; type: "bool"; isReadonly: true } + Property { name: "canRedo"; type: "bool"; isReadonly: true } + Property { name: "canUndo"; type: "bool"; isReadonly: true } + Property { name: "textColor"; type: "QColor" } + Property { name: "cursorPosition"; type: "int" } + Property { name: "font"; type: "QFont" } + Property { name: "horizontalAlignment"; type: "int" } + Property { name: "effectiveHorizontalAlignment"; type: "int"; isReadonly: true } + Property { name: "verticalAlignment"; type: "int" } + Property { name: "inputMethodHints"; type: "int" } + Property { name: "length"; type: "int"; isReadonly: true } + Property { name: "lineCount"; type: "int"; isReadonly: true } + Property { name: "readOnly"; type: "bool" } + Property { name: "selectedText"; type: "string"; isReadonly: true } + Property { name: "selectionEnd"; type: "int"; isReadonly: true } + Property { name: "selectionStart"; type: "int"; isReadonly: true } + Property { name: "text"; type: "string" } + Property { name: "textFormat"; type: "int" } + Property { name: "wrapMode"; type: "int" } + Property { name: "selectByMouse"; type: "bool" } + Property { name: "selectByKeyboard"; type: "bool" } + Property { name: "hoveredLink"; type: "string"; isReadonly: true } + Property { name: "backgroundVisible"; type: "bool" } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "textMargin"; type: "double" } + Property { name: "textDocument"; type: "QQuickTextDocument"; isReadonly: true; isPointer: true } + Signal { + name: "linkActivated" + Parameter { name: "link"; type: "string" } + } + Signal { + name: "linkHovered" + Parameter { name: "link"; type: "string" } + } + Method { + name: "append" + type: "QVariant" + Parameter { name: "string"; type: "QVariant" } + } + Method { name: "copy"; type: "QVariant" } + Method { name: "cut"; type: "QVariant" } + Method { name: "deselect"; type: "QVariant" } + Method { + name: "getFormattedText" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { + name: "getText" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { + name: "insert" + type: "QVariant" + Parameter { name: "position"; type: "QVariant" } + Parameter { name: "text"; type: "QVariant" } + } + Method { + name: "isRightToLeft" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { + name: "moveCursorSelection" + type: "QVariant" + Parameter { name: "position"; type: "QVariant" } + Parameter { name: "mode"; type: "QVariant" } + } + Method { name: "paste"; type: "QVariant" } + Method { + name: "positionAt" + type: "QVariant" + Parameter { name: "x"; type: "QVariant" } + Parameter { name: "y"; type: "QVariant" } + } + Method { + name: "positionToRectangle" + type: "QVariant" + Parameter { name: "position"; type: "QVariant" } + } + Method { name: "redo"; type: "QVariant" } + Method { + name: "remove" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { + name: "select" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { name: "selectAll"; type: "QVariant" } + Method { name: "selectWord"; type: "QVariant" } + Method { name: "undo"; type: "QVariant" } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/TextField" + exports: ["QtQuick.Controls/TextField 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + Property { name: "acceptableInput"; type: "bool"; isReadonly: true } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "canPaste"; type: "bool"; isReadonly: true } + Property { name: "canRedo"; type: "bool"; isReadonly: true } + Property { name: "canUndo"; type: "bool"; isReadonly: true } + Property { name: "textColor"; type: "QColor" } + Property { name: "cursorPosition"; type: "int" } + Property { name: "displayText"; type: "string"; isReadonly: true } + Property { name: "echoMode"; type: "int" } + Property { name: "font"; type: "QFont" } + Property { name: "horizontalAlignment"; type: "int" } + Property { name: "effectiveHorizontalAlignment"; type: "int"; isReadonly: true } + Property { name: "verticalAlignment"; type: "int" } + Property { name: "inputMask"; type: "string" } + Property { name: "inputMethodHints"; type: "int" } + Property { name: "length"; type: "int"; isReadonly: true } + Property { name: "maximumLength"; type: "int" } + Property { name: "placeholderText"; type: "string" } + Property { name: "readOnly"; type: "bool" } + Property { name: "selectedText"; type: "string"; isReadonly: true } + Property { name: "selectionEnd"; type: "int"; isReadonly: true } + Property { name: "selectionStart"; type: "int"; isReadonly: true } + Property { name: "text"; type: "string" } + Property { name: "validator"; type: "QValidator"; isPointer: true } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Property { name: "__contentHeight"; type: "double"; isReadonly: true } + Property { name: "__contentWidth"; type: "double"; isReadonly: true } + Signal { name: "accepted" } + Method { name: "copy"; type: "QVariant" } + Method { name: "cut"; type: "QVariant" } + Method { name: "deselect"; type: "QVariant" } + Method { + name: "getText" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { + name: "insert" + type: "QVariant" + Parameter { name: "position"; type: "QVariant" } + Parameter { name: "text"; type: "QVariant" } + } + Method { + name: "isRightToLeft" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { name: "paste"; type: "QVariant" } + Method { name: "redo"; type: "QVariant" } + Method { + name: "select" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { name: "selectAll"; type: "QVariant" } + Method { name: "selectWord"; type: "QVariant" } + Method { name: "undo"; type: "QVariant" } + } + Component { + prototype: "QQuickItem" + name: "QtQuick.Controls/ToolBar" + exports: ["QtQuick.Controls/ToolBar 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "__content" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true } + Property { name: "__content"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/ToolButton" + exports: ["QtQuick.Controls/ToolButton 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "checkable"; type: "bool" } + Property { name: "checked"; type: "bool" } + Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true } + Property { name: "action"; type: "QQuickAction"; isPointer: true } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "text"; type: "string" } + Property { name: "tooltip"; type: "string" } + Property { name: "iconSource"; type: "QUrl" } + Property { name: "iconName"; type: "string" } + Property { name: "__textColor"; type: "QColor" } + Property { name: "__position"; type: "string" } + Property { name: "__iconOverriden"; type: "bool"; isReadonly: true } + Property { name: "__action"; type: "QQuickAction"; isPointer: true } + Property { name: "__iconAction"; type: "QQuickAction"; isReadonly: true; isPointer: true } + Property { name: "__effectivePressed"; type: "bool" } + Property { name: "__behavior"; type: "QVariant" } + Property { name: "pressed"; type: "bool"; isReadonly: true } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Signal { name: "clicked" } + Method { name: "accessiblePressAction"; type: "QVariant" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/006_loneCompositeAndCpp/Controls/qmldir b/tests/auto/qml/codemodel/importscheck/006_loneCompositeAndCpp/Controls/qmldir new file mode 100644 index 00000000000..f51b0553232 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/006_loneCompositeAndCpp/Controls/qmldir @@ -0,0 +1,4 @@ +module QtQuick.Controls +plugin qtquickcontrolsplugin +classname QtQuickControlsPlugin +typeinfo plugins.qmltypes diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ApplicationWindow.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ApplicationWindow.qml new file mode 100644 index 00000000000..6e0160df27c --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ApplicationWindow.qml @@ -0,0 +1,193 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) 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.Window 2.1 +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Layouts 1.0 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ApplicationWindow + \since 5.1 + \inqmlmodule QtQuick.Controls + \ingroup applicationwindow + \brief Provides a top-level application window. + + ApplicationWindow is a \l Window that adds convenience for positioning items, + such as \l MenuBar, \l ToolBar, and \l StatusBar in a platform independent + manner. + + \code + ApplicationWindow { + id: window + menuBar: MenuBar { + Menu { MenuItem {...} } + Menu { MenuItem {...} } + } + + toolBar: ToolBar { + RowLayout { + anchors.fill: parent + ToolButton {...} + } + } + + TabView { + id: myContent + anchors.fill: parent + ... + } + } + \endcode +*/ + +Window { + id: root + + /*! + \qmlproperty MenuBar ApplicationWindow::menuBar + + This property holds the \l MenuBar. + + By default, this value is not set. + */ + property MenuBar menuBar: null + + /*! + \qmlproperty Item ApplicationWindow::toolBar + + This property holds the toolbar \l Item. + + It can be set to any Item type, but is generally used with \l ToolBar. + + By default, this value is not set. When you set the toolbar item, it will + be anchored automatically into the application window. + */ + property Item toolBar + + /*! + \qmlproperty Item ApplicationWindow::statusBar + + This property holds the status bar \l Item. + + It can be set to any Item type, but is generally used with \l StatusBar. + + By default, this value is not set. When you set the status bar item, it + will be anchored automatically into the application window. + */ + property Item statusBar + + onToolBarChanged: { if (toolBar) { toolBar.parent = toolBarArea } } + + onStatusBarChanged: { if (statusBar) { statusBar.parent = statusBarArea } } + + onVisibleChanged: { if (visible && menuBar) { menuBar.__parentWindow = root } } + + /*! \internal */ + default property alias data: contentArea.data + + color: syspal.window + + flags: Qt.Window | Qt.WindowFullscreenButtonHint | + Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | + Qt.WindowCloseButtonHint | Qt.WindowFullscreenButtonHint + // QTBUG-35049: Windows is removing features we didn't ask for, even though Qt::CustomizeWindowHint is not set + // Otherwise Qt.Window | Qt.WindowFullscreenButtonHint would be enough + + SystemPalette {id: syspal} + + Item { + id: backgroundItem + anchors.fill: parent + + Keys.forwardTo: menuBar ? [menuBar.__contentItem] : [] + + Item { + id: contentArea + anchors.top: toolBarArea.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: statusBarArea.top + } + + Item { + id: toolBarArea + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + implicitHeight: childrenRect.height + height: visibleChildren.length > 0 ? implicitHeight: 0 + } + + Item { + id: statusBarArea + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + implicitHeight: childrenRect.height + height: visibleChildren.length > 0 ? implicitHeight: 0 + } + + onVisibleChanged: if (visible && menuBar) menuBar.__parentWindow = root + + states: State { + name: "hasMenuBar" + when: menuBar && !menuBar.__isNative + + ParentChange { + target: menuBar.__contentItem + parent: backgroundItem + } + + PropertyChanges { + target: menuBar.__contentItem + x: 0 + y: 0 + width: backgroundItem.width + } + + AnchorChanges { + target: toolBarArea + anchors.top: menuBar.__contentItem.bottom + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/BusyIndicator.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/BusyIndicator.qml new file mode 100644 index 00000000000..01820bb8200 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/BusyIndicator.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype BusyIndicator + \inqmlmodule QtQuick.Controls + \since 5.2 + \ingroup controls + \brief A busy indicator. + + The busy indicator should be used to indicate activity while content is + being loaded or the UI is blocked waiting for a resource to become available. + + You can create a custom appearance for a Busy Indicator by + assigning a \l {QtQuick.Controls.Styles::BusyIndicatorStyle}{BusyIndicatorStyle}. + */ +Control { + id: indicator + + /*! \qmlproperty bool BusyIndicator::running + + This property holds whether the busy indicator is currently indicating + activity. + + \note The indicator is only visible when this property is set to \c true. + + The default value is \c true. + */ + property bool running: true + + Accessible.role: Accessible.Indicator + Accessible.name: "busy" + + style: Qt.createComponent(Settings.style + "/BusyIndicatorStyle.qml", indicator) +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Button.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Button.qml new file mode 100644 index 00000000000..1875e423a69 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Button.qml @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype Button + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief A push button with a text label. + + The push button is perhaps the most commonly used widget in any graphical + user interface. Pushing (or clicking) a button commands the computer to + perform some action or answer a question. Common examples of buttons are + OK, Apply, Cancel, Close, Yes, No, and Help buttons. + + Button is similar to the QPushButton widget. + + You can create a custom appearance for a Button by + assigning a \l {QtQuick.Controls.Styles::ButtonStyle}{ButtonStyle}. + */ +BasicButton { + id: button + + /*! This property holds whether the push button is the default button. + Default buttons decide what happens when the user presses enter in a + dialog without giving a button explicit focus. \note This property only + changes the appearance of the button. The expected behavior needs to be + implemented by the user. + + The default value is \c false. + */ + property bool isDefault: false + + /*! Assign a \l Menu to this property to get a pull-down menu button. + + The default value is \c null. + */ + property Menu menu: null + + __effectivePressed: __behavior.effectivePressed || menu && menu.__popupVisible + + activeFocusOnTab: true + + Accessible.name: text + + style: Qt.createComponent(Settings.style + "/ButtonStyle.qml", button) + + Binding { + target: menu + property: "__minimumWidth" + value: button.__panel.width + } + + Binding { + target: menu + property: "__visualItem" + value: button + } + + Connections { + target: __behavior + onEffectivePressedChanged: { + if (__behavior.effectivePressed && menu) + popupMenuTimer.start() + } + } + + Timer { + id: popupMenuTimer + interval: 10 + onTriggered: { + __behavior.keyPressed = false + if (Qt.application.layoutDirection === Qt.RightToLeft) + menu.__popup(button.width, button.height, 0) + else + menu.__popup(0, button.height, 0) + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/CheckBox.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/CheckBox.qml new file mode 100644 index 00000000000..00671755c7d --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/CheckBox.qml @@ -0,0 +1,184 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype CheckBox + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief A checkbox with a text label. + + A CheckBox is an option button that can be toggled on (checked) or off + (unchecked). Checkboxes are typically used to represent features in an + application that can be enabled or disabled without affecting others. + + The state of the checkbox can be set with the \l {AbstractCheckable::checked}{checked} property. + + In addition to the checked and unchecked states, there is a third state: + partially checked. This state indicates that the + regular checked/unchecked state can not be determined; generally because of + other states that affect the checkbox. This state is useful when several + child nodes are selected in a treeview, for example. + + The partially checked state can be made available to the user by setting + \l partiallyCheckedEnabled to \c true, or set directly by setting + \l checkedState to \c Qt.PartiallyChecked. \l checkedState behaves + identically to \l {AbstractCheckable::checked}{checked} when \l partiallyCheckedEnabled + is \c false; setting one will appropriately set the other. + + The label is shown next to the checkbox, and you can set the label text using its + \l {AbstractCheckable::text}{text} property. + + \qml + Column { + CheckBox { + text: qsTr("Breakfast") + } + CheckBox { + text: qsTr("Lunch") + } + CheckBox { + text: qsTr("Dinner") + } + } + \endqml + + Whenever a CheckBox is clicked, it emits the \l {AbstractCheckable::clicked}{clicked()} signal. + + You can create a custom appearance for a CheckBox by + assigning a \l {QtQuick.Controls.Styles::CheckBoxStyle}{CheckBoxStyle}. +*/ + +AbstractCheckable { + id: checkBox + + /*! + \qmlproperty enumeration CheckBox::checkedState + + This property indicates the current checked state of the checkbox. + + Possible values: + \c Qt.UnChecked - The checkbox is not checked (default). + \c Qt.Checked - The checkbox is checked. + \c Qt.PartiallyChecked - The checkbox is in a partially checked (or + "mixed") state. + + The \l {AbstractCheckable::checked}{checked} property also determines whether + this property is \c Qt.Checked or \c Qt.UnChecked, and vice versa. + */ + property int checkedState: checked ? Qt.Checked : Qt.Unchecked + + /*! + This property determines whether the \c Qt.PartiallyChecked state is + available. + + A checkbox may be in a partially checked state when the regular checked + state can not be determined. + + Setting \l checkedState to \c Qt.PartiallyChecked will implicitly set + this property to \c true. + + If this property is \c true, \l {AbstractCheckable::checked}{checked} will be \c false. + + By default, this property is \c false. + */ + property bool partiallyCheckedEnabled: false + + /*! + \internal + True if onCheckedChanged should be ignored because we were reacting + to onCheckedStateChanged. + */ + property bool __ignoreChecked: false + + style: Qt.createComponent(Settings.style + "/CheckBoxStyle.qml", checkBox) + + activeFocusOnTab: true + + Accessible.role: Accessible.CheckBox + Accessible.name: text + + __cycleStatesHandler: __cycleCheckBoxStates + + onCheckedChanged: { + if (!__ignoreChecked) + checkedState = checked ? Qt.Checked : Qt.Unchecked; + } + + onCheckedStateChanged: { + __ignoreChecked = true; + if (checkedState === Qt.PartiallyChecked) { + partiallyCheckedEnabled = true; + checked = false; + } else { + checked = checkedState === Qt.Checked; + } + __ignoreChecked = false; + } + + onPartiallyCheckedEnabledChanged: { + if (exclusiveGroup && partiallyCheckedEnabled) { + console.warn("Cannot have partially checked boxes in an ExclusiveGroup."); + } + } + + onExclusiveGroupChanged: { + if (exclusiveGroup && partiallyCheckedEnabled) { + console.warn("Cannot have partially checked boxes in an ExclusiveGroup."); + } + } + + /*! \internal */ + function __cycleCheckBoxStates() { + if (!partiallyCheckedEnabled) { + checked = !checked; + } else { + switch (checkedState) { + case Qt.Unchecked: checkedState = Qt.Checked; break; + case Qt.Checked: checkedState = Qt.PartiallyChecked; break; + case Qt.PartiallyChecked: checkedState = Qt.Unchecked; break; + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ComboBox.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ComboBox.qml new file mode 100644 index 00000000000..db39f579fe1 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ComboBox.qml @@ -0,0 +1,562 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ComboBox + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief Provides a drop-down list functionality. + + Add items to the comboBox by assigning it a ListModel, or a list of strings to the \l model property. + + \qml + ComboBox { + width: 200 + model: [ "Banana", "Apple", "Coconut" ] + } + \endqml + + In this example we are demonstrating how to use a ListModel with a combo box. + + \qml + ComboBox { + currentIndex: 2 + model: ListModel { + id: cbItems + ListElement { text: "Banana"; color: "Yellow" } + ListElement { text: "Apple"; color: "Green" } + ListElement { text: "Coconut"; color: "Brown" } + } + width: 200 + onCurrentIndexChanged: console.debug(cbItems.get(currentIndex).text + ", " + cbItems.get(currentIndex).color) + } + \endqml + + You can make a combo box editable by setting the \l editable property. An editable combo box will + autocomplete its text based on what is available in the model. + + In the next example we demonstrate how you can append content to an editable combo box by + reacting to the \l accepted signal. Note that you have to explicitly prevent duplicates. + + \qml + ComboBox { + editable: true + model: ListModel { + id: model + ListElement { text: "Banana"; color: "Yellow" } + ListElement { text: "Apple"; color: "Green" } + ListElement { text: "Coconut"; color: "Brown" } + } + onAccepted: { + if (editableCombo.find(currentText) === -1) { + model.append({text: editText}) + currentIndex = editableCombo.find(editText) + } + } + } + \endqml + + + You can create a custom appearance for a ComboBox by + assigning a \l {QtQuick.Controls.Styles::ComboBoxStyle}{ComboBoxStyle}. +*/ + +Control { + id: comboBox + + /*! \qmlproperty model ComboBox::model + The model to populate the ComboBox from. + + Changing the model after initialization will reset \l currentIndex to \c 0. + */ + property alias model: popupItems.model + + /*! The model role used for populating the ComboBox. */ + property string textRole: "" + + /*! \qmlproperty int ComboBox::currentIndex + The index of the currently selected item in the ComboBox. + + \sa model + */ + property alias currentIndex: popup.__selectedIndex + + /*! \qmlproperty string ComboBox::currentText + The text of the currently selected item in the ComboBox. + + \note Since \c currentText depends on \c currentIndex, there's no way to ensure \c currentText + will be up to date whenever a \c onCurrentIndexChanged handler is called. + */ + readonly property alias currentText: popup.currentText + + /*! This property holds whether the combo box can be edited by the user. + The default value is \c false. + \since QtQuick.Controls 1.1 + */ + property bool editable: false + + /*! \qmlproperty string ComboBox::editText + \since QtQuick.Controls 1.1 + This property specifies text being manipulated by the user for an editable combo box. + */ + property alias editText: input.text + + /*! This property specifies whether the combobox should gain active focus when pressed. + The default value is \c false. */ + property bool activeFocusOnPress: false + + /*! \qmlproperty bool ComboBox::pressed + + This property holds whether the button is being pressed. */ + readonly property bool pressed: mouseArea.pressed && mouseArea.containsMouse || popup.__popupVisible + + /*! \qmlproperty bool ComboBox::hovered + + This property indicates whether the control is being hovered. + */ + readonly property alias hovered: mouseArea.containsMouse + + /*! \qmlproperty int ComboBox::count + \since QtQuick.Controls 1.1 + This property holds the number of items in the combo box. + */ + readonly property alias count: popupItems.count + + /*! Returns the text for a given \a index. + If an invalid index is provided, \c null is returned + \since QtQuick.Controls 1.1 + */ + function textAt (index) { + if (index >= count || index < 0) + return null; + return popupItems.objectAt(index).text; + } + + /*! Finds and returns the index of a given \a text + If no match is found, \c -1 is returned. The search is case sensitive. + \since QtQuick.Controls 1.1 + */ + function find (text) { + return input.find(text, Qt.MatchExactly) + } + + /*! + \qmlproperty Validator ComboBox::validator + \since QtQuick.Controls 1.1 + + Allows you to set a text validator for an editable ComboBox. + When a validator is set, + the text field will only accept input which leaves the text property in + an intermediate state. The accepted signal will only be sent + if the text is in an acceptable state when enter is pressed. + + Currently supported validators are \l{QtQuick2::IntValidator}, + \l{QtQuick2::DoubleValidator}, and \l{QtQuick2::RegExpValidator}. An + example of using validators is shown below, which allows input of + integers between 11 and 31 into the text field: + + \note This property is only applied when \l editable is \c true + + \qml + import QtQuick 2.1 + import QtQuick.Controls 1.1 + + ComboBox { + editable: true + model: 10 + validator: IntValidator {bottom: 0; top: 10;} + focus: true + } + \endqml + + \sa acceptableInput, accepted, editable + */ + property alias validator: input.validator + + /*! + \qmlproperty bool ComboBox::acceptableInput + \since QtQuick.Controls 1.1 + + Returns \c true if the combo box contains acceptable + text in the editable text field. + + If a validator was set, this property will return \c + true if the current text satisfies the validator or mask as + a final string (not as an intermediate string). + + \sa validator, accepted + + */ + readonly property alias acceptableInput: input.acceptableInput + + /*! + \qmlsignal ComboBox::accepted() + \since QtQuick.Controls 1.1 + + This signal is emitted when the Return or Enter key is pressed on an + \l editable combo box. If the confirmed string is not currently in the model, + the currentIndex will be set to -1 and the \l currentText will be updated + accordingly. + + \note If there is a \l validator set on the combobox, + the signal will only be emitted if the input is in an acceptable state. + */ + signal accepted + + /*! + \qmlsignal ComboBox::activated(int index) + \since QtQuick.Controls 1.1 + + \a index is the triggered model index or -1 if a new string is accepted + + This signal is similar to currentIndex changed, but will only + be emitted if the combo box index was changed by the user and not + when set programatically. + */ + signal activated(int index) + + /*! + \qmlmethod ComboBox::selectAll() + \since QtQuick.Controls 1.1 + + Causes all \l editText to be selected. + */ + function selectAll() { + input.selectAll() + } + + /*! \internal */ + property var __popup: popup + + style: Qt.createComponent(Settings.style + "/ComboBoxStyle.qml", comboBox) + + activeFocusOnTab: true + + Accessible.role: Accessible.ComboBox + + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + onPressed: { + if (comboBox.activeFocusOnPress) + forceActiveFocus() + popup.show() + } + } + + Component.onCompleted: { + if (currentIndex === -1) + currentIndex = 0 + + popup.ready = true + popup.resolveTextValue(textRole) + } + + Keys.onPressed: { + // Perform one-character based lookup for non-editable combo box + if (!editable && event.text.length > 0) { + var index = input.find(event.text, Qt.MatchStartsWith); + if (index >= 0 && index !== currentIndex) { + currentIndex = index; + activated(currentIndex); + } + } + } + + TextInput { + id: input + + visible: editable + enabled: editable + focus: true + clip: contentWidth > width + text: currentText + + anchors.fill: parent + anchors.leftMargin: 8 + anchors.rightMargin: __style.drowDownButtonWidth + + verticalAlignment: Text.AlignVCenter + + renderType: Text.NativeRendering + selectByMouse: true + selectionColor: syspal.highlight + selectedTextColor: syspal.highlightedText + onAccepted: { + var idx = input.find(editText) + if (idx > -1) { + var string = textAt(idx); + if (string.length === editText.length) { + currentIndex = idx; + editText = string; + } + } else { + currentIndex = -1; + popup.currentText = editText; + } + comboBox.accepted(); + } + + SystemPalette { id: syspal } + + property bool blockUpdate: false + property string prevText + + function find (text, searchType) { + for (var i = 0 ; i < popupItems.count ; ++i) { + var currentString = popupItems.objectAt(i).text + if (searchType === Qt.MatchExactly) { + if (text === currentString) + return i; + } else if (searchType === Qt.CaseSensitive) { + if (currentString.indexOf(text) === 0) + return i; + } else if (currentString.toLowerCase().indexOf(text.toLowerCase()) === 0) { + return i + } + } + return -1; + } + + // Finds first entry and shortest entry. Used by editable combo + function tryComplete (inputText) { + var candidate = ""; + var shortestString = ""; + for (var i = 0 ; i < popupItems.count ; ++i) { + var currentString = popupItems.objectAt(i).text; + + if (currentString.toLowerCase().indexOf(inputText.toLowerCase()) === 0) { + if (candidate.length) { // Find smallest possible match + var cmp = 0; + + // We try to complete the shortest string that matches our search + if (currentString.length < candidate.length) + candidate = currentString + + while (cmp < Math.min(currentString.length, shortestString.length) + && shortestString[cmp].toLowerCase() === currentString[cmp].toLowerCase()) + cmp++; + shortestString = shortestString.substring(0, cmp); + } else { // First match, select as current index and find other matches + candidate = currentString; + shortestString = currentString; + } + } + } + + if (candidate.length) + return inputText + candidate.substring(inputText.length, candidate.length); + return inputText; + } + + property bool allowComplete: false + Keys.onPressed: allowComplete = (event.key !== Qt.Key_Backspace && event.key !== Qt.Key_Delete); + + onTextChanged: { + if (editable && !blockUpdate && allowComplete) { + var completed = input.tryComplete(text) + if (completed.length > text.length) { + var oldtext = input.text; + input.text = completed; + input.select(text.length, oldtext.length); + } + } + prevText = text + } + } + + onTextRoleChanged: popup.resolveTextValue(textRole) + + Menu { + id: popup + objectName: "popup" + + style: isPopup ? __style.__popupStyle : __style.__dropDownStyle + + property string currentText: selectedText + onSelectedTextChanged: if (selectedText) popup.currentText = selectedText + + property string selectedText + on__SelectedIndexChanged: updateSelectedText() + property string textRole: "" + + property bool ready: false + property bool isPopup: !editable && !!__panel && __panel.popup + + property int y: isPopup ? (comboBox.__panel.height - comboBox.__panel.implicitHeight) / 2.0 : comboBox.__panel.height + __minimumWidth: comboBox.width + __visualItem: comboBox + + property ExclusiveGroup eg: ExclusiveGroup { id: eg } + + property bool __modelIsArray: popupItems.model ? popupItems.model.constructor === Array : false + + Instantiator { + id: popupItems + active: false + + property bool updatingModel: false + onModelChanged: { + if (active) { + if (updatingModel && popup.__selectedIndex === 0) { + // We still want to update the currentText + popup.updateSelectedText() + } else { + updatingModel = true + popup.__selectedIndex = 0 + } + } + } + + MenuItem { + text: popup.textRole === '' ? + modelData : + ((popup.__modelIsArray ? modelData[popup.textRole] : model[popup.textRole]) || '') + onTriggered: { + if (index !== currentIndex) + activated(index) + comboBox.editText = text + } + checkable: true + exclusiveGroup: eg + } + onObjectAdded: { + popup.insertItem(index, object) + if (!updatingModel && index === popup.__selectedIndex) + popup.selectedText = object["text"] + } + onObjectRemoved: popup.removeItem(object) + + } + + function resolveTextValue(initialTextRole) { + if (!ready || !model) { + popupItems.active = false + return; + } + + var get = model['get']; + if (!get && popup.__modelIsArray) { + if (model[0].constructor !== String && model[0].constructor !== Number) + get = function(i) { return model[i]; } + } + + var modelMayHaveRoles = get !== undefined + textRole = initialTextRole + if (textRole === "" && modelMayHaveRoles && get(0)) { + // No text role set, check whether model has a suitable role + // If 'text' is found, or there's only one role, pick that. + var listElement = get(0) + var roleName = "" + var roleCount = 0 + for (var role in listElement) { + if (listElement[role].constructor === Function) + continue; + if (role === "text") { + roleName = role + break + } else if (!roleName) { + roleName = role + } + ++roleCount + } + if (roleCount > 1 && roleName !== "text") { + console.warn("No suitable 'textRole' found for ComboBox.") + } else { + textRole = roleName + } + } + + if (!popupItems.active) + popupItems.active = true + else + updateSelectedText() + } + + function show() { + if (items[__selectedIndex]) + items[__selectedIndex].checked = true + __currentIndex = comboBox.currentIndex + if (Qt.application.layoutDirection === Qt.RightToLeft) + __popup(comboBox.width, y, isPopup ? __selectedIndex : 0) + else + __popup(0, y, isPopup ? __selectedIndex : 0) + } + + function updateSelectedText() { + var selectedItem; + if (__selectedIndex !== -1 && (selectedItem = items[__selectedIndex])) + selectedText = selectedItem.text + } + } + + // The key bindings below will only be in use when popup is + // not visible. Otherwise, native popup key handling will take place: + Keys.onSpacePressed: { + if (!popup.popupVisible) + popup.show() + } + + Keys.onUpPressed: { + input.blockUpdate = true + if (currentIndex > 0) { + currentIndex--; + input.text = popup.currentText; + activated(currentIndex); + } + input.blockUpdate = false; + } + + Keys.onDownPressed: { + input.blockUpdate = true; + if (currentIndex < popupItems.count - 1) { + currentIndex++; + input.text = popup.currentText; + activated(currentIndex); + } + input.blockUpdate = false; + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/GroupBox.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/GroupBox.qml new file mode 100644 index 00000000000..12959d16ff3 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/GroupBox.qml @@ -0,0 +1,226 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.0 + +/*! + \qmltype GroupBox + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief GroupBox provides a group box frame with a title. + + A group box provides a frame, a title on top and displays various other controls inside itself. Group boxes can also be checkable. + + Child controls in checkable group boxes are enabled or disabled depending on whether or not the group box is checked. + + You can minimize the space consumption of a group box by enabling the flat property. + In most styles, enabling this property results in the removal of the left, right and bottom edges of the frame. + + To add content to a group box, you can reparent it to its contentItem property. + + The implicit size of the GroupBox is calculated based on the size of its content. If you want to anchor + items inside the group box, you must specify an explicit width and height on the GroupBox itself. + + The following example shows how we use a GroupBox with a column: + + \qml + GroupBox { + title: qsTr("Package selection") + Column { + spacing: 2 + CheckBox { + text: qsTr("Update system") + } + CheckBox { + text: qsTr("Update applications") + } + CheckBox { + text: qsTr("Update documentation") + } + } + } + \endqml + + \sa CheckBox, RadioButton, Layout + +*/ + +FocusScope { + id: groupbox + + /*! + This property holds the group box title text. + + There is no default title text. + */ + property string title + + /*! + This property holds whether the group box is painted flat or has a frame. + + A group box usually consists of a surrounding frame with a title at the top. + If this property is enabled, only the top part of the frame is drawn in most styles; + otherwise, the whole frame is drawn. + + By default, this property is disabled, so group boxes are not flat unless explicitly specified. + + \note In some styles, flat and non-flat group boxes have similar representations and may not be as + distinguishable as they are in other styles. + */ + property bool flat: false + + /*! + This property holds whether the group box has a checkbox in its title. + + If this property is true, the group box displays its title using a checkbox in place of an ordinary label. + If the checkbox is checked, the group box's children are enabled; otherwise, they are disabled and inaccessible. + + By default, group boxes are not checkable. + */ + property bool checkable: false + + /*! + \qmlproperty bool GroupBox::checked + + This property holds whether the group box is checked. + + If the group box is checkable, it is displayed with a check box. If the check box is checked, the group + box's children are enabled; otherwise, the children are disabled and are inaccessible to the user. + + By default, checkable group boxes are also checked. + */ + property alias checked: check.checked + + + /*! \internal */ + default property alias __content: container.data + + /*! + \qmlproperty Item GroupBox::contentItem + + This property holds the content Item of the group box. + + Items declared as children of a GroupBox are automatically parented to the GroupBox's contentItem. + Items created dynamically need to be explicitly parented to the contentItem: + + \note The implicit size of the GroupBox is calculated based on the size of its content. If you want to anchor + items inside the group box, you must specify an explicit width and height on the GroupBox itself. + */ + readonly property alias contentItem: container + + /*! \internal */ + property Component style: Qt.createComponent(Settings.style + "/GroupBoxStyle.qml", groupbox) + + /*! \internal */ + property alias __checkbox: check + + /*! \internal */ + property alias __style: styleLoader.item + + implicitWidth: Math.max((!anchors.fill ? container.calcWidth() : 0) + loader.leftMargin + loader.rightMargin, + sizeHint.implicitWidth + (checkable ? 24 : 6)) + implicitHeight: (!anchors.fill ? container.calcHeight() : 0) + loader.topMargin + loader.bottomMargin + + Layout.minimumWidth: implicitWidth + Layout.minimumHeight: implicitHeight + + Accessible.role: Accessible.Grouping + Accessible.name: title + + activeFocusOnTab: false + + + data: [ + Loader { + id: loader + anchors.fill: parent + property int topMargin: __style ? __style.padding.top : 0 + property int bottomMargin: __style ? __style.padding.bottom : 0 + property int leftMargin: __style ? __style.padding.left : 0 + property int rightMargin: __style ? __style.padding.right : 0 + sourceComponent: styleLoader.item ? styleLoader.item.panel : null + onLoaded: item.z = -1 + Text { id: sizeHint ; visible: false ; text: title } + Loader { + id: styleLoader + property alias __control: groupbox + sourceComponent: groupbox.style + } + }, + CheckBox { + id: check + objectName: "check" + checked: true + text: groupbox.title + visible: checkable + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + height: loader.topMargin + activeFocusOnTab: groupbox.checkable + style: CheckBoxStyle { panel: Item{} } + }, + Item { + id: container + objectName: "container" + z: 1 + focus: true + anchors.fill: parent + + anchors.topMargin: loader.topMargin + anchors.leftMargin: loader.leftMargin + anchors.rightMargin: loader.rightMargin + anchors.bottomMargin: loader.bottomMargin + enabled: (!groupbox.checkable || groupbox.checked) + + property Item layoutItem: container.children.length === 1 ? container.children[0] : null + function calcWidth () { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) + + (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin + + layoutItem.anchors.rightMargin : 0) : container.childrenRect.width) } + function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) + + (layoutItem.anchors.fill ? layoutItem.anchors.topMargin + + layoutItem.anchors.bottomMargin : 0) : container.childrenRect.height) } + }] +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Label.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Label.qml new file mode 100644 index 00000000000..01f2a1629c0 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Label.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 + +/*! + \qmltype Label + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief A text label. + + In addition to the normal \l Text element, Label follows the font and + color scheme of the system. + Use the \c text property to assign a text to the label. For other properties + check \l Text. + + A simple label looks like this: + \qml + Label { + text: "Hello world" + } + \endqml + + You can use the properties of \l Text to change the appearance + of the text as desired: + \qml + Label { + text: "Hello world" + font.pixelSize: 22 + font.italic: true + color: "steelblue" + } + \endqml + + \sa Text, TextField, TextEdit +*/ + +Text { + /*! + \qmlproperty string Label::text + + The text to display. Use this property to get and set it. + */ + + id: label + color: pal.text + activeFocusOnTab: false + renderType: Text.NativeRendering + SystemPalette { + id: pal + colorGroup: enabled ? SystemPalette.Active : SystemPalette.Disabled + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Menu.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Menu.qml new file mode 100644 index 00000000000..9c76684605f --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Menu.qml @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype Menu + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup menus + \brief Provides a menu component for use in menu bars, as context menu, + and other popup menus. + + \code + Menu { + title: "Edit" + + MenuItem { + text: "Cut" + shortcut: "Ctrl+X" + onTriggered: ... + } + + MenuItem { + text: "Copy" + shortcut: "Ctrl+C" + onTriggered: ... + } + + MenuItem { + text: "Paste" + shortcut: "Ctrl+V" + onTriggered: ... + } + + MenuSeparator { } + + Menu { + title: "More Stuff" + + MenuItem { + text: "Do Nothing" + } + } + } + \endcode + + The main uses for menus: + \list + \li + as a \e top-level menu in a \l MenuBar + \li + as a \e submenu inside another menu + \li + as a standalone or \e context menu + \endlist + + Note that some properties, such as \c enabled, \c text, or \c iconSource, + only make sense in a particular use case of the menu. + + \sa MenuBar, MenuItem, MenuSeparator +*/ + +MenuPrivate { + id: root + + /*! \internal + \omit + Documented in qqquickmenu.cpp. + \endomit + */ + function addMenu(title) { + return root.insertMenu(items.length, title) + } + + /*! \internal + \omit + Documented in qquickmenu.cpp. + \endomit + */ + function insertMenu(index, title) { + if (!__selfComponent) + __selfComponent = Qt.createComponent("Menu.qml", root) + var submenu = __selfComponent.createObject(__selfComponent, { "title": title }) + root.insertItem(index, submenu) + return submenu + } + + /*! \internal */ + property Component __selfComponent: null + + /*! \internal */ + property Component style: Qt.createComponent(Settings.style + "/MenuStyle.qml", root) + + /*! \internal */ + property var __parentContentItem: __parentMenu.__contentItem + /*! \internal */ + property int __currentIndex: -1 + /*! \internal */ + on__MenuClosed: __currentIndex = -1 + + /*! \internal */ + __contentItem: Loader { + sourceComponent: MenuContentItem { + menu: root + } + active: !root.__isNative && root.__popupVisible + focus: true + Keys.forwardTo: item ? [item, root.__parentContentItem] : [] + property bool altPressed: root.__parentContentItem ? root.__parentContentItem.altPressed : false + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/MenuBar.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/MenuBar.qml new file mode 100644 index 00000000000..42b3f39aad6 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/MenuBar.qml @@ -0,0 +1,276 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype MenuBar + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup applicationwindow + \brief Provides a horizontal menu bar. + + \code + MenuBar { + Menu { + title: "File" + MenuItem { text: "Open..." } + MenuItem { text: "Close" } + } + + Menu { + title: "Edit" + MenuItem { text: "Cut" } + MenuItem { text: "Copy" } + MenuItem { text: "Paste" } + } + } + \endcode + + \sa ApplicationWindow::menuBar +*/ + +MenuBarPrivate { + id: root + + /*! \internal */ + property Component style: Qt.createComponent(Settings.style + "/MenuBarStyle.qml", root) + + /*! \internal */ + __contentItem: Loader { + id: topLoader + sourceComponent: __menuBarComponent + active: !root.__isNative + focus: true + Keys.forwardTo: [item] + property bool altPressed: item ? item.altPressed : false + } + + /*! \internal */ + property Component __menuBarComponent: Loader { + id: menuBarLoader + + property Style __style: styleLoader.item + property Component menuItemStyle: __style ? __style.menuItem : null + + property var control: root + onStatusChanged: if (status === Loader.Error) console.error("Failed to load panel for", root) + + visible: status === Loader.Ready + sourceComponent: __style ? __style.frame : undefined + + Loader { + id: styleLoader + property alias __control: menuBarLoader + sourceComponent: root.style + onStatusChanged: { + if (status === Loader.Error) + console.error("Failed to load Style for", root) + } + } + + property int openedMenuIndex: -1 + property bool preselectMenuItem: false + property alias contentHeight: row.height + + Binding { + // Make sure the styled menu bar is in the background + target: menuBarLoader.item + property: "z" + value: menuMouseArea.z - 1 + } + + focus: true + + property bool altPressed: false + property bool altPressedAgain: false + property var mnemonicsMap: ({}) + + Keys.onPressed: { + var action = null + if (event.key === Qt.Key_Alt) { + if (!altPressed) + altPressed = true + else + altPressedAgain = true + } else if (altPressed && (action = mnemonicsMap[event.text.toUpperCase()])) { + preselectMenuItem = true + action.trigger() + event.accepted = true + } + } + + function dismissActiveFocus(event, reason) { + if (reason) { + altPressedAgain = false + altPressed = false + openedMenuIndex = -1 + root.__contentItem.parent.forceActiveFocus() + } else { + event.accepted = false + } + } + + Keys.onReleased: dismissActiveFocus(event, altPressedAgain && openedMenuIndex === -1) + Keys.onEscapePressed: dismissActiveFocus(event, openedMenuIndex === -1) + + function maybeOpenFirstMenu(event) { + if (altPressed && openedMenuIndex === -1) { + preselectMenuItem = true + openedMenuIndex = 0 + } else { + event.accepted = false + } + } + + Keys.onUpPressed: maybeOpenFirstMenu(event) + Keys.onDownPressed: maybeOpenFirstMenu(event) + + Keys.onLeftPressed: { + if (openedMenuIndex > 0) { + preselectMenuItem = true + openedMenuIndex-- + } + } + + Keys.onRightPressed: { + if (openedMenuIndex !== -1 && openedMenuIndex < root.menus.length - 1) { + preselectMenuItem = true + openedMenuIndex++ + } + } + + MouseArea { + id: menuMouseArea + anchors.fill: parent + hoverEnabled: true + + onPositionChanged: updateCurrentItem(mouse, false) + onPressed: { + if (updateCurrentItem(mouse)) { + menuBarLoader.preselectMenuItem = false + menuBarLoader.openedMenuIndex = currentItem.menuItemIndex + } + } + onExited: hoveredItem = null + + property Item currentItem: null + property Item hoveredItem: null + function updateCurrentItem(mouse) { + var pos = mapToItem(row, mouse.x, mouse.y) + if (!hoveredItem || !hoveredItem.contains(Qt.point(pos.x - currentItem.x, pos.y - currentItem.y))) { + hoveredItem = row.childAt(pos.x, pos.y) + if (!hoveredItem) + return false; + currentItem = hoveredItem + if (menuBarLoader.openedMenuIndex !== -1) { + menuBarLoader.preselectMenuItem = false + menuBarLoader.openedMenuIndex = currentItem.menuItemIndex + } + } + return true; + } + + Row { + id: row + width: parent.width + LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft + + Repeater { + id: itemsRepeater + model: root.menus + Loader { + id: menuItemLoader + + property var menuItem: modelData + property bool selected: menuMouseArea.hoveredItem === menuItemLoader + property bool sunken: menuItem.__popupVisible || menuBarLoader.openedMenuIndex === index + property bool showUnderlined: menuBarLoader.altPressed + + sourceComponent: menuBarLoader.menuItemStyle + property int menuItemIndex: index + visible: menuItem.visible + + Connections { + target: menuBarLoader + onOpenedMenuIndexChanged: { + if (menuBarLoader.openedMenuIndex === index) { + if (row.LayoutMirroring.enabled) + menuItem.__popup(menuItemLoader.width, menuBarLoader.height, 0) + else + menuItem.__popup(0, menuBarLoader.height, 0) + if (menuBarLoader.preselectMenuItem) + menuItem.__currentIndex = 0 + } else { + menuItem.__closeMenu() + } + } + } + + Connections { + target: menuItem + onPopupVisibleChanged: { + if (!menuItem.__popupVisible && menuBarLoader.openedMenuIndex === index) + menuBarLoader.openedMenuIndex = -1 + } + } + + Connections { + target: menuItem.__action + onTriggered: menuBarLoader.openedMenuIndex = menuItemIndex + } + + Component.onCompleted: { + menuItem.__visualItem = menuItemLoader + + var title = menuItem.title + var ampersandPos = title.indexOf("&") + if (ampersandPos !== -1) + menuBarLoader.mnemonicsMap[title[ampersandPos + 1].toUpperCase()] = menuItem.__action + } + } + } + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/AbstractCheckable.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/AbstractCheckable.qml new file mode 100644 index 00000000000..858569e8f52 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/AbstractCheckable.qml @@ -0,0 +1,149 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 + +/*! + \qmltype AbstractCheckable + \inqmlmodule QtQuick.Controls + \ingroup controls + \brief An abstract representation of a checkable control with a label + \qmlabstract + \internal + + A checkable control is one that has two states: checked (on) and + unchecked (off). AbstractCheckable encapsulates the basic behavior and + states that are required by checkable controls. + + Examples of checkable controls are RadioButton and + CheckBox. CheckBox extends AbstractCheckable's behavior by adding a third + state: partially checked. +*/ + +Control { + id: abstractCheckable + + /*! + Emitted whenever the control is clicked. + */ + signal clicked + + /*! + \qmlproperty bool AbstractCheckable::pressed + + This property is \c true if the control is being pressed. + Set this property to manually invoke a mouse click. + */ + property alias pressed: mouseArea.effectivePressed + + /*! \qmlproperty bool AbstractCheckcable::hovered + + This property indicates whether the control is being hovered. + */ + readonly property alias hovered: mouseArea.containsMouse + + /*! + This property is \c true if the control is checked. + */ + property bool checked: false + + /*! + This property is \c true if the control takes the focus when it is + pressed; \l{QQuickItem::forceActiveFocus()}{forceActiveFocus()} will be + called on the control. + */ + property bool activeFocusOnPress: false + + /*! + This property stores the ExclusiveGroup that the control belongs to. + */ + property ExclusiveGroup exclusiveGroup: null + + /*! + This property holds the text that the label should display. + */ + property string text + + /*! \internal */ + property var __cycleStatesHandler: cycleRadioButtonStates + + activeFocusOnTab: true + + MouseArea { + id: mouseArea + focus: true + anchors.fill: parent + hoverEnabled: true + enabled: !keyPressed + + property bool keyPressed: false + property bool effectivePressed: pressed && containsMouse || keyPressed + + onClicked: abstractCheckable.clicked(); + + onPressed: if (activeFocusOnPress) forceActiveFocus(); + + onReleased: { + if (containsMouse && (!exclusiveGroup || !checked)) + __cycleStatesHandler(); + } + } + + /*! \internal */ + onExclusiveGroupChanged: { + if (exclusiveGroup) + exclusiveGroup.bindCheckable(abstractCheckable) + } + + Keys.onPressed: { + if (event.key === Qt.Key_Space && !event.isAutoRepeat && !mouseArea.pressed) + mouseArea.keyPressed = true; + } + + Keys.onReleased: { + if (event.key === Qt.Key_Space && !event.isAutoRepeat && mouseArea.keyPressed) { + mouseArea.keyPressed = false; + if (!exclusiveGroup || !checked) + __cycleStatesHandler(); + clicked(); + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/BasicButton.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/BasicButton.qml new file mode 100644 index 00000000000..4c1eeb042c1 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/BasicButton.qml @@ -0,0 +1,233 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.1 + +/*! + \qmltype BasicButton + \internal + \qmlabstract + \inqmlmodule QtQuick.Controls.Private +*/ + +Control { + id: button + + /*! This signal is emitted when the button is clicked. */ + signal clicked + + /*! \qmlproperty bool BasicButton::pressed + + This property holds whether the button is being pressed. */ + readonly property alias pressed: button.__effectivePressed + + /*! \qmlproperty bool BasicButton::hovered + + This property indicates whether the control is being hovered. + */ + readonly property alias hovered: behavior.containsMouse + + /*! This property holds whether the button is checkable. + + The default value is \c false. */ + property bool checkable: false + + /*! This property holds whether the button is checked. + + Only checkable buttons can be checked. + + The default value is \c false. */ + property bool checked: false + + /*! This property holds the ExclusiveGroup that the button belongs to. + + The default value is \c null. */ + property ExclusiveGroup exclusiveGroup: null + + /*! This property holds the associated button action. + + If a button has an action associated, the action defines the + button's properties like checked, text, tooltip etc. + + When an action is set, it's still possible to override the \l text, + \l tooltip, \l iconSource, and \l iconName properties. + + The default value is \c null. */ + property Action action: null + + /*! This property specifies whether the button should gain active focus when pressed. + + The default value is \c false. */ + property bool activeFocusOnPress: false + + /*! This property holds the text shown on the button. If the button has no + text, the \l text property will be an empty string. + + The default value is the empty string. + */ + property string text: action ? action.text : "" + + /*! This property holds the button tooltip. */ + property string tooltip: action ? (action.tooltip || StyleHelpers.removeMnemonics(action.text)) : "" + + /*! This property holds the icon shown on the button. If the button has no + icon, the iconSource property will be an empty string. + + The default value is the empty string. + */ + property url iconSource: action ? action.iconSource : "" + + /*! The image label source as theme name. + When an icon from the platform icon theme is found, this takes + precedence over iconSource. + */ + property string iconName: action ? action.iconName : "" + + /*! \internal */ + property color __textColor: syspal.text + /*! \internal */ + property string __position: "only" + /*! \internal */ + readonly property bool __iconOverriden: button.action && (button.action.iconSource !== button.iconSource || button.action.iconName !== button.iconName) + /*! \internal */ + property Action __action: action || ownAction + /*! \internal */ + readonly property Action __iconAction: __iconOverriden ? ownAction : __action + + /*! \internal */ + onExclusiveGroupChanged: { + if (exclusiveGroup) + exclusiveGroup.bindCheckable(button) + } + + Accessible.role: Accessible.Button + Accessible.description: tooltip + + /*! \internal */ + function accessiblePressAction() { + __action.trigger(button) + } + + Action { + id: ownAction + iconSource: !button.action || __iconOverriden ? button.iconSource : "" + iconName: !button.action || __iconOverriden ? button.iconName : "" + } + + Connections { + target: __action + onTriggered: button.clicked() + } + + activeFocusOnTab: true + + Keys.onPressed: { + if (event.key === Qt.Key_Space && !event.isAutoRepeat && !behavior.pressed) + behavior.keyPressed = true; + } + + onFocusChanged: if (!focus) behavior.keyPressed = false + + Keys.onReleased: { + if (event.key === Qt.Key_Space && !event.isAutoRepeat && behavior.keyPressed) { + behavior.keyPressed = false; + __action.trigger(button) + behavior.toggle() + } + } + + MouseArea { + id: behavior + property bool keyPressed: false + property bool effectivePressed: pressed && containsMouse || keyPressed + + anchors.fill: parent + hoverEnabled: true + enabled: !keyPressed + + function toggle() { + if (button.checkable && !button.action && !(button.checked && button.exclusiveGroup)) + button.checked = !button.checked + } + + onReleased: { + if (containsMouse) { + toggle() + __action.trigger(button) + } + } + onExited: Tooltip.hideText() + onCanceled: Tooltip.hideText() + onPressed: { + if (activeFocusOnPress) + button.forceActiveFocus() + } + + Timer { + interval: 1000 + running: behavior.containsMouse && !pressed && tooltip.length + onTriggered: Tooltip.showText(behavior, Qt.point(behavior.mouseX, behavior.mouseY), tooltip) + } + } + + /*! \internal */ + property var __behavior: behavior + + /*! \internal */ + property bool __effectivePressed: behavior.effectivePressed + + SystemPalette { id: syspal } + + states: [ + State { + name: "boundAction" + when: action !== null + PropertyChanges { + target: button + enabled: action.enabled + checkable: action.checkable + checked: action.checked + } + } + ] +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ColumnMenuContent.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ColumnMenuContent.qml new file mode 100644 index 00000000000..bb21dcb9ce9 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ColumnMenuContent.qml @@ -0,0 +1,160 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 + +Item { + id: content + + property Component menuItemDelegate + property Component scrollerStyle + property var itemsModel + property int minWidth: 100 + property real maxHeight: 800 + property int margin: 1 + + signal triggered(var item) + + function menuItemAt(index) { + list.currentIndex = index + return list.currentItem + } + + width: Math.max(list.contentWidth, minWidth) + height: Math.min(list.contentHeight, fittedMaxHeight) + 2 * margin + + readonly property int currentIndex: menu.__currentIndex + property Item currentItem: null + readonly property int itemHeight: (list.count > 0 && list.contentItem.children[0]) ? list.contentItem.children[0].height : 23 + readonly property int fittingItems: Math.floor((maxHeight - downScroller.height) / itemHeight) + readonly property real fittedMaxHeight: itemHeight * fittingItems + downScroller.height + readonly property bool shouldUseScrollers: scrollView.__style.useScrollers && itemsModel.length > fittingItems + readonly property real upScrollerHeight: upScroller.visible ? upScroller.height : 0 + readonly property real downScrollerHeight: downScroller.visible ? downScroller.height : 0 + + function updateCurrentItem(mouse) { + var pos = mapToItem(list.contentItem, mouse.x, mouse.y) + if (!currentItem || !currentItem.contains(Qt.point(pos.x - currentItem.x, pos.y - currentItem.y))) { + if (currentItem && !hoverArea.pressed && currentItem.isSubmenu) + currentItem.closeSubMenu() + currentItem = list.itemAt(pos.x, pos.y) + if (currentItem) { + menu.__currentIndex = currentItem.menuItemIndex + if (currentItem.isSubmenu && !currentItem.menuItem.__popupVisible) + currentItem.showSubMenu(false) + } else { + menu.__currentIndex = -1 + } + } + } + + ScrollView { + id: scrollView + anchors { + fill: parent + topMargin: content.margin + upScrollerHeight + bottomMargin: downScrollerHeight - content.margin - 1 + rightMargin: -1 + } + + style: scrollerStyle + __wheelAreaScrollSpeed: itemHeight + + ListView { + id: list + model: itemsModel + delegate: menuItemDelegate + snapMode: ListView.SnapToItem + boundsBehavior: Flickable.StopAtBounds + highlightFollowsCurrentItem: true + highlightMoveDuration: 0 + } + } + + MouseArea { + id: hoverArea + anchors.left: scrollView.left + width: scrollView.width - scrollView.__verticalScrollBar.width + height: parent.height + + hoverEnabled: true + acceptedButtons: Qt.AllButtons + + onPositionChanged: updateCurrentItem(mouse) + onReleased: content.triggered(currentItem) + onExited: { + if (currentItem && !currentItem.menuItem.__popupVisible) { + currentItem = null + menu.__currentIndex = -1 + } + } + + MenuContentScroller { + id: upScroller + direction: "up" + visible: shouldUseScrollers && !list.atYBeginning + x: margin + function scrollABit() { list.contentY -= itemHeight } + } + + MenuContentScroller { + id: downScroller + direction: "down" + visible: shouldUseScrollers && !list.atYEnd + x: margin + function scrollABit() { list.contentY += itemHeight } + } + } + + Timer { + interval: 1 + running: true + repeat: false + onTriggered: list.positionViewAtIndex(currentIndex, scrollView.__style.useScrollers + ? ListView.Center : ListView.Beginning) + } + + Binding { + target: scrollView.__verticalScrollBar + property: "singleStep" + value: itemHeight + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/Control.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/Control.qml new file mode 100644 index 00000000000..0ce8908fb05 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/Control.qml @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls.Styles 1.1 + +/*! + \qmltype Control + \internal + \qmlabstract + \inqmlmodule QtQuick.Controls.Private +*/ +FocusScope { + id: root + + /*! \qmlproperty Component Control::style + + The style Component for this control. + \sa {Qt Quick Controls Styles QML Types} + + */ + property Component style + + /*! \internal */ + property QtObject __style: styleLoader.item + + /*! \internal */ + property Item __panel: panelLoader.item + + /*! \internal */ + property var styleHints + + implicitWidth: __panel ? __panel.implicitWidth: 0 + implicitHeight: __panel ? __panel.implicitHeight: 0 + baselineOffset: __panel ? __panel.baselineOffset: 0 + activeFocusOnTab: false + + /*! \internal */ + property alias __styleData: styleLoader.styleData + + Loader { + id: panelLoader + anchors.fill: parent + sourceComponent: __style ? __style.panel : null + onStatusChanged: if (status === Loader.Error) console.error("Failed to load Style for", root) + Loader { + id: styleLoader + sourceComponent: style + property Item __control: root + property QtObject styleData: null + onStatusChanged: { + if (status === Loader.Error) + console.error("Failed to load Style for", root) + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/FastGlow.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/FastGlow.qml new file mode 100644 index 00000000000..f4bd2c74219 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/FastGlow.qml @@ -0,0 +1,393 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant source + property real spread: 0.0 + property real blur: 0.0 + property color color: "white" + property bool transparentBorder: false + property bool cached: false + + SourceProxy { + id: sourceProxy + input: rootItem.source + } + + ShaderEffectSource { + id: cacheItem + anchors.fill: shaderItem + visible: rootItem.cached + smooth: true + sourceItem: shaderItem + live: true + hideSource: visible + } + + property string __internalBlurVertexShader: " + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + uniform highp mat4 qt_Matrix; + uniform highp float yStep; + uniform highp float xStep; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + qt_TexCoord0 = vec2(qt_MultiTexCoord0.x + xStep, qt_MultiTexCoord0.y + yStep * 0.36); + qt_TexCoord1 = vec2(qt_MultiTexCoord0.x + xStep * 0.36, qt_MultiTexCoord0.y - yStep); + qt_TexCoord2 = vec2(qt_MultiTexCoord0.x - xStep * 0.36, qt_MultiTexCoord0.y + yStep); + qt_TexCoord3 = vec2(qt_MultiTexCoord0.x - xStep, qt_MultiTexCoord0.y - yStep * 0.36); + gl_Position = qt_Matrix * qt_Vertex; + } + " + + property string __internalBlurFragmentShader: " + uniform lowp sampler2D source; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + varying highp vec2 qt_TexCoord1; + varying highp vec2 qt_TexCoord2; + varying highp vec2 qt_TexCoord3; + + void main() { + highp vec4 sourceColor = (texture2D(source, qt_TexCoord0) + + texture2D(source, qt_TexCoord1) + + texture2D(source, qt_TexCoord2) + + texture2D(source, qt_TexCoord3)) * 0.25; + gl_FragColor = sourceColor * qt_Opacity; + } + " + + ShaderEffect { + id: level0 + property variant source: sourceProxy.output + anchors.fill: parent + visible: false + smooth: true + } + + ShaderEffectSource { + id: level1 + width: Math.ceil(shaderItem.width / 32) * 32 + height: Math.ceil(shaderItem.height / 32) * 32 + sourceItem: level0 + hideSource: rootItem.visible + sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0,0,0,0) + smooth: true + visible: false + } + + ShaderEffect { + id: effect1 + property variant source: level1 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level2 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level2 + width: level1.width / 2 + height: level1.height / 2 + sourceItem: effect1 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect2 + property variant source: level2 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level3 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level3 + width: level2.width / 2 + height: level2.height / 2 + sourceItem: effect2 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect3 + property variant source: level3 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level4 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level4 + width: level3.width / 2 + height: level3.height / 2 + sourceItem: effect3 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect4 + property variant source: level4 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level5 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level5 + width: level4.width / 2 + height: level4.height / 2 + sourceItem: effect4 + hideSource: rootItem.visible + visible: false + smooth: true + } + + ShaderEffect { + id: effect5 + property variant source: level5 + property real yStep: 1/height + property real xStep: 1/width + anchors.fill: level6 + visible: false + smooth: true + vertexShader: __internalBlurVertexShader + fragmentShader: __internalBlurFragmentShader + } + + ShaderEffectSource { + id: level6 + width: level5.width / 2 + height: level5.height / 2 + sourceItem: effect5 + hideSource: rootItem.visible + visible: false + smooth: true + } + + Item { + id: dummysource + width: 1 + height: 1 + visible: false + } + + ShaderEffectSource { + id: dummy + width: 1 + height: 1 + sourceItem: dummysource + visible: false + smooth: false + live: false + } + + ShaderEffect { + id: shaderItem + x: transparentBorder ? -64 : 0 + y: transparentBorder ? -64 : 0 + width: transparentBorder ? parent.width + 128 : parent.width + height: transparentBorder ? parent.height + 128 : parent.height + + property variant source1: level1 + property variant source2: level2 + property variant source3: level3 + property variant source4: level4 + property variant source5: level5 + property variant source6: level6 + property real lod: rootItem.blur + + property real weight1; + property real weight2; + property real weight3; + property real weight4; + property real weight5; + property real weight6; + + property real spread: 1.0 - (rootItem.spread * 0.98) + property alias color: rootItem.color + + function weight(v) { + if (v <= 0.0) + return 1 + if (v >= 0.5) + return 0 + + return 1.0 - v / 0.5 + } + + function calculateWeights() { + + var w1 = weight(Math.abs(lod - 0.100)) + var w2 = weight(Math.abs(lod - 0.300)) + var w3 = weight(Math.abs(lod - 0.500)) + var w4 = weight(Math.abs(lod - 0.700)) + var w5 = weight(Math.abs(lod - 0.900)) + var w6 = weight(Math.abs(lod - 1.100)) + + var sum = w1 + w2 + w3 + w4 + w5 + w6; + weight1 = w1 / sum; + weight2 = w2 / sum; + weight3 = w3 / sum; + weight4 = w4 / sum; + weight5 = w5 / sum; + weight6 = w6 / sum; + + upateSources() + } + + function upateSources() { + var sources = new Array(); + var weights = new Array(); + + if (weight1 > 0) { + sources.push(level1) + weights.push(weight1) + } + + if (weight2 > 0) { + sources.push(level2) + weights.push(weight2) + } + + if (weight3 > 0) { + sources.push(level3) + weights.push(weight3) + } + + if (weight4 > 0) { + sources.push(level4) + weights.push(weight4) + } + + if (weight5 > 0) { + sources.push(level5) + weights.push(weight5) + } + + if (weight6 > 0) { + sources.push(level6) + weights.push(weight6) + } + + for (var j = sources.length; j < 6; j++) { + sources.push(dummy) + weights.push(0.0) + } + + source1 = sources[0] + source2 = sources[1] + source3 = sources[2] + source4 = sources[3] + source5 = sources[4] + source6 = sources[5] + + weight1 = weights[0] + weight2 = weights[1] + weight3 = weights[2] + weight4 = weights[3] + weight5 = weights[4] + weight6 = weights[5] + } + + Component.onCompleted: calculateWeights() + + onLodChanged: calculateWeights() + + fragmentShader: " + uniform lowp sampler2D source1; + uniform lowp sampler2D source2; + uniform lowp sampler2D source3; + uniform lowp sampler2D source4; + uniform lowp sampler2D source5; + uniform mediump float weight1; + uniform mediump float weight2; + uniform mediump float weight3; + uniform mediump float weight4; + uniform mediump float weight5; + uniform highp vec4 color; + uniform highp float spread; + uniform lowp float qt_Opacity; + varying mediump vec2 qt_TexCoord0; + + highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); + } + + void main() { + lowp vec4 sourceColor = texture2D(source1, qt_TexCoord0) * weight1; + sourceColor += texture2D(source2, qt_TexCoord0) * weight2; + sourceColor += texture2D(source3, qt_TexCoord0) * weight3; + sourceColor += texture2D(source4, qt_TexCoord0) * weight4; + sourceColor += texture2D(source5, qt_TexCoord0) * weight5; + sourceColor = mix(vec4(0), color, linearstep(0.0, spread, sourceColor.a)); + gl_FragColor = sourceColor * qt_Opacity; + } + " + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/FocusFrame.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/FocusFrame.qml new file mode 100644 index 00000000000..449d06b1a68 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/FocusFrame.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype FocusFrame + \internal + \inqmlmodule QtQuick.Controls.Private +*/ +Item { + id: root + activeFocusOnTab: false + Accessible.role: Accessible.StatusBar + + anchors.topMargin: focusMargin + anchors.leftMargin: focusMargin + anchors.rightMargin: focusMargin + anchors.bottomMargin: focusMargin + + property int focusMargin: loader.item ? loader.item.margin : -3 + + Loader { + id: loader + z: 2 + anchors.fill: parent + sourceComponent: Qt.createComponent(Settings.style + "/FocusFrameStyle.qml", root) + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/MenuContentItem.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/MenuContentItem.qml new file mode 100644 index 00000000000..7056b4e1f08 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/MenuContentItem.qml @@ -0,0 +1,234 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 + +Loader { + id: menuFrameLoader + + readonly property Style __style: styleLoader.item + readonly property Component menuItemStyle: __style ? __style.menuItem : null + + property var menu: root + property alias contentWidth: content.width + property alias contentHeight: content.height + + readonly property int subMenuXPos: width + (item && item["subMenuOverlap"] || 0) + + visible: status === Loader.Ready + sourceComponent: __style ? __style.frame : undefined + + Loader { + id: styleLoader + active: !menu.isNative + sourceComponent: menu.style + property alias __control: menuFrameLoader + onStatusChanged: { + if (status === Loader.Error) + console.error("Failed to load Style for", menu) + } + } + + focus: true + property var mnemonicsMap: ({}) + + Keys.onPressed: { + var item = null + if (!(event.modifiers & Qt.AltModifier) + && (item = mnemonicsMap[event.text.toUpperCase()])) { + if (item.isSubmenu) { + menu.__currentIndex = item.menuItemIndex + item.showSubMenu(true) + item.menuItem.__currentIndex = 0 + } else { + triggerAndDismiss(item) + } + event.accepted = true + } else { + event.accepted = false + } + } + + Keys.onEscapePressed: menu.__dismissMenu() + + Keys.onDownPressed: { + if (menu.__currentIndex < 0) + menu.__currentIndex = -1 + + for (var i = menu.__currentIndex + 1; + i < menu.items.length && !canBeHovered(i); i++) + ; + event.accepted = true + } + + Keys.onUpPressed: { + for (var i = menu.__currentIndex - 1; + i >= 0 && !canBeHovered(i); i--) + ; + event.accepted = true + } + + function canBeHovered(index) { + var item = content.menuItemAt(index) + if (item && !item["isSeparator"] && item.enabled) { + menu.__currentIndex = index + return true + } + return false + } + + Keys.onLeftPressed: { + if ((event.accepted = menu.__parentMenu.hasOwnProperty("title"))) + __closeMenu() + } + + Keys.onRightPressed: { + var item = content.menuItemAt(menu.__currentIndex) + if ((event.accepted = (item && item.isSubmenu))) { + item.showSubMenu(true) + item.menuItem.__currentIndex = 0 + } + } + + Keys.onSpacePressed: triggerCurrent() + Keys.onReturnPressed: triggerCurrent() + Keys.onEnterPressed: triggerCurrent() + + function triggerCurrent() { + var item = content.menuItemAt(menu.__currentIndex) + if (item) + content.triggered(item) + } + + function triggerAndDismiss(item) { + if (item && !item.isSeparator) { + menu.__dismissMenu() + if (!item.isSubmenu) + item.menuItem.trigger() + } + } + + Binding { + // Make sure the styled frame is in the background + target: item + property: "z" + value: content.z - 1 + } + + ColumnMenuContent { + id: content + menuItemDelegate: menuItemComponent + scrollerStyle: __style ? __style.scrollerStyle : undefined + itemsModel: menu.items + margin: menuFrameLoader.item ? menuFrameLoader.item.margin : 0 + minWidth: menu.__minimumWidth + maxHeight: menuFrameLoader.item ? menuFrameLoader.item.maxHeight : 0 + onTriggered: triggerAndDismiss(item) + } + + Component { + id: menuItemComponent + Loader { + id: menuItemLoader + + property var menuItem: modelData + readonly property bool isSeparator: !!menuItem && menuItem.type === MenuItemType.Separator + readonly property bool isSubmenu: !!menuItem && menuItem.type === MenuItemType.Menu + property bool selected: !(isSeparator || !!scrollerDirection) && menu.__currentIndex === index + property string text: isSubmenu ? menuItem.title : !(isSeparator || !!scrollerDirection) ? menuItem.text : "" + property bool showUnderlined: menu.__contentItem.altPressed + readonly property var scrollerDirection: menuItem["scrollerDirection"] + + property int menuItemIndex: index + + sourceComponent: menuFrameLoader.menuItemStyle + enabled: visible && !isSeparator && !!menuItem && menuItem.enabled + visible: !!menuItem && menuItem.visible + active: visible + + function showSubMenu(immediately) { + if (immediately) { + if (menu.__currentIndex === menuItemIndex) + menuItem.__popup(menuFrameLoader.subMenuXPos, 0, -1) + } else { + openMenuTimer.start() + } + } + + Timer { + id: openMenuTimer + interval: 50 + onTriggered: menuItemLoader.showSubMenu(true) + } + + function closeSubMenu() { closeMenuTimer.start() } + + Timer { + id: closeMenuTimer + interval: 1 + onTriggered: { + if (menu.__currentIndex !== menuItemIndex) + menuItem.__closeMenu() + } + } + + onLoaded: { + menuItem.__visualItem = menuItemLoader + + if (content.width < item.implicitWidth) + content.width = item.implicitWidth + + var title = text + var ampersandPos = title.indexOf("&") + if (ampersandPos !== -1) + menuFrameLoader.mnemonicsMap[title[ampersandPos + 1].toUpperCase()] = menuItemLoader + } + + Binding { + target: menuItemLoader.item + property: "width" + property alias menuItem: menuItemLoader.item + value: menuItem ? Math.max(menu.__minimumWidth, content.width) - 2 * menuItem.x : 0 + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/MenuContentScroller.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/MenuContentScroller.qml new file mode 100644 index 00000000000..30a8825af2a --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/MenuContentScroller.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 + +MouseArea { + property string direction + + anchors { + top: direction === "up" ? parent.top : undefined + bottom: direction === "down" ? parent.bottom : undefined + } + + hoverEnabled: visible + height: scrollerLoader.item.height + width: parent.width + + Loader { + id: scrollerLoader + + sourceComponent: menuItemDelegate + property int index: -1 + property var modelData: { + "visible": true, + "scrollerDirection": direction, + "enabled": true + } + } + + Timer { + interval: 100 + repeat: true + triggeredOnStart: true + running: parent.containsMouse + onTriggered: scrollABit() + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ModalPopupBehavior.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ModalPopupBehavior.qml new file mode 100644 index 00000000000..8b78cb31b39 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ModalPopupBehavior.qml @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 + +// KNOWN ISSUES +// none + +/*! + \qmltype ModalPopupBehavior + \internal + \inqmlmodule QtQuick.Controls.Private +*/ +Item { + id: popupBehavior + + property bool showing: false + property bool whenAlso: true // modifier to the "showing" property + property bool consumeCancelClick: true + property int delay: 0 // delay before popout becomes visible + property int deallocationDelay: 3000 // 3 seconds + + property Component popupComponent + + property alias popup: popupLoader.item // read-only + property alias window: popupBehavior.root // read-only + + signal prepareToShow + signal prepareToHide + signal cancelledByClick + + // implementation + + anchors.fill: parent + + onShowingChanged: notifyChange() + onWhenAlsoChanged: notifyChange() + function notifyChange() { + if(showing && whenAlso) { + if(popupLoader.sourceComponent == undefined) { + popupLoader.sourceComponent = popupComponent; + } + } else { + mouseArea.enabled = false; // disable before opacity is changed in case it has fading behavior + if(Qt.isQtObject(popupLoader.item)) { + popupBehavior.prepareToHide(); + popupLoader.item.opacity = 0; + } + } + } + + property Item root: findRoot() + function findRoot() { + var p = parent; + while(p.parent != undefined) + p = p.parent; + + return p; + } + + MouseArea { + id: mouseArea + anchors.fill: parent + enabled: false // enabled only when popout is showing + onPressed: { + popupBehavior.showing = false; + mouse.accepted = consumeCancelClick; + cancelledByClick(); + } + } + + Loader { + id: popupLoader + } + + Timer { // visibility timer + running: Qt.isQtObject(popupLoader.item) && showing && whenAlso + interval: delay + onTriggered: { + popupBehavior.prepareToShow(); + mouseArea.enabled = true; + popup.opacity = 1; + } + } + + Timer { // deallocation timer + running: Qt.isQtObject(popupLoader.item) && popupLoader.item.opacity == 0 + interval: deallocationDelay + onTriggered: popupLoader.sourceComponent = undefined + } + + states: State { + name: "active" + when: Qt.isQtObject(popupLoader.item) && popupLoader.item.opacity > 0 + ParentChange { target: popupBehavior; parent: root } + } + } + diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ScrollBar.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ScrollBar.qml new file mode 100644 index 00000000000..65ed51cfcee --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ScrollBar.qml @@ -0,0 +1,234 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ScrollBar + \internal + \inqmlmodule QtQuick.Controls.Private +*/ +Item { + id: scrollbar + + property bool isTransient: false + property bool active: false + property int orientation: Qt.Horizontal + property alias minimumValue: slider.minimumValue + property alias maximumValue: slider.maximumValue + property alias value: slider.value + property int singleStep: 20 + + activeFocusOnTab: false + + Accessible.role: Accessible.ScrollBar + implicitWidth: panelLoader.implicitWidth + implicitHeight: panelLoader.implicitHeight + + property bool upPressed + property bool downPressed + property bool pageUpPressed + property bool pageDownPressed + property bool handlePressed + + + property Item __panel: panelLoader.item + Loader { + id: panelLoader + anchors.fill: parent + sourceComponent: __style ? __style.__scrollbar : null + onStatusChanged: if (status === Loader.Error) console.error("Failed to load Style for", root) + property alias __control: scrollbar + property QtObject __styleData: QtObject { + readonly property alias horizontal: internal.horizontal + readonly property alias upPressed: scrollbar.upPressed + readonly property alias downPressed: scrollbar.downPressed + readonly property alias handlePressed: scrollbar.handlePressed + } + } + + MouseArea { + id: internal + property bool horizontal: orientation === Qt.Horizontal + property int pageStep: internal.horizontal ? width : height + property bool scrollToClickposition: internal.scrollToClickPosition + anchors.fill: parent + cursorShape: __panel.visible ? Qt.ArrowCursor : Qt.IBeamCursor // forces a cursor change + + property bool autoincrement: false + property bool scrollToClickPosition: __style ? __style.scrollToClickedPosition : 0 + + // Update hover item + onEntered: if (!pressed) __panel.activeControl = __panel.hitTest(mouseX, mouseY) + onExited: if (!pressed) __panel.activeControl = "none" + onMouseXChanged: if (!pressed) __panel.activeControl = __panel.hitTest(mouseX, mouseY) + hoverEnabled: true + + property var pressedX + property var pressedY + property int oldPosition + property int grooveSize + + Timer { + running: upPressed || downPressed || pageUpPressed || pageDownPressed + interval: 350 + onTriggered: internal.autoincrement = true + } + + Timer { + running: internal.autoincrement + interval: 60 + repeat: true + onTriggered: { + if (upPressed && internal.containsMouse) + internal.decrement(); + else if (downPressed && internal.containsMouse) + internal.increment(); + else if (pageUpPressed) + internal.decrementPage(); + else if (pageDownPressed) + internal.incrementPage(); + } + } + + onPositionChanged: { + if (handlePressed) { + if (!horizontal) + slider.position = oldPosition + (mouseY - pressedY) + else + slider.position = oldPosition + (mouseX - pressedX) + } + } + + onPressed: { + __panel.activeControl = __panel.hitTest(mouseX, mouseY) + scrollToClickposition = scrollToClickPosition + var handleRect = __panel.subControlRect("handle") + var grooveRect = __panel.subControlRect("groove") + grooveSize = horizontal ? grooveRect.width - handleRect.width: + grooveRect.height - handleRect.height; + if (__panel.activeControl === "handle") { + pressedX = mouseX; + pressedY = mouseY; + handlePressed = true; + oldPosition = slider.position; + } else if (__panel.activeControl === "up") { + decrement(); + upPressed = Qt.binding(function() {return containsMouse}); + } else if (__panel.activeControl === "down") { + increment(); + downPressed = Qt.binding(function() {return containsMouse}); + } else if (!scrollToClickposition){ + if (__panel.activeControl === "upPage") { + decrementPage(); + pageUpPressed = true; + } else if (__panel.activeControl === "downPage") { + incrementPage(); + pageDownPressed = true; + } + } else { // scroll to click position + slider.position = horizontal ? mouseX - handleRect.width/2 - grooveRect.x + : mouseY - handleRect.height/2 - grooveRect.y + pressedX = mouseX; + pressedY = mouseY; + handlePressed = true; + oldPosition = slider.position; + } + } + + onReleased: { + __panel.activeControl = __panel.hitTest(mouseX, mouseY); + autoincrement = false; + upPressed = false; + downPressed = false; + handlePressed = false; + pageUpPressed = false; + pageDownPressed = false; + } + + onWheel: { + var stepCount = -(wheel.angleDelta.x ? wheel.angleDelta.x : wheel.angleDelta.y) / 120 + if (stepCount != 0) { + if (wheel.modifiers & Qt.ControlModifier || wheel.modifiers & Qt.ShiftModifier) + incrementPage(stepCount) + else + increment(stepCount) + } + } + + function incrementPage(stepCount) { + value = boundValue(value + getSteps(pageStep, stepCount)) + } + + function decrementPage(stepCount) { + value = boundValue(value - getSteps(pageStep, stepCount)) + } + + function increment(stepCount) { + value = boundValue(value + getSteps(singleStep, stepCount)) + } + + function decrement(stepCount) { + value = boundValue(value - getSteps(singleStep, stepCount)) + } + + function boundValue(val) { + return Math.min(Math.max(val, minimumValue), maximumValue) + } + + function getSteps(step, count) { + if (count) + step *= count + return step + } + + RangeModel { + id: slider + minimumValue: 0.0 + maximumValue: 1.0 + value: 0 + stepSize: 0.0 + inverted: false + positionAtMaximum: internal.grooveSize + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ScrollViewHelper.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ScrollViewHelper.qml new file mode 100644 index 00000000000..3f1166f3e87 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/ScrollViewHelper.qml @@ -0,0 +1,216 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ScrollViewHeader + \internal + \inqmlmodule QtQuick.Controls.Private +*/ +Item { + id: wheelarea + + property alias horizontalScrollBar: hscrollbar + property alias verticalScrollBar: vscrollbar + property bool blockUpdates: false + property int availableHeight + property int availableWidth + property int contentHeight + property int contentWidth + property real originX + property real originY + property bool active + + property int leftMargin: outerFrame ? root.__style.padding.left : 0 + property int rightMargin: outerFrame ? root.__style.padding.right : 0 + property int topMargin: outerFrame ? root.__style.padding.top : 0 + property int bottomMargin: outerFrame ? root.__style.padding.bottom : 0 + + anchors.fill: parent + + property bool recursionGuard: false + + function doLayout() { + if (!recursionGuard) { + recursionGuard = true + wheelarea.availableWidth = viewport.width + wheelarea.availableHeight = viewport.height + wheelarea.contentWidth = flickableItem !== null ? flickableItem.contentWidth : 0 + wheelarea.contentHeight = flickableItem !== null ? flickableItem.contentHeight : 0 + wheelarea.originX = flickableItem !== null ? flickableItem.originX : 0 + wheelarea.originY = flickableItem !== null ? flickableItem.originY : 0 + recursionGuard = false + } + } + + Connections { + target: viewport + onWidthChanged: doLayout() + onHeightChanged: doLayout() + } + + Connections { + target: flickableItem + onContentWidthChanged: doLayout() + onContentHeightChanged: doLayout() + } + + Connections { + target: flickableItem + onContentXChanged: { + hscrollbar.flash() + vscrollbar.flash() + } + onContentYChanged: { + hscrollbar.flash() + vscrollbar.flash() + } + } + + Loader { + id: cornerFill + z: 1 + sourceComponent: __style.corner + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.bottomMargin: bottomMargin + anchors.rightMargin: rightMargin + width: visible ? vscrollbar.width : 0 + height: visible ? hscrollbar.height : 0 + visible: hscrollbar.visible && !hscrollbar.isTransient && vscrollbar.visible && !vscrollbar.isTransient + } + + ScrollBar { + id: hscrollbar + isTransient: !!__panel && !!__panel.isTransient + active: !!__panel && (__panel.sunken || __panel.activeControl !== "none") + enabled: !isTransient || __panel.visible + orientation: Qt.Horizontal + visible: contentWidth > availableWidth + height: visible ? implicitHeight : 0 + z: 1 + maximumValue: contentWidth > availableWidth ? originX + contentWidth - availableWidth : 0 + minimumValue: originX + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: cornerFill.left + anchors.leftMargin: leftMargin + anchors.bottomMargin: bottomMargin + onValueChanged: { + if (!blockUpdates) { + flickableItem.contentX = value + } + } + Binding { + target: hscrollbar.__panel + property: "raised" + value: vscrollbar.active || wheelarea.active + when: hscrollbar.isTransient + } + Binding { + target: hscrollbar.__panel + property: "visible" + value: true + when: !hscrollbar.isTransient || wheelarea.active + } + function flash() { + if (hscrollbar.isTransient) { + hscrollbar.__panel.on = true + hscrollbar.__panel.visible = true + hFlasher.start() + } + } + Timer { + id: hFlasher + interval: 10 + onTriggered: hscrollbar.__panel.on = false + } + } + + ScrollBar { + id: vscrollbar + isTransient: !!__panel && !!__panel.isTransient + active: !!__panel && (__panel.sunken || __panel.activeControl !== "none") + enabled: !isTransient || __panel.visible + orientation: Qt.Vertical + visible: contentHeight > availableHeight + width: visible ? implicitWidth : 0 + z: 1 + anchors.bottom: cornerFill.top + maximumValue: contentHeight > availableHeight ? originY + contentHeight - availableHeight + __viewTopMargin : 0 + minimumValue: originY + anchors.right: parent.right + anchors.top: parent.top + anchors.topMargin: __scrollBarTopMargin + topMargin + anchors.rightMargin: rightMargin + onValueChanged: { + if (flickableItem && !blockUpdates && enabled) { + flickableItem.contentY = value + } + } + Binding { + target: vscrollbar.__panel + property: "raised" + value: hscrollbar.active || wheelarea.active + when: vscrollbar.isTransient + } + Binding { + target: vscrollbar.__panel + property: "visible" + value: true + when: !vscrollbar.isTransient || wheelarea.active + } + function flash() { + if (vscrollbar.isTransient) { + vscrollbar.__panel.on = true + vscrollbar.__panel.visible = true + vFlasher.start() + } + } + Timer { + id: vFlasher + interval: 10 + onTriggered: vscrollbar.__panel.on = false + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/SourceProxy.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/SourceProxy.qml new file mode 100644 index 00000000000..1cf03f313e0 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/SourceProxy.qml @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Graphical Effects module. +** +** $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 Digia Plc and its Subsidiary(-ies) 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.0 + +Item { + id: rootItem + property variant input + property variant output + property variant sourceRect + visible: false + + Component.onCompleted: evaluateInput() + + onInputChanged: evaluateInput() + + onSourceRectChanged: evaluateInput() + + function evaluateInput() { + if (input == undefined) { + output = input + } + else if (sourceRect != undefined && sourceRect != Qt.rect(0, 0, 0, 0) && !isQQuickShaderEffectSource(input)) { + proxySource.sourceItem = input + output = proxySource + proxySource.sourceRect = sourceRect + } + else if (isQQuickItemLayerEnabled(input)) { + output = input + } + else if ((isQQuickImage(input) && !hasTileMode(input) && !hasChildren(input))) { + output = input + } + else if (isQQuickShaderEffectSource(input)) { + output = input + } + else { + proxySource.sourceItem = input + output = proxySource + proxySource.sourceRect = Qt.rect(0, 0, 0, 0) + } + } + + function isQQuickItemLayerEnabled(item) { + if (item.hasOwnProperty("layer")) { + var l = item["layer"] + if (l.hasOwnProperty("enabled") && l["enabled"].toString() == "true") + return true + } + return false + } + + function isQQuickImage(item) { + var imageProperties = [ "fillMode", "progress", "asynchronous", "sourceSize", "status", "smooth" ] + return hasProperties(item, imageProperties) + } + + function isQQuickShaderEffectSource(item) { + var shaderEffectSourceProperties = [ "hideSource", "format", "sourceItem", "mipmap", "wrapMode", "live", "recursive", "sourceRect" ] + return hasProperties(item, shaderEffectSourceProperties) + } + + function hasProperties(item, properties) { + var counter = 0 + for (var j = 0; j < properties.length; j++) { + if (item.hasOwnProperty(properties [j])) + counter++ + } + return properties.length == counter + } + + function hasChildren(item) { + if (item.hasOwnProperty("childrenRect")) { + if (item["childrenRect"].toString() != "QRectF(0, 0, 0, 0)") + return true + else + return false + } + return false + } + + function hasTileMode(item) { + if (item.hasOwnProperty("fillMode")) { + if (item["fillMode"].toString() != "0") + return true + else + return false + } + return false + } + + ShaderEffectSource { + id: proxySource + live: rootItem.input != rootItem.output + hideSource: false + smooth: true + visible: false + } +} + diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/StackView.js b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/StackView.js new file mode 100644 index 00000000000..fa9bb08e8c3 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/StackView.js @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +var stackView = []; + +function push(p) +{ + if (!p) + return + stackView.push(p) + __depth++ + return p +} + +function pop() +{ + if (stackView.length === 0) + return null + var p = stackView.pop() + __depth-- + return p +} + +function current() +{ + if (stackView.length === 0) + return null + return stackView[stackView.length-1] +} + diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/StackViewSlideDelegate.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/StackViewSlideDelegate.qml new file mode 100644 index 00000000000..88530e696c2 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/StackViewSlideDelegate.qml @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 + +/*! + \qmltype StackViewSlideTransition + \internal + \inqmlmodule QtQuick.Controls.Private +*/ +StackViewDelegate { + id: root + + property bool horizontal: true + + function getTransition(properties) + { + return root[horizontal ? "horizontalSlide" : "verticalSlide"][properties.name] + } + + function transitionFinished(properties) + { + properties.exitItem.x = 0 + properties.exitItem.y = 0 + } + + property QtObject horizontalSlide: QtObject { + property Component pushTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "x" + from: target.width + to: 0 + duration: 300 + } + PropertyAnimation { + target: exitItem + property: "x" + from: 0 + to: -target.width + duration: 300 + } + } + + property Component popTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "x" + from: -target.width + to: 0 + duration: 300 + } + PropertyAnimation { + target: exitItem + property: "x" + from: 0 + to: target.width + duration: 300 + } + } + property Component replaceTransition: pushTransition + } + + property QtObject verticalSlide: QtObject { + property Component pushTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "y" + from: target.height + to: 0 + duration: 300 + } + PropertyAnimation { + target: exitItem + property: "y" + from: 0 + to: -target.height + duration: 300 + } + } + + property Component popTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "y" + from: -target.height + to: 0 + duration: 300 + } + PropertyAnimation { + target: exitItem + property: "y" + from: 0 + to: target.height + duration: 300 + } + property Component replaceTransition: pushTransition + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/Style.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/Style.qml new file mode 100644 index 00000000000..ed31536dd7f --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/Style.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype Style + \internal + \inqmlmodule QtQuick.Controls.Private +*/ + +AbstractStyle { + /*! The control attached to this style */ + readonly property Item control: __control + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TabBar.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TabBar.qml new file mode 100644 index 00000000000..2e374f994e5 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TabBar.qml @@ -0,0 +1,308 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 + +/*! + \qmltype TabBar + \internal + \inqmlmodule QtQuick.Controls.Private +*/ +FocusScope { + id: tabbar + height: Math.max(tabrow.height, Math.max(leftCorner.height, rightCorner.height)) + width: tabView.width + + activeFocusOnTab: true + + Keys.onRightPressed: { + if (tabView && tabView.currentIndex < tabView.count - 1) + tabView.currentIndex = tabView.currentIndex + 1 + } + Keys.onLeftPressed: { + if (tabView && tabView.currentIndex > 0) + tabView.currentIndex = tabView.currentIndex - 1 + } + + onTabViewChanged: parent = tabView + visible: tabView ? tabView.tabsVisible : true + + property var tabView + property var style + property var styleItem: tabView.__styleItem ? tabView.__styleItem : null + + property bool tabsMovable: styleItem ? styleItem.tabsMovable : false + + property int tabsAlignment: styleItem ? styleItem.tabsAlignment : Qt.AlignLeft + + property int tabOverlap: styleItem ? styleItem.tabOverlap : 0 + + property int elide: Text.ElideRight + + property real availableWidth: tabbar.width - leftCorner.width - rightCorner.width + + property var __selectedTabRect + + function tab(index) { + for (var i = 0; i < tabrow.children.length; ++i) { + if (tabrow.children[i].tabindex == index) { + return tabrow.children[i] + } + } + return null; + } + + /*! \internal */ + function __isAncestorOf(item, child) { + //TODO: maybe removed from 5.2 if the function was merged in qtdeclarative + if (child === item) + return false; + + while (child) { + child = child.parent; + if (child === item) + return true; + } + return false; + } + Loader { + id: background + anchors.fill: parent + sourceComponent: styleItem ? styleItem.tabBar : undefined + } + + ListView { + id: tabrow + objectName: "tabrow" + Accessible.role: Accessible.PageTabList + LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft + spacing: -tabOverlap + orientation: Qt.Horizontal + interactive: false + focus: true + + // Note this will silence the binding loop warnings caused by QTBUG-35038 + // and should be removed when this issue is resolved. + property int contentWidthWorkaround: contentWidth > 0 ? contentWidth: 0 + width: Math.min(availableWidth, count ? contentWidthWorkaround : availableWidth) + height: currentItem ? currentItem.height : 0 + + highlightMoveDuration: 0 + currentIndex: tabView.currentIndex + onCurrentIndexChanged: tabrow.positionViewAtIndex(currentIndex, ListView.Contain) + + moveDisplaced: Transition { + NumberAnimation { + property: "x" + duration: 125 + easing.type: Easing.OutQuad + } + } + + states: [ + State { + name: "left" + when: tabsAlignment === Qt.AlignLeft + AnchorChanges { target:tabrow ; anchors.left: parent.left } + PropertyChanges { target:tabrow ; anchors.leftMargin: leftCorner.width } + }, + State { + name: "center" + when: tabsAlignment === Qt.AlignHCenter + AnchorChanges { target:tabrow ; anchors.horizontalCenter: tabbar.horizontalCenter } + }, + State { + name: "right" + when: tabsAlignment === Qt.AlignRight + AnchorChanges { target:tabrow ; anchors.right: parent.right } + PropertyChanges { target:tabrow ; anchors.rightMargin: rightCorner.width } + } + ] + + model: tabView.__tabs + + delegate: MouseArea { + id: tabitem + objectName: "mousearea" + hoverEnabled: true + focus: true + + Binding { + target: tabbar + when: selected + property: "__selectedTabRect" + value: Qt.rect(x, y, width, height) + } + + drag.target: tabsMovable ? tabloader : null + drag.axis: Drag.XAxis + drag.minimumX: drag.active ? 0 : -Number.MAX_VALUE + drag.maximumX: tabrow.width - tabitem.width + + property int tabindex: index + property bool selected : tabView.currentIndex === index + property string title: modelData.title + property bool nextSelected: tabView.currentIndex === index + 1 + property bool previousSelected: tabView.currentIndex === index - 1 + + z: selected ? 1 : -index + implicitWidth: tabloader.implicitWidth + implicitHeight: tabloader.implicitHeight + + function changeTab() { + tabView.currentIndex = index; + var next = tabbar.nextItemInFocusChain(true); + if (__isAncestorOf(tabView.getTab(currentIndex), next)) + next.forceActiveFocus(); + } + + onClicked: { + if (tabrow.interactive) { + changeTab() + } + } + onPressed: { + if (!tabrow.interactive) { + changeTab() + } + } + + Loader { + id: tabloader + + property Item control: tabView + property int index: tabindex + + property QtObject styleData: QtObject { + readonly property alias index: tabitem.tabindex + readonly property alias selected: tabitem.selected + readonly property alias title: tabitem.title + readonly property alias nextSelected: tabitem.nextSelected + readonly property alias previsousSelected: tabitem.previousSelected + readonly property alias hovered: tabitem.containsMouse + readonly property bool activeFocus: tabbar.activeFocus + readonly property real availableWidth: tabbar.availableWidth + } + + sourceComponent: loader.item ? loader.item.tab : null + + Drag.keys: "application/x-tabbartab" + Drag.active: tabitem.drag.active + Drag.source: tabitem + + property real __prevX: 0 + property real __dragX: 0 + onXChanged: { + if (Drag.active) { + // keep track for the snap back animation + __dragX = tabitem.mapFromItem(tabrow, tabloader.x, 0).x + + // when moving to the left, the hot spot is the left edge and vice versa + Drag.hotSpot.x = x < __prevX ? 0 : width + __prevX = x + } + } + + width: tabitem.width + state: Drag.active ? "drag" : "" + + transitions: [ + Transition { + to: "drag" + PropertyAction { target: tabloader; property: "parent"; value: tabrow } + }, + Transition { + from: "drag" + SequentialAnimation { + PropertyAction { target: tabloader; property: "parent"; value: tabitem } + NumberAnimation { + target: tabloader + duration: 50 + easing.type: Easing.OutQuad + property: "x" + from: tabloader.__dragX + to: 0 + } + } + } + ] + } + + Accessible.role: Accessible.PageTab + Accessible.name: modelData.title + } + } + + Loader { + id: leftCorner + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + sourceComponent: styleItem ? styleItem.leftCorner : undefined + width: item ? item.implicitWidth : 0 + height: item ? item.implicitHeight : 0 + } + + Loader { + id: rightCorner + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + sourceComponent: styleItem ? styleItem.rightCorner : undefined + width: item ? item.implicitWidth : 0 + height: item ? item.implicitHeight : 0 + } + + DropArea { + anchors.fill: tabrow + keys: "application/x-tabbartab" + onPositionChanged: { + var source = drag.source + var target = tabrow.itemAt(drag.x, drag.y) + if (source && target && source !== target) { + source = source.drag.target + target = target.drag.target + var center = target.parent.x + target.width / 2 + if ((source.index > target.index && source.x < center) + || (source.index < target.index && source.x + source.width > center)) + tabView.moveTab(source.index, target.index) + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TableViewSelection.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TableViewSelection.qml new file mode 100644 index 00000000000..181c19e7792 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TableViewSelection.qml @@ -0,0 +1,197 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 + +QtObject { + + property int count: 0 + signal selectionChanged + + property bool __dirty: false + property var __ranges: new Array() + + function forEach (callback) { + if (!(callback instanceof Function)) { + console.warn("TableViewSelection.forEach: argument is not a function") + return; + } + __forEach(callback, -1) + } + + function contains(index) { + for (var i = 0 ; i < __ranges.length ; ++i) { + if (__ranges[i][0] <= index && index <= __ranges[i][1]) + return true; + else if (__ranges[i][0] > index) + return false; + } + return false; + } + + function clear() { + __ranges = new Array() + __dirty = true + count = 0 + selectionChanged() + } + + function selectAll() { select(0, rowCount - 1) } + function select(first, last) { __select(true, first, last) } + function deselect(first, last) { __select(false, first, last) } + + // --- private section --- + + function __printRanges() { + var out = "" + for (var i = 0 ; i < __ranges.length ; ++ i) + out += ("{" + __ranges[i][0] + "," + __ranges[i][1] + "} ") + print(out) + } + + function __count() { + var sum = 0 + for (var i = 0 ; i < __ranges.length ; ++i) { + sum += (1 + __ranges[i][1] - __ranges[i][0]) + } + return sum + } + + function __forEach (callback, startIndex) { + __dirty = false + var i, j + + for (i = 0 ; i < __ranges.length && !__dirty ; ++i) { + for (j = __ranges[i][0] ; !__dirty && j <= __ranges[i][1] ; ++j) { + if (j >= startIndex) + callback.call(this, j) + } + } + + // Restart iteration at last index if selection changed + if (__dirty) + return __forEach(callback, j) + } + + function __selectOne(index) { + __ranges = [[index, index]] + __dirty = true + count = 1 + selectionChanged(); + } + + function __select(select, first, last) { + + var i, range + var start = first + var stop = first + var startRangeIndex = -1 + var stopRangeIndex = -1 + var newRangePos = 0 + + if (first < 0 || last < 0 || first >= rowCount || last >=rowCount) { + console.warn("TableViewSelection: index out of range") + return + } + + if (last !== undefined) { + start = first <= last ? first : last + stop = first <= last ? last : first + } + + if (select) { + + // Find beginning and end ranges + for (i = 0 ; i < __ranges.length; ++ i) { + range = __ranges[i] + if (range[0] > stop + 1) continue; // above range + if (range[1] < start - 1) { // below range + newRangePos = i + 1 + continue; + } + if (startRangeIndex == -1) + startRangeIndex = i + stopRangeIndex = i + } + + if (startRangeIndex !== -1) + start = Math.min(__ranges[startRangeIndex][0], start) + if (stopRangeIndex !== -1) + stop = Math.max(__ranges[stopRangeIndex][1], stop) + + if (startRangeIndex == -1) + startRangeIndex = newRangePos + + __ranges.splice(Math.max(0, startRangeIndex), + 1 + stopRangeIndex - startRangeIndex, [start, stop]) + + } else { + + // Find beginning and end ranges + for (i = 0 ; i < __ranges.length; ++ i) { + range = __ranges[i] + if (range[1] < start) continue; // below range + if (range[0] > stop) continue; // above range + if (startRangeIndex == -1) + startRangeIndex = i + stopRangeIndex = i + } + + // Slice ranges accordingly + if (startRangeIndex >= 0 && stopRangeIndex >= 0) { + var startRange = __ranges[startRangeIndex] + var stopRange = __ranges[stopRangeIndex] + var length = 1 + stopRangeIndex - startRangeIndex + if (start <= startRange[0] && stop >= stopRange[1]) { //remove + __ranges.splice(startRangeIndex, length) + } else if (start - 1 < startRange[0] && stop <= stopRange[1]) { //cut front + __ranges.splice(startRangeIndex, length, [stop + 1, stopRange[1]]) + } else if (start - 1 < startRange[1] && stop >= stopRange[1]) { // cut back + __ranges.splice(startRangeIndex, length, [startRange[0], start - 1]) + } else { //split + __ranges.splice(startRangeIndex, length, [startRange[0], start - 1], [stop + 1, stopRange[1]]) + } + } + } + __dirty = true + count = __count() // forces a re-evaluation of indexes in the delegates + selectionChanged() + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TextSingleton.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TextSingleton.qml new file mode 100644 index 00000000000..7a3f07cdd15 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/TextSingleton.qml @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +pragma Singleton +import QtQuick 2.1 +Text {} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/qmldir b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/qmldir new file mode 100644 index 00000000000..3513878067d --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/qmldir @@ -0,0 +1,22 @@ +module QtQuick.Controls.Private +AbstractCheckable 1.0 AbstractCheckable.qml +Control 1.0 Control.qml +FocusFrame 1.0 FocusFrame.qml +Margins 1.0 Margins.qml +BasicButton 1.0 BasicButton.qml +ScrollBar 1.0 ScrollBar.qml +ScrollViewHelper 1.0 ScrollViewHelper.qml +Style 1.0 Style.qml +TabBar 1.0 TabBar.qml +StackViewSlideDelegate 1.0 StackViewSlideDelegate.qml +StyleHelpers 1.0 style.js +JSArray 1.0 StackView.js +TableViewSelection 1.0 TableViewSelection.qml +FastGlow 1.0 FastGlow.qml +SourceProxy 1.0 SourceProxy.qml +GroupBoxStyle 1.0 ../Styles/Base/GroupBoxStyle.qml +ToolButtonStyle 1.0 ../Styles/Base/ToolButtonStyle.qml +MenuContentItem 1.0 MenuContentItem.qml +MenuContentScroller 1.0 MenuContentScroller.qml +ColumnMenuContent 1.0 ColumnMenuContent.qml +singleton TextSingleton 1.0 TextSingleton.qml diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/style.js b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/style.js new file mode 100644 index 00000000000..2c47ff0e72a --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Private/style.js @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +.pragma library + +function underlineAmpersands(match, p1, p2, p3) { + if (p2 === "&") + return p1.concat(p2, p3) + return p1.concat("", p2, "", p3) +} + +function removeAmpersands(match, p1, p2, p3) { + return p1.concat(p2, p3) +} + +function replaceAmpersands(text, replaceFunction) { + return text.replace(/([^&]*)&(.)([^&]*)/g, replaceFunction) +} + +function stylizeMnemonics(text) { + return replaceAmpersands(text, underlineAmpersands) +} + +function removeMnemonics(text) { + return replaceAmpersands(text, removeAmpersands) +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ProgressBar.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ProgressBar.qml new file mode 100644 index 00000000000..523f3978e0b --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ProgressBar.qml @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ProgressBar + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief A progress indicator. + + The ProgressBar is used to give an indication of the progress of an operation. + \l value is updated regularly and must be between \l minimumValue and \l maximumValue. + + You can create a custom appearance for a ProgressBar by + assigning a \l {QtQuick.Controls.Styles::ProgressBarStyle}{ProgressBarStyle}. +*/ + +Control { + id: progressbar + + /*! This property holds the progress bar's current value. + Attempting to change the current value to one outside the minimum-maximum + range has no effect on the current value. + + The default value is \c{0}. + */ + property real value: 0 + + /*! This property is the progress bar's minimum value. + The \l value is clamped to this value. + The default value is \c{0}. + */ + property real minimumValue: 0 + + /*! This property is the progress bar's maximum value. + The \l value is clamped to this value. + If maximumValue is smaller than \l minimumValue, \l minimumValue will be enforced. + The default value is \c{1}. + */ + property real maximumValue: 1 + + /*! This property toggles indeterminate mode. + When the actual progress is unknown, use this option. + The progress bar will be animated as a busy indicator instead. + The default value is \c false. + */ + property bool indeterminate: false + + /*! \qmlproperty enumeration orientation + + This property holds the orientation of the progress bar. + + \list + \li Qt.Horizontal - Horizontal orientation. (Default) + \li Qt.Vertical - Vertical orientation. + \endlist + */ + property int orientation: Qt.Horizontal + + /*! \qmlproperty bool ProgressBar::hovered + + This property indicates whether the control is being hovered. + */ + readonly property alias hovered: hoverArea.containsMouse + + /*! \internal */ + style: Qt.createComponent(Settings.style + "/ProgressBarStyle.qml", progressbar) + + /*! \internal */ + property bool __initialized: false + /*! \internal */ + onMaximumValueChanged: setValue(value) + /*! \internal */ + onMinimumValueChanged: setValue(value) + /*! \internal */ + onValueChanged: if (__initialized) setValue(value) + /*! \internal */ + Component.onCompleted: { + __initialized = true; + setValue(value) + } + + activeFocusOnTab: false + + Accessible.role: Accessible.ProgressBar + Accessible.name: value + + implicitWidth:(__panel ? __panel.implicitWidth : 0) + implicitHeight: (__panel ? __panel.implicitHeight: 0) + + MouseArea { + id: hoverArea + anchors.fill: parent + hoverEnabled: true + } + + /*! \internal */ + function setValue(v) { + var newval = parseFloat(v) + if (!isNaN(newval)) { + // we give minimumValue priority over maximum if they are inconsistent + if (newval > maximumValue) { + if (maximumValue >= minimumValue) + newval = maximumValue; + else + newval = minimumValue + } else if (v < minimumValue) { + newval = minimumValue + } + if (value !== newval) + value = newval + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/RadioButton.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/RadioButton.qml new file mode 100644 index 00000000000..5ab7f68cb9a --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/RadioButton.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype RadioButton + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief A radio button with a text label. + + A RadioButton is an option button that can be switched on (checked) or off + (unchecked). Radio buttons typically present the user with a "one of many" + choice. In a group of radio buttons, only one radio button at a time can be + checked; if the user selects another button, the previously selected button + is switched off. + + \qml + GroupBox { + title: qsTr("Search") + Column { + ExclusiveGroup { id: group } + RadioButton { + text: qsTr("From top") + exclusiveGroup: group + checked: true + } + RadioButton { + text: qsTr("From cursor") + exclusiveGroup: group + } + } + } + \endqml + + You can create a custom appearance for a RadioButton by + assigning a \l {QtQuick.Controls.Styles::RadioButtonStyle}{RadioButtonStyle}. +*/ + +AbstractCheckable { + id: radioButton + + activeFocusOnTab: true + + Accessible.role: Accessible.RadioButton + + /*! + The style that should be applied to the radio button. Custom style + components can be created with: + + \codeline Qt.createComponent("path/to/style.qml", radioButtonId); + */ + style: Qt.createComponent(Settings.style + "/RadioButtonStyle.qml", radioButton) + + __cycleStatesHandler: function() { checked = !checked; } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ScrollView.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ScrollView.qml new file mode 100644 index 00000000000..6f1187ea50f --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ScrollView.qml @@ -0,0 +1,318 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.1 + +/*! + \qmltype ScrollView + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup views + \brief Provides a scrolling view within another Item. + + A ScrollView can be used either to replace a \l Flickable or decorate an + existing \l Flickable. Depending on the platform, it will add scroll bars and + a content frame. + + Only one Item can be a direct child of the ScrollView and the child is implicitly anchored + to fill the scroll view. + + Example: + \code + ScrollView { + Image { imageSource: "largeImage.png" } + } + \endcode + + In the previous example the Image item will implicitly get scroll behavior as if it was + used within a \l Flickable. The width and height of the child item will be used to + define the size of the content area. + + Example: + \code + ScrollView { + ListView { + ... + } + } + \endcode + + In this case the content size of the ScrollView will simply mirror that of its contained + \l flickableItem. + + You can create a custom appearance for a ScrollView by + assigning a \l {QtQuick.Controls.Styles::ScrollViewStyle}{ScrollViewStyle}. +*/ + +FocusScope { + id: root + + implicitWidth: 240 + implicitHeight: 150 + + /*! + This property tells the ScrollView if it should render + a frame around its content. + + The default value is \c false. + */ + property bool frameVisible: false + + /*! + This property controls if there should be a highlight + around the frame when the ScrollView has input focus. + + The default value is \c false. + + \note This property is only applicable on some platforms, such + as Mac OS. + */ + property bool highlightOnFocus: false + + /*! + \qmlproperty Item ScrollView::viewport + + The viewport determines the current "window" on the contentItem. + In other words, it clips it and the size of the viewport tells you + how much of the content area is visible. + */ + property alias viewport: viewportItem + + /*! + \qmlproperty Item ScrollView::flickableItem + + The flickableItem of the ScrollView. If the contentItem provided + to the ScrollView is a Flickable, it will be the \l contentItem. + */ + readonly property alias flickableItem: internal.flickableItem + + /*! + The contentItem of the ScrollView. This is set by the user. + + Note that the definition of contentItem is somewhat different to that + of a Flickable, where the contentItem is implicitly created. + */ + default property Item contentItem + + /*! \internal */ + property Item __scroller: scroller + /*! \internal */ + property alias __wheelAreaScrollSpeed: wheelArea.scrollSpeed + /*! \internal */ + property int __scrollBarTopMargin: 0 + /*! \internal */ + property int __viewTopMargin: 0 + /*! \internal */ + property alias __horizontalScrollBar: scroller.horizontalScrollBar + /*! \internal */ + property alias __verticalScrollBar: scroller.verticalScrollBar + /*! \qmlproperty Component ScrollView::style + + The style Component for this control. + \sa {Qt Quick Controls Styles QML Types} + + */ + property Component style: Qt.createComponent(Settings.style + "/ScrollViewStyle.qml", root) + + /*! \internal */ + property Style __style: styleLoader.item + + activeFocusOnTab: true + + onContentItemChanged: { + + if (contentItem.hasOwnProperty("contentY") && // Check if flickable + contentItem.hasOwnProperty("contentHeight")) { + internal.flickableItem = contentItem // "Use content if it is a flickable + internal.flickableItem.parent = viewportItem + } else { + internal.flickableItem = flickableComponent.createObject(viewportItem) + contentItem.parent = internal.flickableItem.contentItem + } + internal.flickableItem.anchors.fill = viewportItem + if (!Settings.hasTouchScreen) + internal.flickableItem.interactive = false + } + + + children: Item { + id: internal + + property Flickable flickableItem + + Loader { + id: styleLoader + sourceComponent: style + onStatusChanged: { + if (status === Loader.Error) + console.error("Failed to load Style for", root) + } + property alias __control: root + } + + Binding { + target: flickableItem + property: "contentHeight" + when: contentItem !== flickableItem + value: contentItem ? contentItem.height : 0 + } + + Binding { + target: flickableItem + when: contentItem !== flickableItem + property: "contentWidth" + value: contentItem ? contentItem.width : 0 + } + + Connections { + target: flickableItem + + onContentYChanged: { + scroller.blockUpdates = true + scroller.verticalScrollBar.value = flickableItem.contentY + scroller.blockUpdates = false + } + + onContentXChanged: { + scroller.blockUpdates = true + scroller.horizontalScrollBar.value = flickableItem.contentX + scroller.blockUpdates = false + } + + } + + anchors.fill: parent + + Component { + id: flickableComponent + Flickable {} + } + + WheelArea { + id: wheelArea + parent: flickableItem + + // ### Note this is needed due to broken mousewheel behavior in Flickable. + + anchors.fill: parent + + property int acceleration: 40 + property int flickThreshold: 20 + property real speedThreshold: 3 + property real ignored: 0.001 // ## flick() does not work with 0 yVelocity + property int maxFlick: 400 + + property bool horizontalRecursionGuard: false + property bool verticalRecursionGuard: false + + horizontalMinimumValue: flickableItem ? flickableItem.originX : 0 + horizontalMaximumValue: flickableItem ? flickableItem.originX + flickableItem.contentWidth - viewport.width : 0 + + verticalMinimumValue: flickableItem ? flickableItem.originY : 0 + verticalMaximumValue: flickableItem ? flickableItem.originY + flickableItem.contentHeight - viewport.height + __viewTopMargin : 0 + + Connections { + target: flickableItem + + onContentYChanged: { + wheelArea.verticalRecursionGuard = true + wheelArea.verticalValue = flickableItem.contentY + wheelArea.verticalRecursionGuard = false + } + onContentXChanged: { + wheelArea.horizontalRecursionGuard = true + wheelArea.horizontalValue = flickableItem.contentX + wheelArea.horizontalRecursionGuard = false + } + } + + onVerticalValueChanged: { + if (!verticalRecursionGuard) { + if (flickableItem.contentY < flickThreshold && verticalDelta > speedThreshold) { + flickableItem.flick(ignored, Math.min(maxFlick, acceleration * verticalDelta)) + } else if (flickableItem.contentY > flickableItem.contentHeight + - flickThreshold - viewport.height && verticalDelta < -speedThreshold) { + flickableItem.flick(ignored, Math.max(-maxFlick, acceleration * verticalDelta)) + } else { + flickableItem.contentY = verticalValue + } + } + } + + onHorizontalValueChanged: { + if (!horizontalRecursionGuard) + flickableItem.contentX = horizontalValue + } + } + + ScrollViewHelper { + id: scroller + anchors.fill: parent + active: wheelArea.active + property bool outerFrame: !frameVisible || !(__style ? __style.__externalScrollBars : 0) + property int scrollBarSpacing: outerFrame ? 0 : (__style ? __style.__scrollBarSpacing : 0) + property int verticalScrollbarOffset: verticalScrollBar.visible && !verticalScrollBar.isTransient ? + verticalScrollBar.width + scrollBarSpacing : 0 + property int horizontalScrollbarOffset: horizontalScrollBar.visible && !horizontalScrollBar.isTransient ? + horizontalScrollBar.height + scrollBarSpacing : 0 + Loader { + id: frameLoader + sourceComponent: __style ? __style.frame : null + anchors.fill: parent + anchors.rightMargin: scroller.outerFrame ? 0 : scroller.verticalScrollbarOffset + anchors.bottomMargin: scroller.outerFrame ? 0 : scroller.horizontalScrollbarOffset + } + + Item { + id: viewportItem + anchors.fill: frameLoader + anchors.topMargin: frameVisible ? __style.padding.top : 0 + anchors.leftMargin: frameVisible ? __style.padding.left : 0 + anchors.rightMargin: (frameVisible ? __style.padding.right : 0) + (scroller.outerFrame ? scroller.verticalScrollbarOffset : 0) + anchors.bottomMargin: (frameVisible ? __style.padding.bottom : 0) + (scroller.outerFrame ? scroller.horizontalScrollbarOffset : 0) + clip: true + } + } + FocusFrame { visible: highlightOnFocus && root.activeFocus } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Slider.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Slider.qml new file mode 100644 index 00000000000..d87bb526ae4 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Slider.qml @@ -0,0 +1,299 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype Slider + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief Provides a vertical or horizontal slider control. + + The slider is the classic control for providing a bounded value. It lets + the user move a slider handle along a horizontal or vertical groove + and translates the handle's position into a value within the legal range. + + \code + Slider { + onValueChanged: print(value) + } + \endcode + + The Slider value is by default in the range [0, 1]. If integer values are + needed, you can set the \l stepSize. + + You can create a custom appearance for a Slider by + assigning a \l {QtQuick.Controls.Styles::SliderStyle}{SliderStyle}. +*/ + +Control { + id: slider + + /*! + \qmlproperty enumeration Slider::orientation + + This property holds the layout orientation of the slider. + The default value is \c Qt.Horizontal. + */ + property int orientation: Qt.Horizontal + + /*! + \qmlproperty real Slider::minimumValue + + This property holds the minimum value of the Slider. + The default value is \c{0.0}. + */ + property alias minimumValue: range.minimumValue + + /*! + \qmlproperty real Slider::maximumValue + + This property holds the maximum value of the Slider + The default value is \c{1.0}. + */ + property alias maximumValue: range.maximumValue + + /*! + \qmlproperty bool Slider::updateValueWhileDragging + + This property indicates whether the current \l value should be updated while + the user is moving the slider handle, or only when the button has been released. + This property could for instance be modified if changing the slider value would turn + out to be too time consuming. + + The default value is \c true. + */ + property bool updateValueWhileDragging: true + + /*! + \qmlproperty bool Slider::pressed + + This property indicates whether the slider handle is being pressed. + */ + readonly property alias pressed: mouseArea.pressed + + /*! + \qmlproperty bool Slider::hovered + + This property indicates whether the control is being hovered. + */ + readonly property alias hovered: mouseArea.containsMouse + + /*! + \qmlproperty real Slider::stepSize + + This property indicates the slider step size. + + A value of 0 indicates that the value of the slider operates in a + continuous range between \l minimumValue and \l maximumValue. + + Any non 0 value indicates a discrete stepSize. The following example + will generate a slider with integer values in the range [0-5]. + + \qml + Slider { + maximumValue: 5.0 + stepSize: 1.0 + } + \endqml + + The default value is \c{0.0}. + */ + property alias stepSize: range.stepSize + + /*! + \qmlproperty real Slider::value + + This property holds the current value of the Slider. + The default value is \c{0.0}. + */ + property alias value: range.value + + /*! + \qmlproperty bool Slider::activeFocusOnPress + + This property indicates whether the Slider should receive active focus when + pressed. + */ + property bool activeFocusOnPress: false + + /*! + \qmlproperty bool Slider::tickmarksEnabled + + This property indicates whether the Slider should display tickmarks + at step intervals. Tick mark spacing is calculated based on the + \l stepSize property. + + The default value is \c false. + */ + property bool tickmarksEnabled: false + + /*! \internal */ + property bool __horizontal: orientation === Qt.Horizontal + + /*! \internal */ + property real __handlePos: range.valueForPosition(__horizontal ? fakeHandle.x : fakeHandle.y) + + activeFocusOnTab: true + + Accessible.role: Accessible.Slider + Accessible.name: value + + style: Qt.createComponent(Settings.style + "/SliderStyle.qml", slider) + + Keys.onRightPressed: value += (maximumValue - minimumValue)/10.0 + Keys.onLeftPressed: value -= (maximumValue - minimumValue)/10.0 + + RangeModel { + id: range + minimumValue: 0.0 + maximumValue: 1.0 + value: 0 + stepSize: 0.0 + inverted: __horizontal ? false : true + + positionAtMinimum: 0 + positionAtMaximum: __horizontal ? slider.width - fakeHandle.width : slider.height - fakeHandle.height + } + + Item { + id: fakeHandle + anchors.verticalCenter: __horizontal ? parent.verticalCenter : undefined + anchors.horizontalCenter: !__horizontal ? parent.horizontalCenter : undefined + width: __panel.handleWidth + height: __panel.handleHeight + + function updatePos() { + if (updateValueWhileDragging && !mouseArea.drag.active) + range.position = __horizontal ? x : y + } + + onXChanged: updatePos(); + onYChanged: updatePos(); + } + + MouseArea { + id: mouseArea + + hoverEnabled: true + anchors.centerIn: parent + + preventStealing: true + + width: parent.width + height: parent.height + + property int clickOffset: 0 + + function clamp ( val ) { + return Math.max(range.positionAtMinimum, Math.min(range.positionAtMaximum, val)) + } + + onMouseXChanged: { + if (pressed && __horizontal) { + var pos = clamp (mouse.x + clickOffset - fakeHandle.width/2) + fakeHandle.x = pos + } + } + + onMouseYChanged: { + if (pressed && !__horizontal) { + var pos = clamp (mouse.y + clickOffset- fakeHandle.height/2) + fakeHandle.y = pos + } + } + + onPressed: { + if (slider.activeFocusOnPress) + slider.forceActiveFocus(); + + var point = mouseArea.mapToItem(fakeHandle, mouse.x, mouse.y) + if (fakeHandle.contains(Qt.point(point.x, point.y))) { + clickOffset = __horizontal ? fakeHandle.width/2 - point.x : fakeHandle.height/2 - point.y + } + } + + onReleased: { + // If we don't update while dragging, this is the only + // moment that the range is updated. + if (!slider.updateValueWhileDragging) + range.position = __horizontal ? fakeHandle.x : fakeHandle.y; + clickOffset = 0 + } + } + + + // During the drag, we simply ignore the position set from the range, this + // means that setting a value while dragging will not "interrupt" the + // dragging activity. + Binding { + when: !mouseArea.drag.active + target: fakeHandle + property: __horizontal ? "x" : "y" + value: range.position + } + + WheelArea { + id: wheelarea + anchors.fill: parent + horizontalMinimumValue: slider.minimumValue + horizontalMaximumValue: slider.maximumValue + verticalMinimumValue: slider.minimumValue + verticalMaximumValue: slider.maximumValue + property real step: (slider.maximumValue - slider.minimumValue)/(range.positionAtMaximum - range.positionAtMinimum) + + onVerticalWheelMoved: { + if (verticalDelta !== 0) { + var delta = Math.abs(verticalDelta)*step > stepSize ? verticalDelta*step : verticalDelta/Math.abs(verticalDelta)*stepSize + value += delta + } + } + + onHorizontalWheelMoved: { + if (horizontalDelta !== 0) { + var delta = Math.abs(horizontalDelta)*step > stepSize ? horizontalDelta*step : horizontalDelta/Math.abs(horizontalDelta)*stepSize + value += delta + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/SpinBox.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/SpinBox.qml new file mode 100644 index 00000000000..c756566deca --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/SpinBox.qml @@ -0,0 +1,339 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.2 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype SpinBox + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief Provides a spin box control. + + SpinBox allows the user to choose a value by clicking the up or down buttons, or by + pressing up or down on the keyboard. The user can also type the value in manually. + + By default the SpinBox provides discrete values in the range [0-99] with a \l stepSize of 1 and 0 \l decimals. + + \code + SpinBox { + id: spinbox + } + \endcode + + Note that if you require decimal values you will need to set the \l decimals to a non 0 value. + + \code + SpinBox { + id: spinbox + decimals: 2 + } + \endcode + +*/ + +Control { + id: spinbox + + /*! + \qmlproperty real SpinBox::value + + The value of this SpinBox, clamped to \l minimumValue and \l maximumValue. + + The default value is \c{0.0}. + */ + property alias value: validator.value + + /*! + \qmlproperty real SpinBox::minimumValue + + The minimum value of the SpinBox range. + The \l value is clamped to this value. + + The default value is \c{0.0}. + */ + property alias minimumValue: validator.minimumValue + + /*! + \qmlproperty real SpinBox::maximumValue + + The maximum value of the SpinBox range. + The \l value is clamped to this value. If maximumValue is smaller than + \l minimumValue, \l minimumValue will be enforced. + + The default value is \c{99}. + */ + property alias maximumValue: validator.maximumValue + + /*! \qmlproperty real SpinBox::stepSize + The amount by which the \l value is incremented/decremented when a + spin button is pressed. + + The default value is \c{1.0}. + */ + property alias stepSize: validator.stepSize + + /*! \qmlproperty string SpinBox::suffix + The suffix for the value. I.e "cm" */ + property alias suffix: validator.suffix + + /*! \qmlproperty string SpinBox::prefix + The prefix for the value. I.e "$" */ + property alias prefix: validator.prefix + + /*! \qmlproperty int SpinBox::decimals + This property indicates the amount of decimals. + Note that if you enter more decimals than specified, they will + be truncated to the specified amount of decimal places. + The default value is \c{0}. + */ + property alias decimals: validator.decimals + + /*! \qmlproperty font SpinBox::font + + This property indicates the current font used by the SpinBox. + */ + property alias font: input.font + + /*! This property indicates whether the Spinbox should get active + focus when pressed. + The default value is \c true. + */ + property bool activeFocusOnPress: true + + /*! \qmlproperty enumeration horizontalAlignment + \since 5.2 + + This property indicates how the content is horizontally aligned + within the text field. + + The supported values are: + \list + \li Qt.AlignLeft + \li Qt.AlignHCenter + \li Qt.AlignRight + \endlist + + The default value is style dependent. + */ + property int horizontalAlignment: __panel ? __panel.horizontalAlignment : Qt.AlignLeft + + /*! + \qmlproperty bool SpinBox::hovered + + This property indicates whether the control is being hovered. + */ + readonly property alias hovered: mouseArea.containsMouse + + /*! + \qmlsignal SpinBox::editingFinished() + \since 5.2 + + This signal is emitted when the Return or Enter key is pressed or + the control loses focus. Note that if there is a validator + set on the control and enter/return is pressed, this signal will + only be emitted if the validator returns an acceptable state. + */ + signal editingFinished() + + style: Qt.createComponent(Settings.style + "/SpinBoxStyle.qml", spinbox) + + /*! \internal */ + function __increment() { + validator.increment() + input.selectValue() + } + + /*! \internal */ + function __decrement() { + validator.decrement() + input.selectValue() + } + + /*! \internal */ + property alias __text: input.text + + __styleData: QtObject { + readonly property bool upEnabled: value != maximumValue; + readonly property alias upHovered: mouseUp.containsMouse + readonly property alias upPressed: mouseUp.pressed + + readonly property bool downEnabled: value != minimumValue; + readonly property alias downPressed: mouseDown.pressed + readonly property alias downHovered: mouseDown.containsMouse + + readonly property int contentHeight: Math.max(input.implicitHeight, 16) + readonly property int contentWidth: Math.max(maxSizeHint.implicitWidth, minSizeHint.implicitWidth) + } + + Text { + id: maxSizeHint + text: prefix + maximumValue.toFixed(decimals) + suffix + font: input.font + visible: false + } + + Text { + id: minSizeHint + text: prefix + minimumValue.toFixed(decimals) + suffix + font: input.font + visible: false + } + + activeFocusOnTab: true + + onActiveFocusChanged: if (activeFocus) input.selectValue() + + Accessible.name: input.text + Accessible.role: Accessible.SpinBox + + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + onPressed: if (activeFocusOnPress) input.forceActiveFocus() + onWheel: { + if (wheel.angleDelta.y > 0) + __increment(); + else + __decrement(); + } + } + + TextInput { + id: input + clip: contentWidth > width + anchors.fill: parent + anchors.leftMargin: __style ? __style.padding.left : 0 + anchors.topMargin: __style ? __style.padding.top : 0 + anchors.rightMargin: __style ? __style.padding.right: 0 + anchors.bottomMargin: __style ? __style.padding.bottom: 0 + + focus: true + activeFocusOnPress: spinbox.activeFocusOnPress + + horizontalAlignment: spinbox.horizontalAlignment + verticalAlignment: __panel ? __panel.verticalAlignment : Qt.AlignVCenter + selectByMouse: true + + validator: SpinBoxValidator { + id: validator + property bool ready: false // Delay validation until all properties are ready + onTextChanged: if (ready) input.text = validator.text + Component.onCompleted: {input.text = validator.text ; ready = true} + } + onAccepted: { + input.text = validator.text + selectValue() + } + + onEditingFinished: spinbox.editingFinished() + + color: __panel ? __panel.foregroundColor : "black" + selectionColor: __panel ? __panel.selectionColor : "black" + selectedTextColor: __panel ? __panel.selectedTextColor : "black" + + opacity: parent.enabled ? 1 : 0.5 + renderType: __style ? __style.renderType : Text.NativeRendering + + function selectValue() { + select(prefix.length, text.length - suffix.length) + } + } + + // Spinbox increment button + + MouseArea { + id: mouseUp + objectName: "mouseUp" + hoverEnabled: true + + property var upRect: __panel ? __panel.upRect : null + + anchors.left: parent.left + anchors.top: parent.top + + anchors.leftMargin: upRect ? upRect.x : 0 + anchors.topMargin: upRect ? upRect.y : 0 + + width: upRect ? upRect.width : 0 + height: upRect ? upRect.height : 0 + + onClicked: __increment() + onPressed: if (activeFocusOnPress) input.forceActiveFocus() + + property bool autoincrement: false; + onReleased: autoincrement = false + Timer { running: mouseUp.pressed; interval: 350 ; onTriggered: mouseUp.autoincrement = true } + Timer { running: mouseUp.autoincrement; interval: 60 ; repeat: true ; onTriggered: __increment() } + } + + // Spinbox decrement button + + MouseArea { + id: mouseDown + objectName: "mouseDown" + hoverEnabled: true + + onClicked: __decrement() + onPressed: if (activeFocusOnPress) input.forceActiveFocus() + + property var downRect: __panel ? __panel.downRect : null + + anchors.left: parent.left + anchors.top: parent.top + + anchors.leftMargin: downRect ? downRect.x : 0 + anchors.topMargin: downRect ? downRect.y : 0 + + width: downRect ? downRect.width : 0 + height: downRect ? downRect.height : 0 + + property bool autoincrement: false; + onReleased: autoincrement = false + Timer { running: mouseDown.pressed; interval: 350 ; onTriggered: mouseDown.autoincrement = true } + Timer { running: mouseDown.autoincrement; interval: 60 ; repeat: true ; onTriggered: __decrement() } + } + + Keys.onUpPressed: __increment() + Keys.onDownPressed: __decrement() +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/SplitView.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/SplitView.qml new file mode 100644 index 00000000000..1f829a34689 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/SplitView.qml @@ -0,0 +1,504 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Layouts 1.0 +import QtQuick.Controls.Private 1.0 as Private + +/*! + \qmltype SplitView + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup views + \brief Lays out items with a draggable splitter between each item. + + SplitView is a control that lays out items horizontally or + vertically with a draggable splitter between each item. + + There will always be one (and only one) item in the SplitView that has \l{Layout::fillWidth}{Layout.fillWidth} + set to \c true (or \l{Layout::fillHeight}{Layout.fillHeight}, if orientation is Qt.Vertical). This means that the + item will get all leftover space when other items have been laid out. + By default, the last visible child of the SplitView will have this set, but + it can be changed by explicitly setting fillWidth to \c true on another item. + As the fillWidth item will automatically be resized to fit the extra space, explicit assignments + to width and height will be ignored (but \l{Layout::minimumWidth}{Layout.minimumWidth} and + \l{Layout::maximumWidth}{Layout.maximumWidth} will still be respected). + + A handle can belong to the item either on the left or top side, or on the right or bottom side: + \list + \li If the fillWidth item is to the right: the handle belongs to the left item. + \li if the fillWidth item is on the left: the handle belongs to the right item. + \endlist + + This will again control which item gets resized when the user drags a handle, + and which handle gets hidden when an item is told to hide. + + SplitView supports setting attached Layout properties on child items, which + means that you can set the following attached properties for each child: + \list + \li \l{Layout::minimumWidth}{Layout.minimumWidth} + \li \l{Layout::minimumHeight}{Layout.minimumHeight} + \li \l{Layout::maximumWidth}{Layout.maximumWidth} + \li \l{Layout::maximumHeight}{Layout.maximumHeight} + \li \l{Layout::fillWidth}{Layout.fillWidth} (\c true for only one child) + \li \l{Layout::fillHeight}{Layout.fillHeight} (\c true for only one child) + \endlist + + \note Please import QtQuick.Layout 1.0 in your QML file in order to use the Layout + attached properties inside SplitView. + + Example: + + To create a SplitView with three items, and let the center item get superfluous space, one + could do the following: + + \qml + SplitView { + anchors.fill: parent + orientation: Qt.Horizontal + + Rectangle { + width: 200 + Layout.maximumWidth: 400 + color: "gray" + } + Rectangle { + id: centerItem + Layout.minimumWidth: 50 + Layout.fillWidth: true + color: "darkgray" + } + Rectangle { + width: 200 + color: "gray" + } + } + \endqml +*/ + +Item { + id: root + + /*! + \qmlproperty enumeration SplitView::orientation + + This property holds the orientation of the SplitView. + The value can be either \c Qt.Horizontal or \c Qt.Vertical. + The default value is \c Qt.Horizontal. + */ + property int orientation: Qt.Horizontal + + /*! + This property holds the delegate that will be instantiated between each + child item. Inside the delegate the following properties are available: + + \table + \row \li readonly property bool styleData.index \li Specifies the index of the splitter handle. The handle + between the first and the second item will get index 0, + the next handle index 1 etc. + \row \li readonly property bool styleData.hovered \li The handle is being hovered. + \row \li readonly property bool styleData.pressed \li The handle is being pressed. + \row \li readonly property bool styleData.resizing \li The handle is being dragged. + \endtable + +*/ + property Component handleDelegate: Rectangle { + width: 1 + height: 1 + color: Qt.darker(pal.window, 1.5) + } + + /*! + This propery is \c true when the user is resizing any of the items by + dragging on the splitter handles. + */ + property bool resizing: false + + /*! \internal */ + default property alias __contents: contents.data + /*! \internal */ + property alias __items: splitterItems.children + /*! \internal */ + property alias __handles: splitterHandles.children + + clip: true + Component.onCompleted: d.init() + onWidthChanged: d.updateLayout() + onHeightChanged: d.updateLayout() + onOrientationChanged: d.changeOrientation() + + SystemPalette { id: pal } + + QtObject { + id: d + property bool horizontal: orientation == Qt.Horizontal + readonly property string minimum: horizontal ? "minimumWidth" : "minimumHeight" + readonly property string maximum: horizontal ? "maximumWidth" : "maximumHeight" + readonly property string otherMinimum: horizontal ? "minimumHeight" : "minimumWidth" + readonly property string otherMaximum: horizontal ? "maximumHeight" : "maximumWidth" + readonly property string offset: horizontal ? "x" : "y" + readonly property string otherOffset: horizontal ? "y" : "x" + readonly property string size: horizontal ? "width" : "height" + readonly property string otherSize: horizontal ? "height" : "width" + readonly property string implicitSize: horizontal ? "implicitWidth" : "implicitHeight" + readonly property string implicitOtherSize: horizontal ? "implicitHeight" : "implicitWidth" + + property int fillIndex: -1 + property bool updateLayoutGuard: true + + function init() + { + for (var i=0; i<__contents.length; ++i) { + var item = __contents[i]; + if (!item.hasOwnProperty("x")) + continue + + if (splitterItems.children.length > 0) + handleLoader.createObject(splitterHandles, {"__handleIndex":splitterItems.children.length - 1}) + item.parent = splitterItems + i-- // item was removed from list + + // should match disconnections in Component.onDestruction + item.widthChanged.connect(d.updateLayout) + item.heightChanged.connect(d.updateLayout) + item.Layout.maximumWidthChanged.connect(d.updateLayout) + item.Layout.minimumWidthChanged.connect(d.updateLayout) + item.Layout.maximumHeightChanged.connect(d.updateLayout) + item.Layout.minimumHeightChanged.connect(d.updateLayout) + item.visibleChanged.connect(d.updateFillIndex) + item.Layout.fillWidthChanged.connect(d.updateFillIndex) + item.Layout.fillHeightChanged.connect(d.updateFillIndex) + } + + d.calculateImplicitSize() + d.updateLayoutGuard = false + d.updateFillIndex() + } + + function updateFillIndex() + { + if (lastItem.visible !== root.visible) + return + var policy = (root.orientation === Qt.Horizontal) ? "fillWidth" : "fillHeight" + for (var i=0; i<__items.length-1; ++i) { + if (__items[i].Layout[policy] === true) + break; + } + + d.fillIndex = i + d.updateLayout() + } + + function changeOrientation() + { + if (__items.length == 0) + return; + d.updateLayoutGuard = true + + // Swap width/height for items and handles: + for (var i=0; i<__items.length; ++i) { + var item = __items[i] + var tmp = item.x + item.x = item.y + item.y = tmp + tmp = item.width + item.width = item.height + item.height = tmp + + var handle = __handles[i] + if (handle) { + tmp = handle.x + handle.x = handle.y + handle.y = handle.x + tmp = handle.width + handle.width = handle.height + handle.height = tmp + } + } + + // Change d.horizontal explicit, since the binding will change too late: + d.horizontal = orientation == Qt.Horizontal + d.updateLayoutGuard = false + d.updateFillIndex() + } + + function calculateImplicitSize() + { + var implicitSize = 0 + var implicitOtherSize = 0 + + for (var i=0; i<__items.length; ++i) { + var item = __items[i]; + implicitSize += clampedMinMax(item[d.size], item.Layout[minimum], item.Layout[maximum]) + var os = clampedMinMax(item[otherSize], item.Layout[otherMinimum], item.Layout[otherMaximum]) + implicitOtherSize = Math.max(implicitOtherSize, os) + + var handle = __handles[i] + if (handle) + implicitSize += handle[d.size] + } + + root[d.implicitSize] = implicitSize + root[d.implicitOtherSize] = implicitOtherSize + } + + function clampedMinMax(value, minimum, maximum) + { + if (value < minimum) + value = minimum + if (value > maximum) + value = maximum + return value + } + + function accumulatedSize(firstIndex, lastIndex, includeFillItemMinimum) + { + // Go through items and handles, and + // calculate their acummulated width. + var w = 0 + for (var i=firstIndex; i __handleIndex) + visible: __items[__handleIndex + (resizeLeftItem ? 0 : 1)].visible + sourceComponent: handleDelegate + onWidthChanged: d.updateLayout() + onHeightChanged: d.updateLayout() + onXChanged: moveHandle() + onYChanged: moveHandle() + + MouseArea { + id: mouseArea + anchors.fill: parent + anchors.leftMargin: (parent.width <= 1) ? -2 : 0 + anchors.rightMargin: (parent.width <= 1) ? -2 : 0 + anchors.topMargin: (parent.height <= 1) ? -2 : 0 + anchors.bottomMargin: (parent.height <= 1) ? -2 : 0 + hoverEnabled: true + drag.threshold: 0 + drag.target: parent + drag.axis: root.orientation === Qt.Horizontal ? Drag.XAxis : Drag.YAxis + cursorShape: root.orientation === Qt.Horizontal ? Qt.SplitHCursor : Qt.SplitVCursor + } + + function moveHandle() { + // Moving the handle means resizing an item. Which one, + // left or right, depends on where the fillItem is. + // 'updateLayout' will be overridden in case new width violates max/min. + // 'updateLayout' will be triggered when an item changes width. + if (d.updateLayoutGuard) + return + + var leftHandle, leftItem, rightItem, rightHandle + var leftEdge, rightEdge, newWidth, leftStopX, rightStopX + var i + + if (resizeLeftItem) { + // Ensure that the handle is not crossing other handles. So + // find the first visible handle to the left to determine the left edge: + leftEdge = 0 + for (i=__handleIndex-1; i>=0; --i) { + leftHandle = __handles[i] + if (leftHandle.visible) { + leftEdge = leftHandle[d.offset] + leftHandle[d.size] + break; + } + } + + // Ensure: leftStopX >= itemHandle[d.offset] >= rightStopX + var min = d.accumulatedSize(__handleIndex+1, __items.length, true) + rightStopX = root[d.size] - min - itemHandle[d.size] + leftStopX = Math.max(leftEdge, itemHandle[d.offset]) + itemHandle[d.offset] = Math.min(rightStopX, Math.max(leftStopX, itemHandle[d.offset])) + + newWidth = itemHandle[d.offset] - leftEdge + leftItem = __items[__handleIndex] + // The next line will trigger 'updateLayout': + leftItem[d.size] = newWidth + } else { + // Resize item to the right. + // Ensure that the handle is not crossing other handles. So + // find the first visible handle to the right to determine the right edge: + rightEdge = root[d.size] + for (i=__handleIndex+1; i<__handles.length; ++i) { + rightHandle = __handles[i] + if (rightHandle.visible) { + rightEdge = rightHandle[d.offset] + break; + } + } + + // Ensure: leftStopX <= itemHandle[d.offset] <= rightStopX + min = d.accumulatedSize(0, __handleIndex+1, true) + leftStopX = min - itemHandle[d.size] + rightStopX = Math.min((rightEdge - itemHandle[d.size]), itemHandle[d.offset]) + itemHandle[d.offset] = Math.max(leftStopX, Math.min(itemHandle[d.offset], rightStopX)) + + newWidth = rightEdge - (itemHandle[d.offset] + itemHandle[d.size]) + rightItem = __items[__handleIndex+1] + // The next line will trigger 'updateLayout': + rightItem[d.size] = newWidth + } + } + } + } + + Item { + id: contents + visible: false + anchors.fill: parent + } + Item { + id: splitterItems + anchors.fill: parent + } + Item { + id: splitterHandles + anchors.fill: parent + } + + Item { + id: lastItem + onVisibleChanged: d.updateFillIndex() + } + + Component.onDestruction: { + for (var i=0; i [A, B, C, D] - "push" transition animation between C and D + \li pop() => [A, B] - "pop" transition animation between C and B + \li \l{push()}{push(D, replace)} => [A, B, D] - "replace" transition between C and D + \li \l{pop()}{pop(A)} => [A] - "pop" transition between C and A + \endlist + + \note Note that when the stack is empty, a push() will not perform a + transition animation because there is nothing to transition from (typically during + application start-up). A pop() on a stack with depth 1 or 0 is a no-operation. + If removing all items from the stack is needed, a separate function clear() is + available. + + Calling push() returns the item that was pushed onto the stack. + Calling pop() returns the item that was popped off the stack. When pop() is + called in an unwind operation the top-most item (the first item that was + popped, which will also be the one transitioning out) is returned. + + \section1 Deep Linking + \e{Deep linking} means launching an application into a particular state. For example, + a newspaper application could be launched into showing a particular article, + bypassing the front item (and possibly a section item) that would normally have + to be navigated through to get to the article concerned. In terms of StackView, deep + linking means the ability to modify the state of the stack, so much so that it is + possible to push a set of items to the top of the stack, or to completely reset + the stack to a given state. + + The API for deep linking in StackView is the same as for basic navigation. Pushing + an array instead of a single item, will involve that all the items in that array will + be pushed onto the stack. The transition animation, however, will be conducted as + if only the last item in the array was pushed onto the stack. The normal semantics + of push() apply for deep linking, meaning that push() adds whatever is pushed onto + the stack. Note also that only the last item of the array will be loaded. + The rest will be lazy-loaded as needed when entering the screen upon subsequent + calls to pop (or when requesting the item by using \a get). + + This gives us the following result, given the stack [A, B, C]: + + \list + \li \l{push()}{push([D, E, F])} => [A, B, C, D, E, F] - "push" transition animation between C and F + \li \l{push()}{push([D, E, F], replace)} => [A, B, D, E, F] - "replace" transition animation between C and F + \li clear(); \l{push()}{push([D, E, F])} => [D, E, F] - no transition animation (since the stack was empty) + \endlist + + \section1 Pushing items + + An item pushed onto the StackView can be either an Item, a URL, a string + with a URL, or a Component. To push it, assign it to a property "item" + inside a property list, and send it as an argument to \l{StackView::push}{push}: + + \code + stackView.push({item: yourItem}) + \endcode + + The list can contain several properties that control how the item should be pushed: + \list + \li \c item: this property is required, and holds the item to be pushed. + \li \c properties: a list of QML properties to be assigned to the item upon push. These + properties will be copied into the item at load time, or when the item will become + the current item (normally upon push). + \li \c immediate: set this property to \c true to skip transition effects. When pushing + an array, this property only needs to be set on the first element to make the + whole operation immediate. + \li \c replace: set this property to replace the current item on the stack. When pushing + an array, you only need to set this property on the first element to replace + as many elements on the stack as inside the array. + \li \c destroyOnPop: set this boolean to true if StackView needs to destroy the item when + it is popped off the stack. By default (if \a destroyOnPop is not specified), StackView + will destroy items pushed as components or URLs. Items not destroyed will be re-parented + back to the original parents they had before being pushed onto the stack and hidden. + If you need to set this property, do it with care, so that items are not leaked. + \endlist + + If the only argument needed is "item", the following short-hand notation can be applied: + + \code + stackView.push(yourItem) + \endcode + + You can push several items in one go by using an array of property lists. This is + optimizing compared to pushing items one by one, since StackView then can load only the + last item in the list. The rest will be loaded as they are about to become + the current item (which happens when the stack is popped). The following example shows how + to push an array of items: + + \code + stackView.push([{item: yourItem1}, {item: yourItem2}]) + \endcode + + If an inline item is pushed, the item is temporarily re-parented into the StackView. When the item + is later popped off, it gets re-parented back to its original owner again. + If, however, an item is pushed as a component or a URL, the actual item will be created as an + item from that component. This happens automatically when the item is about to become the current + item in the stack. Ownership of the item will then normally be taken by the StackView. It will as + such automatically destroy the item when it is later popped off. The component that declared the item, by + contrast, remains in the ownership of the application and is not destroyed by the stack. + This can be overridden by explicitly setting \c{destroyOnPop} in the list of arguments given to push. + + If the \c properties to be pushed are specified, they will be copied into the item at loading time + (in case of a component or URL), or when the item will become the current item (in case of an inline + item). The following example shows how this can be done: + + \code + stackView.push({item: someItem, properties: {fgcolor: "red", bgcolor: "blue"}}) + \endcode + + + \note Note that if an item is declared inside another item, and if that parent gets destroyed, + (even if a component was used), that child item will also be destroyed. + This follows normal Qt parent-child destruction rules, but sometimes comes as a surprise + for developers. + + \section1 Lifecycle + An item's lifecycle in the StackView can have the following transitions: + \list 1 + \li instantiation + \li inactive + \li activating + \li active + \li deactivating + \li inactive + \li destruction + \endlist + + It can move any number of times between inactive and active. When an item is activated, + it's visible on the screen and is considered to be the current item. An item + in a StackView that is not visible is not activated, even if the item is currently the + top-most item in the stack. When the stack becomes visible, the item that is top-most gets + activated. Likewise if the stack is then hidden, the topmost item would be deactivated. + Popping the item off the top of the stack at this point would not result in further + deactivation since the item is not active. + + There is an attached \l{Stack::status}{Stack.status} property that tracks the lifecycle. The + status values list is an enumeration with values \c Stack.Inactive, \c Stack.Activating, + \c Stack.Active and \c Stack.Deactivating. Combined with the normal \c Component.onComplete and + \c Component.onDestruction signals the entire lifecycle is thus: + + \list + \li Created: Component.onCompleted() + \li Activating: Stack.onStatusChanged (Stack.status is Stack.Activating) + \li Acivated: Stack.onStatusChanged (Stack.status is Stack.Active) + \li Deactivating: Stack.onStatusChanged (Stack.status is Stack.Deactivating) + \li Deactivated: Stack.onStatusChanged (Stack.status is Stack.Inactive) + \li Destruction: Component.onDestruction() + \endlist + + \section1 Finding items + Sometimes it is necessary to search for an item, for example, in order to unwind the stack to + an item to which the application does not have a reference. This is facilitated using a + function find() in StackView. The find() function takes a callback function as its + only argument. The callback gets invoked for each item in the stack (starting at the top). + If the callback returns true, then it signals that a match has been found and the find() + function returns that item. If the callback fails to return true (no match is found), + then find() returns \c null. + + The code below searches for an item in the stack that has a name "order_id" and then unwinds to + that item. Note that since find() returns \c {null} if no item is found, and since pop unwinds to + the bottom of the stack if null is given as the target item, the code works well even in + case no matching item is found. + + \code + stackView.pop(stackView.find(function(item) { + return item.name == "order_id"; + })); + \endcode + + You can also get to an item in the stack using \l {get()}{get(index)}. You should use + this function if your item depends on another item in the stack, as the function will + ensure that the item at the given index gets loaded before it is returned. + + \code + previousItem = stackView.get(myItem.Stack.index - 1)); + \endcode + + \section1 Transitions + + A transition is performed whenever a item is pushed or popped, and consists of + two items: enterItem and exitItem. The StackView itself will never move items + around, but instead delegate the job to an external animation set provided + by the style or the application developer. How items should visually enter and leave the stack + (and the geometry they should end up with) is therefore completely controlled from the outside. + + When the transition starts, the StackView will search for a transition that + matches the operation executed. There are three transitions to choose + from: pushTransition, popTransition, and replaceTransition. Each implements how + enterItem should animate in, and exitItem out. The transitions are + collected inside a StackViewDelegate object assigned to + \l {StackView::delegate}{delegate}. By default, popTransition and + replaceTransition will be the same as pushTransition, unless you set them + to something else. + + A simple fade transition could be implemented as: + + \qml + StackView { + delegate: StackViewDelegate { + function transitionFinished(properties) + { + properties.exitItem.opacity = 1 + } + + property Component pushTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "opacity" + from: 0 + to: 1 + } + PropertyAnimation { + target: exitItem + property: "opacity" + from: 1 + to: 0 + } + } + } + } + \endqml + + PushTransition needs to inherit from StackViewTransition, which is a ParallelAnimation that + contains the properties \c enterItem and \c exitItem. You set the target of your + inner animations to those items. Since the same items instance can be pushed several + times to a StackView, you should always override + \l {StackViewDelegate::transitionFinished(properties)}{StackViewDelegate.transitionFinished(properties)}. + Implement this function to reset any properties animated on the exitItem so that later + transitions can expect the items to be in a default state. + + A more complex example could look like the following. Here, the items are lying on the side before + being rotated to an upright position: + + \qml + StackView { + delegate: StackViewDelegate { + function transitionFinished(properties) + { + properties.exitItem.x = 0 + properties.exitItem.rotation = 0 + } + + property Component pushTransition: StackViewTransition { + SequentialAnimation { + ScriptAction { + script: enterItem.rotation = 90 + } + PropertyAnimation { + target: enterItem + property: "x" + from: enterItem.width + to: 0 + } + PropertyAnimation { + target: enterItem + property: "rotation" + from: 90 + to: 0 + } + } + PropertyAnimation { + target: exitItem + property: "x" + from: 0 + to: -exitItem.width + } + } + } + } + \endqml + + \section2 Advanced usage + + When the StackView needs a new transition, it first calls + \l {StackViewDelegate::getTransition(properties)}{StackViewDelegate.getTransition(properties)}. + The base implementation of this function just looks for a property named \c properties.name inside + itself (root), which is how it finds \c {property Component pushTransition} in the examples above. + + \code + function getTransition(properties) + { + return root[properties.name] + } + \endcode + + You can override this function for your delegate if you need extra logic to decide which + transition to return. You could for example introspect the items, and return different animations + depending on the their internal state. StackView will expect you to return a Component that + contains a StackViewTransition, or a StackViewTransition directly. The former is easier, as StackView will + then create the transition and later destroy it when it's done, while avoiding any sideeffects + caused by the transition being alive long after it has run. Returning a StackViewTransition directly + can be useful if you need to write some sort of transition caching for performance reasons. + As an optimization, you can also return \c null to signal that you just want to show/hide the items + immediately without creating or running any transitions. You can also override this function if + you need to alter the items in any way before the transition starts. + + \c properties contains the properties that will be assigned to the StackViewTransition before + it runs. In fact, you can add more properties to this object during the call + if you need to initialize additional properties of your custom StackViewTransition when the returned + component is instantiated. + + The following example shows how you can decide which animation to use during runtime : + + \qml + StackViewDelegate { + function getTransition(properties) + { + return (properties.enterItem.Stack.index % 2) ? horizontalTransition : verticalTransition + } + + function transitionFinished(properties) + { + properties.exitItem.x = 0 + properties.exitItem.y = 0 + } + + property Component horizontalTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "x" + from: target.width + to: 0 + duration: 300 + } + PropertyAnimation { + target: exitItem + property: "x" + from: 0 + to: target.width + duration: 300 + } + } + + property Component verticalTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "y" + from: target.height + to: 0 + duration: 300 + } + PropertyAnimation { + target: exitItem + property: "y" + from: 0 + to: target.height + duration: 300 + } + } + } + \endqml + + \section1 Supported Attached Properties + + Items in a StackView support these attached properties: + \list + \li \l{Stack::index}{Stack.index} - Contains the index of the item inside the StackView + \li \l{Stack::view}{Stack.view} - Contains the StackView the item is in + \li \l{Stack::status}{Stack.status} - Contains the status of the item + \endlist +*/ + +Item { + id: root + + /*! \qmlproperty int StackView::depth + \readonly + The number of items currently pushed onto the stack. + */ + readonly property alias depth: root.__depth + + /*! \qmlproperty Item StackView::currentItem + \readonly + The currently top-most item in the stack. + */ + readonly property alias currentItem: root.__currentItem + + /*! The first \l item that should be shown when the StackView is created. + \a initialItem can take same value as the first argument to \l{StackView::push()} + {StackView.push()}. Note that this is just a convenience for writing + \c{Component.onCompleted: stackView.push(myInitialItem)} + + Examples: + + \list + \li initialItem: Qt.resolvedUrl("MyItem.qml") + \li initialItem: myItem + \li initialItem: {"item" : Qt.resolvedUrl("MyRectangle.qml"), "properties" : {"color" : "red"}} + \endlist + \sa push + */ + property var initialItem: null + + /*! \readonly + \a busy is \c true if a transition is running, and \c false otherwise. */ + readonly property bool busy: __currentTransition !== null + + /*! The transitions to use when pushing or popping items. + For better understanding on how to apply custom transitions, read \l{Transitions}. + \sa {Stack::transitions}{Stack.transitions} */ + property StackViewDelegate delegate: StackViewSlideDelegate {} + + /*! Pushes an item onto the stack. The function takes a property list as argument, which + should contain one or more of the following properties: + \list + \li \c item: this property is required, and holds the item you want to push. + \li \c properties: a list of QML properties that should be assigned + to the item upon push. These properties will be copied into the item when it is + loaded (in case of a component or URL), or when it becomes the current item for the + first time (normally upon push). + \li \c immediate: set this property to \c true to skip transition effects. When pushing + an array, you only need to set this property on the first element to make the + whole operation immediate. + \li \c replace: set this property to replace the current item on the stack. When pushing + an array, you only need to set this property on the first element to replace + as many elements on the stack as inside the array. + \li \c destroyOnPop: set this property to specify if the item needs to be destroyed + when its popped off the stack. By default (if \a destroyOnPop is not specified), + StackView will destroy items pushed as components or URLs. Items + not destroyed will be re-parented to the original parents they had before being + pushed onto the stack, and hidden. If you need to set this property, do it with + care, so that items are not leaked. + \endlist + + You can also push an array of items (property lists) if you need to push several items + in one go. A transition will then only occur between the current item and the last + item in the list. Loading the other items will be deferred until needed. + + Examples: + \list + \li stackView.push({item:anItem}) + \li stackView.push({item:aURL, immediate: true, replace: true}) + \li stackView.push({item:aRectangle, properties:{color:"red"}}) + \li stackView.push({item:aComponent, properties:{color:"red"}}) + \li stackView.push({item:aComponent.createObject(), destroyOnPop:true}) + \li stackView.push([{item:anitem, immediate:true}, {item:aURL}]) + \endlist + + \note Note: if the only argument needed is "item", you can apply the following short- + hand notation: \c{stackView.push(anItem)}. + + Returns the item that became current. + + \sa initialItem + \sa {Pushing items} + */ + function push(item) { + // Note: we support two different APIs in this function; The old meego API, and + // the new "property list" API. Hence the reason for hiding the fact that you + // can pass more arguments than shown in the signature: + if (__recursionGuard(true)) + return + var properties = arguments[1] + var immediate = arguments[2] + var replace = arguments[3] + var arrayPushed = (item instanceof Array) + var firstItem = arrayPushed ? item[0] : item + immediate = (immediate || JSArray.stackView.length === 0) + + if (firstItem && firstItem.item && firstItem.hasOwnProperty("x") === false) { + // Property list API used: + immediate = immediate || firstItem.immediate + replace = replace || firstItem.replace + } + + // Create, and push, a new javascript object, called "element", onto the stack. + // This element contains all the information necessary to construct the item, and + // will, after loaded, also contain the loaded item: + if (arrayPushed) { + if (item.length === 0) + return + var outElement = replace ? JSArray.pop() : JSArray.current() + for (var i=0; i 1 && item !== undefined && item !== inElement.item) { + // Pop from the top until we find 'item', and return the corresponding + // element. Skip all non-loaded items (except the first), since no one + // has any references to such items anyway: + while (__depth > 1 && !JSArray.current().loaded) + JSArray.pop() + inElement = JSArray.current() + while (__depth > 1 && item !== inElement.item) { + JSArray.pop() + __cleanup(inElement) + while (__depth > 1 && !JSArray.current().loaded) + JSArray.pop() + inElement = JSArray.current() + } + } + + var transition = { + inElement: inElement, + outElement: outElement, + immediate: immediate, + replace: false, + push: false + } + __performTransition(transition) + __recursionGuard(false) + return outElement.item; + } + + /*! Remove all items from the stack. No animations will be applied. */ + function clear() { + if (__recursionGuard(true)) + return + if (__currentTransition) + __currentTransition.animation.complete() + __currentItem = null + var count = __depth + for (var i=0; i=0; --i) { + var element = JSArray.stackView[i]; + if (onlySearchLoadedItems !== true) + __loadElement(element) + else if (!element.item) + continue + if (func(element.item)) + return element.item + } + return null; + } + + /*! Returns the item at position \a index in + the stack. If \a dontLoad is true, the + item will not be forced to load (and \c null + will be returned if not yet loaded) */ + function get(index, dontLoad) + { + if (index < 0 || index >= JSArray.stackView.length) + return null + var element = JSArray.stackView[index] + if (dontLoad !== true) { + __loadElement(element) + return element.item + } else if (element.item) { + return element.item + } else { + return null + } + } + + /*! Immediately completes any ongoing transition. + /sa Animation.complete + */ + function completeTransition() + { + if (__recursionGuard(true)) + return + if (__currentTransition) + __currentTransition.animation.complete() + __recursionGuard(false) + } + + /********* DEPRECATED API *********/ + + /*! \internal + \deprecated Use Push() instead */ + function replace(item, properties, immediate) { + push(item, properties, immediate, true) + } + + /********* PRIVATE API *********/ + + width: parent ? parent.width : 0 + height: parent ? parent.height : 0 + + /*! \internal The currently top-most item on the stack. */ + property Item __currentItem: null + /*! \internal The number of items currently pushed onto the stack. */ + property int __depth: 0 + /*! \internal Stores the transition info while a transition is ongoing */ + property var __currentTransition: null + /*! \internal Stops the user from pushing items while preparing a transition */ + property bool __guard: false + + Component.onCompleted: { + if (initialItem) + push(initialItem) + } + + Component.onDestruction: { + if (__currentTransition) + __currentTransition.animation.complete() + __currentItem = null + } + + /*! \internal */ + function __recursionGuard(use) + { + if (use && __guard) { + console.warn("Warning: StackView: You cannot push/pop recursively!") + console.trace() + return true + } + __guard = use + } + + /*! \internal */ + function __loadElement(element) + { + if (element.loaded) { + if (!element.item) { + element.item = invalidItemReplacement.createObject(root) + element.item.text = "\nError: The item has been deleted outside StackView!" + } + return + } + if (!element.itemComponent) { + element.item = invalidItemReplacement.createObject(root) + element.item.text = "\nError: Invalid item (item was 'null'). " + + "This might indicate that the item was deleted outside StackView!" + return + } + + var comp = __resolveComponent(element.itemComponent, element) + + // Assign properties to item: + if (!element.properties) + element.properties = {} + + if (comp.hasOwnProperty("createObject")) { + if (comp.status === Component.Error) { + element.item = invalidItemReplacement.createObject(root) + element.item.text = "\nError: Could not load: " + comp.errorString() + } else { + element.item = comp.createObject(root, element.properties) + // Destroy items we create unless the user specified something else: + if (!element.hasOwnProperty("destroyOnPop")) + element.destroyOnPop = true + } + } else { + // comp is already an Item, so just re-parent it into the StackView: + element.item = comp + element.originalParent = parent + element.item.parent = root + for (var prop in element.properties) { + if (element.item.hasOwnProperty(prop)) + element.item[prop] = element.properties[prop]; + } + // Do not destroy items we didn't create, unless the user specified something else: + if (!element.hasOwnProperty("destroyOnPop")) + element.destroyOnPop = false + } + + element.item.Stack.__index = element.index + element.item.Stack.__view = root + // Let item fill all available space by default: + element.item.width = Qt.binding(function() { return root.width }) + element.item.height = Qt.binding(function() { return root.height }) + element.loaded = true + } + + /*! \internal */ + function __resolveComponent(unknownObjectType, element) + { + // We need this extra resolve function since we dont really + // know what kind of object the user pushed. So we try to + // figure it out by inspecting the object: + if (unknownObjectType.hasOwnProperty("createObject")) { + return unknownObjectType + } else if (typeof unknownObjectType == "string") { + return Qt.createComponent(unknownObjectType) + } else if (unknownObjectType.hasOwnProperty("x")) { + return unknownObjectType + } else if (unknownObjectType.hasOwnProperty("item")) { + // INVARIANT: user pushed a JS-object + element.properties = unknownObjectType.properties + if (!unknownObjectType.item) + unknownObjectType.item = invalidItemReplacement + if (unknownObjectType.hasOwnProperty("destroyOnPop")) + element.destroyOnPop = unknownObjectType.destroyOnPop + return __resolveComponent(unknownObjectType.item, element) + } else { + // We cannot determine the type, so assume its a URL: + return Qt.createComponent(unknownObjectType) + } + } + + /*! \internal */ + function __cleanup(element) { + // INVARIANT: element has been removed from JSArray. Destroy its + // item, or re-parent it back to the parent it had before it was pushed: + var item = element.item + if (element.destroyOnPop) { + item.destroy() + } else { + // Mark the item as no longer part of the StackView. It + // might reenter on pop if pushed several times: + item.visible = false + __setStatus(item, Stack.Inactive) + item.Stack.__view = null + item.Stack.__index = -1 + if (element.originalParent) + item.parent = element.originalParent + } + } + + /*! \internal */ + function __setStatus(item, status) { + item.Stack.__status = status + } + + /*! \internal */ + function __performTransition(transition) + { + // Animate item in "outElement" out, and item in "inElement" in. Set a guard to protect + // the user from pushing new items on signals that will fire while preparing for the transition + // (e.g Stack.onCompleted, Stack.onStatusChanged, Stack.onIndexChanged etc). Otherwise, we will enter + // this function several times, which causes the items to be updated half-way. + if (__currentTransition) + __currentTransition.animation.complete() + __loadElement(transition.inElement) + + transition.name = transition.replace ? "replaceTransition" : (transition.push ? "pushTransition" : "popTransition") + var enterItem = transition.inElement.item + transition.enterItem = enterItem + + // Since an item can be pushed several times, we need to update its properties: + enterItem.parent = root + enterItem.Stack.__view = root + enterItem.Stack.__index = transition.inElement.index + __currentItem = enterItem + + if (!transition.outElement) { + // A transition consists of two items, but we got just one. So just show the item: + enterItem.visible = true + __setStatus(enterItem, Stack.Activating) + __setStatus(enterItem, Stack.Active) + return + } + + var exitItem = transition.outElement.item + transition.exitItem = exitItem + if (enterItem === exitItem) + return + + if (root.delegate) { + transition.properties = { + "name":transition.name, + "enterItem":transition.enterItem, + "exitItem":transition.exitItem, + "immediate":transition.immediate } + var anim = root.delegate.getTransition(transition.properties) + if (anim.createObject) { + anim = anim.createObject(null, transition.properties) + anim.runningChanged.connect(function(){ if (anim.running === false) anim.destroy() }) + } + transition.animation = anim + } + + if (!transition.animation) { + console.warn("Warning: StackView: no", transition.name, "found!") + return + } + if (enterItem.anchors.fill || exitItem.anchors.fill) + console.warn("Warning: StackView: cannot transition an item that is anchored!") + + __currentTransition = transition + __setStatus(exitItem, Stack.Deactivating) + enterItem.visible = true + __setStatus(enterItem, Stack.Activating) + transition.animation.runningChanged.connect(animationFinished) + transition.animation.start() + // NB! For empty animations, "animationFinished" is already + // executed at this point, leaving __animation === null: + if (transition.immediate === true && transition.animation) + transition.animation.complete() + } + + /*! \internal */ + function animationFinished() + { + if (!__currentTransition || __currentTransition.animation.running) + return + + __currentTransition.animation.runningChanged.disconnect(animationFinished) + __currentTransition.exitItem.visible = false + __setStatus(__currentTransition.exitItem, Stack.Inactive); + __setStatus(__currentTransition.enterItem, Stack.Active); + __currentTransition.properties.animation = __currentTransition.animation + root.delegate.transitionFinished(__currentTransition.properties) + + if (!__currentTransition.push || __currentTransition.replace) + __cleanup(__currentTransition.outElement) + + __currentTransition = null + } + + /*! \internal */ + property Component invalidItemReplacement: Component { + Text { + width: parent.width + height: parent.height + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackViewDelegate.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackViewDelegate.qml new file mode 100644 index 00000000000..e77b8235276 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackViewDelegate.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 + +/*! + \qmltype StackViewDelegate + \inqmlmodule QtQuick.Controls + \since 5.1 + + \brief A delegate used by StackView for loading transitions. + + See the documentation for the \l {QtQuick.Controls1::StackView} {StackView} + component. + +*/ +QtObject { + id: root + + function getTransition(properties) + { + return root[properties.name] + } + + function transitionFinished(properties) + { + } + + property Component pushTransition: StackViewTransition {} + property Component popTransition: root["pushTransition"] + property Component replaceTransition: root["pushTransition"] +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackViewTransition.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackViewTransition.qml new file mode 100644 index 00000000000..e58ad3f34e7 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StackViewTransition.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 + +ParallelAnimation { + id: root + /*! The name of the animation that is running. Can be one of the following: + \list + \li 'PushTransition' + \li 'PopTransition' + \li 'ReplaceTransition' + \endlist + */ + property string name + /*! The page that is transitioning in. */ + property Item enterItem + /*! The page that is transitioning out */ + property Item exitItem + /*! Set to \c true if the transition is told to + fast-forward directly to its end-state */ + property bool immediate +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StatusBar.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StatusBar.qml new file mode 100644 index 00000000000..cf41a2dc760 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/StatusBar.qml @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype StatusBar + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup applicationwindow + \brief Contains status information in your app. + + The common way of using StatusBar is in relation to \l ApplicationWindow. + + Note that the StatusBar does not provide a layout of its own, but requires + you to position its contents, for instance by creating a \l RowLayout. + + If only a single item is used within the StatusBar, it will resize to fit the implicitHeight + of its contained item. This makes it particularly suitable for use together with layouts. + Otherwise the height is platform dependent. + + \code + import QtQuick.Controls 1.1 + import QtQuick.Layouts 1.0 + + ApplicationWindow { + statusBar: StatusBar { + RowLayout { + Label { text: "Read Only" } + } + } + } + \endcode +*/ + +Item { + id: statusbar + + activeFocusOnTab: false + Accessible.role: Accessible.StatusBar + + width: parent ? parent.width : implicitWidth + implicitWidth: container.leftMargin + container.rightMargin + container.calcWidth() + implicitHeight: Math.max(container.topMargin + container.bottomMargin + container.calcHeight(), + loader.item ? loader.item.implicitHeight : 19) + + /*! \internal */ + property Component style: Qt.createComponent(Settings.style + "/StatusBarStyle.qml", statusbar) + + /*! \internal */ + property alias __style: styleLoader.item + + /*! \internal */ + default property alias __content: container.data + + /*! + \qmlproperty Item StatusBar::contentItem + + This property holds the content Item of the status bar. + + Items declared as children of a StatusBar are automatically parented to the StatusBar's contentItem. + Items created dynamically need to be explicitly parented to the contentItem: + + \note The implicit size of the StatusBar is calculated based on the size of its content. If you want to anchor + items inside the status bar, you must specify an explicit width and height on the StatusBar itself. + */ + readonly property alias contentItem: container + + data: [ + Loader { + id: loader + anchors.fill: parent + sourceComponent: styleLoader.item ? styleLoader.item.panel : null + onLoaded: item.z = -1 + Loader { + id: styleLoader + property alias __control: statusbar + sourceComponent: style + } + }, + Item { + id: container + z: 1 + focus: true + anchors.fill: parent + + anchors.topMargin: topMargin + anchors.leftMargin: leftMargin + anchors.rightMargin: rightMargin + anchors.bottomMargin: bottomMargin + + property int topMargin: __style ? __style.padding.top : 0 + property int bottomMargin: __style ? __style.padding.bottom : 0 + property int leftMargin: __style ? __style.padding.left : 0 + property int rightMargin: __style ? __style.padding.right : 0 + + property Item layoutItem: container.children.length === 1 ? container.children[0] : null + function calcWidth() { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) + + (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin + + layoutItem.anchors.rightMargin : 0) : + loader.item ? loader.item.implicitWidth: 0) } + function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) + + (layoutItem.anchors.fill ? layoutItem.anchors.topMargin + + layoutItem.anchors.bottomMargin : 0) : loader.item ? loader.item.implicitHeight : 0) } + }] +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/BusyIndicatorStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/BusyIndicatorStyle.qml new file mode 100644 index 00000000000..d53ccb29255 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/BusyIndicatorStyle.qml @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.2 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype BusyIndicatorStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.2 + \ingroup controlsstyling + \brief Provides custom styling for BusyIndicatorStyle + + You can create a busy indicator by replacing the "indicator" delegate + of the BusyIndicatorStyle with a custom design. + + Example: + \qml + BusyIndicator { + style: BusyIndicatorStyle + indicator: Image { + visible: control.running + source: "spinner.png" + NumberAnimation on rotation { + running: control.running + loops: Animation.Infinite + duration: 2000 + from: 0 ; to: 360 + } + } + } + } + \endqml +*/ +Style { + id: indicatorstyle + + /*! The \l BusyIndicator attached to this style. */ + readonly property BusyIndicator control: __control + + /*! This defines the appearance of the busy indicator. */ + property Component indicator: Item { + implicitWidth: 48 + implicitHeight: 48 + + opacity: control.running ? 1 : 0 + Behavior on opacity { OpacityAnimator { duration: 250 } } + + Image { + anchors.centerIn: parent + anchors.alignWhenCentered: true + width: Math.min(parent.width, parent.height) + height: width + source: width <= 32 ? "images/spinner_small.png" : + width >= 48 ? "images/spinner_large.png" : + "images/spinner_medium.png" + RotationAnimator on rotation { + duration: 800 + loops: Animation.Infinite + from: 0 + to: 360 + } + } + } + + /*! \internal */ + property Component panel: Item { + anchors.fill: parent + implicitWidth: indicatorLoader.implicitWidth + implicitHeight: indicatorLoader.implicitHeight + + Loader { + id: indicatorLoader + sourceComponent: indicator + anchors.centerIn: parent + width: Math.min(parent.width, parent.height) + height: width + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ButtonStyle.qml new file mode 100644 index 00000000000..ad14095c59c --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ButtonStyle.qml @@ -0,0 +1,177 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ButtonStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup controlsstyling + \brief Provides custom styling for Button + + You can create a custom button by replacing the "background" delegate + of the ButtonStyle with a custom design. + + Example: + \qml + Button { + text: "A button" + style: ButtonStyle { + background: Rectangle { + implicitWidth: 100 + implicitHeight: 25 + border.width: control.activeFocus ? 2 : 1 + border.color: "#888" + radius: 4 + gradient: Gradient { + GradientStop { position: 0 ; color: control.pressed ? "#ccc" : "#eee" } + GradientStop { position: 1 ; color: control.pressed ? "#aaa" : "#ccc" } + } + } + } + } + \endqml + If you need a custom label, you can replace the label item. +*/ + +Style { + id: buttonstyle + + /*! The \l Button attached to this style. */ + readonly property Button control: __control + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + + /*! The padding between the background and the label components. */ + padding { + top: 4 + left: 4 + right: control.menu !== null ? Math.round(TextSingleton.implicitHeight * 0.5) : 4 + bottom: 4 + } + + /*! This defines the background of the button. */ + property Component background: Item { + implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5) + implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2)) + Rectangle { + anchors.fill: parent + anchors.bottomMargin: control.pressed ? 0 : -1 + color: "#10000000" + radius: baserect.radius + } + Rectangle { + id: baserect + gradient: Gradient { + GradientStop {color: control.pressed ? "#aaa" : "#fefefe" ; position: 0} + GradientStop {color: control.pressed ? "#ccc" : "#e3e3e3" ; position: control.pressed ? 0.1: 1} + } + radius: TextSingleton.implicitHeight * 0.16 + anchors.fill: parent + border.color: control.activeFocus ? "#47b" : "#999" + Rectangle { + anchors.fill: parent + radius: parent.radius + color: control.activeFocus ? "#47b" : "white" + opacity: control.hovered || control.activeFocus ? 0.1 : 0 + Behavior on opacity {NumberAnimation{ duration: 100 }} + } + } + Image { + id: imageItem + visible: control.menu !== null + source: "images/arrow-down.png" + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: padding.right + opacity: control.enabled ? 0.6 : 0.5 + } + } + + /*! This defines the label of the button. */ + property Component label: Item { + implicitWidth: row.implicitWidth + implicitHeight: row.implicitHeight + Row { + id: row + anchors.centerIn: parent + spacing: 2 + Image { + source: control.iconSource + anchors.verticalCenter: parent.verticalCenter + } + Text { + renderType: Text.NativeRendering + anchors.verticalCenter: parent.verticalCenter + text: control.text + color: __syspal.text + } + } + } + + /*! \internal */ + property Component panel: Item { + anchors.fill: parent + implicitWidth: Math.max(labelLoader.implicitWidth + padding.left + padding.right, backgroundLoader.implicitWidth) + implicitHeight: Math.max(labelLoader.implicitHeight + padding.top + padding.bottom, backgroundLoader.implicitHeight) + + Loader { + id: backgroundLoader + anchors.fill: parent + sourceComponent: background + } + + Loader { + id: labelLoader + sourceComponent: label + anchors.fill: parent + anchors.leftMargin: padding.left + anchors.topMargin: padding.top + anchors.rightMargin: padding.right + anchors.bottomMargin: padding.bottom + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/CheckBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/CheckBoxStyle.qml new file mode 100644 index 00000000000..8fb58207cbb --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/CheckBoxStyle.qml @@ -0,0 +1,196 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Window 2.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype CheckBoxStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup controlsstyling + \brief Provides custom styling for CheckBox + + Example: + \qml + CheckBox { + text: "Check Box" + style: CheckBoxStyle { + indicator: Rectangle { + implicitWidth: 16 + implicitHeight: 16 + radius: 3 + border.color: control.activeFocus ? "darkblue" : "gray" + border.width: 1 + Rectangle { + visible: control.checked + color: "#555" + border.color: "#333" + radius: 1 + anchors.margins: 4 + anchors.fill: parent + } + } + } + } + \endqml +*/ +Style { + id: checkboxStyle + + /*! The \l CheckBox attached to this style. */ + readonly property CheckBox control: __control + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + + /*! This defines the text label. */ + property Component label: Item { + implicitWidth: text.implicitWidth + 2 + implicitHeight: text.implicitHeight + Rectangle { + anchors.fill: text + anchors.margins: -1 + anchors.leftMargin: -3 + anchors.rightMargin: -3 + visible: control.activeFocus + height: 6 + radius: 3 + color: "#224f9fef" + border.color: "#47b" + opacity: 0.6 + } + Text { + id: text + text: control.text + anchors.centerIn: parent + color: __syspal.text + renderType: Text.NativeRendering + } + } + /*! The background under indicator and label. */ + property Component background + + /*! The spacing between indicator and label. */ + property int spacing: Math.round(TextSingleton.implicitHeight/4) + + /*! This defines the indicator button. */ + property Component indicator: Item { + implicitWidth: Math.round(TextSingleton.implicitHeight) + height: width + Rectangle { + anchors.fill: parent + anchors.bottomMargin: -1 + color: "#44ffffff" + radius: baserect.radius + } + Rectangle { + id: baserect + gradient: Gradient { + GradientStop {color: "#eee" ; position: 0} + GradientStop {color: control.pressed ? "#eee" : "#fff" ; position: 0.1} + GradientStop {color: "#fff" ; position: 1} + } + radius: TextSingleton.implicitHeight * 0.16 + anchors.fill: parent + border.color: control.activeFocus ? "#47b" : "#999" + } + + Image { + source: "images/check.png" + opacity: control.checkedState === Qt.Checked ? control.enabled ? 1 : 0.5 : 0 + anchors.centerIn: parent + anchors.verticalCenterOffset: 1 + Behavior on opacity {NumberAnimation {duration: 80}} + } + + Rectangle { + anchors.fill: parent + anchors.margins: Math.round(baserect.radius) + antialiasing: true + gradient: Gradient { + GradientStop {color: control.pressed ? "#555" : "#999" ; position: 0} + GradientStop {color: "#555" ; position: 1} + } + radius: baserect.radius - 1 + anchors.centerIn: parent + anchors.alignWhenCentered: true + border.color: "#222" + Behavior on opacity {NumberAnimation {duration: 80}} + opacity: control.checkedState === Qt.PartiallyChecked ? control.enabled ? 1 : 0.5 : 0 + } + } + + /*! \internal */ + property Component panel: Item { + implicitWidth: Math.max(backgroundLoader.implicitWidth, row.implicitWidth + padding.left + padding.right) + implicitHeight: Math.max(backgroundLoader.implicitHeight, labelLoader.implicitHeight + padding.top + padding.bottom,indicatorLoader.implicitHeight + padding.top + padding.bottom) + + Loader { + id: backgroundLoader + sourceComponent: background + anchors.fill: parent + } + Row { + id: row + anchors.fill: parent + + anchors.leftMargin: padding.left + anchors.rightMargin: padding.right + anchors.topMargin: padding.top + anchors.bottomMargin: padding.bottom + + spacing: checkboxStyle.spacing + Loader { + id: indicatorLoader + sourceComponent: indicator + anchors.verticalCenter: parent.verticalCenter + } + Loader { + id: labelLoader + sourceComponent: label + anchors.verticalCenter: parent.verticalCenter + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ComboBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ComboBoxStyle.qml new file mode 100644 index 00000000000..2b4b237d20d --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ComboBoxStyle.qml @@ -0,0 +1,233 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Window 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ComboBoxStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup controlsstyling + \brief Provides custom styling for ComboBox +*/ + +Style { + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + /*! The \l ComboBox attached to this style. */ + readonly property ComboBox control: __control + + /*! The padding between the background and the label components. */ + padding { top: 4 ; left: 6 ; right: 6 ; bottom:4 } + + /*! The size of the drop down button when the combobox is editable. */ + property int drowDownButtonWidth: Math.round(TextSingleton.implicitHeight) + + /*! This defines the background of the button. */ + property Component background: Item { + implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5) + implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2)) + Rectangle { + anchors.fill: parent + anchors.bottomMargin: control.pressed ? 0 : -1 + color: "#10000000" + radius: baserect.radius + } + Rectangle { + id: baserect + gradient: Gradient { + GradientStop {color: control.pressed ? "#bababa" : "#fefefe" ; position: 0} + GradientStop {color: control.pressed ? "#ccc" : "#e3e3e3" ; position: 1} + } + radius: TextSingleton.implicitHeight * 0.16 + anchors.fill: parent + border.color: control.activeFocus ? "#47b" : "#999" + Rectangle { + anchors.fill: parent + radius: parent.radius + color: control.activeFocus ? "#47b" : "white" + opacity: control.hovered || control.activeFocus ? 0.1 : 0 + Behavior on opacity {NumberAnimation{ duration: 100 }} + } + } + Image { + id: imageItem + visible: control.menu !== null + source: "images/arrow-down.png" + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: drowDownButtonWidth / 2 + opacity: control.enabled ? 0.6 : 0.3 + } + } + + /*! \internal */ + property Component __editor: Item { + implicitWidth: 100 + implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2)) + clip: true + Rectangle { + anchors.fill: parent + anchors.bottomMargin: 0 + color: "#44ffffff" + radius: baserect.radius + } + Rectangle { + id: baserect + anchors.rightMargin: -radius + anchors.bottomMargin: 1 + gradient: Gradient { + GradientStop {color: "#e0e0e0" ; position: 0} + GradientStop {color: "#fff" ; position: 0.1} + GradientStop {color: "#fff" ; position: 1} + } + radius: TextSingleton.implicitHeight * 0.16 + anchors.fill: parent + border.color: control.activeFocus ? "#47b" : "#999" + } + Rectangle { + color: "#aaa" + anchors.bottomMargin: 2 + anchors.topMargin: 1 + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + width: 1 + } + } + + /*! This defines the label of the button. */ + property Component label: Item { + implicitWidth: textitem.implicitWidth + 20 + Text { + id: textitem + anchors.left: parent.left + anchors.right: parent.right + anchors.leftMargin: 4 + anchors.rightMargin: 10 + anchors.verticalCenter: parent.verticalCenter + text: control.currentText + renderType: Text.NativeRendering + color: __syspal.text + elide: Text.ElideRight + } + } + + /*! \internal */ + property Component panel: Item { + property bool popup: false + anchors.centerIn: parent + anchors.fill: parent + implicitWidth: backgroundLoader.implicitWidth + implicitHeight: Math.max(labelLoader.implicitHeight + padding.top + padding.bottom, backgroundLoader.implicitHeight) + + Loader { + id: backgroundLoader + anchors.fill: parent + sourceComponent: background + + } + + Loader { + id: editorLoader + anchors.fill: parent + anchors.rightMargin: drowDownButtonWidth + padding.right + anchors.bottomMargin: -1 + sourceComponent: control.editable ? __editor : null + } + + Loader { + id: labelLoader + sourceComponent: label + visible: !control.editable + anchors.fill: parent + anchors.leftMargin: padding.left + anchors.topMargin: padding.top + anchors.rightMargin: padding.right + anchors.bottomMargin: padding.bottom + } + } + + /*! \internal */ + property Component __dropDownStyle: MenuStyle { + maxPopupHeight: 600 + __menuItemType: "comboboxitem" + scrollerStyle: ScrollViewStyle { + property bool useScrollers: false + } + } + + /*! \internal */ + property Component __popupStyle: Style { + + property Component frame: Rectangle { + width: (parent ? parent.contentWidth : 0) + height: (parent ? parent.contentHeight : 0) + 2 + border.color: "white" + property real maxHeight: 500 + property int margin: 1 + } + + property Component menuItem: Text { + text: "NOT IMPLEMENTED" + color: "red" + font { + pixelSize: 14 + bold: true + } + } + + property Component scrollerStyle: Style { + padding { left: 0; right: 0; top: 0; bottom: 0 } + property bool scrollToClickedPosition: false + property Component frame: Item { visible: false } + property Component corner: Item { visible: false } + property Component __scrollbar: Item { visible: false } + property bool useScrollers: true + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/FocusFrameStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/FocusFrameStyle.qml new file mode 100644 index 00000000000..27edf11c5c5 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/FocusFrameStyle.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype FocusFrameStyle + \internal + \inqmlmodule QtQuick.Controls.Styles +*/ +Item { + property int margin: -3 +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/GroupBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/GroupBoxStyle.qml new file mode 100644 index 00000000000..c0c08d56230 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/GroupBoxStyle.qml @@ -0,0 +1,148 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype GroupBoxStyle + \internal + \inqmlmodule QtQuick.Controls.Styles + \ingroup controlsstyling + \since 5.1 +*/ +Style { + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + /*! The \l GroupBox attached to this style. */ + readonly property GroupBox control: __control + + /*! The margin from the content item to the groupbox. */ + padding { + top: (control.title.length > 0 || control.checkable ? TextSingleton.implicitHeight : 0) + 10 + left: 8 + right: 8 + bottom: 6 + } + + /*! The title text color. */ + property color textColor: __syspal.text + + /*! The check box. */ + property Component checkbox: Item { + implicitWidth: 18 + implicitHeight: 18 + BorderImage { + anchors.fill: parent + source: "images/editbox.png" + border.top: 6 + border.bottom: 6 + border.left: 6 + border.right: 6 + } + Rectangle { + height: 16 + width: 16 + antialiasing: true + visible: control.checked + color: "#666" + radius: 1 + anchors.margins: 4 + anchors.fill: parent + anchors.topMargin: 3 + anchors.bottomMargin: 5 + border.color: "#222" + opacity: control.enabled ? 1 : 0.5 + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + border.color: "#33ffffff" + } + } + BorderImage { + anchors.fill: parent + anchors.margins: -1 + source: "images/focusframe.png" + visible: control.activeFocus + border.left: 4 + border.right: 4 + border.top: 4 + border.bottom: 4 + } + } + + /*! The groupbox frame. */ + property Component panel: Item { + anchors.fill: parent + Loader { + id: checkboxloader + anchors.left: parent.left + sourceComponent: control.checkable ? checkbox : null + anchors.verticalCenter: label.verticalCenter + width: item ? item.implicitWidth : 0 + } + + Text { + id: label + anchors.top: parent.top + anchors.left: checkboxloader.right + anchors.margins: 4 + text: control.title + color: textColor + renderType: Text.NativeRendering + } + + BorderImage { + anchors.fill: parent + anchors.topMargin: padding.top - 7 + source: "images/groupbox.png" + border.left: 4 + border.right: 4 + border.top: 4 + border.bottom: 4 + visible: !control.flat + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/MenuBarStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/MenuBarStyle.qml new file mode 100644 index 00000000000..3a3b552dd66 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/MenuBarStyle.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype MenuBarStyle + \internal + \ingroup applicationwindowstyling + \inqmlmodule QtQuick.Controls.Styles +*/ + +Style { + readonly property color __backgroundColor: "#dcdcdc" + + property Component frame: Rectangle { + width: control.__contentItem.width + height: contentHeight + color: __backgroundColor + } + + property Component menuItem: Rectangle { + width: text.width + 12 + height: text.height + 4 + color: sunken ? "#49d" :__backgroundColor + + SystemPalette { id: syspal } + + Text { + id: text + text: StyleHelpers.stylizeMnemonics(menuItem.title) + anchors.centerIn: parent + renderType: Text.NativeRendering + color: sunken ? "white" : syspal.windowText + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/MenuStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/MenuStyle.qml new file mode 100644 index 00000000000..c05c6a6d100 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/MenuStyle.qml @@ -0,0 +1,220 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Window 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype MenuStyle + \internal + \ingroup menusstyling + \inqmlmodule QtQuick.Controls.Styles +*/ + +Style { + id: styleRoot + + property string __menuItemType: "menuitem" + property real maxPopupHeight: 600 // ### FIXME Screen.desktopAvailableHeight * 0.99 + + property Component frame: Rectangle { + width: (parent ? parent.contentWidth : 0) + 2 + height: (parent ? parent.contentHeight : 0) + 2 + + color: "lightgray" + border { width: 1; color: "darkgray" } + + property int subMenuOverlap: -1 + property real maxHeight: maxPopupHeight + property int margin: 1 + } + + property Component menuItem: Rectangle { + x: 1 + y: 1 + implicitWidth: Math.max((parent ? parent.width : 0), + 18 + text.paintedWidth + (rightDecoration.visible ? rightDecoration.width + 40 : 12)) + implicitHeight: isSeparator ? text.font.pixelSize / 2 : !!scrollerDirection ? text.font.pixelSize * 0.75 : text.paintedHeight + 4 + color: selected && enabled ? "" : backgroundColor + gradient: selected && enabled ? selectedGradient : undefined + border.width: 1 + border.color: selected && enabled ? Qt.darker(selectedColor, 1) : color + readonly property int leftMargin: __menuItemType === "menuitem" ? 18 : 0 + + readonly property color backgroundColor: "#dcdcdc" + readonly property color selectedColor: "#49d" + Gradient { + id: selectedGradient + GradientStop {color: Qt.lighter(selectedColor, 1.3) ; position: -0.2} + GradientStop {color: selectedColor; position: 1.4} + } + antialiasing: true + + SystemPalette { + id: syspal + colorGroup: enabled ? SystemPalette.Active : SystemPalette.Disabled + } + + readonly property string itemText: parent ? parent.text : "" + readonly property bool mirrored: Qt.application.layoutDirection === Qt.RightToLeft + + Loader { + id: checkMark + x: mirrored ? parent.width - width - 4 : 4 + y: 6 + active: __menuItemType === "menuitem" && !!menuItem && !!menuItem["checkable"] + sourceComponent: exclusive ? exclusiveCheckMark : nonExclusiveCheckMark + + readonly property bool checked: !!menuItem && !!menuItem.checked + readonly property bool exclusive: !!menuItem && !!menuItem["exclusiveGroup"] + + Component { + id: nonExclusiveCheckMark + BorderImage { + width: 12 + height: 12 + source: "images/editbox.png" + border.top: 6 + border.bottom: 6 + border.left: 6 + border.right: 6 + + Rectangle { + antialiasing: true + visible: checkMark.checked + color: "#666" + radius: 1 + anchors.margins: 4 + anchors.fill: parent + anchors.topMargin: 3 + anchors.bottomMargin: 5 + border.color: "#222" + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + border.color: "#33ffffff" + } + } + } + } + + Component { + id: exclusiveCheckMark + Rectangle { + x: 1 + width: 10 + height: 10 + color: "white" + border.color: "gray" + antialiasing: true + radius: height/2 + + Rectangle { + anchors.centerIn: parent + visible: checkMark.checked + width: 4 + height: 4 + color: "#666" + border.color: "#222" + antialiasing: true + radius: height/2 + } + } + } + } + + Text { + id: text + visible: !isSeparator + text: StyleHelpers.stylizeMnemonics(itemText) + readonly property real offset: __menuItemType === "menuitem" ? 24 : 6 + x: mirrored ? parent.width - width - offset : offset + anchors.verticalCenter: parent.verticalCenter + renderType: Text.NativeRendering + color: selected && enabled ? "white" : syspal.text + } + + Text { + id: rightDecoration + readonly property string shortcut: !!menuItem && menuItem["shortcut"] || "" + visible: isSubmenu || shortcut !== "" + text: isSubmenu ? mirrored ? "\u25c2" : "\u25b8" // BLACK LEFT/RIGHT-POINTING SMALL TRIANGLE + : shortcut + LayoutMirroring.enabled: mirrored + anchors { + right: parent.right + rightMargin: 6 + baseline: isSubmenu ? undefined : text.baseline + } + font.pixelSize: isSubmenu ? text.font.pixelSize : text.font.pixelSize * 0.9 + color: text.color + renderType: Text.NativeRendering + style: selected || !isSubmenu ? Text.Normal : Text.Raised; styleColor: Qt.lighter(color, 4) + } + + Image { + id: scrollerDecoration + visible: !!scrollerDirection + anchors.centerIn: parent + source: scrollerDirection === "up" ? "images/arrow-up.png" : "images/arrow-down.png" + } + + Rectangle { + visible: isSeparator + width: parent.width - 2 + height: 1 + x: 1 + anchors.verticalCenter: parent.verticalCenter + color: "darkgray" + } + } + + property Component scrollerStyle: Style { + padding { left: 0; right: 0; top: 0; bottom: 0 } + property bool scrollToClickedPosition: false + property Component frame: Item { visible: false } + property Component corner: Item { visible: false } + property Component __scrollbar: Item { visible: false } + property bool useScrollers: true + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ProgressBarStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ProgressBarStyle.qml new file mode 100644 index 00000000000..d8ff8140ebe --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ProgressBarStyle.qml @@ -0,0 +1,232 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ProgressBarStyle + + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup controlsstyling + \brief Provides custom styling for ProgressBar + + Example: + \qml + ProgressBar { + value: slider.value + style: ProgressBarStyle { + background: Rectangle { + radius: 2 + color: "lightgray" + border.color: "gray" + border.width: 1 + implicitWidth: 200 + implicitHeight: 24 + } + progress: Rectangle { + color: "lightsteelblue" + border.color: "steelblue" + } + } + } + \endqml +*/ + +Style { + id: progressBarStyle + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + /*! The \l ProgressBar attached to this style. */ + readonly property ProgressBar control: __control + + /*! A value in the range [0-1] indicating the current progress. */ + readonly property real currentProgress: control.indeterminate ? 1.0 : + control.value / control.maximumValue + + /*! This property holds the visible contents of the progress bar + You can access the Slider through the \c control property. + + For convenience, you can also access the readonly property \c styleData.progress + which provides the current progress as a \c real in the range [0-1] + */ + padding { top: 0 ; left: 0 ; right: 0 ; bottom: 0 } + + /*! \qmlproperty Component ProgressBarStyle::progress + The progress component for this style. + */ + property Component progress: Item { + property color progressColor: "#49d" + anchors.fill: parent + clip: true + Rectangle { + id: base + width: control.width + height: control.height + radius: TextSingleton.implicitHeight * 0.16 + antialiasing: true + gradient: Gradient { + GradientStop {color: Qt.lighter(progressColor, 1.3) ; position: 0} + GradientStop {color: progressColor ; position: 1.4} + } + border.width: 1 + border.color: Qt.darker(progressColor, 1.2) + Rectangle { + color: "transparent" + radius: 1.5 + clip: true + antialiasing: true + anchors.fill: parent + anchors.margins: 1 + border.color: Qt.rgba(1,1,1,0.1) + Image { + visible: control.indeterminate + height: parent.height + NumberAnimation on x { + from: -39 + to: 0 + running: control.indeterminate + duration: 800 + loops: Animation.Infinite + } + fillMode: Image.Tile + width: parent.width + 25 + source: "images/progress-indeterminate.png" + } + } + } + Rectangle { + height: parent.height - 2 + width: 1 + y: 1 + anchors.right: parent.right + anchors.rightMargin: 1 + color: Qt.rgba(1,1,1,0.1) + visible: splitter.visible + } + Rectangle { + id: splitter + height: parent.height - 2 + width: 1 + y: 1 + anchors.right: parent.right + color: Qt.darker(progressColor, 1.2) + property int offset: currentProgress * control.width + visible: offset > base.radius && offset < control.width - base.radius + 1 + } + } + + /*! \qmlproperty Component ProgressBarStyle::background + The background component for this style. + + \note The implicitWidth and implicitHeight of the background component + must be set. + */ + property Component background: Item { + implicitWidth: 200 + implicitHeight: Math.max(17, Math.round(TextSingleton.implicitHeight * 0.7)) + Rectangle { + anchors.fill: parent + anchors.bottomMargin: control.pressed ? 0 : -1 + color: "#44ffffff" + radius: baserect.radius + } + Rectangle { + id: baserect + gradient: Gradient { + GradientStop {color: "#eee" ; position: 0} + GradientStop {color: "#fff" ; position: 0.1} + GradientStop {color: "#fff" ; position: 1} + } + radius: TextSingleton.implicitHeight * 0.16 + anchors.fill: parent + border.color: control.activeFocus ? "#47b" : "#999" + Rectangle { + anchors.fill: parent + radius: parent.radius + color: control.activeFocus ? "#47b" : "white" + opacity: control.hovered || control.activeFocus ? 0.1 : 0 + Behavior on opacity {NumberAnimation{ duration: 100 }} + } + } + } + + /*! \qmlproperty Component ProgressBarStyle::panel + The panel component for this style. + */ + property Component panel: Item{ + property bool horizontal: control.orientation == Qt.Horizontal + implicitWidth: horizontal ? backgroundLoader.implicitWidth : backgroundLoader.implicitHeight + implicitHeight: horizontal ? backgroundLoader.implicitHeight : backgroundLoader.implicitWidth + + Item { + width: horizontal ? parent.width : parent.height + height: !horizontal ? parent.width : parent.height + y: horizontal ? 0 : width + rotation: horizontal ? 0 : -90 + transformOrigin: Item.TopLeft + + Loader { + id: backgroundLoader + anchors.fill: parent + sourceComponent: background + } + + Loader { + sourceComponent: progressBarStyle.progress + anchors.topMargin: padding.top + anchors.leftMargin: padding.left + anchors.rightMargin: padding.right + anchors.bottomMargin: padding.bottom + + anchors.top: parent.top + anchors.left: parent.left + anchors.bottom: parent.bottom + width: currentProgress * (parent.width - padding.left - padding.right) + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/RadioButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/RadioButtonStyle.qml new file mode 100644 index 00000000000..78f423ace4c --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/RadioButtonStyle.qml @@ -0,0 +1,177 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype RadioButtonStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup controlsstyling + \brief Provides custom styling for RadioButton + + Example: + \qml + RadioButton { + text: "Radio Button" + style: RadioButtonStyle { + indicator: Rectangle { + implicitWidth: 16 + implicitHeight: 16 + radius: 9 + border.color: control.activeFocus ? "darkblue" : "gray" + border.width: 1 + Rectangle { + anchors.fill: parent + visible: control.checked + color: "#555" + radius: 9 + anchors.margins: 4 + } + } + } + } + \endqml +*/ + +Style { + id: radiobuttonStyle + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + /*! The \l RadioButton attached to this style. */ + readonly property RadioButton control: __control + + /*! This defines the text label. */ + property Component label: Item { + implicitWidth: text.implicitWidth + 2 + implicitHeight: text.implicitHeight + Rectangle { + anchors.fill: text + anchors.margins: -1 + anchors.leftMargin: -3 + anchors.rightMargin: -3 + visible: control.activeFocus + height: 6 + radius: 3 + color: "#224f9fef" + border.color: "#47b" + opacity: 0.6 + } + Text { + id: text + text: control.text + anchors.centerIn: parent + color: __syspal.text + renderType: Text.NativeRendering + } + } + + /*! The background under indicator and label. */ + property Component background + + /*! The spacing between indicator and label. */ + property int spacing: Math.round(TextSingleton.implicitHeight/4) + + /*! This defines the indicator button. */ + property Component indicator: Rectangle { + width: Math.round(TextSingleton.implicitHeight) + height: width + gradient: Gradient { + GradientStop {color: "#eee" ; position: 0} + GradientStop {color: control.pressed ? "#eee" : "#fff" ; position: 0.4} + GradientStop {color: "#fff" ; position: 1} + } + border.color: control.activeFocus ? "#16c" : "gray" + antialiasing: true + radius: height/2 + Rectangle { + anchors.centerIn: parent + width: Math.round(parent.width * 0.5) + height: width + gradient: Gradient { + GradientStop {color: "#999" ; position: 0} + GradientStop {color: "#555" ; position: 1} + } + border.color: "#222" + antialiasing: true + radius: height/2 + Behavior on opacity {NumberAnimation {duration: 80}} + opacity: control.checked ? control.enabled ? 1 : 0.5 : 0 + } + } + + /*! \internal */ + property Component panel: Item { + implicitWidth: Math.max(backgroundLoader.implicitWidth, row.implicitWidth + padding.left + padding.right) + implicitHeight: Math.max(backgroundLoader.implicitHeight, labelLoader.implicitHeight + padding.top + padding.bottom,indicatorLoader.implicitHeight + padding.top + padding.bottom) + + Loader { + id:backgroundLoader + sourceComponent: background + anchors.fill: parent + } + Row { + id: row + anchors.fill: parent + + anchors.leftMargin: padding.left + anchors.rightMargin: padding.right + anchors.topMargin: padding.top + anchors.bottomMargin: padding.bottom + + spacing: radiobuttonStyle.spacing + Loader { + id: indicatorLoader + sourceComponent: indicator + anchors.verticalCenter: parent.verticalCenter + } + Loader { + id: labelLoader + sourceComponent: label + anchors.verticalCenter: parent.verticalCenter + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ScrollViewStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ScrollViewStyle.qml new file mode 100644 index 00000000000..a7dbcc520ea --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ScrollViewStyle.qml @@ -0,0 +1,398 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ScrollViewStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup viewsstyling + \brief Provides custom styling for ScrollView +*/ +Style { + id: root + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + /*! The \l ScrollView attached to this style. */ + readonly property ScrollView control: __control + + /*! This property controls the frame border padding of the scrollView. */ + padding {left: 1; top: 1; right: 1; bottom: 1} + + /*! This Component paints the corner area between scroll bars */ + property Component corner: Rectangle { color: "#ccc" } + + /*! This component determines if the flickable should reposition itself at the + mouse location when clicked. */ + property bool scrollToClickedPosition: true + + /*! This property holds whether the scroll bars are transient. Transient scroll bars + appear when the content is scrolled and disappear when they are no longer needed. + + The default value is platform dependent. */ + property bool transientScrollBars: Settings.hasTouchScreen + + /*! This Component paints the frame around scroll bars. */ + property Component frame: Rectangle { + color: control["backgroundVisible"] ? "white": "transparent" + border.color: "#999" + border.width: 1 + radius: 1 + visible: control.frameVisible + } + + /*! This is the minimum extent of the scroll bar handle. + + The default value is \c 30. + */ + + property int minimumHandleLength: 30 + + /*! This property controls the edge overlap + between the handle and the increment/decrement buttons. + + The default value is \c 30. + */ + + property int handleOverlap: 1 + + /*! This component controls the appearance of the + scroll bar background. + + You can access the following state properties: + + \table + \row \li property bool \b styleData.hovered + \row \li property bool \b styleData.horizontal + \endtable + */ + + property Component scrollBarBackground: Item { + property bool sticky: false + property bool hovered: styleData.hovered + implicitWidth: Math.round(TextSingleton.implicitHeight) + implicitHeight: Math.round(TextSingleton.implicitHeight) + clip: true + opacity: transientScrollBars ? 0.5 : 1.0 + visible: !transientScrollBars || sticky + Rectangle { + anchors.fill: parent + color: "#ddd" + border.color: "#aaa" + anchors.rightMargin: styleData.horizontal ? -2 : -1 + anchors.leftMargin: styleData.horizontal ? -2 : 0 + anchors.topMargin: styleData.horizontal ? 0 : -2 + anchors.bottomMargin: styleData.horizontal ? -1 : -2 + } + onHoveredChanged: if (hovered) sticky = true + onVisibleChanged: if (!visible) sticky = false + } + + /*! This component controls the appearance of the + scroll bar handle. + + You can access the following state properties: + + \table + \row \li property bool \b styleData.hovered + \row \li property bool \b styleData.pressed + \row \li property bool \b styleData.horizontal + \endtable + */ + + property Component handle: Item { + property bool sticky: false + property bool hovered: __activeControl !== "none" + implicitWidth: Math.round(TextSingleton.implicitHeight) + 1 + implicitHeight: Math.round(TextSingleton.implicitHeight) + 1 + BorderImage { + id: img + opacity: styleData.pressed && !transientScrollBars ? 0.5 : styleData.hovered ? 1 : 0.8 + source: "images/scrollbar-handle-" + (transientScrollBars ? "transient" : styleData.horizontal ? "horizontal" : "vertical") + ".png" + border.left: transientScrollBars ? 5 : 2 + border.top: transientScrollBars ? 5 : 2 + border.right: transientScrollBars ? 5 : 2 + border.bottom: transientScrollBars ? 5 : 2 + anchors.top: !styleData.horizontal ? parent.top : undefined + anchors.margins: transientScrollBars ? 2 : 0 + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.left: styleData.horizontal ? parent.left : undefined + width: !styleData.horizontal && transientScrollBars ? sticky ? 13 : 10 : parent.width + height: styleData.horizontal && transientScrollBars ? sticky ? 13 : 10 : parent.height + Behavior on width { enabled: !styleData.horizontal && transientScrollBars; NumberAnimation { duration: 100 } } + Behavior on height { enabled: styleData.horizontal && transientScrollBars; NumberAnimation { duration: 100 } } + } + onHoveredChanged: if (hovered) sticky = true + onVisibleChanged: if (!visible) sticky = false + } + + /*! This component controls the appearance of the + scroll bar increment button. + + You can access the following state properties: + + \table + \row \li property bool \b styleData.hovered + \row \li property bool \b styleData.pressed + \row \li property bool \b styleData.horizontal + \endtable + */ + property Component incrementControl: Rectangle { + visible: !transientScrollBars + implicitWidth: transientScrollBars ? 0 : Math.round(TextSingleton.implicitHeight) + implicitHeight: transientScrollBars ? 0 : Math.round(TextSingleton.implicitHeight) + Rectangle { + anchors.fill: parent + anchors.bottomMargin: -1 + anchors.rightMargin: -1 + border.color: "#aaa" + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + border.color: "#44ffffff" + } + Image { + source: styleData.horizontal ? "images/arrow-right.png" : "images/arrow-down.png" + anchors.centerIn: parent + opacity: control.enabled ? 0.6 : 0.5 + } + gradient: Gradient { + GradientStop {color: styleData.pressed ? "lightgray" : "white" ; position: 0} + GradientStop {color: styleData.pressed ? "lightgray" : "lightgray" ; position: 1} + } + } + } + + /*! This component controls the appearance of the + scroll bar decrement button. + + You can access the following state properties: + + \table + \row \li property bool \b styleData.hovered + \row \li property bool \b styleData.pressed + \row \li property bool \b styleData.horizontal + \endtable + */ + property Component decrementControl: Rectangle { + visible: !transientScrollBars + implicitWidth: transientScrollBars ? 0 : Math.round(TextSingleton.implicitHeight) + implicitHeight: transientScrollBars ? 0 : Math.round(TextSingleton.implicitHeight) + Rectangle { + anchors.fill: parent + anchors.topMargin: styleData.horizontal ? 0 : -1 + anchors.leftMargin: styleData.horizontal ? -1 : 0 + anchors.bottomMargin: styleData.horizontal ? -1 : 0 + anchors.rightMargin: styleData.horizontal ? 0 : -1 + color: "lightgray" + Rectangle { + anchors.fill: parent + anchors.margins: 1 + color: "transparent" + border.color: "#44ffffff" + } + Image { + source: styleData.horizontal ? "images/arrow-left.png" : "images/arrow-up.png" + anchors.centerIn: parent + anchors.verticalCenterOffset: styleData.horizontal ? 0 : -1 + anchors.horizontalCenterOffset: styleData.horizontal ? -1 : 0 + opacity: control.enabled ? 0.6 : 0.5 + } + gradient: Gradient { + GradientStop {color: styleData.pressed ? "lightgray" : "white" ; position: 0} + GradientStop {color: styleData.pressed ? "lightgray" : "lightgray" ; position: 1} + } + border.color: "#aaa" + } + } + + /*! \internal */ + property Component __scrollbar: Item { + id: panel + property string activeControl: "none" + property bool scrollToClickPosition: true + property bool isTransient: transientScrollBars + + property bool on: false + property bool raised: false + property bool sunken: __styleData.upPressed | __styleData.downPressed | __styleData.handlePressed + + states: State { + name: "out" + when: isTransient && panel.activeControl === "none" && !panel.on && !panel.raised + PropertyChanges { target: panel; opacity: 0 } + } + + transitions: Transition { + to: "out" + SequentialAnimation { + PauseAnimation { duration: 450 } + NumberAnimation { properties: "opacity"; duration: 200 } + PropertyAction { target: panel; property: "visible"; value: false } + } + } + + implicitWidth: __styleData.horizontal ? 200 : bg.implicitWidth + implicitHeight: __styleData.horizontal ? bg.implicitHeight : 200 + + function pixelMetric(arg) { + if (arg === "scrollbarExtent") + return (__styleData.horizontal ? bg.height : bg.width); + return 0; + } + + function styleHint(arg) { + return false; + } + + function hitTest(argX, argY) { + if (itemIsHit(handleControl, argX, argY)) + return "handle" + else if (itemIsHit(incrementLoader, argX, argY)) + return "up"; + else if (itemIsHit(decrementLoader, argX, argY)) + return "down"; + else if (itemIsHit(bg, argX, argY)) { + if (__styleData.horizontal && argX < handleControl.x || !__styleData.horizontal && argY < handleControl.y) + return "upPage" + else + return "downPage" + } + + return "none"; + } + + function subControlRect(arg) { + if (arg === "handle") { + return Qt.rect(handleControl.x, handleControl.y, handleControl.width, handleControl.height); + } else if (arg === "groove") { + if (__styleData.horizontal) { + return Qt.rect(incrementLoader.width - handleOverlap, + 0, + __control.width - (incrementLoader.width + decrementLoader.width - handleOverlap * 2), + __control.height); + } else { + return Qt.rect(0, + incrementLoader.height - handleOverlap, + __control.width, + __control.height - (incrementLoader.height + decrementLoader.height - handleOverlap * 2)); + } + } + return Qt.rect(0,0,0,0); + } + + function itemIsHit(argItem, argX, argY) { + var pos = argItem.mapFromItem(__control, argX, argY); + return (pos.x >= 0 && pos.x <= argItem.width && pos.y >= 0 && pos.y <= argItem.height); + } + + Loader { + id: incrementLoader + anchors.top: parent.top + anchors.left: parent.left + sourceComponent: decrementControl + property QtObject styleData: QtObject { + readonly property bool hovered: activeControl === "up" + readonly property bool pressed: __styleData.upPressed + readonly property bool horizontal: __styleData.horizontal + } + } + + Loader { + id: bg + anchors.top: __styleData.horizontal ? undefined : incrementLoader.bottom + anchors.bottom: __styleData.horizontal ? undefined : decrementLoader.top + anchors.left: __styleData.horizontal ? incrementLoader.right : undefined + anchors.right: __styleData.horizontal ? decrementLoader.left : undefined + sourceComponent: scrollBarBackground + property QtObject styleData: QtObject { + readonly property bool horizontal: __styleData.horizontal + readonly property bool hovered: activeControl !== "none" + } + } + + Loader { + id: decrementLoader + anchors.bottom: __styleData.horizontal ? undefined : parent.bottom + anchors.right: __styleData.horizontal ? parent.right : undefined + sourceComponent: incrementControl + property QtObject styleData: QtObject { + readonly property bool hovered: activeControl === "down" + readonly property bool pressed: __styleData.downPressed + readonly property bool horizontal: __styleData.horizontal + } + } + + property var flickableItem: control.flickableItem + property int extent: Math.max(minimumHandleLength, __styleData.horizontal ? + (flickableItem ? flickableItem.width/flickableItem.contentWidth : 0 ) * bg.width : + (flickableItem ? flickableItem.height/flickableItem.contentHeight : 0) * bg.height) + + Loader { + id: handleControl + height: __styleData.horizontal ? implicitHeight : extent + width: __styleData.horizontal ? extent : implicitWidth + anchors.top: bg.top + anchors.left: bg.left + anchors.topMargin: __styleData.horizontal ? 0 : -handleOverlap + (__control.value / __control.maximumValue) * (bg.height + 2 * handleOverlap- height) + anchors.leftMargin: __styleData.horizontal ? -handleOverlap + (__control.value / __control.maximumValue) * (bg.width + 2 * handleOverlap - width) : 0 + sourceComponent: handle + property QtObject styleData: QtObject { + readonly property bool hovered: activeControl === "handle" + readonly property bool pressed: __styleData.handlePressed + readonly property bool horizontal: __styleData.horizontal + } + readonly property alias __activeControl: panel.activeControl + } + } + + /*! \internal */ + property bool __externalScrollBars: false + /*! \internal */ + property int __scrollBarSpacing: 4 +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SliderStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SliderStyle.qml new file mode 100644 index 00000000000..a62230bcf52 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SliderStyle.qml @@ -0,0 +1,234 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype SliderStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup controlsstyling + \brief Provides custom styling for Slider + + The slider style allows you to create a custom appearance for + a \l Slider control. + + The implicit size of the slider is calculated based on the + maximum implicit size of the \c background and \c handle + delegates combined. + + Example: + \qml + Slider { + anchors.centerIn: parent + style: SliderStyle { + groove: Rectangle { + implicitWidth: 200 + implicitHeight: 8 + color: "gray" + radius: 8 + } + handle: Rectangle { + anchors.centerIn: parent + color: control.pressed ? "white" : "lightgray" + border.color: "gray" + border.width: 2 + width: 34 + height: 34 + radius: 12 + } + } + } + \endqml +*/ +Style { + id: styleitem + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + /*! The \l Slider attached to this style. */ + readonly property Slider control: __control + + padding { top: 0 ; left: 0 ; right: 0 ; bottom: 0 } + + /*! This property holds the item for the slider handle. + You can access the slider through the \c control property + */ + property Component handle: Item{ + implicitWidth: implicitHeight + implicitHeight: TextSingleton.implicitHeight * 1.2 + + FastGlow { + source: handle + anchors.fill: parent + anchors.bottomMargin: -1 + anchors.topMargin: 1 + smooth: true + color: "#11000000" + spread: 0.8 + transparentBorder: true + blur: 0.1 + + } + Rectangle { + id: handle + anchors.fill: parent + + radius: width/2 + gradient: Gradient { + GradientStop { color: control.pressed ? "#e0e0e0" : "#fff" ; position: 1 } + GradientStop { color: "#eee" ; position: 0 } + } + Rectangle { + anchors.fill: parent + anchors.margins: 1 + radius: width/2 + border.color: "#99ffffff" + color: control.activeFocus ? "#224f7fbf" : "transparent" + } + border.color: control.activeFocus ? "#47b" : "#777" + } + + } + /*! This property holds the background groove of the slider. + + You can access the handle position through the \c styleData.handlePosition property. + */ + property Component groove: Item { + property color fillColor: "#49d" + anchors.verticalCenter: parent.verticalCenter + implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5) + implicitHeight: Math.max(6, Math.round(TextSingleton.implicitHeight * 0.3)) + Rectangle { + radius: height/2 + anchors.fill: parent + border.width: 1 + border.color: "#888" + gradient: Gradient { + GradientStop { color: "#bbb" ; position: 0 } + GradientStop { color: "#ccc" ; position: 0.6 } + GradientStop { color: "#ccc" ; position: 1 } + } + } + Item { + clip: true + width: styleData.handlePosition + height: parent.height + Rectangle { + anchors.fill: parent + border.color: Qt.darker(fillColor, 1.2) + radius: height/2 + gradient: Gradient { + GradientStop {color: Qt.lighter(fillColor, 1.3) ; position: 0} + GradientStop {color: fillColor ; position: 1.4} + } + } + } + } + + /*! This property holds the tick mark labels + \since QtQuick.Controls.Styles 1.1 + + You can access the handle width through the \c styleData.handleWidth property. + */ + property Component tickmarks: Repeater { + id: repeater + model: control.stepSize > 0 ? 1 + (control.maximumValue - control.minimumValue) / control.stepSize : 0 + Rectangle { + color: "#777" + width: 1 ; height: 3 + y: repeater.height + x: styleData.handleWidth / 2 + index * ((repeater.width - styleData.handleWidth) / (repeater.count-1)) + } + } + + /*! This property holds the slider style panel. + + Note that it is generally not recommended to override this. + */ + property Component panel: Item { + id: root + property int handleWidth: handleLoader.width + property int handleHeight: handleLoader.height + + property bool horizontal : control.orientation === Qt.Horizontal + property int horizontalSize: grooveLoader.implicitWidth + padding.left + padding.right + property int verticalSize: Math.max(handleLoader.implicitHeight, grooveLoader.implicitHeight) + padding.top + padding.bottom + + implicitWidth: horizontal ? horizontalSize : verticalSize + implicitHeight: horizontal ? verticalSize : horizontalSize + + y: horizontal ? 0 : height + rotation: horizontal ? 0 : -90 + transformOrigin: Item.TopLeft + + Item { + + anchors.fill: parent + + Loader { + id: grooveLoader + property QtObject styleData: QtObject { + readonly property int handlePosition: handleLoader.x + handleLoader.width/2 + } + x: padding.left + sourceComponent: groove + width: (horizontal ? parent.width : parent.height) - padding.left - padding.right + y: Math.round(padding.top + (Math.round(horizontal ? parent.height : parent.width - padding.top - padding.bottom) - grooveLoader.item.height)/2) + } + Loader { + id: tickMarkLoader + anchors.fill: parent + sourceComponent: control.tickmarksEnabled ? tickmarks : null + property QtObject styleData: QtObject { readonly property int handleWidth: control.__panel.handleWidth } + } + Loader { + id: handleLoader + sourceComponent: handle + anchors.verticalCenter: grooveLoader.verticalCenter + x: Math.round((control.__handlePos - control.minimumValue) / (control.maximumValue - control.minimumValue) * ((horizontal ? root.width : root.height) - item.width)) + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SpinBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SpinBoxStyle.qml new file mode 100644 index 00000000000..9f1b565d324 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SpinBoxStyle.qml @@ -0,0 +1,207 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype SpinBoxStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.2 + \ingroup controlsstyling + \brief Provides custom styling for SpinBox + + Example: + \qml + SpinBox { + style: SpinBoxStyle{ + background: Rectangle { + implicitWidth: 100 + implicitHeight: 20 + border.color: "gray" + radius: 2 + } + } + } + \endqml +*/ + +Style { + id: spinboxStyle + + /*! The \l SpinBox attached to this style. */ + readonly property SpinBox control: __control + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + + /*! The content margins of the text field. */ + padding { top: 1 ; left: Math.round(TextSingleton.implicitHeight/2) ; right: Math.round(TextSingleton.implicitHeight) ; bottom: 0 } + + /*! \qmlproperty enumeration horizontalAlignment + + This property defines the default text aligment. + + The supported values are: + \list + \li Qt.AlignLeft + \li Qt.AlignHCenter + \li Qt.AlignRight + \endlist + + The default value is Qt.AlignRight + */ + property int horizontalAlignment: Qt.AlignRight + + /*! The text color. */ + property color textColor: __syspal.text + + /*! The text highlight color, used behind selections. */ + property color selectionColor: __syspal.highlight + + /*! The highlighted text color, used in selections. */ + property color selectedTextColor: __syspal.highlightedText + + /*! + \qmlproperty enumeration renderType + + Override the default rendering type for the control. + + Supported render types are: + \list + \li Text.QtRendering + \li Text.NativeRendering - the default + \endlist + + \sa Text::renderType + */ + property int renderType: Text.NativeRendering + + /*! The button used to increment the value. */ + property Component incrementControl: Item { + implicitWidth: padding.right + Image { + source: "images/arrow-up.png" + anchors.centerIn: parent + anchors.verticalCenterOffset: 1 + opacity: control.enabled ? (styleData.upPressed ? 1 : 0.6) : 0.5 + } + } + + /*! The button used to decrement the value. */ + property Component decrementControl: Item { + implicitWidth: padding.right + Image { + source: "images/arrow-down.png" + anchors.centerIn: parent + anchors.verticalCenterOffset: -2 + opacity: control.enabled ? (styleData.downPressed ? 1 : 0.6) : 0.5 + } + } + + /*! The background of the SpinBox. */ + property Component background: Item { + implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2)) + implicitWidth: styleData.contentWidth + 26 + Rectangle { + anchors.fill: parent + anchors.bottomMargin: -1 + color: "#44ffffff" + radius: baserect.radius + } + Rectangle { + id: baserect + gradient: Gradient { + GradientStop {color: "#eee" ; position: 0} + GradientStop {color: "#fff" ; position: 0.1} + GradientStop {color: "#fff" ; position: 1} + } + radius: TextSingleton.implicitHeight * 0.16 + anchors.fill: parent + border.color: control.activeFocus ? "#47b" : "#999" + } + } + + /*! \internal */ + property Component panel: Item { + id: styleitem + implicitWidth: backgroundLoader.implicitWidth + implicitHeight: backgroundLoader.implicitHeight + + property color foregroundColor: spinboxStyle.textColor + property color selectionColor: spinboxStyle.selectionColor + property color selectedTextColor: spinboxStyle.selectedTextColor + + property var margins: spinboxStyle.padding + + property rect upRect: Qt.rect(width - incrementControlLoader.implicitWidth, 0, incrementControlLoader.implicitWidth, height / 2 + 1) + property rect downRect: Qt.rect(width - decrementControlLoader.implicitWidth, height / 2, decrementControlLoader.implicitWidth, height / 2) + + property int horizontalAlignment: spinboxStyle.horizontalAlignment + property int verticalAlignment: Qt.AlignVCenter + + Loader { + id: backgroundLoader + anchors.fill: parent + sourceComponent: background + } + + Loader { + id: incrementControlLoader + x: upRect.x + y: upRect.y + width: upRect.width + height: upRect.height + sourceComponent: incrementControl + } + + Loader { + id: decrementControlLoader + x: downRect.x + y: downRect.y + width: downRect.width + height: downRect.height + sourceComponent: decrementControl + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/StatusBarStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/StatusBarStyle.qml new file mode 100644 index 00000000000..aa8f6d6e9f6 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/StatusBarStyle.qml @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype StatusBarStyle + \inqmlmodule QtQuick.Controls.Styles + \ingroup controlsstyling + \since 5.2 + \brief Provides custom styling for StatusBar + + The status bar can be defined by overriding the background component and + setting the content padding. + + Example: + \qml + StatusBar { + style: StatusBarStyle { + padding { + left: 8 + right: 8 + top: 3 + bottom: 3 + } + background: Rectangle { + implicitHeight: 16 + implicitWidth: 200 + gradient: Gradient{ + GradientStop{color: "#eee" ; position: 0} + GradientStop{color: "#ccc" ; position: 1} + } + Rectangle { + anchors.top: parent.top + width: parent.width + height: 1 + color: "#999" + } + } + } + } + \endqml +*/ + +Style { + + /*! The content padding inside the status bar. */ + padding { + left: 3 + right: 3 + top: 3 + bottom: 2 + } + + /*! This defines the background of the tool bar. */ + property Component background: Rectangle { + implicitHeight: 16 + implicitWidth: 200 + + gradient: Gradient{ + GradientStop{color: "#eee" ; position: 0} + GradientStop{color: "#ccc" ; position: 1} + } + + Rectangle { + anchors.top: parent.top + width: parent.width + height: 1 + color: "#999" + } + } + + property Component panel: Loader { + sourceComponent: background + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SwitchStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SwitchStyle.qml new file mode 100644 index 00000000000..687966453e9 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/SwitchStyle.qml @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.2 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype SwitchStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.2 + \ingroup controlsstyling + \brief Provides custom styling for Switch + + Example: + \qml + Switch { + style: SwitchStyle { + groove: Rectangle { + implicitWidth: 100 + implicitHeight: 20 + radius: 9 + border.color: control.activeFocus ? "darkblue" : "gray" + border.width: 1 + } + } + } + \endqml +*/ +Style { + id: switchstyle + + /*! The content padding. */ + padding { + top: 0 + left: 0 + right: 0 + bottom: 0 + } + + /*! This defines the switch handle. */ + property Component handle: Rectangle { + opacity: control.enabled ? 1.0 : 0.5 + implicitWidth: Math.round((parent.parent.width - padding.left - padding.right)/2) + implicitHeight: control.height - padding.top - padding.bottom + + border.color: control.activeFocus ? Qt.darker(__syspal.highlight, 2) : Qt.darker(__syspal.button, 2) + property color bg: control.activeFocus ? Qt.darker(__syspal.highlight, 1.2) : __syspal.button + gradient: Gradient { + GradientStop {color: Qt.lighter(bg, 1.4) ; position: 0} + GradientStop {color: bg ; position: 1} + } + + radius: 2 + } + + /*! This property holds the background groove of the switch. */ + property Component groove: Rectangle { + property color shadow: control.checked ? Qt.darker(__syspal.highlight, 1.2): "#999" + property color bg: control.checked ? __syspal.highlight:"#bbb" + + implicitWidth: Math.round(implicitHeight * 3) + implicitHeight: Math.max(16, Math.round(TextSingleton.implicitHeight)) + + border.color: "gray" + color: "red" + + radius: 2 + Behavior on shadow {ColorAnimation{ duration: 80 }} + Behavior on bg {ColorAnimation{ duration: 80 }} + gradient: Gradient { + GradientStop {color: shadow; position: 0} + GradientStop {color: bg ; position: 0.2} + GradientStop {color: bg ; position: 1} + } + Rectangle { + color: "#44ffffff" + height: 1 + anchors.bottom: parent.bottom + anchors.bottomMargin: -1 + width: parent.width - 2 + x: 1 + } + } + + /*! \internal */ + property Component panel: Item { + + implicitWidth: Math.round(grooveLoader.width + padding.left + padding.right) + implicitHeight: grooveLoader.implicitHeight + padding.top + padding.bottom + + property var __groove: grooveLoader + property var __handle: handleLoader + property bool enableAnimation: false + + Loader { + id: grooveLoader + y: padding.top + x: padding.left + + sourceComponent: groove + anchors.verticalCenter: parent.verticalCenter + + + Loader { + id: handleLoader + + z:1 + anchors.top: grooveLoader.top + anchors.bottom: grooveLoader.bottom + anchors.topMargin: padding.top + anchors.bottomMargin: padding.bottom + + Behavior on x { + id: behavior + enabled: enableAnimation + NumberAnimation { + duration: 150 + easing.type: Easing.OutCubic + } + } + + sourceComponent: handle + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TabViewStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TabViewStyle.qml new file mode 100644 index 00000000000..430dd02fa47 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TabViewStyle.qml @@ -0,0 +1,190 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype TabViewStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup viewsstyling + \brief Provides custom styling for TabView + +\qml + TabView { + id: frame + anchors.fill: parent + anchors.margins: 4 + Tab { title: "Tab 1" } + Tab { title: "Tab 2" } + Tab { title: "Tab 3" } + + style: TabViewStyle { + frameOverlap: 1 + tab: Rectangle { + color: styleData.selected ? "steelblue" :"lightsteelblue" + border.color: "steelblue" + implicitWidth: Math.max(text.width + 4, 80) + implicitHeight: 20 + radius: 2 + Text { + id: text + anchors.centerIn: parent + text: styleData.title + color: styleData.selected ? "white" : "black" + } + } + frame: Rectangle { color: "steelblue" } + } + } +\endqml + +*/ + +Style { + + /*! The \l ScrollView attached to this style. */ + readonly property TabView control: __control + + /*! This property holds whether the user can move the tabs. + Tabs are not movable by default. */ + property bool tabsMovable: false + + /*! This property holds the horizontal alignment of + the tab buttons. Supported values are: + \list + \li Qt.AlignLeft (default) + \li Qt.AlignHCenter + \li Qt.AlignRight + \endlist + */ + property int tabsAlignment: Qt.AlignLeft + + /*! This property holds the amount of overlap there are between + individual tab buttons. */ + property int tabOverlap: 1 + + /*! This property holds the amount of overlap there are between + individual tab buttons and the frame. */ + property int frameOverlap: 2 + + /*! This defines the tab frame. */ + property Component frame: Rectangle { + color: "#dcdcdc" + border.color: "#aaa" + + Rectangle { + anchors.fill: parent + color: "transparent" + border.color: "#66ffffff" + anchors.margins: 1 + } + } + + /*! This defines the tab. You can access the tab state through the + \c styleData property, with the following properties: + + \table + \row \li readonly property int \b styleData.index \li This is the current tab index. + \row \li readonly property bool \b styleData.selected \li This is the active tab. + \row \li readonly property string \b styleData.title \li Tab title text. + \row \li readonly property bool \b styleData.nextSelected \li The next tab is selected. + \row \li readonly property bool \b styleData.previousSelected \li The previous tab is selected. + \row \li readonly property bool \b styleData.hovered \li The tab is being hovered. + \row \li readonly property bool \b styleData.activeFocus \li The tab button has keyboard focus. + \row \li readonly property bool \b styleData.availableWidth \li The available width for the tabs. + \endtable + */ + property Component tab: Item { + scale: control.tabPosition === Qt.TopEdge ? 1 : -1 + + property int totalOverlap: tabOverlap * (control.count - 1) + property real maxTabWidth: (styleData.availableWidth + totalOverlap) / control.count + + implicitWidth: Math.round(Math.min(maxTabWidth, textitem.implicitWidth + 20)) + implicitHeight: Math.round(textitem.implicitHeight + 10) + + clip: true + Item { + anchors.fill: parent + anchors.bottomMargin: styleData.selected ? 0 : 2 + clip: true + BorderImage { + anchors.fill: parent + source: styleData.selected ? "images/tab_selected.png" : "images/tab.png" + border.top: 6 + border.bottom: 6 + border.left: 6 + border.right: 6 + anchors.topMargin: styleData.selected ? 0 : 1 + } + } + Rectangle { + anchors.fill: textitem + anchors.margins: -1 + anchors.leftMargin: -3 + anchors.rightMargin: -3 + visible: (styleData.activeFocus && styleData.selected) + height: 6 + radius: 3 + color: "#224f9fef" + border.color: "#47b" + } + Text { + id: textitem + anchors.centerIn: parent + anchors.alignWhenCentered: true + text: styleData.title + renderType: Text.NativeRendering + scale: control.tabPosition === Qt.TopEdge ? 1 : -1 + color: __syspal.text + } + } + + /*! This defines the left corner. */ + property Component leftCorner: null + + /*! This defines the right corner. */ + property Component rightCorner: null + + /*! This defines the tab bar background. */ + property Component tabBar: null +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TableViewStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TableViewStyle.qml new file mode 100644 index 00000000000..512b0cfef7d --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TableViewStyle.qml @@ -0,0 +1,142 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype TableViewStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup viewsstyling + \brief Provides custom styling for TableView + + Note that this class derives from \l ScrollViewStyle + and supports all of the properties defined there. +*/ +ScrollViewStyle { + id: root + + /*! The \l TableView attached to this style. */ + readonly property TableView control: __control + + /*! The text color. */ + property color textColor: __syspal.text + + /*! The background color. */ + property color backgroundColor: control.backgroundVisible ? __syspal.base : "transparent" + + /*! The alternate background color. */ + property color alternateBackgroundColor: "#f5f5f5" + + /*! The text highlight color, used within selections. */ + property color highlightedTextColor: "white" + + /*! Activates items on single click. */ + property bool activateItemOnSingleClick: false + + padding.top: control.headerVisible ? 0 : 1 + + /*! \qmlproperty Component TableViewStyle::headerDelegate + Delegate for header. This delegate is described in \l {TableView::headerDelegate} + */ + property Component headerDelegate: BorderImage { + height: textItem.implicitHeight * 1.2 + source: "images/header.png" + border.left: 4 + border.bottom: 2 + border.top: 2 + Text { + id: textItem + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignLeft + anchors.leftMargin: 12 + text: styleData.value + elide: Text.ElideRight + color: textColor + renderType: Text.NativeRendering + } + Rectangle { + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.bottomMargin: 1 + anchors.topMargin: 1 + width: 1 + color: "#ccc" + } + } + + /*! \qmlproperty Component TableViewStyle::rowDelegate + Delegate for header. This delegate is described in \l {TableView::rowDelegate} + */ + property Component rowDelegate: Rectangle { + height: Math.round(TextSingleton.implicitHeight * 1.2) + property color selectedColor: styleData.hasActiveFocus ? "#07c" : "#999" + color: styleData.selected ? selectedColor : + !styleData.alternate ? alternateBackgroundColor : backgroundColor + } + + /*! \qmlproperty Component TableViewStyle::itemDelegate + Delegate for item. This delegate is described in \l {TableView::itemDelegate} + */ + property Component itemDelegate: Item { + height: Math.max(16, label.implicitHeight) + property int implicitWidth: label.implicitWidth + 20 + + Text { + id: label + objectName: "label" + width: parent.width + anchors.leftMargin: 12 + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: styleData.textAlignment + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: 1 + elide: styleData.elideMode + text: styleData.value !== undefined ? styleData.value : "" + color: styleData.textColor + renderType: Text.NativeRendering + } + } +} + diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TextAreaStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TextAreaStyle.qml new file mode 100644 index 00000000000..c974c01dac7 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TextAreaStyle.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype TextAreaStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.2 + \ingroup controlsstyling + \brief Provides custom styling for TextArea. + + Example: + \qml + TextArea { + style: TextAreaStyle { + textColor: "#333" + selectionColor: "steelblue" + selectedTextColor: "#eee" + backgroundColor: "#eee" + } + } + \endqml +*/ + +ScrollViewStyle { + id: style + + /*! The \l TextArea attached to this style. */ + readonly property TextArea control: __control + + /*! The current font. */ + property font font + + /*! The text color. */ + property color textColor: __syspal.text + + /*! The text highlight color, used behind selections. */ + property color selectionColor: __syspal.highlight + + /*! The highlighted text color, used in selections. */ + property color selectedTextColor: __syspal.highlightedText + + /*! The background color. */ + property color backgroundColor: control.backgroundVisible ? __syspal.base : "transparent" + + /*! + \qmlproperty enumeration renderType + + Override the default rendering type for the control. + + Supported render types are: + \list + \li Text.QtRendering + \li Text.NativeRendering - the default + \endlist + + \sa Text::renderType + */ + property int renderType: Text.NativeRendering +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TextFieldStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TextFieldStyle.qml new file mode 100644 index 00000000000..8b4494d1864 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/TextFieldStyle.qml @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype TextFieldStyle + \inqmlmodule QtQuick.Controls.Styles + \since 5.1 + \ingroup controlsstyling + \brief Provides custom styling for TextField. + + Example: + \qml + TextField { + style: TextFieldStyle { + textColor: "black" + background: Rectangle { + radius: 2 + implicitWidth: 100 + implicitHeight: 24 + border.color: "#333" + border.width: 1 + } + } + } + \endqml +*/ + +Style { + id: style + + /*! \internal */ + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + /*! The \l TextField attached to this style. */ + readonly property TextField control: __control + + /*! The content margins of the text field. */ + padding { top: 4 ; left: TextSingleton.implicitHeight/3 ; right: TextSingleton.implicitHeight/3 ; bottom:4 } + + /*! The current font. */ + property font font + + /*! The text color. */ + property color textColor: __syspal.text + + /*! The text highlight color, used behind selections. */ + property color selectionColor: __syspal.highlight + + /*! The highlighted text color, used in selections. */ + property color selectedTextColor: __syspal.highlightedText + + /*! + \qmlproperty enumeration renderType + + Override the default rendering type for the control. + + Supported render types are: + \list + \li Text.QtRendering + \li Text.NativeRendering - the default + \endlist + + \sa Text::renderType + */ + property int renderType: Text.NativeRendering + + /*! The placeholder text color, used when the text field is empty. + \since 5.2 + */ + property color placeholderTextColor: Qt.rgba(0, 0, 0, 0.5) + + /*! The background of the text field. */ + property Component background: Item { + implicitWidth: Math.round(TextSingleton.implicitHeight * 8) + implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2)) + Rectangle { + anchors.fill: parent + anchors.bottomMargin: -1 + color: "#44ffffff" + radius: baserect.radius + } + Rectangle { + id: baserect + gradient: Gradient { + GradientStop {color: "#e0e0e0" ; position: 0} + GradientStop {color: "#fff" ; position: 0.1} + GradientStop {color: "#fff" ; position: 1} + } + radius: TextSingleton.implicitHeight * 0.16 + anchors.fill: parent + border.color: control.activeFocus ? "#47b" : "#999" + } + } + + /*! \internal */ + property Component panel: Item { + anchors.fill: parent + + property int topMargin: padding.top + property int leftMargin: padding.left + property int rightMargin: padding.right + property int bottomMargin: padding.bottom + + property color textColor: style.textColor + property color selectionColor: style.selectionColor + property color selectedTextColor: style.selectedTextColor + + implicitWidth: backgroundLoader.implicitWidth ? backgroundLoader.implicitWidth : 100 + implicitHeight: backgroundLoader.implicitHeight ? backgroundLoader.implicitHeight : 20 + + property color placeholderTextColor: style.placeholderTextColor + property font font: style.font + + Loader { + id: backgroundLoader + sourceComponent: background + anchors.fill: parent + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ToolBarStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ToolBarStyle.qml new file mode 100644 index 00000000000..ca5d93fbae0 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ToolBarStyle.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ToolBarStyle + \inqmlmodule QtQuick.Controls.Styles + \ingroup controlsstyling + \since 5.2 + \brief Provides custom styling for ToolBar + + The tool bar can be defined by overriding the background component and + setting the content padding. + + Example: + \qml + ToolBar { + style: ToolBarStyle { + padding { + left: 8 + right: 8 + top: 3 + bottom: 3 + } + background: Rectangle { + implicitWidth: 100 + implicitHeight: 40 + border.color: "#999" + gradient: Gradient { + GradientStop { position: 0 ; color: "#fff" } + GradientStop { position: 1 ; color: "#eee" } + } + } + } + } + \endqml +*/ + +Style { + + /*! The content padding inside the tool bar. */ + padding { + left: 6 + right: 6 + top: 3 + bottom: 3 + } + + /*! This defines the background of the tool bar. */ + property Component background: Item { + implicitHeight: 40 + implicitWidth: 200 + Rectangle { + anchors.fill: parent + gradient: Gradient{ + GradientStop{color: "#eee" ; position: 0} + GradientStop{color: "#ccc" ; position: 1} + } + Rectangle { + anchors.bottom: parent.bottom + width: parent.width + height: 1 + color: "#999" + } + } + } + + property Component panel: Loader { + sourceComponent: background + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ToolButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ToolButtonStyle.qml new file mode 100644 index 00000000000..dcdfe4dee8a --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Base/ToolButtonStyle.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ToolButtonStyle + \internal + \ingroup controlsstyling + \inqmlmodule QtQuick.Controls.Styles +*/ +Style { + readonly property ToolButton control: __control + property Component panel: Item { + id: styleitem + implicitWidth: (hasIcon ? 36 : Math.max(label.implicitWidth + frame.border.left + frame.border.right, 36)) + + (arrow.visible ? 10 : 0) + implicitHeight: hasIcon ? 36 : Math.max(label.implicitHeight, 36) + + readonly property bool hasIcon: icon.status === Image.Ready || icon.status === Image.Loading + + Rectangle { + anchors.fill: parent + visible: control.pressed || (control.checkable && control.checked) + color: "lightgray" + radius:4 + border.color: "#aaa" + } + Item { + anchors.left: parent.left + anchors.right: arrow.left + anchors.top: parent.top + anchors.bottom: parent.bottom + clip: true + Text { + id: label + visible: !hasIcon + anchors.centerIn: parent + text: control.text + } + Image { + id: icon + anchors.centerIn: parent + source: control.iconSource + } + } + + BorderImage { + id: frame + anchors.fill: parent + anchors.margins: -1 + anchors.topMargin: -2 + anchors.rightMargin: 0 + source: "images/focusframe.png" + visible: control.activeFocus + border.left: 4 + border.right: 4 + border.top: 4 + border.bottom: 4 + } + + Image { + id: arrow + visible: control.menu !== null + source: visible ? "images/arrow-down.png" : "" + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: visible ? 3 : 0 + opacity: control.enabled ? 0.7 : 0.5 + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/BusyIndicatorStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/BusyIndicatorStyle.qml new file mode 100644 index 00000000000..99f37919f91 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/BusyIndicatorStyle.qml @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick.Controls.Styles 1.1 + +BusyIndicatorStyle { } diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ButtonStyle.qml new file mode 100644 index 00000000000..33e8f0eeda3 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ButtonStyle.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + property Component panel: StyleItem { + id: styleitem + elementType: "button" + sunken: control.pressed || (control.checkable && control.checked) + raised: !(control.pressed || (control.checkable && control.checked)) + hover: control.hovered + text: control.iconSource === "" ? "" : control.text + hasFocus: control.activeFocus + hints: control.styleHints + // If no icon, let the style do the drawing + activeControl: control.isDefault ? "default" : "f" + + properties: { + "icon": control.__iconAction.__icon, + "menu": control.menu + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/CheckBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/CheckBoxStyle.qml new file mode 100644 index 00000000000..819c6a81988 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/CheckBoxStyle.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + property Component panel: Item { + anchors.fill: parent + + implicitWidth: styleitem.implicitWidth + implicitHeight: styleitem.implicitHeight + baselineOffset: styleitem.baselineOffset + StyleItem { + id: styleitem + elementType: "checkbox" + sunken: control.pressed + on: control.checked || control.pressed + hover: control.hovered + enabled: control.enabled + hasFocus: control.activeFocus && styleitem.style == "mac" + hints: control.styleHints + properties: {"partiallyChecked": (control.checkedState === Qt.PartiallyChecked) } + contentHeight: textitem.implicitHeight + contentWidth: textitem.implicitWidth + indicatorWidth + property int indicatorWidth: pixelMetric("indicatorwidth") + (macStyle ? 2 : 4) + property bool macStyle: (style === "mac") + + Text { + id: textitem + text: control.text + anchors.left: parent.left + anchors.leftMargin: parent.indicatorWidth + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: parent.macStyle ? 1 : 0 + anchors.right: parent.right + renderType: Text.NativeRendering + elide: Text.ElideRight + enabled: control.enabled + color: __syspal.windowText + StyleItem { + elementType: "focusrect" + anchors.margins: -1 + anchors.leftMargin: -2 + anchors.top: parent.top + anchors.left: parent.left + anchors.bottom: parent.bottom + width: textitem.implicitWidth + 3 + visible: control.activeFocus + } + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ComboBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ComboBoxStyle.qml new file mode 100644 index 00000000000..b36b4c1ddc8 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ComboBoxStyle.qml @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Window 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Controls.Private 1.0 +import "." as Desktop + +Style { + readonly property ComboBox control: __control + property int drowDownButtonWidth: 24 + property Component panel: Item { + property bool popup: !!styleItem.styleHint("comboboxpopup") + + implicitWidth: 125 + implicitHeight: styleItem.implicitHeight + baselineOffset: styleItem.baselineOffset + anchors.fill: parent + StyleItem { + id: styleItem + + height: parent.height + width: parent.width + elementType: "combobox" + sunken: control.pressed + raised: !sunken + hover: control.hovered + enabled: control.enabled + // The style makes sure the text rendering won't overlap the decoration. + // In that case, 35 pixels margin in this case looks good enough. Worst + // case, the ellipsis will be truncated (2nd worst, not visible at all). + text: elidedText(control.currentText, Text.ElideRight, parent.width - 35) + hasFocus: control.activeFocus + // contentHeight as in QComboBox + contentHeight: Math.max(Math.ceil(textHeight("")), 14) + 2 + + hints: control.styleHints + properties: { + "popup": control.__popup, + "editable" : control.editable + } + } + } + + property Component __popupStyle: MenuStyle { + __menuItemType: "comboboxitem" + } + + property Component __dropDownStyle: Style { + property Component frame: StyleItem { + elementType: "frame" + + width: (parent ? parent.contentWidth : 0) + height: (parent ? parent.contentHeight : 0) + 2 * pixelMetric("defaultframewidth") + property real maxHeight: 600 + property int margin: pixelMetric("menuvmargin") + pixelMetric("menupanelwidth") + } + + property Component menuItem: StyleItem { + elementType: "itemrow" + selected: parent ? parent.selected : false + + x: pixelMetric("defaultframewidth") + y: pixelMetric("defaultframewidth") + + implicitWidth: textItem.contentWidth + implicitHeight: textItem.contentHeight + + StyleItem { + id: textItem + elementType: "item" + contentWidth: textWidth(text) + contentHeight: textHeight(text) + text: parent && parent.parent ? parent.parent.text : "" + selected: parent ? parent.selected : false + } + } + + property Component scrollerStyle: Desktop.ScrollViewStyle { + property bool useScrollers: false + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/FocusFrameStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/FocusFrameStyle.qml new file mode 100644 index 00000000000..0bea860eee4 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/FocusFrameStyle.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype FocusFrameStyle + \internal + \inqmlmodule QtQuick.Controls.Styles +*/ +StyleItem { + property int margin: -3 + anchors.fill: parent + elementType: "focusframe" +} + + diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/GroupBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/GroupBoxStyle.qml new file mode 100644 index 00000000000..cfe02d3f178 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/GroupBoxStyle.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + + +Style { + readonly property GroupBox control: __control + + property var __style: StyleItem { id: style } + property int titleHeight: 18 + + Component.onCompleted: { + var stylename = __style.style + if (stylename.indexOf("windows") > -1) + titleHeight = 9 + } + + padding { + top: Math.round(Settings.dpiScaleFactor * (control.title.length > 0 || control.checkable ? titleHeight : 0) + (style.style == "mac" ? 9 : 6)) + left: Math.round(Settings.dpiScaleFactor * 8) + right: Math.round(Settings.dpiScaleFactor * 8) + bottom: Math.round(Settings.dpiScaleFactor * 7 + (style.style.indexOf("windows") > -1 ? 2 : 0)) + } + + property Component panel: StyleItem { + anchors.fill: parent + id: styleitem + elementType: "groupbox" + text: control.title + on: control.checked + hasFocus: control.__checkbox.activeFocus + activeControl: control.checkable ? "checkbox" : "" + properties: { "checkable" : control.checkable , "sunken" : !control.flat} + textureHeight: 128 + border {top: 32 ; bottom: 8} + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/MenuBarStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/MenuBarStyle.qml new file mode 100644 index 00000000000..a8b389c1a70 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/MenuBarStyle.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + + +Style { + property Component frame: StyleItem { + elementType: "menubar" + contentWidth: control.__contentItem.width + contentHeight: parent ? parent.contentHeight : 0 + width: implicitWidth + 2 * (pixelMetric("menubarhmargin") + pixelMetric("menubarpanelwidth")) + height: implicitHeight + 2 * (pixelMetric("menubarvmargin") + pixelMetric("menubarpanelwidth")) + + pixelMetric("spacebelowmenubar") + + Accessible.role: Accessible.MenuBar + } + + property Component menuItem: StyleItem { + elementType: "menubaritem" + x: pixelMetric("menubarhmargin") + pixelMetric("menubarpanelwidth") + y: pixelMetric("menubarvmargin") + pixelMetric("menubarpanelwidth") + + text: menuItem.title + contentWidth: textWidth(text) + contentHeight: textHeight(text) + width: implicitWidth + pixelMetric("menubaritemspacing") + + enabled: menuItem.enabled + selected: (parent && parent.selected) || sunken + sunken: parent && parent.sunken + + hints: { "showUnderlined": showUnderlined } + + Accessible.role: Accessible.MenuItem + Accessible.name: StyleHelpers.removeMnemonics(text) + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/MenuStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/MenuStyle.qml new file mode 100644 index 00000000000..ad04281de85 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/MenuStyle.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Window 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + id: styleRoot + + property string __menuItemType: "menuitem" + + property Component frame: StyleItem { + elementType: "menu" + + contentWidth: parent ? parent.contentWidth : 0 + contentHeight: parent ? parent.contentHeight : 0 + width: implicitWidth + height: implicitHeight + + property int subMenuOverlap: -2 * pixelMetric("menupanelwidth") + property real maxHeight: Screen.desktopAvailableHeight * 0.99 + property int margin: pixelMetric("menuvmargin") + pixelMetric("menupanelwidth") + + Rectangle { + visible: anchors.margins > 0 + anchors { + fill: parent + margins: pixelMetric("menupanelwidth") + } + color: __syspal.window + } + + Accessible.role: Accessible.PopupMenu + } + + property Component menuItem: StyleItem { + elementType: __menuItemType + x: pixelMetric("menuhmargin") + pixelMetric("menupanelwidth") + y: pixelMetric("menuvmargin") + + text: !!parent && parent.text + property string textAndShorcut: text + (properties.shortcut ? "\t" + properties.shortcut : "") + contentWidth: textWidth(textAndShorcut) + contentHeight: textHeight(textAndShorcut) + + enabled: !!parent && parent.enabled + selected: !!parent && parent.selected + on: !!menuItem && !!menuItem["checkable"] && menuItem.checked + + hints: { "showUnderlined": showUnderlined } + + properties: { + "checkable": !!menuItem && !!menuItem["checkable"], + "exclusive": !!menuItem && !!menuItem["exclusiveGroup"], + "shortcut": !!menuItem && menuItem["shortcut"] || "", + "isSubmenu": isSubmenu, + "scrollerDirection": scrollerDirection, + "icon": !!menuItem && menuItem.__icon + } + + Accessible.role: Accessible.MenuItem + Accessible.name: StyleHelpers.removeMnemonics(text) + } + + property Component scrollerStyle: Style { + padding { left: 0; right: 0; top: 0; bottom: 0 } + property bool scrollToClickedPosition: false + property Component frame: Item { visible: false } + property Component corner: Item { visible: false } + property Component __scrollbar: Item { visible: false } + property bool useScrollers: true + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ProgressBarStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ProgressBarStyle.qml new file mode 100644 index 00000000000..70fa0402476 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ProgressBarStyle.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + property Component panel: StyleItem { + anchors.fill: parent + elementType: "progressbar" + // XXX: since desktop uses int instead of real, the progressbar + // range [0..1] must be stretched to a good precision + property int factor : 1000 + property int decimals: 3 + value: indeterminate ? 0 : control.value.toFixed(decimals) * factor // does indeterminate value need to be 1 on windows? + minimum: indeterminate ? 0 : control.minimumValue.toFixed(decimals) * factor + maximum: indeterminate ? 0 : control.maximumValue.toFixed(decimals) * factor + enabled: control.enabled + horizontal: control.orientation === Qt.Horizontal + hints: control.styleHints + contentWidth: horizontal ? 200 : 23 + contentHeight: horizontal ? 23 : 200 + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/RadioButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/RadioButtonStyle.qml new file mode 100644 index 00000000000..4a00ee22a6d --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/RadioButtonStyle.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + readonly property RadioButton control: __control + property Component panel: Item { + anchors.fill: parent + + implicitWidth: styleitem.implicitWidth + implicitHeight: styleitem.implicitHeight + baselineOffset: styleitem.baselineOffset + + StyleItem { + id: styleitem + elementType: "radiobutton" + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: macStyle ? -1 : 0 + sunken: control.pressed + on: control.checked || control.pressed + hover: control.hovered + enabled: control.enabled + hasFocus: control.activeFocus && styleitem.style == "mac" + hints: control.styleHints + contentHeight: textitem.implicitHeight + contentWidth: textitem.implicitWidth + indicatorWidth + property int indicatorWidth: pixelMetric("indicatorwidth") + (macStyle ? 2 : 4) + property bool macStyle: (style === "mac") + + Text { + id: textitem + text: control.text + anchors.left: parent.left + anchors.leftMargin: parent.indicatorWidth + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: parent.macStyle ? 2 : 0 + anchors.right: parent.right + renderType: Text.NativeRendering + elide: Text.ElideRight + enabled: control.enabled + color: __syspal.windowText + StyleItem { + elementType: "focusrect" + anchors.margins: -1 + anchors.leftMargin: -2 + anchors.top: parent.top + anchors.left: parent.left + anchors.bottom: parent.bottom + width: textitem.implicitWidth + 3 + visible: control.activeFocus + } + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/RowItemSingleton.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/RowItemSingleton.qml new file mode 100644 index 00000000000..b78fc04335d --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/RowItemSingleton.qml @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +pragma Singleton +import QtQuick.Controls.Private 1.0 +StyleItem { + elementType: "itemrow" +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ScrollViewStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ScrollViewStyle.qml new file mode 100644 index 00000000000..22c28441643 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ScrollViewStyle.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + id: root + + padding { + property int frameWidth: __styleitem.pixelMetric("defaultframewidth") + left: frameWidth + top: frameWidth + bottom: frameWidth + right: frameWidth + } + + property StyleItem __styleitem: StyleItem { elementType: "frame" } + + property Component frame: StyleItem { + id: styleitem + elementType: "frame" + sunken: true + visible: control.frameVisible + textureHeight: 64 + textureWidth: 64 + border { + top: 16 + left: 16 + right: 16 + bottom: 16 + } + } + + property Component corner: StyleItem { elementType: "scrollareacorner" } + + readonly property bool __externalScrollBars: __styleitem.styleHint("externalScrollBars") + readonly property int __scrollBarSpacing: __styleitem.pixelMetric("scrollbarspacing") + readonly property bool scrollToClickedPosition: __styleitem.styleHint("scrollToClickPosition") !== 0 + + property Component __scrollbar: StyleItem { + anchors.fill:parent + elementType: "scrollbar" + hover: activeControl != "none" + activeControl: "none" + sunken: __styleData.upPressed | __styleData.downPressed | __styleData.handlePressed + minimum: __control.minimumValue + maximum: __control.maximumValue + value: __control.value + horizontal: __styleData.horizontal + enabled: __control.enabled + + implicitWidth: horizontal ? 200 : pixelMetric("scrollbarExtent") + implicitHeight: horizontal ? pixelMetric("scrollbarExtent") : 200 + } + +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SliderStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SliderStyle.qml new file mode 100644 index 00000000000..fd426e35b7e --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SliderStyle.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + readonly property Item control: __control + property Component panel: StyleItem { + elementType: "slider" + sunken: control.pressed + implicitWidth: 200 + contentHeight: horizontal ? 22 : 200 + contentWidth: horizontal ? 200 : 22 + + maximum: control.maximumValue*100 + minimum: control.minimumValue*100 + step: control.stepSize*100 + value: control.__handlePos*100 + horizontal: control.orientation === Qt.Horizontal + enabled: control.enabled + hasFocus: control.activeFocus + hints: control.styleHints + activeControl: control.tickmarksEnabled ? "ticks" : "" + property int handleWidth: 15 + property int handleHeight: 15 + } + padding { top: 0 ; left: 0 ; right: 0 ; bottom: 0 } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SpinBoxStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SpinBoxStyle.qml new file mode 100644 index 00000000000..5cf13ea8fa2 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SpinBoxStyle.qml @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + readonly property SpinBox control: __control + + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + + padding { + top: control.__panel ? control.__panel.topPadding + (styleitem.style === "mac" ? 2 : 0) : 0 + left: control.__panel ? control.__panel.leftPadding : 0 + right: control.__panel ? control.__panel.rightPadding : 0 + bottom: control.__panel ? control.__panel.bottomPadding : 0 + } + StyleItem {id: styleitem ; visible: false} + + property int renderType: Text.NativeRendering + + property Component panel: Item { + id: style + + property rect upRect + property rect downRect + + property int horizontalAlignment: Qt.platform.os === "osx" ? Qt.AlignRight : Qt.AlignLeft + property int verticalAlignment: Qt.AlignVCenter + + property color foregroundColor: __syspal.text + property color backgroundColor: __syspal.base + property color selectionColor: __syspal.highlight + property color selectedTextColor: __syspal.highlightedText + + property int topPadding: edit.anchors.topMargin + property int leftPadding: 3 + edit.anchors.leftMargin + property int rightPadding: 3 + edit.anchors.rightMargin + property int bottomPadding: edit.anchors.bottomMargin + + width: 100 + height: styleitem.implicitHeight + + implicitWidth: 2 + styleitem.implicitWidth + implicitHeight: styleitem.implicitHeight + baselineOffset: styleitem.baselineOffset + + Item { + id: edit + anchors.fill: parent + Rectangle { + color: "white" + anchors.fill: parent + anchors.margins: -1 + } + FocusFrame { + anchors.fill: parent + focusMargin:-6 + visible: spinbox.activeFocus && styleitem.styleHint("focuswidget") + } + } + + function updateRect() { + style.upRect = styleitem.subControlRect("up"); + style.downRect = styleitem.subControlRect("down"); + var inputRect = styleitem.subControlRect("edit"); + edit.anchors.topMargin = inputRect.y + edit.anchors.leftMargin = inputRect.x + edit.anchors.rightMargin = style.width - inputRect.width - edit.anchors.leftMargin + edit.anchors.bottomMargin = style.height - inputRect.height - edit.anchors.topMargin + } + + Component.onCompleted: updateRect() + onWidthChanged: updateRect() + onHeightChanged: updateRect() + + StyleItem { + id: styleitem + elementType: "spinbox" + anchors.fill: parent + sunken: (styleData.downEnabled && styleData.downPressed) || (styleData.upEnabled && styleData.upPressed) + hover: control.hovered + hints: control.styleHints + hasFocus: control.activeFocus + enabled: control.enabled + value: (styleData.upPressed ? 1 : 0) | + (styleData.downPressed ? 1<<1 : 0) | + (styleData.upEnabled ? (1<<2) : 0) | + (styleData.downEnabled ? (1<<3) : 0) + contentWidth: styleData.contentWidth + contentHeight: styleData.contentHeight + textureHeight: implicitHeight + border {top: 6 ; bottom: 6} + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/StatusBarStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/StatusBarStyle.qml new file mode 100644 index 00000000000..1a1c687ea46 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/StatusBarStyle.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype StatusBarStyle + \internal + \inqmlmodule QtQuick.Controls.Styles +*/ +Style { + + padding.left: 4 + padding.right: 4 + padding.top: 3 + padding.bottom: 2 + + property Component panel: StyleItem { + implicitHeight: 16 + implicitWidth: 200 + anchors.fill: parent + elementType: "statusbar" + textureWidth: 64 + border {left: 16 ; right: 16} + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SwitchStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SwitchStyle.qml new file mode 100644 index 00000000000..df9dd5bf963 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/SwitchStyle.qml @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.1 + +SwitchStyle { +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TabViewStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TabViewStyle.qml new file mode 100644 index 00000000000..cf61a4d16ea --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TabViewStyle.qml @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.1 +Style { + id: root + + property bool tabsMovable: false + property int tabsAlignment: __barstyle.styleHint("tabbaralignment") === "center" ? Qt.AlignHCenter : Qt.AlignLeft; + property int tabOverlap: __barstyle.pixelMetric("taboverlap"); + property int frameOverlap: __barstyle.pixelMetric("tabbaseoverlap"); + + property StyleItem __barstyle: StyleItem { + elementType: "tab" + properties: { "tabposition" : (control.tabPosition === Qt.TopEdge ? "Top" : "Bottom") } + visible: false + } + + property Component frame: StyleItem { + id: styleitem + anchors.fill: parent + anchors.topMargin: 1//stack.baseOverlap + z: style == "oxygen" ? 1 : 0 + elementType: "tabframe" + value: tabbarItem && tabsVisible && tabbarItem.tab(currentIndex) ? tabbarItem.tab(currentIndex).x : 0 + minimum: tabbarItem && tabsVisible && tabbarItem.tab(currentIndex) ? tabbarItem.tab(currentIndex).width : 0 + maximum: tabbarItem && tabsVisible ? tabbarItem.width : width + properties: { "selectedTabRect" : tabbarItem.__selectedTabRect, "orientation" : control.tabPosition } + hints: control.styleHints + Component.onCompleted: { + stack.frameWidth = styleitem.pixelMetric("defaultframewidth"); + stack.style = style; + } + border{ + top: 16 + bottom: 16 + } + textureHeight: 64 + } + + property Component tab: Item { + id: item + property string tabpos: control.count === 1 ? "only" : index === 0 ? "beginning" : index === control.count - 1 ? "end" : "middle" + property string selectedpos: styleData.nextSelected ? "next" : styleData.previousSelected ? "previous" : "" + property string orientation: control.tabPosition === Qt.TopEdge ? "Top" : "Bottom" + property int tabHSpace: __barstyle.pixelMetric("tabhspace"); + property int tabVSpace: __barstyle.pixelMetric("tabvspace"); + property int totalOverlap: tabOverlap * (control.count - 1) + property real maxTabWidth: (control.width + totalOverlap) / control.count + implicitWidth: Math.min(maxTabWidth, Math.max(50, styleitem.textWidth(styleData.title)) + tabHSpace + 2) + implicitHeight: Math.max(styleitem.font.pixelSize + tabVSpace + 6, 0) + + StyleItem { + id: styleitem + + elementType: "tab" + paintMargins: style === "mac" ? 0 : 2 + + anchors.fill: parent + anchors.topMargin: style === "mac" ? 2 : 0 + anchors.rightMargin: -paintMargins + anchors.bottomMargin: -1 + anchors.leftMargin: -paintMargins + (style === "mac" && selected ? -1 : 0) + properties: { "hasFrame" : true, "orientation": orientation, "tabpos": tabpos, "selectedpos": selectedpos } + hints: control.styleHints + + selected: styleData.selected + text: elidedText(styleData.title, tabbarItem.elide, item.width - item.tabHSpace) + hover: styleData.hovered + hasFocus: tabbarItem.activeFocus && selected + } + } + + property Component leftCorner: null + property Component rightCorner: null +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml new file mode 100644 index 00000000000..88611ab5c76 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TableViewStyle.qml @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 +import "." + +ScrollViewStyle { + id: root + + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } + readonly property TableView control: __control + property bool activateItemOnSingleClick: __styleitem.styleHint("activateItemOnSingleClick") + property color textColor: __styleitem.textColor + property color backgroundColor: __syspal.base + property color highlightedTextColor: __styleitem.highlightedTextColor + + property StyleItem __styleitem: StyleItem{ + property color textColor: styleHint("textColor") + property color highlightedTextColor: styleHint("highlightedTextColor") + elementType: "item" + visible: false + active: control.activeFocus + onActiveChanged: { + highlightedTextColor = styleHint("highlightedTextColor") + textColor = styleHint("textColor") + } + } + + property Component headerDelegate: StyleItem { + elementType: "header" + activeControl: itemSort + raised: true + sunken: styleData.pressed + text: styleData.value + hover: styleData.containsMouse + hints: control.styleHints + properties: {"headerpos": headerPosition} + property string itemSort: (control.sortIndicatorVisible && styleData.column === control.sortIndicatorColumn) ? (control.sortIndicatorOrder == Qt.AscendingOrder ? "up" : "down") : ""; + property string headerPosition: control.columnCount === 1 ? "only" : + styleData.column === control.columnCount-1 ? "end" : + styleData.column === 0 ? "beginning" : "" + } + + property Component rowDelegate: BorderImage { + visible: styleData.selected || styleData.alternate + source: "image://__tablerow/" + (styleData.alternate ? "alternate_" : "") + + (styleData.selected ? "selected_" : "") + + (styleData.hasActiveFocus ? "active" : "") + height: Math.max(16, RowItemSingleton.implicitHeight) + border.left: 4 ; border.right: 4 + } + + property Component itemDelegate: Item { + height: Math.max(16, label.implicitHeight) + property int implicitWidth: label.implicitWidth + 16 + + Text { + id: label + objectName: "label" + width: parent.width + anchors.leftMargin: 8 + font: __styleitem.font + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: styleData.textAlignment + anchors.verticalCenter: parent.verticalCenter + elide: styleData.elideMode + text: styleData.value !== undefined ? styleData.value : "" + color: styleData.textColor + renderType: Text.NativeRendering + } + } +} + diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TextAreaStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TextAreaStyle.qml new file mode 100644 index 00000000000..3f2904a350b --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TextAreaStyle.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +ScrollViewStyle { + property font font: __styleitem.font + property color textColor: __styleitem.textColor + property color selectionColor: __syspal.highlight + property color selectedTextColor: __syspal.highlightedText + property color backgroundColor: control.backgroundVisible ? __syspal.base : "transparent" + + property StyleItem __styleitem: StyleItem{ + property color textColor: styleHint("textColor") + elementType: "edit" + visible: false + active: control.activeFocus + onActiveChanged: textColor = styleHint("textColor") + } + + property int renderType: Text.NativeRendering +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TextFieldStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TextFieldStyle.qml new file mode 100644 index 00000000000..0ca0d743d60 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/TextFieldStyle.qml @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + property int renderType: Text.NativeRendering + + property Component panel: StyleItem { + id: textfieldstyle + elementType: "edit" + anchors.fill: parent + + sunken: true + hasFocus: control.activeFocus + hover: hovered + hints: control.styleHints + + SystemPalette { + id: syspal + colorGroup: control.enabled ? + SystemPalette.Active : + SystemPalette.Disabled + } + + property color textColor: syspal.text + property color placeholderTextColor: "darkGray" + property color selectionColor: syspal.highlight + property color selectedTextColor: syspal.highlightedText + + + property bool rounded: !!hints["rounded"] + property int topMargin: style === "mac" ? 3 : 2 + property int leftMargin: rounded ? 12 : 4 + property int rightMargin: leftMargin + property int bottomMargin: 2 + + contentWidth: 100 + // Form QLineEdit::sizeHint + contentHeight: Math.max(control.__contentHeight, 16) + + FocusFrame { + anchors.fill: parent + visible: textfield.activeFocus && textfieldstyle.styleHint("focuswidget") && !rounded + } + textureHeight: implicitHeight + textureWidth: 32 + border {top: 8 ; bottom: 8 ; left: 8 ; right: 8} + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ToolBarStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ToolBarStyle.qml new file mode 100644 index 00000000000..4f4b451e10f --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ToolBarStyle.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype StatusBarStyle + \internal + \inqmlmodule QtQuick.Controls.Styles +*/ +Style { + + padding.left: 6 + padding.right: 6 + padding.top: 1 + padding.bottom: style.style === "mac" ? 1 : style.style === "fusion" ? 3 : 2 + + StyleItem { id: style ; visible: false} + + property Component panel: StyleItem { + id: toolbar + anchors.fill: parent + elementType: "toolbar" + textureWidth: 64 + border {left: 16 ; right: 16} + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ToolButtonStyle.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ToolButtonStyle.qml new file mode 100644 index 00000000000..d690a5775e6 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/ToolButtonStyle.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +Style { + property Component panel: StyleItem { + id: styleitem + + anchors.fill: parent + elementType: "toolbutton" + on: control.checkable && control.checked + sunken: control.pressed + raised: !(control.checkable && control.checked) && control.hovered + hover: control.hovered + hasFocus: control.activeFocus + hints: control.styleHints + text: control.text + + properties: { + "icon": control.__iconAction.__icon, + "position": control.__position, + "menu" : control.menu !== null + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/qmldir b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/qmldir new file mode 100644 index 00000000000..ac80635cc2a --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/Desktop/qmldir @@ -0,0 +1,2 @@ +singleton RowItemSingleton 1.0 RowItemSingleton.qml + diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/qmldir b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/qmldir new file mode 100644 index 00000000000..5cd368ac881 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Styles/qmldir @@ -0,0 +1,17 @@ +module QtQuick.Controls.Styles +ButtonStyle 1.0 Base/ButtonStyle.qml +BusyIndicatorStyle 1.1 Base/BusyIndicatorStyle.qml +CheckBoxStyle 1.0 Base/CheckBoxStyle.qml +ComboBoxStyle 1.0 Base/ComboBoxStyle.qml +ProgressBarStyle 1.0 Base/ProgressBarStyle.qml +RadioButtonStyle 1.0 Base/RadioButtonStyle.qml +ScrollViewStyle 1.0 Base/ScrollViewStyle.qml +SliderStyle 1.0 Base/SliderStyle.qml +SpinBoxStyle 1.1 Base/SpinBoxStyle.qml +SwitchStyle 1.1 Base/SwitchStyle.qml +TabViewStyle 1.0 Base/TabViewStyle.qml +TableViewStyle 1.0 Base/TableViewStyle.qml +TextAreaStyle 1.1 Base/TextAreaStyle.qml +TextFieldStyle 1.0 Base/TextFieldStyle.qml +ToolBarStyle 1.0 Base/ToolBarStyle.qml +StatusBarStyle 1.0 Base/StatusBarStyle.qml diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Switch.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Switch.qml new file mode 100644 index 00000000000..bed46a84492 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Switch.qml @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype Switch + \inqmlmodule QtQuick.Controls + \since 5.2 + \ingroup controls + \brief A switch. + + A Switch is an option button that can be switched on (checked) or off + (unchecked). Switches are typically used to represent features in an + application that can be enabled or disabled without affecting others. + + On mobile platforms, switches are commonly used to enable or disable + features. + + \qml + Column { + Switch { checked: true } + Switch { checked: false } + } + \endqml + + You can create a custom appearance for a Switch by + assigning a \l {QtQuick.Controls.Styles::SwitchStyle}{SwitchStyle}. +*/ + +Control { + id: root + + /*! + This property is \c true if the control is checked. + The default value is \c false. + */ + property bool checked: false + + /*! + This property is \c true if the control takes the focus when it is + pressed; \l{QQuickItem::forceActiveFocus()}{forceActiveFocus()} will be + called on the control. + */ + property bool activeFocusOnPress: false + + /*! + This property stores the ExclusiveGroup that the control belongs to. + */ + property ExclusiveGroup exclusiveGroup: null + + Keys.onPressed: { + if (event.key === Qt.Key_Space && !event.isAutoRepeat) + checked = !checked; + } + + /*! \internal */ + onExclusiveGroupChanged: { + if (exclusiveGroup) + exclusiveGroup.bindCheckable(root) + } + + MouseArea { + id: internal + + property Item handle: __panel ? __panel.__handle : null + property int min: __style ? __style.padding.left : 0 + property int max: handle.parent.width - (handle ? handle.width : 0) - + ( __style ? __style.padding.right : 0) + focus: true + anchors.fill: parent + drag.threshold: 0 + drag.target: handle + drag.axis: Drag.XAxis + drag.minimumX: min + drag.maximumX: max + + onPressed: { + if (activeFocusOnPress) + root.forceActiveFocus() + } + + onReleased: { + if (drag.active) { + checked = (handle.x < max/2) ? false : true; + internal.handle.x = checked ? internal.max : internal.min + } else { + checked = (handle.x === max) ? false : true + } + } + } + + Component.onCompleted: { + internal.handle.x = checked ? internal.max : internal.min + __panel.enableAnimation = true + } + + onCheckedChanged: { + if (internal.handle) + internal.handle.x = checked ? internal.max : internal.min + } + + activeFocusOnTab: true + Accessible.role: Accessible.CheckBox + Accessible.name: "switch" + + /*! + The style that should be applied to the switch. Custom style + components can be created with: + + \codeline Qt.createComponent("path/to/style.qml", switchId); + */ + style: Qt.createComponent(Settings.style + "/SwitchStyle.qml", root) +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Tab.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Tab.qml new file mode 100644 index 00000000000..cfd757c9726 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/Tab.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 + +/*! + \qmltype Tab + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup viewaddons + \brief Tab represents the content of a tab in a TabView. + + A Tab item inherits from Loader and provides a similar + api. +*/ + +Loader { + id: tab + anchors.fill: parent + + /*! This property holds the title of the tab. */ + property string title + + /*! \internal */ + property bool __inserted: false + + Accessible.role: Accessible.LayeredPane + active: false + visible: false + + activeFocusOnTab: false + + onVisibleChanged: if (visible) active = true + + /*! \internal */ + default property alias component: tab.sourceComponent +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TabView.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TabView.qml new file mode 100644 index 00000000000..e20bcf224ff --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TabView.qml @@ -0,0 +1,270 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype TabView + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup views + \brief A control that allows the user to select one of multiple stacked items. + + You can create a custom appearance for a TabView by + assigning a \l {QtQuick.Controls.Styles::TabViewStyle}{TabViewStyle}. +*/ + +FocusScope { + id: root + + implicitWidth: 240 + implicitHeight: 150 + + /*! The current tab index */ + property int currentIndex: 0 + + /*! The current tab count */ + property int count: 0 + + /*! The visibility of the tab frame around contents */ + property bool frameVisible: true + + /*! The visibility of the tab bar */ + property bool tabsVisible: true + + /*! + \qmlproperty enumeration TabView::tabPosition + + \list + \li Qt.TopEdge (default) + \li Qt.BottomEdge + \endlist + */ + property int tabPosition: Qt.TopEdge + + /*! \internal */ + default property alias data: stack.data + + /*! Adds a new tab page with title with and optional Component. + Returns the newly added tab. + */ + function addTab(title, component) { + return insertTab(__tabs.count, title, component) + } + + /*! Inserts a new tab with title at index, with an optional Component. + Returns the newly added tab. + */ + function insertTab(index, title, component) { + // 'loader' parent is a pending workaround while waiting for: + // https://codereview.qt-project.org/#change,65788 + var tab = tabcomp.createObject(loader) + tab.sourceComponent = component + tab.title = title + // insert at appropriate index first, then set the parent to + // avoid onChildrenChanged appending it to the end of the list + __tabs.insert(index, {tab: tab}) + tab.__inserted = true + tab.parent = stack + __setOpacities() + return tab + } + + /*! Removes and destroys a tab at the given \a index. */ + function removeTab(index) { + var tab = __tabs.get(index).tab + __tabs.remove(index, 1) + tab.destroy() + if (currentIndex > 0) + currentIndex-- + __setOpacities() + } + + /*! Moves a tab \a from index \a to another. */ + function moveTab(from, to) { + __tabs.move(from, to, 1) + + if (currentIndex == from) { + currentIndex = to + } else { + var start = Math.min(from, to) + var end = Math.max(from, to) + if (currentIndex >= start && currentIndex <= end) { + if (from < to) + --currentIndex + else + ++currentIndex + } + } + } + + /*! Returns the \l Tab item at \a index. */ + function getTab(index) { + return __tabs.get(index).tab + } + + /*! \internal */ + property ListModel __tabs: ListModel { } + + /*! \internal */ + property Component style: Qt.createComponent(Settings.style + "/TabViewStyle.qml", root) + + /*! \internal */ + property var __styleItem: loader.item + + onCurrentIndexChanged: __setOpacities() + + /*! \internal */ + function __setOpacities() { + for (var i = 0; i < __tabs.count; ++i) { + var child = __tabs.get(i).tab + child.visible = (i == currentIndex ? true : false) + } + count = __tabs.count + } + + activeFocusOnTab: false + + Component { + id: tabcomp + Tab {} + } + + TabBar { + id: tabbarItem + objectName: "tabbar" + tabView: root + style: loader.item + anchors.top: parent.top + anchors.left: root.left + anchors.right: root.right + } + + Loader { + id: loader + z: tabbarItem.z - 1 + sourceComponent: style + property var __control: root + } + + Loader { + id: frameLoader + z: tabbarItem.z - 1 + + anchors.fill: parent + anchors.topMargin: tabPosition === Qt.TopEdge && tabbarItem && tabsVisible ? Math.max(0, tabbarItem.height - baseOverlap) : 0 + anchors.bottomMargin: tabPosition === Qt.BottomEdge && tabbarItem && tabsVisible ? Math.max(0, tabbarItem.height -baseOverlap) : 0 + sourceComponent: frameVisible && loader.item ? loader.item.frame : null + + property int baseOverlap: __styleItem ? __styleItem.frameOverlap : 0 + + Item { + id: stack + + anchors.fill: parent + anchors.margins: (frameVisible ? frameWidth : 0) + anchors.topMargin: anchors.margins + (style =="mac" ? 6 : 0) + anchors.bottomMargin: anchors.margins + + property int frameWidth + property string style + property bool completed: false + + Component.onCompleted: { + addTabs(stack.children) + completed = true + } + + onChildrenChanged: { + if (completed) + stack.addTabs(stack.children) + } + + function addTabs(tabs) { + var tabAdded = false + for (var i = 0 ; i < tabs.length ; ++i) { + var tab = tabs[i] + if (!tab.__inserted && tab.Accessible.role === Accessible.LayeredPane) { + tab.__inserted = true + // reparent tabs created dynamically by createObject(tabView) + tab.parent = stack + // a dynamically added tab should also get automatically removed when destructed + if (completed) + tab.Component.onDestruction.connect(stack.onDynamicTabDestroyed.bind(tab)) + __tabs.append({tab: tab}) + tabAdded = true + } + } + if (tabAdded) + __setOpacities() + } + + function onDynamicTabDestroyed() { + for (var i = 0; i < __tabs.count; ++i) { + if (__tabs.get(i).tab === this) { + __tabs.remove(i, 1) + __setOpacities() + break + } + } + } + } + onLoaded: { item.z = -1 } + } + + onChildrenChanged: stack.addTabs(root.children) + + states: [ + State { + name: "Bottom" + when: tabPosition === Qt.BottomEdge && tabbarItem != undefined + PropertyChanges { + target: tabbarItem + anchors.topMargin: -frameLoader.baseOverlap + } + AnchorChanges { + target: tabbarItem + anchors.top: frameLoader.bottom + } + } + ] +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TableView.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TableView.qml new file mode 100644 index 00000000000..586f1211dfc --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TableView.qml @@ -0,0 +1,1016 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.1 + +/*! + \qmltype TableView + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup views + \brief Provides a list view with scroll bars, styling and header sections. + + \image tableview.png + + A TableView is similar to \l ListView, and adds scroll bars, selection, and + resizable header sections. As with \l ListView, data for each row is provided through a \l model: + + \code + ListModel { + id: libraryModel + ListElement{ title: "A Masterpiece" ; author: "Gabriel" } + ListElement{ title: "Brilliance" ; author: "Jens" } + ListElement{ title: "Outstanding" ; author: "Frederik" } + } + \endcode + + You provide title and size of a column header + by adding a \l TableViewColumn as demonstrated below. + \code + + TableView { + TableViewColumn{ role: "title" ; title: "Title" ; width: 100 } + TableViewColumn{ role: "author" ; title: "Author" ; width: 200 } + model: libraryModel + } + \endcode + + The header sections are attached to values in the \l model by defining + the model role they attach to. Each property in the model will + then be shown in their corresponding column. + + You can customize the look by overriding the \l itemDelegate, + \l rowDelegate, or \l headerDelegate properties. + + The view itself does not provide sorting. This has to + be done on the model itself. However you can provide sorting + on the model, and enable sort indicators on headers. + +\list + \li int sortIndicatorColumn - The index of the current sort column + \li bool sortIndicatorVisible - Whether the sort indicator should be enabled + \li enum sortIndicatorOrder - Qt.AscendingOrder or Qt.DescendingOrder depending on state +\endlist + + You can create a custom appearance for a TableView by + assigning a \l {QtQuick.Controls.Styles::TableViewStyle}{TableViewStyle}. +*/ + +ScrollView { + id: root + + /*! \qmlproperty model TableView::model + This property holds the model providing data for the table view. + + The model provides the set of data that is used to create the items in the view. + Models can be created directly in QML using ListModel, XmlListModel or VisualItemModel, + or provided by C++ model classes. \sa ListView::model + + Example model: + + \code + model: ListModel { + ListElement{ column1: "value 1" ; column2: "value 2" } + ListElement{ column1: "value 3" ; column2: "value 4" } + } + \endcode + \sa {qml-data-models}{Data Models} + */ + property var model + + /*! This property is set to \c true if the view alternates the row color. + The default value is \c true. */ + property bool alternatingRowColors: true + + /*! This property determines if the header is visible. + The default value is \c true. */ + property bool headerVisible: true + + /*! \qmlproperty bool TableView::backgroundVisible + + This property determines if the background should be filled or not. + + The default value is \c true. + + \note The rowDelegate is not affected by this property + */ + property alias backgroundVisible: colorRect.visible + + /*! This property defines a delegate to draw a specific cell. + + In the item delegate you have access to the following special properties: + \list + \li styleData.selected - if the item is currently selected + \li styleData.value - the value or text for this item + \li styleData.textColor - the default text color for an item + \li styleData.row - the index of the row + \li styleData.column - the index of the column + \li styleData.elideMode - the elide mode of the column + \li styleData.textAlignment - the horizontal text alignment of the column + \endlist + + Example: + \code + itemDelegate: Item { + Text { + anchors.verticalCenter: parent.verticalCenter + color: styleData.textColor + elide: styleData.elideMode + text: styleData.value + } + } + \endcode */ + property Component itemDelegate: __style ? __style.itemDelegate : null + + /*! This property defines a delegate to draw a row. + + In the row delegate you have access to the following special properties: + \list + \li styleData.alternate - true when the row uses the alternate background color + \li styleData.selected - true when the row is currently selected + \li styleData.row - the index of the row + \endlist + */ + property Component rowDelegate: __style ? __style.rowDelegate : null + + /*! This property defines a delegate to draw a header. + + In the header delegate you have access to the following special properties: + \list + \li styleData.value - the value or text for this item + \li styleData.column - the index of the column + \li styleData.pressed - true when the column is being pressed + \li styleData.containsMouse - true when the column is under the mouse + \li styleData.textAlignment - the horizontal text alignment of the column (since QtQuickControls 1.1) + \endlist + */ + property Component headerDelegate: __style ? __style.headerDelegate : null + + /*! Index of the current sort column. + The default value is \c {0}. */ + property int sortIndicatorColumn + + /*! This property shows or hides the sort indicator + The default value is \c false. + \note The view itself does not sort the data. */ + property bool sortIndicatorVisible: false + + /*! + \qmlproperty enumeration TableView::sortIndicatorOrder + + This sets the sorting order of the sort indicator + The allowed values are: + \list + \li Qt.AscendingOrder - the default + \li Qt.DescendingOrder + \endlist + */ + property int sortIndicatorOrder: Qt.AscendingOrder + + /*! \internal */ + default property alias __columns: root.data + + /*! \qmlproperty Component TableView::contentHeader + This is the content header of the TableView */ + property alias contentHeader: listView.header + + /*! \qmlproperty Component TableView::contentFooter + This is the content footer of the TableView */ + property alias contentFooter: listView.footer + + /*! \qmlproperty int TableView::rowCount + The current number of rows */ + readonly property alias rowCount: listView.count + + /*! \qmlproperty int TableView::columnCount + The current number of columns */ + readonly property alias columnCount: columnModel.count + + /*! \qmlproperty string TableView::section.property + \qmlproperty enumeration TableView::section.criteria + \qmlproperty Component TableView::section.delegate + \qmlproperty enumeration TableView::section.labelPositioning + These properties determine the section labels. + \sa ListView::section */ + property alias section: listView.section + + /*! \qmlproperty int TableView::currentRow + The current row index of the view. + The default value is \c -1 to indicate that no row is selected. + */ + property alias currentRow: listView.currentIndex + + /*! \internal */ + property alias __currentRowItem: listView.currentItem + + /*! \qmlsignal TableView::activated(int row) + + Emitted when the user activates an item by mouse or keyboard interaction. + Mouse activation is triggered by single- or double-clicking, depending on the platform. + + \a row int provides access to the activated row index. + + \note This signal is only emitted for mouse interaction that is not blocked in the row or item delegate. + */ + signal activated(int row) + + /*! \qmlsignal TableView::clicked(int row) + + Emitted when the user clicks a valid row by single clicking + + \a row int provides access to the clicked row index. + + \note This signal is only emitted if the row or item delegate does not accept mouse events. + */ + signal clicked(int row) + + /*! \qmlsignal TableView::doubleClicked(int row) + + Emitted when the user double clicks a valid row. + + \a row int provides access to the clicked row index. + + \note This signal is only emitted if the row or item delegate does not accept mouse events. + */ + signal doubleClicked(int row) + + /*! + \qmlmethod TableView::positionViewAtRow( int row, PositionMode mode ) + + Positions the view such that the specified \a row is at the position defined by \a mode: + \list + \li ListView.Beginning - position item at the top of the view. + \li ListView.Center - position item in the center of the view. + \li ListView.End - position item at bottom of the view. + \li ListView.Visible - if any part of the item is visible then take no action, otherwise bring the item into view. + \li ListView.Contain - ensure the entire item is visible. If the item is larger than the view the item is positioned + at the top of the view. + \endlist + + If positioning the \a row creates an empty space at the beginning + or end of the view, then the view is positioned at the boundary. + + For example, to position the view at the end at startup: + + \code + Component.onCompleted: table.positionViewAtRow(rowCount -1, ListView.Contain) + \endcode + + Depending on how the model is populated, the model may not be ready when + TableView Component.onCompleted is called. In that case you may need to + delay the call to positionViewAtRow by using a \l {QtQml::Timer}{Timer}. + + \note This method should only be called after the component has completed. + */ + + function positionViewAtRow(row, mode) { + listView.positionViewAtIndex(row, mode) + } + + /*! + \qmlmethod int TableView::rowAt( int x, int y ) + + Returns the index of the visible row at the point \a x, \a y in content + coordinates. If there is no visible row at the point specified, \c -1 is returned. + + \note This method should only be called after the component has completed. + */ + + function rowAt(x, y) { + var obj = root.mapToItem(listView.contentItem, x, y) + return listView.indexAt(obj.x, obj.y) + } + + /*! Adds a \a column and returns the added column. + + The \a column argument can be an instance of TableViewColumn, + or a Component. The component has to contain a TableViewColumn. + Otherwise \c null is returned. + */ + function addColumn(column) { + return insertColumn(columnCount, column) + } + + /*! Inserts a \a column at the given \a index and returns the inserted column. + + The \a column argument can be an instance of TableViewColumn, + or a Component. The component has to contain a TableViewColumn. + Otherwise \c null is returned. + */ + function insertColumn(index, column) { + var object = column + if (typeof column['createObject'] === 'function') + object = column.createObject(root) + + else if (object.__view) { + console.warn("TableView::insertColumn(): you cannot add a column to multiple views") + return null + } + if (index >= 0 && index <= columnCount && object.Accessible.role === Accessible.ColumnHeader) { + object.__view = root + columnModel.insert(index, {columnItem: object}) + return object + } + + if (object !== column) + object.destroy() + console.warn("TableView::insertColumn(): invalid argument") + return null + } + + /*! Removes and destroys a column at the given \a index. */ + function removeColumn(index) { + if (index < 0 || index >= columnCount) { + console.warn("TableView::removeColumn(): invalid argument") + return + } + var column = columnModel.get(index).columnItem + columnModel.remove(index, 1) + column.destroy() + } + + /*! Moves a column \a from index \a to another. */ + function moveColumn(from, to) { + if (from < 0 || from >= columnCount || to < 0 || to >= columnCount) { + console.warn("TableView::moveColumn(): invalid argument") + return + } + columnModel.move(from, to, 1) + } + + /*! Returns the column at the given \a index + or \c null if the \a index is invalid. */ + function getColumn(index) { + if (index < 0 || index >= columnCount) + return null + return columnModel.get(index).columnItem + } + + /*! \qmlproperty Selection TableView::selection + \since QtQuick.Controls 1.1 + + This property contains the current row-selection of the \l TableView. + The selection allows you to select, deselect or iterate over selected rows. + + \list + \li function \b clear() - deselects all rows + \li function \b selectAll() - selects all rows + \li function \b select(from, to) - select a range + \li functton \b deselect(from, to) - de-selects a range + \li function \b forEach(callback) - Allows you to iterate over selected rows + \li function \b contains(index) - Allows you to iterate over selected rows + \li signal \b selectionChanged() - The current row selection changed + \li readonly property int \b count - The number of selected rows + \endlist + + \b Example: + \code + tableview.selection.select(0) // select row index 0 + + tableview.selection.select(1, 3) // select row indexes 1, 2 and 3 + + tableview.selection.deselect(0, 1) // deselects row index 0 and 1 + + tableview.selection.deselect(2) // deselects row index 2 + \endcode + + \b Example: To iterate over selected indexes, you can pass a callback function. + \a rowIndex is passed as as an argument to the callback function. + \code + tableview.selection.forEach( function(rowIndex) {console.log(rowIndex)} ) + \endcode + + */ + + readonly property alias selection: selectionObject + + /*! + \qmlproperty enumeration TableView::selectionMode + \since QtQuick.Controls 1.1 + + This enum indicates how the view responds to user selections: + + The possible modes are: + + \list + + \li SelectionMode.NoSelection - Items cannot be selected. + + \li SelectionMode.SingleSelection - When the user selects an item, + any already-selected item becomes unselected, and the user cannot + unselect the selected item. (Default) + + \li SelectionMode.MultiSelection - When the user selects an item in the usual way, + the selection status of that item is toggled and the other items are left alone. + + \li SelectionMode.ExtendedSelection - When the user selects an item in the usual way, + the selection is cleared and the new item selected. However, if the user presses the + Ctrl key when clicking on an item, the clicked item gets toggled and all other items + are left untouched. If the user presses the Shift key while clicking + on an item, all items between the current item and the clicked item are selected or unselected, + depending on the state of the clicked item. Multiple items can be selected by dragging the + mouse over them. + + \li SelectionMode.ContiguousSelection - When the user selects an item in the usual way, + the selection is cleared and the new item selected. However, if the user presses the Shift key while + clicking on an item, all items between the current item and the clicked item are selected. + + \endlist + */ + property int selectionMode: SelectionMode.SingleSelection + + Component.onCompleted: { + for (var i = 0; i < __columns.length; ++i) { + var column = __columns[i] + if (column.Accessible.role === Accessible.ColumnHeader) + addColumn(column) + } + } + + style: Qt.createComponent(Settings.style + "/TableViewStyle.qml", root) + + + Accessible.role: Accessible.Table + + implicitWidth: 200 + implicitHeight: 150 + + frameVisible: true + __scrollBarTopMargin: (__style && __style.transientScrollBars || Qt.platform.os === "osx") ? headerrow.height : 0 + __viewTopMargin: headerrow.height + + /*! \internal */ + property bool __activateItemOnSingleClick: __style ? __style.activateItemOnSingleClick : false + + /*! \internal */ + function __decrementCurrentIndex() { + __scroller.blockUpdates = true; + listView.decrementCurrentIndex(); + __scroller.blockUpdates = false; + + var newIndex = listView.indexAt(0, listView.contentY) + if (newIndex !== -1) { + if (selectionMode > SelectionMode.SingleSelection) + mousearea.dragRow = newIndex + else if (selectionMode === SelectionMode.SingleSelection) + selection.__selectOne(newIndex) + } + } + + /*! \internal */ + function __incrementCurrentIndex() { + __scroller.blockUpdates = true; + listView.incrementCurrentIndex(); + __scroller.blockUpdates = false; + + var newIndex = Math.max(0, listView.indexAt(0, listView.height + listView.contentY)) + if (newIndex !== -1) { + if (selectionMode > SelectionMode.SingleSelection) + mousearea.dragRow = newIndex + else if (selectionMode === SelectionMode.SingleSelection) + selection.__selectOne(newIndex) + } + } + + onModelChanged: selection.clear() + + ListView { + id: listView + focus: true + activeFocusOnTab: true + anchors.topMargin: tableHeader.height + anchors.fill: parent + currentIndex: -1 + visible: columnCount > 0 + interactive: Settings.hasTouchScreen + + SystemPalette { + id: palette + colorGroup: enabled ? SystemPalette.Active : SystemPalette.Disabled + } + + Rectangle { + id: colorRect + parent: viewport + anchors.fill: parent + color: __style ? __style.backgroundColor : palette.base + z: -2 + } + + MouseArea { + id: mousearea + + z: -1 + anchors.fill: listView + propagateComposedEvents: true + + property bool autoincrement: false + property bool autodecrement: false + property int mouseModifiers: 0 + property int previousRow: 0 + property int clickedRow: -1 + property int dragRow: -1 + property int firstKeyRow: -1 + + onReleased: { + autoincrement = false + autodecrement = false + var clickIndex = listView.indexAt(0, mouseY + listView.contentY) + if (clickIndex > -1) { + if (Settings.hasTouchScreen) { + listView.currentIndex = clickIndex + mouseSelect(clickIndex, mouse.modifiers) + } + previousRow = clickIndex + } + + if (mousearea.dragRow >= 0) { + selection.__select(selection.contains(mousearea.clickedRow), mousearea.clickedRow, mousearea.dragRow) + mousearea.dragRow = -1 + } + } + + // Handle vertical scrolling whem dragging mouse outside boundraries + Timer { running: mousearea.autoincrement && __verticalScrollBar.visible; repeat: true; interval: 20 ; onTriggered: __incrementCurrentIndex()} + Timer { running: mousearea.autodecrement && __verticalScrollBar.visible; repeat: true; interval: 20 ; onTriggered: __decrementCurrentIndex()} + + onPositionChanged: { + if (mouseY > listView.height && pressed) { + if (autoincrement) return; + autodecrement = false; + autoincrement = true; + } else if (mouseY < 0 && pressed) { + if (autodecrement) return; + autoincrement = false; + autodecrement = true; + } else { + autoincrement = false; + autodecrement = false; + } + + if (pressed && !Settings.hasTouchScreen) { + var newIndex = Math.max(0, listView.indexAt(0, mouseY + listView.contentY)) + if (newIndex >= 0 && newIndex != currentRow) { + listView.currentIndex = newIndex; + if (selectionMode === SelectionMode.SingleSelection) { + selection.__selectOne(newIndex) + } else if (selectionMode > 1) { + dragRow = newIndex + } + } + } + mouseModifiers = mouse.modifiers + } + + onClicked: { + var clickIndex = listView.indexAt(0, mouseY + listView.contentY) + if (clickIndex > -1) { + if (root.__activateItemOnSingleClick) + root.activated(clickIndex) + root.clicked(clickIndex) + } + } + + onPressed: { + var newIndex = listView.indexAt(0, mouseY + listView.contentY) + listView.forceActiveFocus() + if (newIndex > -1 && !Settings.hasTouchScreen) { + listView.currentIndex = newIndex + mouseSelect(newIndex, mouse.modifiers) + mousearea.clickedRow = newIndex + } + mouseModifiers = mouse.modifiers + } + + function mouseSelect(index, modifiers) { + if (selectionMode) { + if (modifiers & Qt.ShiftModifier && (selectionMode === SelectionMode.ExtendedSelection)) { + selection.select(previousRow, index) + } else if (selectionMode === SelectionMode.MultiSelection || + (selectionMode === SelectionMode.ExtendedSelection && modifiers & Qt.ControlModifier)) { + selection.__select(!selection.contains(index) , index) + } else { + selection.__selectOne(index) + } + } + } + + onDoubleClicked: { + var clickIndex = listView.indexAt(0, mouseY + listView.contentY) + if (clickIndex > -1) { + if (!root.__activateItemOnSingleClick) + root.activated(clickIndex) + root.doubleClicked(clickIndex) + } + } + + // Note: with boolean preventStealing we are keeping the flickable from + // eating our mouse press events + preventStealing: !Settings.hasTouchScreen + + TableViewSelection { id: selectionObject } + } + + // Fills extra rows with alternate color + Column { + id: rowfiller + Loader { + id: rowSizeItem + sourceComponent: root.rowDelegate + visible: false + property QtObject styleData: QtObject { + property bool alternate: false + property bool selected: false + property bool hasActiveFocus: false + } + } + property int rowHeight: rowSizeItem.implicitHeight + property int paddedRowCount: height/rowHeight + property int count: listView.count + y: listView.contentHeight + width: parent.width + visible: alternatingRowColors + height: viewport.height - listView.contentHeight + Repeater { + model: visible ? parent.paddedRowCount : 0 + Loader { + width: rowfiller.width + height: rowfiller.rowHeight + sourceComponent: root.rowDelegate + property QtObject styleData: QtObject { + readonly property bool alternate: (index + rowCount) % 2 === 1 + readonly property bool selected: false + readonly property bool hasActiveFocus: root.activeFocus + } + readonly property var model: listView.model + readonly property var modelData: null + } + } + } + + ListModel { + id: columnModel + } + + highlightFollowsCurrentItem: true + model: root.model + + function keySelect(shiftPressed, row) { + if (row < 0 || row === rowCount - 1) + return + if (shiftPressed && (selectionMode >= SelectionMode.ExtendedSelection)) { + selection.__ranges = new Array() + selection.select(mousearea.firstKeyRow, row) + } else { + selection.__selectOne(row) + } + } + + Keys.onUpPressed: { + event.accepted = false + __scroller.blockUpdates = true; + listView.decrementCurrentIndex(); + __scroller.blockUpdates = false; + if (selectionMode) + keySelect(event.modifiers & Qt.ShiftModifier, currentRow) + } + + Keys.onDownPressed: { + event.accepted = false + __scroller.blockUpdates = true; + listView.incrementCurrentIndex(); + __scroller.blockUpdates = false; + if (selectionMode) + keySelect(event.modifiers & Qt.ShiftModifier, currentRow) + } + + Keys.onPressed: { + if (event.key === Qt.Key_PageUp) { + __verticalScrollBar.value = __verticalScrollBar.value - listView.height + } else if (event.key === Qt.Key_PageDown) + __verticalScrollBar.value = __verticalScrollBar.value + listView.height + + if (event.key === Qt.Key_Shift) { + mousearea.firstKeyRow = currentRow + } + + if (event.key === Qt.Key_A && event.modifiers & Qt.ControlModifier) { + if (selectionMode > 1) + selection.selectAll() + } + } + + Keys.onReleased: { + if (event.key === Qt.Key_Shift) + mousearea.firstKeyRow = -1 + } + + Keys.onReturnPressed: { + event.accepted = false + if (currentRow > -1) + root.activated(currentRow); + } + + delegate: FocusScope { + id: rowitem + width: itemrow.width + height: rowstyle.height + + function selected() { + if (mousearea.dragRow > -1 && (rowIndex >= mousearea.clickedRow && rowIndex <= mousearea.dragRow + || rowIndex <= mousearea.clickedRow && rowIndex >=mousearea.dragRow)) + return selection.contains(mousearea.clickedRow) + + return selection.count && selection.contains(rowIndex) + } + readonly property int rowIndex: model.index + readonly property bool alternate: alternatingRowColors && rowIndex % 2 == 1 + readonly property var itemModelData: typeof modelData == "undefined" ? null : modelData + readonly property var itemModel: model + readonly property bool itemSelected: selected() + readonly property color itemTextColor: itemSelected ? __style.highlightedTextColor : __style.textColor + + onActiveFocusChanged: { + if (activeFocus) + listView.currentIndex = rowIndex + } + + Loader { + id: rowstyle + // row delegate + sourceComponent: root.rowDelegate + // Row fills the view width regardless of item size + // But scrollbar should not adjust to it + height: item ? item.height : 16 + width: parent.width + __horizontalScrollBar.width + x: listView.contentX + + // these properties are exposed to the row delegate + // Note: these properties should be mirrored in the row filler as well + property QtObject styleData: QtObject { + readonly property int row: rowitem.rowIndex + readonly property bool alternate: rowitem.alternate + readonly property bool selected: rowitem.itemSelected + readonly property bool hasActiveFocus: root.activeFocus + } + readonly property var model: listView.model + readonly property var modelData: rowitem.itemModelData + } + Row { + id: itemrow + height: parent.height + Repeater { + id: repeater + model: columnModel + + Loader { + id: itemDelegateLoader + width: columnItem.width + height: parent ? parent.height : 0 + visible: columnItem.visible + sourceComponent: columnItem.delegate ? columnItem.delegate : itemDelegate + + // these properties are exposed to the item delegate + readonly property var model: listView.model + readonly property var modelData: itemModelData + + property QtObject styleData: QtObject { + readonly property int row: rowitem.rowIndex + readonly property int column: index + readonly property int elideMode: columnItem.elideMode + readonly property int textAlignment: columnItem.horizontalAlignment + readonly property bool selected: rowitem.itemSelected + readonly property color textColor: rowitem.itemTextColor + readonly property string role: columnItem.role + readonly property var value: itemModel.hasOwnProperty(role) + ? itemModel[role] // Qml ListModel and QAbstractItemModel + : modelData && modelData.hasOwnProperty(role) + ? modelData[role] // QObjectList / QObject + : modelData != undefined ? modelData : "" // Models without role + } + } + } + onWidthChanged: listView.contentWidth = width + } + } + + Text{ id:text } + + Item { + id: tableHeader + clip: true + parent: __scroller + visible: headerVisible + anchors.top: parent.top + anchors.topMargin: viewport.anchors.topMargin + anchors.leftMargin: viewport.anchors.leftMargin + anchors.margins: viewport.anchors.margins + anchors.rightMargin: (frameVisible ? __scroller.rightMargin : 0) + + (__scroller.outerFrame && __scrollBarTopMargin ? 0 : __verticalScrollBar.width + + __scroller.scrollBarSpacing + root.__style.padding.right) + + anchors.left: parent.left + anchors.right: parent.right + + height: headerrow.height + + Row { + id: headerrow + x: -listView.contentX + + Repeater { + id: repeater + + property int targetIndex: -1 + property int dragIndex: -1 + + model: columnModel + + delegate: Item { + z:-index + width: columnCount == 1 ? viewport.width + __verticalScrollBar.width : modelData.width + visible: modelData.visible + height: headerVisible ? headerStyle.height : 0 + + Loader { + id: headerStyle + sourceComponent: root.headerDelegate + anchors.left: parent.left + anchors.right: parent.right + property QtObject styleData: QtObject { + readonly property string value: modelData.title + readonly property bool pressed: headerClickArea.pressed + readonly property bool containsMouse: headerClickArea.containsMouse + readonly property int column: index + readonly property int textAlignment: modelData.horizontalAlignment + } + } + Rectangle{ + id: targetmark + width: parent.width + height:parent.height + opacity: (index == repeater.targetIndex && repeater.targetIndex != repeater.dragIndex) ? 0.5 : 0 + Behavior on opacity { NumberAnimation{duration:160}} + color: palette.highlight + visible: modelData.movable + } + + MouseArea{ + id: headerClickArea + drag.axis: Qt.YAxis + hoverEnabled: true + anchors.fill: parent + onClicked: { + if (sortIndicatorColumn == index) + sortIndicatorOrder = sortIndicatorOrder == Qt.AscendingOrder ? Qt.DescendingOrder : Qt.AscendingOrder + sortIndicatorColumn = index + } + // Here we handle moving header sections + // NOTE: the direction is different from the master branch + // so this indicates that I am using an invalid assumption on item ordering + onPositionChanged: { + if (modelData.movable && pressed && columnCount > 1) { // only do this while dragging + for (var h = columnCount-1 ; h >= 0 ; --h) { + if (drag.target.x > headerrow.children[h].x) { + repeater.targetIndex = h + break + } + } + } + } + + onPressed: { + repeater.dragIndex = index + draghandle.x = parent.x + } + + onReleased: { + if (repeater.targetIndex >= 0 && repeater.targetIndex != index ) { + var targetColumn = columnModel.get(repeater.targetIndex).columnItem + if (targetColumn.movable) { + columnModel.move(index, repeater.targetIndex, 1) + if (sortIndicatorColumn == index) + sortIndicatorColumn = repeater.targetIndex + } + } + repeater.targetIndex = -1 + } + drag.maximumX: 1000 + drag.minimumX: -1000 + drag.target: modelData.movable && columnCount > 1 ? draghandle : null + } + + Loader { + id: draghandle + property QtObject styleData: QtObject{ + readonly property string value: modelData.title + readonly property bool pressed: headerClickArea.pressed + readonly property bool containsMouse: headerClickArea.containsMouse + readonly property int column: index + readonly property int textAlignment: modelData.horizontalAlignment + } + + parent: tableHeader + width: modelData.width + height: parent.height + sourceComponent: root.headerDelegate + visible: headerClickArea.pressed + opacity: 0.5 + } + + + MouseArea { + id: headerResizeHandle + property int offset: 0 + property int minimumSize: 20 + anchors.rightMargin: -width/2 + width: 16 ; height: parent.height + anchors.right: parent.right + enabled: modelData.resizable && columnCount > 1 + onPositionChanged: { + var newHeaderWidth = modelData.width + (mouseX - offset) + modelData.width = Math.max(minimumSize, newHeaderWidth) + } + property bool found:false + + onDoubleClicked: { + var row + var minWidth = 0 + var listdata = listView.children[0] + for (row = 0 ; row < listdata.children.length ; ++row){ + var item = listdata.children[row+1] + if (item && item.children[1] && item.children[1].children[index] && + item.children[1].children[index].children[0].hasOwnProperty("implicitWidth")) + minWidth = Math.max(minWidth, item.children[1].children[index].children[0].implicitWidth) + } + if (minWidth) + modelData.width = minWidth + } + onPressedChanged: if (pressed) offset=mouseX + cursorShape: enabled ? Qt.SplitHCursor : Qt.ArrowCursor + } + } + } + } + Loader { + id: loader + property QtObject styleData: QtObject{ + readonly property string value: "" + readonly property bool pressed: false + readonly property bool containsMouse: false + readonly property int column: -1 + readonly property int textAlignment: Text.AlignLeft + } + + anchors.top: parent.top + anchors.right: parent.right + anchors.bottom: headerrow.bottom + anchors.rightMargin: -2 + sourceComponent: root.headerDelegate + width: root.width - headerrow.width + 2 + visible: root.columnCount + z:-1 + } + } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TableViewColumn.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TableViewColumn.qml new file mode 100644 index 00000000000..cbf20945638 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TableViewColumn.qml @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 + +/*! + \qmltype TableViewColumn + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup viewitems + \brief Used to define columns in a \l TableView. +*/ + +QtObject { + + /*! \internal */ + property Item __view: null + + /*! The title text of the column. */ + property string title + + /*! The model \c role of the column. */ + property string role + + /*! The current width of the column + The default value depends on platform. If only one + column is defined, the width expands to the viewport. + */ + property int width: (__view && __view.columnCount === 1) ? __view.viewport.width : 160 + + /*! The visible status of the column. */ + property bool visible: true + + /*! Determines if the column should be resizable. + \since QtQuick.Controls 1.1 */ + property bool resizable: true + + /*! Determines if the column should be movable. + The default value is \c true. + \note A non-movable column may get indirectly moved if adjacent columns are movable. + \since QtQuick.Controls 1.1 */ + property bool movable: true + + /*! \qmlproperty enumeration TableViewColumn::elideMode + The text elide mode of the column. + Allowed values are: + \list + \li Text.ElideNone + \li Text.ElideLeft + \li Text.ElideMiddle + \li Text.ElideRight - the default + \endlist + \sa {QtQuick2::}{Text::elide} */ + property int elideMode: Text.ElideRight + + /*! \qmlproperty enumeration TableViewColumn::horizontalAlignment + The horizontal text alignment of the column. + Allowed values are: + \list + \li Text.AlignLeft - the default + \li Text.AlignRight + \li Text.AlignHCenter + \li Text.AlignJustify + \endlist + \sa {QtQuick2::}{Text::horizontalAlignment} */ + property int horizontalAlignment: Text.AlignLeft + + /*! The delegate of the column. This can be used to set the + \l TableView::itemDelegate for a specific column. + + In the delegate you have access to the following special properties: + \list + \li styleData.selected - if the item is currently selected + \li styleData.value - the value or text for this item + \li styleData.textColor - the default text color for an item + \li styleData.row - the index of the row + \li styleData.column - the index of the column + \li styleData.elideMode - the elide mode of the column + \li styleData.textAlignment - the horizontal text alignment of the column + \endlist + */ + property Component delegate + + Accessible.role: Accessible.ColumnHeader +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TextArea.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TextArea.qml new file mode 100644 index 00000000000..7269791962b --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TextArea.qml @@ -0,0 +1,764 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.2 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 +/*! + \qmltype TextArea + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief Displays multiple lines of editable formatted text. + + It can display both plain and rich text. For example: + + \qml + TextArea { + width: 240 + text: "Hello World!" + } + \endqml + + Clipboard support is provided by the cut(), copy(), and paste() functions, and the selection can + be handled in a traditional "mouse" mechanism by setting selectByMouse, or handled completely + from QML by manipulating selectionStart and selectionEnd, or using selectAll() or selectWord(). + + You can translate between cursor positions (characters from the start of the document) and pixel + points using positionAt() and positionToRectangle(). + + You can create a custom appearance for a TextArea by + assigning a \l{QtQuick.Controls.Styles::TextAreaStyle}{TextAreaStyle}. + + \sa TextField, TextEdit +*/ + +ScrollView { + id: area + + /*! + \qmlproperty bool TextArea::activeFocusOnPress + + Whether the TextEdit should gain active focus on a mouse press. By default this is + set to true. + */ + property alias activeFocusOnPress: edit.activeFocusOnPress + + /*! + \qmlproperty url TextArea::baseUrl + + This property specifies a base URL which is used to resolve relative URLs + within the text. + + The default value is the url of the QML file instantiating the TextArea item. + */ + property alias baseUrl: edit.baseUrl + + /*! + \qmlproperty bool TextArea::canPaste + + Returns true if the TextArea is writable and the content of the clipboard is + suitable for pasting into the TextArea. + */ + readonly property alias canPaste: edit.canPaste + + /*! + \qmlproperty bool TextArea::canRedo + + Returns true if the TextArea is writable and there are \l {undo}{undone} + operations that can be redone. + */ + readonly property alias canRedo: edit.canRedo + + /*! + \qmlproperty bool TextArea::canUndo + + Returns true if the TextArea is writable and there are previous operations + that can be undone. + */ + readonly property alias canUndo: edit.canUndo + + /*! + \qmlproperty color TextArea::textColor + + The text color. + + \qml + TextArea { textColor: "orange" } + \endqml + */ + property alias textColor: edit.color + + /*! + \qmlproperty int TextArea::cursorPosition + The position of the cursor in the TextArea. + */ + property alias cursorPosition: edit.cursorPosition + + /*! \qmlproperty font TextArea::font + + The font of the TextArea. + */ + property alias font: edit.font + + /*! + \qmlproperty enumeration TextArea::horizontalAlignment + + Sets the alignment of the text within the TextArea item's width. + + By default, the horizontal text alignment follows the natural alignment of the text, + for example, text that is read from left to right will be aligned to the left. + + The valid values for \c horizontalAlignment are: + \list + \li TextEdit.AlignLeft (Default) + \li TextEdit.AlignRight + \li TextEdit.AlignHCenter + \endlist + + When using the attached property LayoutMirroring::enabled to mirror application + layouts, the horizontal alignment of text will also be mirrored. However, the property + \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment + of TextArea, use the read-only property \c effectiveHorizontalAlignment. + */ + property alias horizontalAlignment: edit.horizontalAlignment + + /*! + \qmlproperty enumeration TextArea::effectiveHorizontalAlignment + + Gets the effective horizontal alignment of the text within the TextArea item's width. + + To set/get the default horizontal alignment of TextArea, use the property \c horizontalAlignment. + + */ + readonly property alias effectiveHorizontalAlignment: edit.effectiveHorizontalAlignment + + /*! + \qmlproperty enumeration TextArea::verticalAlignment + + Sets the alignment of the text within the TextArea item's height. + + The valid values for \c verticalAlignment are: + \list + \li TextEdit.AlignTop + \li TextEdit.AlignBottom + \li TextEdit.AlignVCenter (Default) + \endlist + */ + property alias verticalAlignment: edit.verticalAlignment + + /*! + \qmlproperty enumeration TextArea::inputMethodHints + + Provides hints to the input method about the expected content of the text edit, and how it + should operate. + + The value is a bit-wise combination of flags or Qt.ImhNone if no hints are set. + + The default value is \c Qt.ImhNone. + + Flags that alter behavior are: + + \list + \li Qt.ImhHiddenText - Characters should be hidden, as is typically used when entering passwords. + \li Qt.ImhSensitiveData - Typed text should not be stored by the active input method + in any persistent storage like predictive user dictionary. + \li Qt.ImhNoAutoUppercase - The input method should not try to automatically switch to upper case + when a sentence ends. + \li Qt.ImhPreferNumbers - Numbers are preferred (but not required). + \li Qt.ImhPreferUppercase - Upper case letters are preferred (but not required). + \li Qt.ImhPreferLowercase - Lower case letters are preferred (but not required). + \li Qt.ImhNoPredictiveText - Do not use predictive text (i.e. dictionary lookup) while typing. + + \li Qt.ImhDate - The text editor functions as a date field. + \li Qt.ImhTime - The text editor functions as a time field. + \endlist + + Flags that restrict input (exclusive flags) are: + + \list + \li Qt.ImhDigitsOnly - Only digits are allowed. + \li Qt.ImhFormattedNumbersOnly - Only number input is allowed. This includes decimal point and minus sign. + \li Qt.ImhUppercaseOnly - Only upper case letter input is allowed. + \li Qt.ImhLowercaseOnly - Only lower case letter input is allowed. + \li Qt.ImhDialableCharactersOnly - Only characters suitable for phone dialing are allowed. + \li Qt.ImhEmailCharactersOnly - Only characters suitable for email addresses are allowed. + \li Qt.ImhUrlCharactersOnly - Only characters suitable for URLs are allowed. + \endlist + + Masks: + + \list + \li Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used. + \endlist + */ + property alias inputMethodHints: edit.inputMethodHints + + /*! + \qmlproperty int TextArea::length + + Returns the total number of plain text characters in the TextArea item. + + As this number doesn't include any formatting markup, it may not be the same as the + length of the string returned by the \l text property. + + This property can be faster than querying the length the \l text property as it doesn't + require any copying or conversion of the TextArea's internal string data. + */ + readonly property alias length: edit.length + + /*! + \qmlproperty int TextArea::lineCount + + Returns the total number of lines in the TextArea item. + */ + readonly property alias lineCount: edit.lineCount + + /*! + \qmlproperty bool TextArea::readOnly + + Whether the user can interact with the TextArea item. + + The difference from a disabled text field is that it will appear + to be active, and text can be selected and copied. + + If this property is set to \c true, the text cannot be edited by user interaction. + + By default this property is \c false. + */ + property alias readOnly: edit.readOnly + + /*! + \qmlproperty string TextArea::selectedText + + This read-only property provides the text currently selected in the + text edit. + */ + readonly property alias selectedText: edit.selectedText + + /*! + \qmlproperty int TextArea::selectionEnd + + The cursor position after the last character in the current selection. + + This property is read-only. To change the selection, use select(start,end), + selectAll(), or selectWord(). + + \sa selectionStart, cursorPosition, selectedText + */ + readonly property alias selectionEnd: edit.selectionEnd + + /*! + \qmlproperty int TextArea::selectionStart + + The cursor position before the first character in the current selection. + + This property is read-only. To change the selection, use select(start,end), + selectAll(), or selectWord(). + + \sa selectionEnd, cursorPosition, selectedText + */ + readonly property alias selectionStart: edit.selectionStart + + /*! + \qmlproperty bool TextArea::tabChangesFocus + + This property holds whether Tab changes focus, or is accepted as input. + + Defaults to \c false. + */ + property bool tabChangesFocus: false + + /*! + \qmlproperty string TextArea::text + + The text to display. If the text format is AutoText the text edit will + automatically determine whether the text should be treated as + rich text. This determination is made using Qt::mightBeRichText(). + */ + property alias text: edit.text + + /*! + \qmlproperty enumeration TextArea::textFormat + + The way the text property should be displayed. + + \list + \li TextEdit.AutoText + \li TextEdit.PlainText + \li TextEdit.RichText + \endlist + + The default is TextEdit.PlainText. If the text format is TextEdit.AutoText the text edit + will automatically determine whether the text should be treated as + rich text. This determination is made using Qt::mightBeRichText(). + */ + property alias textFormat: edit.textFormat + + /*! + \qmlproperty enumeration TextArea::wrapMode + + Set this property to wrap the text to the TextArea item's width. + The text will only wrap if an explicit width has been set. + + \list + \li TextEdit.NoWrap - no wrapping will be performed. If the text contains insufficient newlines, then implicitWidth will exceed a set width. + \li TextEdit.WordWrap - wrapping is done on word boundaries only. If a word is too long, implicitWidth will exceed a set width. + \li TextEdit.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word. + \li TextEdit.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word. + \endlist + + The default is \c TextEdit.NoWrap. If you set a width, consider using TextEdit.Wrap. + */ + property alias wrapMode: edit.wrapMode + + /*! + \qmlproperty bool TextArea::selectByMouse + + This property determines if the user can select the text with the + mouse. + + The default value is \c true. + */ + property alias selectByMouse: edit.selectByMouse + + /*! + \qmlproperty bool TextArea::selectByKeyboard + + This property determines if the user can select the text with the + keyboard. + + If set to \c true, the user can use the keyboard to select the text + even if the editor is read-only. If set to \c false, the user cannot + use the keyboard to select the text even if the editor is editable. + + The default value is \c true when the editor is editable, + and \c false when read-only. + + \sa readOnly + */ + property alias selectByKeyboard: edit.selectByKeyboard + + /*! + \qmlsignal TextArea::linkActivated(string link) + + This signal is emitted when the user clicks on a link embedded in the text. + The link must be in rich text or HTML format and the + \a link string provides access to the particular link. + */ + signal linkActivated(string link) + + /*! + \qmlsignal TextArea::linkHovered(string link) + \since 5.2 + + This signal is emitted when the user hovers a link embedded in the text. + The link must be in rich text or HTML format and the + \a link string provides access to the particular link. + + \sa hoveredLink + */ + signal linkHovered(string link) + + /*! + \qmlproperty string TextArea::hoveredLink + \since QtQuick.Controls 1.1 + + This property contains the link string when user hovers a link + embedded in the text. The link must be in rich text or HTML format + and the link string provides access to the particular link. + + \sa onLinkHovered + */ + readonly property alias hoveredLink: edit.hoveredLink + + /*! + \qmlmethod TextArea::append(string) + + Appends \a string as a new line to the end of the text area. + */ + function append (string) { + edit.append(string) + __verticalScrollBar.value = __verticalScrollBar.maximumValue + } + + /*! + \qmlmethod TextArea::copy() + + Copies the currently selected text to the system clipboard. + */ + function copy() { + edit.copy(); + } + + /*! + \qmlmethod TextArea::cut() + + Moves the currently selected text to the system clipboard. + */ + function cut() { + edit.cut(); + } + + /*! + \qmlmethod TextArea::deselect() + + Removes active text selection. + */ + function deselect() { + edit.deselect(); + } + + /*! + \qmlmethod string TextArea::getFormattedText(int start, int end) + + Returns the section of text that is between the \a start and \a end positions. + + The returned text will be formatted according to the \l textFormat property. + */ + function getFormattedText(start, end) { + return edit.getFormattedText(start, end); + } + + /*! + \qmlmethod string TextArea::getText(int start, int end) + + Returns the section of text that is between the \a start and \a end positions. + + The returned text does not include any rich text formatting. + */ + function getText(start, end) { + return edit.getText(start, end); + } + + /*! + \qmlmethod TextArea::insert(int position, string text) + + Inserts \a text into the TextArea at position. + */ + function insert(position, text) { + edit.insert(position, text); + } + + /*! + \qmlmethod TextArea::isRightToLeft(int start, int end) + + Returns true if the natural reading direction of the editor text + found between positions \a start and \a end is right to left. + */ + function isRightToLeft(start, end) { + return edit.isRightToLeft(start, end); + } + + /*! + \qmlmethod TextArea::moveCursorSelection(int position, SelectionMode mode = TextEdit.SelectCharacters) + + Moves the cursor to \a position and updates the selection according to the optional \a mode + parameter. (To only move the cursor, set the \l cursorPosition property.) + + When this method is called it additionally sets either the + selectionStart or the selectionEnd (whichever was at the previous cursor position) + to the specified position. This allows you to easily extend and contract the selected + text range. + + The selection mode specifies whether the selection is updated on a per character or a per word + basis. If not specified the selection mode will default to TextEdit.SelectCharacters. + + \list + \li TextEdit.SelectCharacters - Sets either the selectionStart or selectionEnd (whichever was at + the previous cursor position) to the specified position. + \li TextEdit.SelectWords - Sets the selectionStart and selectionEnd to include all + words between the specified position and the previous cursor position. Words partially in the + range are included. + \endlist + + For example, take this sequence of calls: + + \code + cursorPosition = 5 + moveCursorSelection(9, TextEdit.SelectCharacters) + moveCursorSelection(7, TextEdit.SelectCharacters) + \endcode + + This moves the cursor to the 5th position, extends the selection end from 5 to 9, + and then retracts the selection end from 9 to 7, leaving the text from the 5th + position to the 7th position selected (the 6th and 7th characters). + + The same sequence with TextEdit.SelectWords will extend the selection start to a word boundary + before or on the 5th position, and extend the selection end to a word boundary on or past the 9th position. + */ + function moveCursorSelection(position, mode) { + edit.moveCursorSelection(position, mode); + } + + /*! + \qmlmethod TextArea::paste() + + Replaces the currently selected text by the contents of the system clipboard. + */ + function paste() { + edit.paste(); + } + + /*! + \qmlmethod int TextArea::positionAt(int x, int y) + + Returns the text position closest to pixel position (\a x, \a y). + + Position 0 is before the first character, position 1 is after the first character + but before the second, and so on until position \l {text}.length, which is after all characters. + */ + function positionAt(x, y) { + return edit.positionAt(x, y); + } + + /*! + \qmlmethod rectangle TextArea::positionToRectangle(position) + + Returns the rectangle at the given \a position in the text. The x, y, + and height properties correspond to the cursor that would describe + that position. + */ + function positionToRectangle(position) { + return edit.positionToRectangle(position); + } + + /*! + \qmlmethod TextArea::redo() + + Redoes the last operation if redo is \l {canRedo}{available}. + */ + function redo() { + edit.redo(); + } + + /*! + \qmlmethod string TextArea::remove(int start, int end) + + Removes the section of text that is between the \a start and \a end positions from the TextArea. + */ + function remove(start, end) { + return edit.remove(start, end); + } + + /*! + \qmlmethod TextArea::select(int start, int end) + + Causes the text from \a start to \a end to be selected. + + If either start or end is out of range, the selection is not changed. + + After calling this, selectionStart will become the lesser + and selectionEnd will become the greater (regardless of the order passed + to this method). + + \sa selectionStart, selectionEnd + */ + function select(start, end) { + edit.select(start, end); + } + + /*! + \qmlmethod TextArea::selectAll() + + Causes all text to be selected. + */ + function selectAll() { + edit.selectAll(); + } + + /*! + \qmlmethod TextArea::selectWord() + + Causes the word closest to the current cursor position to be selected. + */ + function selectWord() { + edit.selectWord(); + } + + /*! + \qmlmethod TextArea::undo() + + Undoes the last operation if undo is \l {canUndo}{available}. Deselects any + current selection, and updates the selection start to the current cursor + position. + */ + function undo() { + edit.undo(); + } + + /*! \qmlproperty bool TextArea::backgroundVisible + + This property determines if the background should be filled or not. + + The default value is \c true. + */ + property alias backgroundVisible: colorRect.visible + + /*! \internal */ + default property alias data: area.data + + /*! \qmlproperty real TextArea::textMargin + \since QtQuick.Controls 1.1 + + The margin, in pixels, around the text in the TextArea. + */ + property alias textMargin: edit.textMargin + + frameVisible: true + + activeFocusOnTab: true + + Accessible.role: Accessible.EditableText + + style: Qt.createComponent(Settings.style + "/TextAreaStyle.qml", area) + + /*! + \qmlproperty TextDocument TextArea::textDocument + + This property exposes the \l QQuickTextDocument of this TextArea. + \sa TextEdit::textDocument + */ + property alias textDocument: edit.textDocument + + Flickable { + id: flickable + + interactive: false + anchors.fill: parent + + TextEdit { + id: edit + focus: true + + Rectangle { + id: colorRect + parent: viewport + anchors.fill: parent + color: __style ? __style.backgroundColor : "white" + z: -1 + } + + property int layoutRecursionDepth: 0 + + function doLayout() { + // scrollbars affect the document/viewport size and vice versa, so we + // must allow the layout loop to recurse twice until the sizes stabilize + if (layoutRecursionDepth <= 2) { + layoutRecursionDepth++ + + if (wrapMode == TextEdit.NoWrap) { + __horizontalScrollBar.visible = edit.contentWidth > viewport.width + edit.width = Math.max(viewport.width, edit.contentWidth) + } else { + __horizontalScrollBar.visible = false + edit.width = viewport.width + } + edit.height = Math.max(viewport.height, edit.contentHeight) + + flickable.contentWidth = edit.contentWidth + flickable.contentHeight = edit.contentHeight + + layoutRecursionDepth-- + } + } + + Connections { + target: area.viewport + onWidthChanged: edit.doLayout() + onHeightChanged: edit.doLayout() + } + onContentWidthChanged: edit.doLayout() + onContentHeightChanged: edit.doLayout() + onWrapModeChanged: edit.doLayout() + + renderType: __style ? __style.renderType : Text.NativeRendering + font: __style ? __style.font : font + color: __style ? __style.textColor : "darkgray" + selectionColor: __style ? __style.selectionColor : "darkred" + selectedTextColor: __style ? __style.selectedTextColor : "white" + wrapMode: TextEdit.WordWrap + textMargin: 4 + + selectByMouse: true + readOnly: false + + KeyNavigation.priority: KeyNavigation.BeforeItem + KeyNavigation.tab: area.tabChangesFocus ? area.KeyNavigation.tab : null + KeyNavigation.backtab: area.tabChangesFocus ? area.KeyNavigation.backtab : null + + // keep textcursor within scroll view + onCursorPositionChanged: { + if (cursorRectangle.y >= flickableItem.contentY + viewport.height - cursorRectangle.height - textMargin) { + // moving down + flickableItem.contentY = cursorRectangle.y - viewport.height + cursorRectangle.height + textMargin + } else if (cursorRectangle.y < flickableItem.contentY) { + // moving up + flickableItem.contentY = cursorRectangle.y - textMargin + } + + if (cursorRectangle.x >= flickableItem.contentX + viewport.width - textMargin) { + // moving right + flickableItem.contentX = cursorRectangle.x - viewport.width + textMargin + } else if (cursorRectangle.x < flickableItem.contentX) { + // moving left + flickableItem.contentX = cursorRectangle.x - textMargin + } + } + onLinkActivated: area.linkActivated(link) + onLinkHovered: area.linkHovered(link) + + MouseArea { + parent: area.viewport + anchors.fill: parent + cursorShape: edit.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor + acceptedButtons: Qt.NoButton + } + } + } + + Keys.onPressed: { + if (event.key == Qt.Key_PageUp) { + __verticalScrollBar.value -= area.height + } else if (event.key == Qt.Key_PageDown) + __verticalScrollBar.value += area.height + } + +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TextField.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TextField.qml new file mode 100644 index 00000000000..0961430d524 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/TextField.qml @@ -0,0 +1,609 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.2 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype TextField + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief Displays a single line of editable plain text. + + TextField is used to accept a line of text input. Input constraints can be + placed on a TextField item (for example, through a \l validator or \l + inputMask). Setting \l echoMode to an appropriate value enables + TextField to be used for a password input field. + + You can create a custom appearance for a TextField by + assigning a \l {QtQuick.Controls.Styles::TextFieldStyle}{TextFieldStyle}. + + \sa TextArea, TextInput +*/ + +Control { + id: textfield + + /*! + \qmlproperty bool TextField::acceptableInput + + Returns \c true if the text field contains acceptable + text. + + If a validator or input mask was set, this property will return \c + true if the current text satisfies the validator or mask as + a final string (not as an intermediate string). + + The default value is \c true. + + \sa validator, inputMask, accepted + + */ + readonly property alias acceptableInput: textInput.acceptableInput // read only + + /*! + \qmlproperty bool TextField::activeFocusOnPress + + This property is set to \c true if the TextField should gain active + focus on a mouse press. + + The default value is \c true. + */ + property alias activeFocusOnPress: textInput.activeFocusOnPress + + /*! + \qmlproperty bool TextField::canPaste + + Returns \c true if the TextField is writable and the content of the + clipboard is suitable for pasting into the TextField. + */ + readonly property alias canPaste: textInput.canPaste + + /*! + \qmlproperty bool TextField::canRedo + + Returns \c true if the TextField is writable and there are \l + {undo}{undone} operations that can be redone. + */ + readonly property alias canRedo: textInput.canRedo + + /*! + \qmlproperty bool TextField::canUndo + + Returns \c true if the TextField is writable and there are previous + operations that can be undone. + */ + readonly property alias canUndo: textInput.canUndo + + /*! + \qmlproperty color TextField::textColor + + This property holds the text color. + */ + property alias textColor: textInput.color + + /*! + \qmlproperty int TextField::cursorPosition + + This property holds the position of the cursor in the TextField. + */ + property alias cursorPosition: textInput.cursorPosition + + /*! + \qmlproperty string TextField::displayText + + This property holds the text displayed in the TextField. + + If \l echoMode is set to TextInput::Normal, this holds the + same value as the TextField::text property. Otherwise, + this property holds the text visible to the user, while + the \l text property holds the actual entered text. + */ + readonly property alias displayText: textInput.displayText + + /*! + \qmlproperty enumeration TextField::echoMode + + Specifies how the text should be displayed in the + TextField. + + The possible modes are: + \list + \li TextInput.Normal - Displays the text as it is. (Default) + \li TextInput.Password - Displays asterisks instead of characters. + \li TextInput.NoEcho - Displays nothing. + \li TextInput.PasswordEchoOnEdit - Displays characters as they are + entered while editing, otherwise displays asterisks. + \endlist + */ + property alias echoMode: textInput.echoMode + + /*! + \qmlproperty font TextField::font + + Sets the font of the TextField. + */ + property alias font: textInput.font + + /*! + \qmlproperty enumeration TextField::horizontalAlignment + + Sets the alignment of the text within the TextField item's width. + + By default, the horizontal text alignment follows the natural alignment + of the text, for example text that is read from left to right will be + aligned to the left. + + The possible alignment values are: + \list + \li TextInput.AlignLeft + \li TextInput.AlignRight + \li TextInput.AlignHCenter + \endlist + + When using the attached property, LayoutMirroring::enabled, to mirror + application layouts, the horizontal alignment of text will also be + mirrored. However, the property \c horizontalAlignment will remain + unchanged. To query the effective horizontal alignment of TextField, use + the read-only property \c effectiveHorizontalAlignment. + */ + property alias horizontalAlignment: textInput.horizontalAlignment + + /*! + \qmlproperty enumeration TextField::effectiveHorizontalAlignment + + Gets the effective horizontal alignment of the text within the TextField + item's width. + + \l horizontalAlignment contains the default horizontal alignment. + + \sa horizontalAlignment + + */ + readonly property alias effectiveHorizontalAlignment: textInput.effectiveHorizontalAlignment + + /*! + \qmlproperty enumeration TextField::verticalAlignment + + Sets the alignment of the text within the TextField item's height. + + The possible alignment values are: + \list + \li TextInput.AlignTop + \li TextInput.AlignBottom + \li TextInput.AlignVCenter (default). + \endlist + */ + property alias verticalAlignment: textInput.verticalAlignment + + /*! + \qmlproperty string TextField::inputMask + + Sets an input mask on the TextField, restricting the allowable text + inputs. See QLineEdit::inputMask for further details, as the exact same + mask strings are used by TextField. + + \sa acceptableInput, validator + */ + property alias inputMask: textInput.inputMask + + /*! + \qmlproperty enumeration TextField::inputMethodHints + + Provides hints to the input method about the expected content of the + text field and how it should operate. + + The value is a bit-wise combination of flags, or \c Qt.ImhNone if no + hints are set. + + The default value is \c Qt.ImhNone. + + Flags that alter behavior are: + + \list + \li Qt.ImhHiddenText - Characters should be hidden, as is typically used when entering passwords. + This is automatically set when setting echoMode to \c TextInput.Password. + \li Qt.ImhSensitiveData - Typed text should not be stored by the active input method + in any persistent storage like predictive user dictionary. + \li Qt.ImhNoAutoUppercase - The input method should not try to automatically switch to upper case + when a sentence ends. + \li Qt.ImhPreferNumbers - Numbers are preferred (but not required). + \li Qt.ImhPreferUppercase - Uppercase letters are preferred (but not required). + \li Qt.ImhPreferLowercase - Lowercase letters are preferred (but not required). + \li Qt.ImhNoPredictiveText - Do not use predictive text (for example, dictionary lookup) while typing. + + \li Qt.ImhDate - The text editor functions as a date field. + \li Qt.ImhTime - The text editor functions as a time field. + \endlist + + Flags that restrict input (exclusive flags) are: + + \list + \li Qt.ImhDigitsOnly - Only digits are allowed. + \li Qt.ImhFormattedNumbersOnly - Only number input is allowed. This includes decimal point and minus sign. + \li Qt.ImhUppercaseOnly - Only uppercase letter input is allowed. + \li Qt.ImhLowercaseOnly - Only lowercase letter input is allowed. + \li Qt.ImhDialableCharactersOnly - Only characters suitable for phone dialing are allowed. + \li Qt.ImhEmailCharactersOnly - Only characters suitable for email addresses are allowed. + \li Qt.ImhUrlCharactersOnly - Only characters suitable for URLs are allowed. + \endlist + + Masks: + \list + \li Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used. + \endlist + */ + property alias inputMethodHints: textInput.inputMethodHints + + /*! + \qmlproperty int TextField::length + + Returns the total number of characters in the TextField item. + + If the TextField has an input mask, the length will include mask + characters and may differ from the length of the string returned by the + \l text property. + + This property can be faster than querying the length of the \l text + property as it doesn't require any copying or conversion of the + TextField's internal string data. + */ + readonly property alias length: textInput.length + + /*! + \qmlproperty int TextField::maximumLength + + This property holds the maximum permitted length of the text in the + TextField. + + If the text is too long, it is truncated at the limit. + */ + property alias maximumLength: textInput.maximumLength + + /*! + \qmlproperty string TextField::placeholderText + + This property contains the text that is shown in the text field when the + text field is empty and has no focus. + */ + property alias placeholderText: placeholderTextComponent.text + + /*! + \qmlproperty bool TextField::readOnly + + Sets whether user input can modify the contents of the TextField. Read- + only is different from a disabled text field in that the text field will + appear to be active and text can still be selected and copied. + + If readOnly is set to \c true, then user input will not affect the text. + Any bindings or attempts to set the text property will still + work, however. + */ + property alias readOnly: textInput.readOnly + + /*! + \qmlproperty string TextField::selectedText + + Provides the text currently selected in the text input. + + It is equivalent to the following snippet, but is faster and easier + to use. + + \code + myTextField.text.toString().substring(myTextField.selectionStart, myTextField.selectionEnd); + \endcode + */ + readonly property alias selectedText: textInput.selectedText + + /*! + \qmlproperty int TextField::selectionEnd + + The cursor position after the last character in the current selection. + + This property is read-only. To change the selection, use + select(start,end), selectAll(), or selectWord(). + + \sa selectionStart, cursorPosition, selectedText + */ + readonly property alias selectionEnd: textInput.selectionEnd + + /*! + \qmlproperty int TextField::selectionStart + + The cursor position before the first character in the current selection. + + This property is read-only. To change the selection, use select(start,end), + selectAll(), or selectWord(). + + \sa selectionEnd, cursorPosition, selectedText + */ + readonly property alias selectionStart: textInput.selectionStart + + /*! + \qmlproperty string TextField::text + + This property contains the text in the TextField. + */ + property alias text: textInput.text + + /*! + \qmlproperty Validator TextField::validator + + Allows you to set a validator on the TextField. When a validator is set, + the TextField will only accept input which leaves the text property in + an intermediate state. The accepted signal will only be sent + if the text is in an acceptable state when enter is pressed. + + Currently supported validators are \l{QtQuick2::IntValidator}, + \l{QtQuick2::DoubleValidator}, and \l{QtQuick2::RegExpValidator}. An + example of using validators is shown below, which allows input of + integers between 11 and 31 into the text input: + + \code + import QtQuick 2.1 + import QtQuick.Controls 1.1 + + TextField { + validator: IntValidator {bottom: 11; top: 31;} + focus: true + } + \endcode + + \sa acceptableInput, inputMask, accepted + */ + property alias validator: textInput.validator + + /*! + \qmlsignal TextField::accepted() + + This signal is emitted when the Return or Enter key is pressed. + Note that if there is a \l validator or \l inputMask set on the text + field, the signal will only be emitted if the input is in an acceptable + state. + */ + signal accepted() + + /*! + \qmlsignal TextField::editingFinished() + \since 5.2 + + This signal is emitted when the Return or Enter key is pressed or + the text field loses focus. Note that if there is a validator or + inputMask set on the text field and enter/return is pressed, this + signal will only be emitted if the input follows + the inputMask and the validator returns an acceptable state. + */ + signal editingFinished() + + /*! + \qmlmethod TextField::copy() + + Copies the currently selected text to the system clipboard. + */ + function copy() { + textInput.copy() + } + + /*! + \qmlmethod TextField::cut() + + Moves the currently selected text to the system clipboard. + */ + function cut() { + textInput.cut() + } + + /*! + \qmlmethod TextField::deselect() + + Removes active text selection. + */ + function deselect() { + textInput.deselect(); + } + + /*! + \qmlmethod string TextField::getText(int start, int end) + + Removes the section of text that is between the \a start and \a end + positions from the TextField. + */ + function getText(start, end) { + return textInput.getText(start, end); + } + + /*! + \qmlmethod TextField::insert(int position, string text) + + Inserts \a text into the TextField at \a position. + */ + function insert(position, text) { + textInput.insert(position, text); + } + + /*! + \qmlmethod bool TextField::isRightToLeft(int start, int end) + + Returns \c true if the natural reading direction of the editor text + found between positions \a start and \a end is right to left. + */ + function isRightToLeft(start, end) { + return textInput.isRightToLeft(start, end); + } + + /*! + \qmlmethod TextField::paste() + + Replaces the currently selected text by the contents of the system + clipboard. + */ + function paste() { + textInput.paste() + } + + /*! + \qmlmethod TextField::redo() + + Performs the last operation if redo is \l {canRedo}{available}. + */ + function redo() { + textInput.redo(); + } + + /*! + \qmlmethod TextField::select(int start, int end) + + Causes the text from \a start to \a end to be selected. + + If either start or end is out of range, the selection is not changed. + + After calling select, selectionStart will become the lesser + and selectionEnd will become the greater (regardless of the order passed + to this method). + + \sa selectionStart, selectionEnd + */ + function select(start, end) { + textInput.select(start, end) + } + + /*! + \qmlmethod TextField::selectAll() + + Causes all text to be selected. + */ + function selectAll() { + textInput.selectAll() + } + + /*! + \qmlmethod TextField::selectWord() + + Causes the word closest to the current cursor position to be selected. + */ + function selectWord() { + textInput.selectWord() + } + + /*! + \qmlmethod TextField::undo() + + Reverts the last operation if undo is \l {canUndo}{available}. undo() + deselects any current selection and updates the selection start to the + current cursor position. + */ + function undo() { + textInput.undo(); + } + + /*! \qmlproperty bool TextField::hovered + + This property holds whether the control is being hovered. + */ + readonly property alias hovered: mouseArea.containsMouse + + /*! \internal */ + property alias __contentHeight: textInput.contentHeight + + /*! \internal */ + property alias __contentWidth: textInput.contentWidth + + style: Qt.createComponent(Settings.style + "/TextFieldStyle.qml", textInput) + + activeFocusOnTab: true + + Accessible.name: text + Accessible.role: Accessible.EditableText + Accessible.description: placeholderText + + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.IBeamCursor + onClicked: textfield.forceActiveFocus() + } + + Text { + id: placeholderTextComponent + anchors.fill: textInput + font: textInput.font + horizontalAlignment: textInput.horizontalAlignment + verticalAlignment: textInput.verticalAlignment + opacity: !textInput.text.length && !textInput.inputMethodComposing ? 1 : 0 + color: __panel ? __panel.placeholderTextColor : "darkgray" + clip: contentWidth > width; + elide: Text.ElideRight + renderType: __style ? __style.renderType : Text.NativeRendering + Behavior on opacity { NumberAnimation { duration: 90 } } + } + + TextInput { + id: textInput + focus: true + selectByMouse: true + selectionColor: __panel ? __panel.selectionColor : "darkred" + selectedTextColor: __panel ? __panel.selectedTextColor : "white" + + font: __panel ? __panel.font : font + anchors.leftMargin: __panel ? __panel.leftMargin : 0 + anchors.topMargin: __panel ? __panel.topMargin : 0 + anchors.rightMargin: __panel ? __panel.rightMargin : 0 + anchors.bottomMargin: __panel ? __panel.bottomMargin : 0 + + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + + color: __panel ? __panel.textColor : "darkgray" + clip: contentWidth > width + + renderType: __style ? __style.renderType : Text.NativeRendering + + onAccepted: { + Qt.inputMethod.commit() + Qt.inputMethod.hide() + textfield.accepted() + } + + onEditingFinished: textfield.editingFinished() + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ToolBar.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ToolBar.qml new file mode 100644 index 00000000000..1a4c7cb65f1 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ToolBar.qml @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ToolBar + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup applicationwindow + \brief Contains ToolButton and related controls. + + The common way of using ToolBar is in relation to \l ApplicationWindow. It + provides styling and is generally designed to work well with ToolButton as + well as other controls. + + Note that the ToolBar does not provide a layout of its own, but requires + you to position its contents, for instance by creating a \l RowLayout. + + If only a single item is used within the ToolBar, it will resize to fit the implicitHeight + of its contained item. This makes it particularly suitable for use together with layouts. + Otherwise the height is platform dependent. + + \code + import QtQuick.Controls 1.1 + import QtQuick.Layouts 1.0 + + ApplicationWindow { + toolBar: ToolBar { + RowLayout { + ToolButton { ... } + ToolButton { ... } + ToolButton { ... } + } + } + } + \endcode +*/ + +Item { + id: toolbar + + activeFocusOnTab: false + Accessible.role: Accessible.ToolBar + LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft + LayoutMirroring.childrenInherit: true + + width: parent ? parent.width : implicitWidth + implicitWidth: container.leftMargin + container.rightMargin + container.calcWidth() + implicitHeight: container.topMargin + container.bottomMargin + container.calcHeight() + + /*! \internal */ + property Component style: Qt.createComponent(Settings.style + "/ToolBarStyle.qml", toolbar) + + /*! \internal */ + property alias __style: styleLoader.item + + /*! \internal */ + default property alias __content: container.data + + /*! + \qmlproperty Item ToolBar::contentItem + + This property holds the content Item of the tool bar. + + Items declared as children of a ToolBar are automatically parented to the ToolBar's contentItem. + Items created dynamically need to be explicitly parented to the contentItem: + + \note The implicit size of the ToolBar is calculated based on the size of its content. If you want to anchor + items inside the tool bar, you must specify an explicit width and height on the ToolBar itself. + */ + readonly property alias contentItem: container + + data: [ + Loader { + id: loader + anchors.fill: parent + sourceComponent: styleLoader.item ? styleLoader.item.panel : null + onLoaded: item.z = -1 + Loader { + id: styleLoader + property alias __control: toolbar + sourceComponent: style + } + }, + Item { + id: container + z: 1 + focus: true + anchors.fill: parent + + anchors.topMargin: topMargin + anchors.leftMargin: leftMargin + anchors.rightMargin: rightMargin + anchors.bottomMargin: bottomMargin + + property int topMargin: __style ? __style.padding.top : 0 + property int bottomMargin: __style ? __style.padding.bottom : 0 + property int leftMargin: __style ? __style.padding.left : 0 + property int rightMargin: __style ? __style.padding.right : 0 + + property Item layoutItem: container.children.length === 1 ? container.children[0] : null + function calcWidth() { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) + + (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin + + layoutItem.anchors.rightMargin : 0) : + loader.item ? loader.item.implicitWidth : 0) } + function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) + + (layoutItem.anchors.fill ? layoutItem.anchors.topMargin + + layoutItem.anchors.bottomMargin : 0) : + loader.item ? loader.item.implicitHeight : 0) } + }] +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ToolButton.qml b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ToolButton.qml new file mode 100644 index 00000000000..0ff62ec45a9 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/ToolButton.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Controls module 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Private 1.0 + +/*! + \qmltype ToolButton + \inqmlmodule QtQuick.Controls + \since 5.1 + \ingroup controls + \brief Provides a button type that is typically used within a ToolBar. + + ToolButton is functionally similar to \l Button, but can provide a look that is more + suitable within a \l ToolBar. + + \code + ToolButton { + iconSource: "edit-cut.png" + } + \endcode + + You can create a custom appearance for a ToolButton by + assigning a \l {QtQuick.Controls.Styles::ButtonStyle}{ButtonStyle}. +*/ + +Button { + id: button + style: Qt.createComponent(Settings.style + "/ToolButtonStyle.qml", button) +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/plugins.qmltypes b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/plugins.qmltypes new file mode 100644 index 00000000000..eadb72efb7a --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/plugins.qmltypes @@ -0,0 +1,1889 @@ +import QtQuick.tooling 1.1 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. +// +// This file was auto-generated with the command 'qmlplugindump -nonrelocatable QtQuick.Controls 1.1'. + +Module { + Component { + name: "QQuickAbstractStyle" + defaultProperty: "data" + prototype: "QObject" + exports: ["QtQuick.Controls.Private/AbstractStyle 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "padding"; type: "QQuickPadding"; isReadonly: true; isPointer: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + } + Component { + name: "QQuickAction" + prototype: "QObject" + exports: ["QtQuick.Controls/Action 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "text"; type: "string" } + Property { name: "iconSource"; type: "QUrl" } + Property { name: "iconName"; type: "string" } + Property { name: "__icon"; type: "QVariant"; isReadonly: true } + Property { name: "tooltip"; type: "string" } + Property { name: "enabled"; type: "bool" } + Property { name: "checkable"; type: "bool" } + Property { name: "checked"; type: "bool" } + Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true } + Property { name: "shortcut"; type: "QVariant" } + Signal { name: "triggered" } + Signal { + name: "toggled" + Parameter { name: "checked"; type: "bool" } + } + Signal { + name: "shortcutChanged" + Parameter { name: "shortcut"; type: "QVariant" } + } + Signal { name: "iconChanged" } + Signal { + name: "tooltipChanged" + Parameter { name: "arg"; type: "string" } + } + Method { name: "trigger" } + } + Component { + name: "QQuickControlSettings" + prototype: "QObject" + exports: ["QtQuick.Controls.Private/Settings 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "style"; type: "QUrl"; isReadonly: true } + Property { name: "styleName"; type: "string" } + Property { name: "stylePath"; type: "string" } + Property { name: "dpiScaleFactor"; type: "double"; isReadonly: true } + } + Component { + name: "QQuickExclusiveGroup" + defaultProperty: "__actions" + prototype: "QObject" + exports: ["QtQuick.Controls/ExclusiveGroup 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "current"; type: "QObject"; isPointer: true } + Property { name: "__actions"; type: "QQuickAction"; isList: true; isReadonly: true } + Method { + name: "bindCheckable" + Parameter { name: "o"; type: "QObject"; isPointer: true } + } + Method { + name: "unbindCheckable" + Parameter { name: "o"; type: "QObject"; isPointer: true } + } + } + Component { + name: "QQuickMenu" + defaultProperty: "items" + prototype: "QQuickMenuText" + exports: ["QtQuick.Controls/MenuPrivate 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "title"; type: "string" } + Property { name: "items"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "__selectedIndex"; type: "int" } + Property { name: "__popupVisible"; type: "bool"; isReadonly: true } + Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__minimumWidth"; type: "int" } + Property { name: "__font"; type: "QFont" } + Property { name: "__xOffset"; type: "double" } + Property { name: "__yOffset"; type: "double" } + Signal { name: "__menuClosed" } + Signal { name: "popupVisibleChanged" } + Method { name: "__closeMenu" } + Method { name: "__dismissMenu" } + Method { name: "popup" } + Method { + name: "addItem" + type: "QQuickMenuItem*" + Parameter { type: "string" } + } + Method { + name: "insertItem" + type: "QQuickMenuItem*" + Parameter { type: "int" } + Parameter { type: "string" } + } + Method { name: "addSeparator" } + Method { + name: "insertSeparator" + Parameter { type: "int" } + } + Method { + name: "insertItem" + Parameter { type: "int" } + Parameter { type: "QQuickMenuBase"; isPointer: true } + } + Method { + name: "removeItem" + Parameter { type: "QQuickMenuBase"; isPointer: true } + } + Method { name: "clear" } + Method { + name: "__popup" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + Parameter { name: "atActionIndex"; type: "int" } + } + Method { + name: "__popup" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } + Component { + name: "QQuickMenuBar" + defaultProperty: "menus" + prototype: "QObject" + exports: ["QtQuick.Controls/MenuBarPrivate 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "menus"; type: "QQuickMenu"; isList: true; isReadonly: true } + Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__parentWindow"; type: "QQuickWindow"; isPointer: true } + Property { name: "__isNative"; type: "bool"; isReadonly: true } + Signal { name: "contentItemChanged" } + } + Component { + name: "QQuickMenuBase" + prototype: "QObject" + exports: ["QtQuick.Controls/MenuBase 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "visible"; type: "bool" } + Property { name: "type"; type: "QQuickMenuItemType::MenuItemType"; isReadonly: true } + Property { name: "__parentMenu"; type: "QQuickMenu"; isReadonly: true; isPointer: true } + Property { name: "__isNative"; type: "bool"; isReadonly: true } + Property { name: "__visualItem"; type: "QQuickItem"; isPointer: true } + } + Component { + name: "QQuickMenuItem" + prototype: "QQuickMenuText" + exports: ["QtQuick.Controls/MenuItem 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "text"; type: "string" } + Property { name: "checkable"; type: "bool" } + Property { name: "checked"; type: "bool" } + Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true } + Property { name: "shortcut"; type: "QVariant" } + Property { name: "action"; type: "QQuickAction"; isPointer: true } + Signal { name: "triggered" } + Signal { + name: "toggled" + Parameter { name: "checked"; type: "bool" } + } + Method { name: "trigger" } + } + Component { + name: "QQuickMenuItemType" + exports: ["QtQuick.Controls/MenuItemType 1.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "MenuItemType" + values: { + "Separator": 0, + "Item": 1, + "Menu": 2 + } + } + } + Component { + name: "QQuickMenuSeparator" + prototype: "QQuickMenuBase" + exports: ["QtQuick.Controls/MenuSeparator 1.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickMenuText" + prototype: "QQuickMenuBase" + Property { name: "enabled"; type: "bool" } + Property { name: "iconSource"; type: "QUrl" } + Property { name: "iconName"; type: "string" } + Property { name: "__icon"; type: "QVariant"; isReadonly: true } + Signal { name: "__textChanged" } + } + Component { + name: "QQuickPadding" + prototype: "QObject" + Property { name: "left"; type: "int" } + Property { name: "top"; type: "int" } + Property { name: "right"; type: "int" } + Property { name: "bottom"; type: "int" } + Method { + name: "setLeft" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setTop" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setRight" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setBottom" + Parameter { name: "arg"; type: "int" } + } + } + Component { + name: "QQuickRangeModel" + prototype: "QObject" + exports: ["QtQuick.Controls.Private/RangeModel 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "value"; type: "double" } + Property { name: "minimumValue"; type: "double" } + Property { name: "maximumValue"; type: "double" } + Property { name: "stepSize"; type: "double" } + Property { name: "position"; type: "double" } + Property { name: "positionAtMinimum"; type: "double" } + Property { name: "positionAtMaximum"; type: "double" } + Property { name: "inverted"; type: "bool" } + Signal { + name: "valueChanged" + Parameter { name: "value"; type: "double" } + } + Signal { + name: "positionChanged" + Parameter { name: "position"; type: "double" } + } + Signal { + name: "stepSizeChanged" + Parameter { name: "stepSize"; type: "double" } + } + Signal { + name: "invertedChanged" + Parameter { name: "inverted"; type: "bool" } + } + Signal { + name: "minimumChanged" + Parameter { name: "min"; type: "double" } + } + Signal { + name: "maximumChanged" + Parameter { name: "max"; type: "double" } + } + Signal { + name: "positionAtMinimumChanged" + Parameter { name: "min"; type: "double" } + } + Signal { + name: "positionAtMaximumChanged" + Parameter { name: "max"; type: "double" } + } + Method { name: "toMinimum" } + Method { name: "toMaximum" } + Method { + name: "setValue" + Parameter { name: "value"; type: "double" } + } + Method { + name: "setPosition" + Parameter { name: "position"; type: "double" } + } + Method { + name: "valueForPosition" + type: "double" + Parameter { name: "position"; type: "double" } + } + Method { + name: "positionForValue" + type: "double" + Parameter { name: "value"; type: "double" } + } + } + Component { + name: "QQuickSpinBoxValidator" + prototype: "QValidator" + exports: ["QtQuick.Controls.Private/SpinBoxValidator 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "text"; type: "string"; isReadonly: true } + Property { name: "value"; type: "double" } + Property { name: "minimumValue"; type: "double" } + Property { name: "maximumValue"; type: "double" } + Property { name: "decimals"; type: "int" } + Property { name: "stepSize"; type: "double" } + Property { name: "prefix"; type: "string" } + Property { name: "suffix"; type: "string" } + Method { name: "increment" } + Method { name: "decrement" } + } + Component { + name: "QQuickStack" + prototype: "QObject" + exports: ["QtQuick.Controls/Stack 1.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Status" + values: { + "Inactive": 0, + "Deactivating": 1, + "Activating": 2, + "Active": 3 + } + } + Property { name: "index"; type: "int"; isReadonly: true } + Property { name: "__index"; type: "int" } + Property { name: "status"; type: "Status"; isReadonly: true } + Property { name: "__status"; type: "Status" } + Property { name: "view"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "__view"; type: "QQuickItem"; isPointer: true } + } + Component { + name: "QQuickStyleItem" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick.Controls.Private/StyleItem 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "sunken"; type: "bool" } + Property { name: "raised"; type: "bool" } + Property { name: "active"; type: "bool" } + Property { name: "selected"; type: "bool" } + Property { name: "hasFocus"; type: "bool" } + Property { name: "on"; type: "bool" } + Property { name: "hover"; type: "bool" } + Property { name: "horizontal"; type: "bool" } + Property { name: "transient"; type: "bool" } + Property { name: "elementType"; type: "string" } + Property { name: "text"; type: "string" } + Property { name: "activeControl"; type: "string" } + Property { name: "style"; type: "string"; isReadonly: true } + Property { name: "hints"; type: "QVariantMap" } + Property { name: "properties"; type: "QVariantMap" } + Property { name: "font"; type: "QFont"; isReadonly: true } + Property { name: "minimum"; type: "int" } + Property { name: "maximum"; type: "int" } + Property { name: "value"; type: "int" } + Property { name: "step"; type: "int" } + Property { name: "paintMargins"; type: "int" } + Property { name: "contentWidth"; type: "int" } + Property { name: "contentHeight"; type: "int" } + Signal { name: "infoChanged" } + Signal { name: "hintChanged" } + Signal { + name: "contentWidthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "contentHeightChanged" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "pixelMetric" + type: "int" + Parameter { type: "string" } + } + Method { + name: "styleHint" + type: "QVariant" + Parameter { type: "string" } + } + Method { name: "updateSizeHint" } + Method { name: "updateRect" } + Method { name: "updateItem" } + Method { + name: "hitTest" + type: "string" + Parameter { name: "x"; type: "int" } + Parameter { name: "y"; type: "int" } + } + Method { + name: "subControlRect" + type: "QRectF" + Parameter { name: "subcontrolString"; type: "string" } + } + Method { + name: "elidedText" + type: "string" + Parameter { name: "text"; type: "string" } + Parameter { name: "elideMode"; type: "int" } + Parameter { name: "width"; type: "int" } + } + Method { + name: "hasThemeIcon" + type: "bool" + Parameter { type: "string" } + } + Method { + name: "textWidth" + type: "double" + Parameter { type: "string" } + } + Method { + name: "textHeight" + type: "double" + Parameter { type: "string" } + } + } + Component { + name: "QQuickTooltip" + prototype: "QObject" + exports: ["QtQuick.Controls.Private/Tooltip 1.0"] + exportMetaObjectRevisions: [0] + Method { + name: "showText" + Parameter { name: "item"; type: "QQuickItem"; isPointer: true } + Parameter { name: "pos"; type: "QPointF" } + Parameter { name: "text"; type: "string" } + } + Method { name: "hideText" } + } + Component { + name: "QQuickWheelArea" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick.Controls.Private/WheelArea 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "verticalDelta"; type: "double" } + Property { name: "horizontalDelta"; type: "double" } + Property { name: "horizontalMinimumValue"; type: "double" } + Property { name: "horizontalMaximumValue"; type: "double" } + Property { name: "verticalMinimumValue"; type: "double" } + Property { name: "verticalMaximumValue"; type: "double" } + Property { name: "horizontalValue"; type: "double" } + Property { name: "verticalValue"; type: "double" } + Property { name: "scrollSpeed"; type: "double" } + Property { name: "active"; type: "bool" } + Signal { name: "verticalWheelMoved" } + Signal { name: "horizontalWheelMoved" } + } + Component { + name: "QQuickWindow" + defaultProperty: "data" + prototype: "QWindow" + exports: ["QtQuick.Window/Window 2.0", "QtQuick.Window/Window 2.1"] + exportMetaObjectRevisions: [0, 1] + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "color"; type: "QColor" } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { + name: "activeFocusItem" + revision: 1 + type: "QQuickItem" + isReadonly: true + isPointer: true + } + Signal { name: "frameSwapped" } + Signal { name: "sceneGraphInitialized" } + Signal { name: "sceneGraphInvalidated" } + Signal { name: "beforeSynchronizing" } + Signal { name: "beforeRendering" } + Signal { name: "afterRendering" } + Signal { + name: "closing" + revision: 1 + Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true } + } + Signal { + name: "colorChanged" + Parameter { type: "QColor" } + } + Signal { name: "activeFocusItemChanged"; revision: 1 } + Method { name: "update" } + Method { name: "releaseResources" } + } + Component { + name: "QWindow" + prototype: "QObject" + Enum { + name: "Visibility" + values: { + "Hidden": 0, + "AutomaticVisibility": 1, + "Windowed": 2, + "Minimized": 3, + "Maximized": 4, + "FullScreen": 5 + } + } + Property { name: "title"; type: "string" } + Property { name: "modality"; type: "Qt::WindowModality" } + Property { name: "flags"; type: "Qt::WindowFlags" } + Property { name: "x"; type: "int" } + Property { name: "y"; type: "int" } + Property { name: "width"; type: "int" } + Property { name: "height"; type: "int" } + Property { name: "minimumWidth"; revision: 1; type: "int" } + Property { name: "minimumHeight"; revision: 1; type: "int" } + Property { name: "maximumWidth"; revision: 1; type: "int" } + Property { name: "maximumHeight"; revision: 1; type: "int" } + Property { name: "visible"; type: "bool" } + Property { name: "active"; revision: 1; type: "bool"; isReadonly: true } + Property { name: "visibility"; revision: 1; type: "Visibility" } + Property { name: "contentOrientation"; revision: 1; type: "Qt::ScreenOrientation" } + Property { name: "opacity"; revision: 1; type: "double" } + Signal { + name: "screenChanged" + Parameter { name: "screen"; type: "QScreen"; isPointer: true } + } + Signal { + name: "modalityChanged" + Parameter { name: "modality"; type: "Qt::WindowModality" } + } + Signal { + name: "windowStateChanged" + Parameter { name: "windowState"; type: "Qt::WindowState" } + } + Signal { + name: "xChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "yChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "widthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "heightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "minimumWidthChanged" + revision: 1 + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "minimumHeightChanged" + revision: 1 + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "maximumWidthChanged" + revision: 1 + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "maximumHeightChanged" + revision: 1 + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "visibleChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "visibilityChanged" + revision: 1 + Parameter { name: "visibility"; type: "QWindow::Visibility" } + } + Signal { name: "activeChanged"; revision: 1 } + Signal { + name: "contentOrientationChanged" + revision: 1 + Parameter { name: "orientation"; type: "Qt::ScreenOrientation" } + } + Signal { + name: "focusObjectChanged" + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "opacityChanged" + revision: 1 + Parameter { name: "opacity"; type: "double" } + } + Method { name: "requestActivate"; revision: 1 } + Method { + name: "setVisible" + Parameter { name: "visible"; type: "bool" } + } + Method { name: "show" } + Method { name: "hide" } + Method { name: "showMinimized" } + Method { name: "showMaximized" } + Method { name: "showFullScreen" } + Method { name: "showNormal" } + Method { name: "close"; type: "bool" } + Method { name: "raise" } + Method { name: "lower" } + Method { + name: "setTitle" + Parameter { type: "string" } + } + Method { + name: "setX" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setY" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setWidth" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setHeight" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setMinimumWidth" + revision: 1 + Parameter { name: "w"; type: "int" } + } + Method { + name: "setMinimumHeight" + revision: 1 + Parameter { name: "h"; type: "int" } + } + Method { + name: "setMaximumWidth" + revision: 1 + Parameter { name: "w"; type: "int" } + } + Method { + name: "setMaximumHeight" + revision: 1 + Parameter { name: "h"; type: "int" } + } + Method { + name: "alert" + Parameter { name: "msec"; type: "int" } + } + } + Component { + prototype: "QQuickWindow" + name: "QtQuick.Controls/ApplicationWindow" + exports: ["QtQuick.Controls/ApplicationWindow 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "menuBar"; type: "MenuBar_QMLTYPE_1"; isPointer: true } + Property { name: "toolBar"; type: "QQuickItem"; isPointer: true } + Property { name: "statusBar"; type: "QQuickItem"; isPointer: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "color"; type: "QColor" } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { + name: "activeFocusItem" + revision: 1 + type: "QQuickItem" + isReadonly: true + isPointer: true + } + Signal { name: "frameSwapped" } + Signal { name: "sceneGraphInitialized" } + Signal { name: "sceneGraphInvalidated" } + Signal { name: "beforeSynchronizing" } + Signal { name: "beforeRendering" } + Signal { name: "afterRendering" } + Signal { + name: "closing" + revision: 1 + Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true } + } + Signal { + name: "colorChanged" + Parameter { type: "QColor" } + } + Signal { name: "activeFocusItemChanged"; revision: 1 } + Method { name: "update" } + Method { name: "forcePolish" } + Method { name: "releaseResources" } + Property { name: "title"; type: "string" } + Property { name: "modality"; type: "Qt::WindowModality" } + Property { name: "flags"; type: "Qt::WindowFlags" } + Property { name: "x"; type: "int" } + Property { name: "y"; type: "int" } + Property { name: "width"; type: "int" } + Property { name: "height"; type: "int" } + Property { name: "minimumWidth"; type: "int" } + Property { name: "minimumHeight"; type: "int" } + Property { name: "maximumWidth"; type: "int" } + Property { name: "maximumHeight"; type: "int" } + Property { name: "visible"; type: "bool" } + Property { name: "active"; revision: 1; type: "bool"; isReadonly: true } + Property { name: "visibility"; revision: 1; type: "Visibility" } + Property { name: "contentOrientation"; type: "Qt::ScreenOrientation" } + Property { name: "opacity"; revision: 1; type: "double" } + Signal { + name: "screenChanged" + Parameter { name: "screen"; type: "QScreen"; isPointer: true } + } + Signal { + name: "modalityChanged" + Parameter { name: "modality"; type: "Qt::WindowModality" } + } + Signal { + name: "windowStateChanged" + Parameter { name: "windowState"; type: "Qt::WindowState" } + } + Signal { + name: "xChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "yChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "widthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "heightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "minimumWidthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "minimumHeightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "maximumWidthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "maximumHeightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "visibleChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "visibilityChanged" + revision: 1 + Parameter { name: "visibility"; type: "QWindow::Visibility" } + } + Signal { name: "activeChanged"; revision: 1 } + Signal { + name: "contentOrientationChanged" + Parameter { name: "orientation"; type: "Qt::ScreenOrientation" } + } + Signal { + name: "focusObjectChanged" + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "opacityChanged" + revision: 1 + Parameter { name: "opacity"; type: "double" } + } + Method { name: "requestActivate"; revision: 1 } + Method { + name: "setVisible" + Parameter { name: "visible"; type: "bool" } + } + Method { name: "show" } + Method { name: "hide" } + Method { name: "showMinimized" } + Method { name: "showMaximized" } + Method { name: "showFullScreen" } + Method { name: "showNormal" } + Method { name: "close"; type: "bool" } + Method { name: "raise" } + Method { name: "lower" } + Method { + name: "setTitle" + Parameter { type: "string" } + } + Method { + name: "setX" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setY" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setWidth" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setHeight" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setMinimumWidth" + Parameter { name: "w"; type: "int" } + } + Method { + name: "setMinimumHeight" + Parameter { name: "h"; type: "int" } + } + Method { + name: "setMaximumWidth" + Parameter { name: "w"; type: "int" } + } + Method { + name: "setMaximumHeight" + Parameter { name: "h"; type: "int" } + } + Method { + name: "alert" + revision: 1 + Parameter { name: "msec"; type: "int" } + } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/BusyIndicator" + exports: ["QtQuick.Controls/BusyIndicator 1.1"] + exportMetaObjectRevisions: [1] + defaultProperty: "data" + Property { name: "running"; type: "bool" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/Button" + exports: ["QtQuick.Controls/Button 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "checkable"; type: "bool" } + Property { name: "checked"; type: "bool" } + Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true } + Property { name: "action"; type: "QQuickAction"; isPointer: true } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "text"; type: "string" } + Property { name: "tooltip"; type: "string" } + Property { name: "iconSource"; type: "QUrl" } + Property { name: "iconName"; type: "string" } + Property { name: "__textColor"; type: "QColor" } + Property { name: "__position"; type: "string" } + Property { name: "__iconOverriden"; type: "bool"; isReadonly: true } + Property { name: "__action"; type: "QQuickAction"; isPointer: true } + Property { name: "__iconAction"; type: "QQuickAction"; isReadonly: true; isPointer: true } + Property { name: "__effectivePressed"; type: "bool" } + Property { name: "__behavior"; type: "QVariant" } + Property { name: "pressed"; type: "bool"; isReadonly: true } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Signal { name: "clicked" } + Method { name: "accessiblePressAction"; type: "QVariant" } + Property { name: "isDefault"; type: "bool" } + Property { name: "menu"; type: "Menu_QMLTYPE_16"; isPointer: true } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/CheckBox" + exports: ["QtQuick.Controls/CheckBox 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "checked"; type: "bool" } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true } + Property { name: "text"; type: "string" } + Property { name: "__cycleStatesHandler"; type: "QVariant" } + Property { name: "pressed"; type: "bool" } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Signal { name: "clicked" } + Property { name: "checkedState"; type: "int" } + Property { name: "partiallyCheckedEnabled"; type: "bool" } + Property { name: "__ignoreChecked"; type: "bool" } + Method { name: "__cycleCheckBoxStates"; type: "QVariant" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/ComboBox" + exports: ["QtQuick.Controls/ComboBox 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "textRole"; type: "string" } + Property { name: "editable"; type: "bool" } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "pressed"; type: "bool"; isReadonly: true } + Property { name: "__popup"; type: "QVariant" } + Property { name: "model"; type: "QVariant" } + Property { name: "currentIndex"; type: "int" } + Property { name: "currentText"; type: "string"; isReadonly: true } + Property { name: "editText"; type: "string" } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "validator"; type: "QValidator"; isPointer: true } + Property { name: "acceptableInput"; type: "bool"; isReadonly: true } + Signal { name: "accepted" } + Signal { + name: "activated" + Parameter { name: "index"; type: "int" } + } + Method { + name: "textAt" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + } + Method { + name: "find" + type: "QVariant" + Parameter { name: "text"; type: "QVariant" } + } + Method { name: "selectAll"; type: "QVariant" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/GroupBox" + exports: ["QtQuick.Controls/GroupBox 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "__content" + Property { name: "title"; type: "string" } + Property { name: "flat"; type: "bool" } + Property { name: "checkable"; type: "bool" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "checked"; type: "bool" } + Property { name: "__content"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "__checkbox"; type: "CheckBox_QMLTYPE_25"; isReadonly: true; isPointer: true } + Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true } + } + Component { + name: "QQuickText" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + exports: ["QtQuick/Text 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4, + "AlignJustify": 8 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Enum { + name: "TextStyle" + values: { + "Normal": 0, + "Outline": 1, + "Raised": 2, + "Sunken": 3 + } + } + Enum { + name: "TextFormat" + values: { + "PlainText": 0, + "RichText": 1, + "AutoText": 2, + "StyledText": 4 + } + } + Enum { + name: "TextElideMode" + values: { + "ElideLeft": 0, + "ElideRight": 1, + "ElideMiddle": 2, + "ElideNone": 3 + } + } + Enum { + name: "WrapMode" + values: { + "NoWrap": 0, + "WordWrap": 1, + "WrapAnywhere": 3, + "WrapAtWordBoundaryOrAnywhere": 4, + "Wrap": 4 + } + } + Enum { + name: "RenderType" + values: { + "QtRendering": 0, + "NativeRendering": 1 + } + } + Enum { + name: "LineHeightMode" + values: { + "ProportionalHeight": 0, + "FixedHeight": 1 + } + } + Enum { + name: "FontSizeMode" + values: { + "FixedSize": 0, + "HorizontalFit": 1, + "VerticalFit": 2, + "Fit": 3 + } + } + Property { name: "text"; type: "string" } + Property { name: "font"; type: "QFont" } + Property { name: "color"; type: "QColor" } + Property { name: "linkColor"; type: "QColor" } + Property { name: "style"; type: "TextStyle" } + Property { name: "styleColor"; type: "QColor" } + Property { name: "horizontalAlignment"; type: "HAlignment" } + Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true } + Property { name: "verticalAlignment"; type: "VAlignment" } + Property { name: "wrapMode"; type: "WrapMode" } + Property { name: "lineCount"; type: "int"; isReadonly: true } + Property { name: "truncated"; type: "bool"; isReadonly: true } + Property { name: "maximumLineCount"; type: "int" } + Property { name: "textFormat"; type: "TextFormat" } + Property { name: "elide"; type: "TextElideMode" } + Property { name: "contentWidth"; type: "double"; isReadonly: true } + Property { name: "contentHeight"; type: "double"; isReadonly: true } + Property { name: "paintedWidth"; type: "double"; isReadonly: true } + Property { name: "paintedHeight"; type: "double"; isReadonly: true } + Property { name: "lineHeight"; type: "double" } + Property { name: "lineHeightMode"; type: "LineHeightMode" } + Property { name: "baseUrl"; type: "QUrl" } + Property { name: "minimumPixelSize"; type: "int" } + Property { name: "minimumPointSize"; type: "int" } + Property { name: "fontSizeMode"; type: "FontSizeMode" } + Property { name: "renderType"; type: "RenderType" } + Signal { + name: "textChanged" + Parameter { name: "text"; type: "string" } + } + Signal { + name: "linkActivated" + Parameter { name: "link"; type: "string" } + } + Signal { + name: "fontChanged" + Parameter { name: "font"; type: "QFont" } + } + Signal { + name: "styleChanged" + Parameter { name: "style"; type: "TextStyle" } + } + Signal { + name: "horizontalAlignmentChanged" + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + Parameter { name: "alignment"; type: "VAlignment" } + } + Signal { + name: "textFormatChanged" + Parameter { name: "textFormat"; type: "TextFormat" } + } + Signal { + name: "elideModeChanged" + Parameter { name: "mode"; type: "TextElideMode" } + } + Signal { name: "contentSizeChanged" } + Signal { + name: "lineHeightChanged" + Parameter { name: "lineHeight"; type: "double" } + } + Signal { + name: "lineHeightModeChanged" + Parameter { name: "mode"; type: "LineHeightMode" } + } + Signal { + name: "lineLaidOut" + Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true } + } + Method { name: "doLayout" } + } + + Component { + prototype: "QQuickText" + name: "QtQuick.Controls/Label" + exports: ["QtQuick.Controls/Label 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + } + Component { + prototype: "QQuickMenu" + name: "QtQuick.Controls/Menu" + exports: ["QtQuick.Controls/Menu 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "items" + Property { name: "__selfComponent"; type: "QQmlComponent"; isPointer: true } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__currentIndex"; type: "int" } + Property { name: "__menuComponent"; type: "QQmlComponent"; isPointer: true } + Property { name: "__menuBar"; type: "QVariant" } + Method { + name: "addMenu" + type: "QVariant" + Parameter { name: "title"; type: "QVariant" } + } + Method { + name: "insertMenu" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + Parameter { name: "title"; type: "QVariant" } + } + Property { name: "title"; type: "string" } + Property { name: "items"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "__selectedIndex"; type: "int" } + Property { name: "__popupVisible"; type: "bool"; isReadonly: true } + Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__minimumWidth"; type: "int" } + Property { name: "__font"; type: "QFont" } + Property { name: "__xOffset"; type: "double" } + Property { name: "__yOffset"; type: "double" } + Signal { name: "__menuClosed" } + Signal { name: "popupVisibleChanged" } + Method { name: "__closeMenu" } + Method { name: "__dismissMenu" } + Method { name: "popup" } + Method { + name: "addItem" + type: "QQuickMenuItem*" + Parameter { type: "string" } + } + Method { + name: "insertItem" + type: "QQuickMenuItem*" + Parameter { type: "int" } + Parameter { type: "string" } + } + Method { name: "addSeparator" } + Method { + name: "insertSeparator" + Parameter { type: "int" } + } + Method { + name: "insertItem" + Parameter { type: "int" } + Parameter { type: "QQuickMenuBase"; isPointer: true } + } + Method { + name: "removeItem" + Parameter { type: "QQuickMenuBase"; isPointer: true } + } + Method { name: "clear" } + Method { + name: "__popup" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + Parameter { name: "atActionIndex"; type: "int" } + } + Method { + name: "__popup" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + Property { name: "visible"; type: "bool" } + Property { name: "type"; type: "QQuickMenuItemType::MenuItemType"; isReadonly: true } + Property { name: "__parentMenu"; type: "QQuickMenu"; isReadonly: true; isPointer: true } + Property { name: "__isNative"; type: "bool"; isReadonly: true } + Property { name: "__visualItem"; type: "QQuickItem"; isPointer: true } + Property { name: "enabled"; type: "bool" } + Property { name: "iconSource"; type: "QUrl" } + Property { name: "iconName"; type: "string" } + Property { name: "__icon"; type: "QVariant"; isReadonly: true } + Signal { name: "__textChanged" } + } + Component { + prototype: "QQuickMenuBar" + name: "QtQuick.Controls/MenuBar" + exports: ["QtQuick.Controls/MenuBar 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "menus" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__menuBarComponent"; type: "QQmlComponent"; isPointer: true } + Property { name: "menus"; type: "QQuickMenu"; isList: true; isReadonly: true } + Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__parentWindow"; type: "QQuickWindow"; isPointer: true } + Property { name: "__isNative"; type: "bool"; isReadonly: true } + Signal { name: "contentItemChanged" } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/ProgressBar" + exports: ["QtQuick.Controls/ProgressBar 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + Property { name: "value"; type: "double" } + Property { name: "minimumValue"; type: "double" } + Property { name: "maximumValue"; type: "double" } + Property { name: "indeterminate"; type: "bool" } + Property { name: "orientation"; type: "int" } + Property { name: "__initialized"; type: "bool" } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Method { + name: "setValue" + type: "QVariant" + Parameter { name: "v"; type: "QVariant" } + } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/RadioButton" + exports: ["QtQuick.Controls/RadioButton 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "checked"; type: "bool" } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true } + Property { name: "text"; type: "string" } + Property { name: "__cycleStatesHandler"; type: "QVariant" } + Property { name: "pressed"; type: "bool" } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Signal { name: "clicked" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/ScrollView" + exports: ["QtQuick.Controls/ScrollView 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "contentItem" + Property { name: "frameVisible"; type: "bool" } + Property { name: "highlightOnFocus"; type: "bool" } + Property { name: "contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__scroller"; type: "QQuickItem"; isPointer: true } + Property { name: "__scrollBarTopMargin"; type: "int" } + Property { name: "__viewTopMargin"; type: "int" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "Style_QMLTYPE_0"; isPointer: true } + Property { name: "viewport"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "flickableItem"; type: "QQuickFlickable"; isReadonly: true; isPointer: true } + Property { + name: "__horizontalScrollBar" + type: "ScrollBar_QMLTYPE_51" + isReadonly: true + isPointer: true + } + Property { + name: "__verticalScrollBar" + type: "ScrollBar_QMLTYPE_51" + isReadonly: true + isPointer: true + } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/Slider" + exports: ["QtQuick.Controls/Slider 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + Property { name: "orientation"; type: "int" } + Property { name: "updateValueWhileDragging"; type: "bool" } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "tickmarksEnabled"; type: "bool" } + Property { name: "__horizontal"; type: "bool" } + Property { name: "__handlePos"; type: "double" } + Property { name: "minimumValue"; type: "double" } + Property { name: "maximumValue"; type: "double" } + Property { name: "pressed"; type: "bool"; isReadonly: true } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Property { name: "stepSize"; type: "double" } + Property { name: "value"; type: "double" } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/SpinBox" + exports: ["QtQuick.Controls/SpinBox 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "value"; type: "double" } + Property { name: "minimumValue"; type: "double" } + Property { name: "maximumValue"; type: "double" } + Property { name: "stepSize"; type: "double" } + Property { name: "suffix"; type: "string" } + Property { name: "prefix"; type: "string" } + Property { name: "decimals"; type: "int" } + Property { name: "font"; type: "QFont" } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Property { name: "__text"; type: "string" } + Method { name: "__increment"; type: "QVariant" } + Method { name: "__decrement"; type: "QVariant" } + } + Component { + prototype: "QQuickItem" + name: "QtQuick.Controls/SplitView" + exports: ["QtQuick.Controls/SplitView 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "__contents" + Property { name: "orientation"; type: "int" } + Property { name: "handleDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "resizing"; type: "bool" } + Property { name: "__contents"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "__items"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "__handles"; type: "QQuickItem"; isList: true; isReadonly: true } + } + Component { + prototype: "QQuickItem" + name: "QtQuick.Controls/StackView" + exports: ["QtQuick.Controls/StackView 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "busy"; type: "bool"; isReadonly: true } + Property { name: "delegate"; type: "StackViewDelegate_QMLTYPE_97"; isPointer: true } + Property { name: "__currentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__depth"; type: "int" } + Property { name: "__guard"; type: "bool" } + Property { name: "invalidItemReplacement"; type: "QQmlComponent"; isPointer: true } + Property { name: "initialItem"; type: "QVariant" } + Property { name: "__currentTransition"; type: "QVariant" } + Property { name: "depth"; type: "int"; isReadonly: true } + Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Method { + name: "push" + type: "QVariant" + Parameter { name: "item"; type: "QVariant" } + } + Method { + name: "pop" + type: "QVariant" + Parameter { name: "item"; type: "QVariant" } + } + Method { name: "clear"; type: "QVariant" } + Method { + name: "find" + type: "QVariant" + Parameter { name: "func"; type: "QVariant" } + Parameter { name: "onlySearchLoadedItems"; type: "QVariant" } + } + Method { + name: "get" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + Parameter { name: "dontLoad"; type: "QVariant" } + } + Method { name: "completeTransition"; type: "QVariant" } + Method { + name: "replace" + type: "QVariant" + Parameter { name: "item"; type: "QVariant" } + Parameter { name: "properties"; type: "QVariant" } + Parameter { name: "immediate"; type: "QVariant" } + } + Method { + name: "__recursionGuard" + type: "QVariant" + Parameter { name: "use"; type: "QVariant" } + } + Method { + name: "__loadElement" + type: "QVariant" + Parameter { name: "element"; type: "QVariant" } + } + Method { + name: "__resolveComponent" + type: "QVariant" + Parameter { name: "unknownObjectType"; type: "QVariant" } + Parameter { name: "element"; type: "QVariant" } + } + Method { + name: "__cleanup" + type: "QVariant" + Parameter { name: "element"; type: "QVariant" } + } + Method { + name: "__setStatus" + type: "QVariant" + Parameter { name: "item"; type: "QVariant" } + Parameter { name: "status"; type: "QVariant" } + } + Method { + name: "__performTransition" + type: "QVariant" + Parameter { name: "transition"; type: "QVariant" } + } + Method { name: "animationFinished"; type: "QVariant" } + } + Component { + prototype: "QObject" + name: "QtQuick.Controls/StackViewDelegate" + exports: ["QtQuick.Controls/StackViewDelegate 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "pushTransition"; type: "QQmlComponent"; isPointer: true } + Property { name: "popTransition"; type: "QQmlComponent"; isPointer: true } + Property { name: "replaceTransition"; type: "QQmlComponent"; isPointer: true } + Method { + name: "getTransition" + type: "QVariant" + Parameter { name: "properties"; type: "QVariant" } + } + Method { + name: "transitionFinished" + type: "QVariant" + Parameter { name: "properties"; type: "QVariant" } + } + } + Component { + prototype: "QQuickParallelAnimation" + name: "QtQuick.Controls/StackViewTransition" + exports: ["QtQuick.Controls/StackViewTransition 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "animations" + Property { name: "name"; type: "string" } + Property { name: "enterItem"; type: "QQuickItem"; isPointer: true } + Property { name: "exitItem"; type: "QQuickItem"; isPointer: true } + Property { name: "immediate"; type: "bool" } + } + Component { + prototype: "QQuickItem" + name: "QtQuick.Controls/StatusBar" + exports: ["QtQuick.Controls/StatusBar 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "__content" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true } + Property { name: "__content"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + } + Component { + prototype: "QQuickLoader" + name: "QtQuick.Controls/Tab" + exports: ["QtQuick.Controls/Tab 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "component" + Property { name: "title"; type: "string" } + Property { name: "__inserted"; type: "bool" } + Property { name: "component"; type: "QQmlComponent"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/TabView" + exports: ["QtQuick.Controls/TabView 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "currentIndex"; type: "int" } + Property { name: "count"; type: "int" } + Property { name: "frameVisible"; type: "bool" } + Property { name: "tabsVisible"; type: "bool" } + Property { name: "tabPosition"; type: "int" } + Property { name: "__tabs"; type: "QQmlListModel"; isPointer: true } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__styleItem"; type: "QVariant" } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Method { + name: "addTab" + type: "QVariant" + Parameter { name: "title"; type: "QVariant" } + Parameter { name: "component"; type: "QVariant" } + } + Method { + name: "insertTab" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + Parameter { name: "title"; type: "QVariant" } + Parameter { name: "component"; type: "QVariant" } + } + Method { + name: "removeTab" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + } + Method { + name: "moveTab" + type: "QVariant" + Parameter { name: "from"; type: "QVariant" } + Parameter { name: "to"; type: "QVariant" } + } + Method { + name: "getTab" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + } + Method { name: "__setOpacities"; type: "QVariant" } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/TableView" + exports: ["QtQuick.Controls/TableView 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "__columns" + Property { name: "frameVisible"; type: "bool" } + Property { name: "highlightOnFocus"; type: "bool" } + Property { name: "contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__scroller"; type: "QQuickItem"; isPointer: true } + Property { name: "__scrollBarTopMargin"; type: "int" } + Property { name: "__viewTopMargin"; type: "int" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "Style_QMLTYPE_0"; isPointer: true } + Property { name: "viewport"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "flickableItem"; type: "QQuickFlickable"; isReadonly: true; isPointer: true } + Property { + name: "__horizontalScrollBar" + type: "ScrollBar_QMLTYPE_51" + isReadonly: true + isPointer: true + } + Property { + name: "__verticalScrollBar" + type: "ScrollBar_QMLTYPE_51" + isReadonly: true + isPointer: true + } + Property { name: "alternatingRowColors"; type: "bool" } + Property { name: "headerVisible"; type: "bool" } + Property { name: "itemDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "rowDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "headerDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "sortIndicatorColumn"; type: "int" } + Property { name: "sortIndicatorVisible"; type: "bool" } + Property { name: "sortIndicatorOrder"; type: "int" } + Property { name: "__activateItemOnSingleClick"; type: "bool" } + Property { name: "model"; type: "QVariant" } + Property { name: "backgroundVisible"; type: "bool" } + Property { name: "__columns"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "contentHeader"; type: "QQmlComponent"; isPointer: true } + Property { name: "contentFooter"; type: "QQmlComponent"; isPointer: true } + Property { name: "rowCount"; type: "int"; isReadonly: true } + Property { name: "columnCount"; type: "int"; isReadonly: true } + Property { name: "section"; type: "QQuickViewSection"; isReadonly: true; isPointer: true } + Property { name: "currentRow"; type: "int" } + Property { name: "__currentRowItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Signal { + name: "activated" + Parameter { name: "row"; type: "int" } + } + Signal { + name: "clicked" + Parameter { name: "row"; type: "int" } + } + Signal { + name: "doubleClicked" + Parameter { name: "row"; type: "int" } + } + Method { + name: "positionViewAtRow" + type: "QVariant" + Parameter { name: "row"; type: "QVariant" } + Parameter { name: "mode"; type: "QVariant" } + } + Method { + name: "rowAt" + type: "QVariant" + Parameter { name: "x"; type: "QVariant" } + Parameter { name: "y"; type: "QVariant" } + } + Method { + name: "addColumn" + type: "QVariant" + Parameter { name: "column"; type: "QVariant" } + } + Method { + name: "insertColumn" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + Parameter { name: "column"; type: "QVariant" } + } + Method { + name: "removeColumn" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + } + Method { + name: "moveColumn" + type: "QVariant" + Parameter { name: "from"; type: "QVariant" } + Parameter { name: "to"; type: "QVariant" } + } + Method { + name: "getColumn" + type: "QVariant" + Parameter { name: "index"; type: "QVariant" } + } + Method { name: "__decrementCurrentIndex"; type: "QVariant" } + Method { name: "__incrementCurrentIndex"; type: "QVariant" } + } + Component { + prototype: "QObject" + name: "QtQuick.Controls/TableViewColumn" + exports: ["QtQuick.Controls/TableViewColumn 1.0"] + exportMetaObjectRevisions: [0] + Property { name: "__view"; type: "QQuickItem"; isPointer: true } + Property { name: "title"; type: "string" } + Property { name: "role"; type: "string" } + Property { name: "width"; type: "int" } + Property { name: "visible"; type: "bool" } + Property { name: "resizable"; type: "bool" } + Property { name: "movable"; type: "bool" } + Property { name: "elideMode"; type: "int" } + Property { name: "horizontalAlignment"; type: "int" } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/TextArea" + exports: ["QtQuick.Controls/TextArea 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "frameVisible"; type: "bool" } + Property { name: "highlightOnFocus"; type: "bool" } + Property { name: "contentItem"; type: "QQuickItem"; isPointer: true } + Property { name: "__scroller"; type: "QQuickItem"; isPointer: true } + Property { name: "__scrollBarTopMargin"; type: "int" } + Property { name: "__viewTopMargin"; type: "int" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "Style_QMLTYPE_0"; isPointer: true } + Property { name: "viewport"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "flickableItem"; type: "QQuickFlickable"; isReadonly: true; isPointer: true } + Property { + name: "__horizontalScrollBar" + type: "ScrollBar_QMLTYPE_51" + isReadonly: true + isPointer: true + } + Property { + name: "__verticalScrollBar" + type: "ScrollBar_QMLTYPE_51" + isReadonly: true + isPointer: true + } + Property { name: "tabChangesFocus"; type: "bool" } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "baseUrl"; type: "QUrl" } + Property { name: "canPaste"; type: "bool"; isReadonly: true } + Property { name: "canRedo"; type: "bool"; isReadonly: true } + Property { name: "canUndo"; type: "bool"; isReadonly: true } + Property { name: "textColor"; type: "QColor" } + Property { name: "cursorPosition"; type: "int" } + Property { name: "font"; type: "QFont" } + Property { name: "horizontalAlignment"; type: "int" } + Property { name: "effectiveHorizontalAlignment"; type: "int"; isReadonly: true } + Property { name: "verticalAlignment"; type: "int" } + Property { name: "inputMethodHints"; type: "int" } + Property { name: "length"; type: "int"; isReadonly: true } + Property { name: "lineCount"; type: "int"; isReadonly: true } + Property { name: "readOnly"; type: "bool" } + Property { name: "selectedText"; type: "string"; isReadonly: true } + Property { name: "selectionEnd"; type: "int"; isReadonly: true } + Property { name: "selectionStart"; type: "int"; isReadonly: true } + Property { name: "text"; type: "string" } + Property { name: "textFormat"; type: "int" } + Property { name: "wrapMode"; type: "int" } + Property { name: "selectByMouse"; type: "bool" } + Property { name: "selectByKeyboard"; type: "bool" } + Property { name: "hoveredLink"; type: "string"; isReadonly: true } + Property { name: "backgroundVisible"; type: "bool" } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "textMargin"; type: "double" } + Property { name: "textDocument"; type: "QQuickTextDocument"; isReadonly: true; isPointer: true } + Signal { + name: "linkActivated" + Parameter { name: "link"; type: "string" } + } + Signal { + name: "linkHovered" + Parameter { name: "link"; type: "string" } + } + Method { + name: "append" + type: "QVariant" + Parameter { name: "string"; type: "QVariant" } + } + Method { name: "copy"; type: "QVariant" } + Method { name: "cut"; type: "QVariant" } + Method { name: "deselect"; type: "QVariant" } + Method { + name: "getFormattedText" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { + name: "getText" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { + name: "insert" + type: "QVariant" + Parameter { name: "position"; type: "QVariant" } + Parameter { name: "text"; type: "QVariant" } + } + Method { + name: "isRightToLeft" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { + name: "moveCursorSelection" + type: "QVariant" + Parameter { name: "position"; type: "QVariant" } + Parameter { name: "mode"; type: "QVariant" } + } + Method { name: "paste"; type: "QVariant" } + Method { + name: "positionAt" + type: "QVariant" + Parameter { name: "x"; type: "QVariant" } + Parameter { name: "y"; type: "QVariant" } + } + Method { + name: "positionToRectangle" + type: "QVariant" + Parameter { name: "position"; type: "QVariant" } + } + Method { name: "redo"; type: "QVariant" } + Method { + name: "remove" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { + name: "select" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { name: "selectAll"; type: "QVariant" } + Method { name: "selectWord"; type: "QVariant" } + Method { name: "undo"; type: "QVariant" } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/TextField" + exports: ["QtQuick.Controls/TextField 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + Property { name: "acceptableInput"; type: "bool"; isReadonly: true } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "canPaste"; type: "bool"; isReadonly: true } + Property { name: "canRedo"; type: "bool"; isReadonly: true } + Property { name: "canUndo"; type: "bool"; isReadonly: true } + Property { name: "textColor"; type: "QColor" } + Property { name: "cursorPosition"; type: "int" } + Property { name: "displayText"; type: "string"; isReadonly: true } + Property { name: "echoMode"; type: "int" } + Property { name: "font"; type: "QFont" } + Property { name: "horizontalAlignment"; type: "int" } + Property { name: "effectiveHorizontalAlignment"; type: "int"; isReadonly: true } + Property { name: "verticalAlignment"; type: "int" } + Property { name: "inputMask"; type: "string" } + Property { name: "inputMethodHints"; type: "int" } + Property { name: "length"; type: "int"; isReadonly: true } + Property { name: "maximumLength"; type: "int" } + Property { name: "placeholderText"; type: "string" } + Property { name: "readOnly"; type: "bool" } + Property { name: "selectedText"; type: "string"; isReadonly: true } + Property { name: "selectionEnd"; type: "int"; isReadonly: true } + Property { name: "selectionStart"; type: "int"; isReadonly: true } + Property { name: "text"; type: "string" } + Property { name: "validator"; type: "QValidator"; isPointer: true } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Property { name: "__contentHeight"; type: "double"; isReadonly: true } + Property { name: "__contentWidth"; type: "double"; isReadonly: true } + Signal { name: "accepted" } + Method { name: "copy"; type: "QVariant" } + Method { name: "cut"; type: "QVariant" } + Method { name: "deselect"; type: "QVariant" } + Method { + name: "getText" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { + name: "insert" + type: "QVariant" + Parameter { name: "position"; type: "QVariant" } + Parameter { name: "text"; type: "QVariant" } + } + Method { + name: "isRightToLeft" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { name: "paste"; type: "QVariant" } + Method { name: "redo"; type: "QVariant" } + Method { + name: "select" + type: "QVariant" + Parameter { name: "start"; type: "QVariant" } + Parameter { name: "end"; type: "QVariant" } + } + Method { name: "selectAll"; type: "QVariant" } + Method { name: "selectWord"; type: "QVariant" } + Method { name: "undo"; type: "QVariant" } + } + Component { + prototype: "QQuickItem" + name: "QtQuick.Controls/ToolBar" + exports: ["QtQuick.Controls/ToolBar 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "__content" + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isReadonly: true; isPointer: true } + Property { name: "__content"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + } + Component { + prototype: "QQuickFocusScope" + name: "QtQuick.Controls/ToolButton" + exports: ["QtQuick.Controls/ToolButton 1.0"] + exportMetaObjectRevisions: [0] + defaultProperty: "data" + Property { name: "checkable"; type: "bool" } + Property { name: "checked"; type: "bool" } + Property { name: "exclusiveGroup"; type: "QQuickExclusiveGroup"; isPointer: true } + Property { name: "action"; type: "QQuickAction"; isPointer: true } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "text"; type: "string" } + Property { name: "tooltip"; type: "string" } + Property { name: "iconSource"; type: "QUrl" } + Property { name: "iconName"; type: "string" } + Property { name: "__textColor"; type: "QColor" } + Property { name: "__position"; type: "string" } + Property { name: "__iconOverriden"; type: "bool"; isReadonly: true } + Property { name: "__action"; type: "QQuickAction"; isPointer: true } + Property { name: "__iconAction"; type: "QQuickAction"; isReadonly: true; isPointer: true } + Property { name: "__effectivePressed"; type: "bool" } + Property { name: "__behavior"; type: "QVariant" } + Property { name: "pressed"; type: "bool"; isReadonly: true } + Property { name: "hovered"; type: "bool"; isReadonly: true } + Signal { name: "clicked" } + Method { name: "accessiblePressAction"; type: "QVariant" } + Property { name: "style"; type: "QQmlComponent"; isPointer: true } + Property { name: "__style"; type: "QObject"; isPointer: true } + Property { name: "__panel"; type: "QQuickItem"; isPointer: true } + Property { name: "styleHints"; type: "QVariant" } + Property { name: "__styleData"; type: "QObject"; isPointer: true } + } +} diff --git a/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/qmldir b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/qmldir new file mode 100644 index 00000000000..f51b0553232 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/007_compositeQmlCopyAndCppAndQml/QtQuick/Controls/qmldir @@ -0,0 +1,4 @@ +module QtQuick.Controls +plugin qtquickcontrolsplugin +classname QtQuickControlsPlugin +typeinfo plugins.qmltypes diff --git a/tests/auto/qml/codemodel/importscheck/base/QtQuick.2/plugins.qmltypes b/tests/auto/qml/codemodel/importscheck/base/QtQuick.2/plugins.qmltypes new file mode 100644 index 00000000000..cadef103707 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/base/QtQuick.2/plugins.qmltypes @@ -0,0 +1,5623 @@ +import QtQuick.tooling 1.1 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. +// +// This file was auto-generated by: +// 'qmlplugindump -nonrelocatable -builtins' + +Module { + Component { + name: "QAbstractItemModel" + prototype: "QObject" + Enum { + name: "LayoutChangeHint" + values: { + "NoLayoutChangeHint": 0, + "VerticalSortHint": 1, + "HorizontalSortHint": 2 + } + } + Signal { + name: "dataChanged" + Parameter { name: "topLeft"; type: "QModelIndex" } + Parameter { name: "bottomRight"; type: "QModelIndex" } + Parameter { name: "roles"; type: "QVector" } + } + Signal { + name: "dataChanged" + Parameter { name: "topLeft"; type: "QModelIndex" } + Parameter { name: "bottomRight"; type: "QModelIndex" } + } + Signal { + name: "headerDataChanged" + Parameter { name: "orientation"; type: "Qt::Orientation" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "layoutChanged" + Parameter { name: "parents"; type: "QList" } + Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } + } + Signal { + name: "layoutChanged" + Parameter { name: "parents"; type: "QList" } + } + Signal { name: "layoutChanged" } + Signal { + name: "layoutAboutToBeChanged" + Parameter { name: "parents"; type: "QList" } + Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } + } + Signal { + name: "layoutAboutToBeChanged" + Parameter { name: "parents"; type: "QList" } + } + Signal { name: "layoutAboutToBeChanged" } + Signal { + name: "rowsAboutToBeInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsAboutToBeRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsAboutToBeInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsAboutToBeRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { name: "modelAboutToBeReset" } + Signal { name: "modelReset" } + Signal { + name: "rowsAboutToBeMoved" + Parameter { name: "sourceParent"; type: "QModelIndex" } + Parameter { name: "sourceStart"; type: "int" } + Parameter { name: "sourceEnd"; type: "int" } + Parameter { name: "destinationParent"; type: "QModelIndex" } + Parameter { name: "destinationRow"; type: "int" } + } + Signal { + name: "rowsMoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + Parameter { name: "destination"; type: "QModelIndex" } + Parameter { name: "row"; type: "int" } + } + Signal { + name: "columnsAboutToBeMoved" + Parameter { name: "sourceParent"; type: "QModelIndex" } + Parameter { name: "sourceStart"; type: "int" } + Parameter { name: "sourceEnd"; type: "int" } + Parameter { name: "destinationParent"; type: "QModelIndex" } + Parameter { name: "destinationColumn"; type: "int" } + } + Signal { + name: "columnsMoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + Parameter { name: "destination"; type: "QModelIndex" } + Parameter { name: "column"; type: "int" } + } + Method { name: "submit"; type: "bool" } + Method { name: "revert" } + } + Component { name: "QAbstractListModel"; prototype: "QAbstractItemModel" } + Component { + name: "QDoubleValidator" + prototype: "QValidator" + Enum { + name: "Notation" + values: { + "StandardNotation": 0, + "ScientificNotation": 1 + } + } + Property { name: "bottom"; type: "double" } + Property { name: "top"; type: "double" } + Property { name: "decimals"; type: "int" } + Property { name: "notation"; type: "Notation" } + Signal { + name: "bottomChanged" + Parameter { name: "bottom"; type: "double" } + } + Signal { + name: "topChanged" + Parameter { name: "top"; type: "double" } + } + Signal { + name: "decimalsChanged" + Parameter { name: "decimals"; type: "int" } + } + Signal { + name: "notationChanged" + Parameter { name: "notation"; type: "QDoubleValidator::Notation" } + } + } + Component { + name: "QInputMethod" + prototype: "QObject" + exports: ["QtQuick/InputMethod 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Action" + values: { + "Click": 0, + "ContextMenu": 1 + } + } + Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true } + Property { name: "keyboardRectangle"; type: "QRectF"; isReadonly: true } + Property { name: "visible"; type: "bool"; isReadonly: true } + Property { name: "animating"; type: "bool"; isReadonly: true } + Property { name: "locale"; type: "QLocale"; isReadonly: true } + Property { name: "inputDirection"; type: "Qt::LayoutDirection"; isReadonly: true } + Signal { + name: "inputDirectionChanged" + Parameter { name: "newDirection"; type: "Qt::LayoutDirection" } + } + Method { name: "show" } + Method { name: "hide" } + Method { + name: "update" + Parameter { name: "queries"; type: "Qt::InputMethodQueries" } + } + Method { name: "reset" } + Method { name: "commit" } + Method { + name: "invokeAction" + Parameter { name: "a"; type: "Action" } + Parameter { name: "cursorPosition"; type: "int" } + } + } + Component { + name: "QIntValidator" + prototype: "QValidator" + Property { name: "bottom"; type: "int" } + Property { name: "top"; type: "int" } + Signal { + name: "bottomChanged" + Parameter { name: "bottom"; type: "int" } + } + Signal { + name: "topChanged" + Parameter { name: "top"; type: "int" } + } + } + Component { + name: "QKeySequence" + exports: ["QtQuick/StandardKey 2.2"] + exportMetaObjectRevisions: [2] + Enum { + name: "StandardKey" + values: { + "UnknownKey": 0, + "HelpContents": 1, + "WhatsThis": 2, + "Open": 3, + "Close": 4, + "Save": 5, + "New": 6, + "Delete": 7, + "Cut": 8, + "Copy": 9, + "Paste": 10, + "Undo": 11, + "Redo": 12, + "Back": 13, + "Forward": 14, + "Refresh": 15, + "ZoomIn": 16, + "ZoomOut": 17, + "Print": 18, + "AddTab": 19, + "NextChild": 20, + "PreviousChild": 21, + "Find": 22, + "FindNext": 23, + "FindPrevious": 24, + "Replace": 25, + "SelectAll": 26, + "Bold": 27, + "Italic": 28, + "Underline": 29, + "MoveToNextChar": 30, + "MoveToPreviousChar": 31, + "MoveToNextWord": 32, + "MoveToPreviousWord": 33, + "MoveToNextLine": 34, + "MoveToPreviousLine": 35, + "MoveToNextPage": 36, + "MoveToPreviousPage": 37, + "MoveToStartOfLine": 38, + "MoveToEndOfLine": 39, + "MoveToStartOfBlock": 40, + "MoveToEndOfBlock": 41, + "MoveToStartOfDocument": 42, + "MoveToEndOfDocument": 43, + "SelectNextChar": 44, + "SelectPreviousChar": 45, + "SelectNextWord": 46, + "SelectPreviousWord": 47, + "SelectNextLine": 48, + "SelectPreviousLine": 49, + "SelectNextPage": 50, + "SelectPreviousPage": 51, + "SelectStartOfLine": 52, + "SelectEndOfLine": 53, + "SelectStartOfBlock": 54, + "SelectEndOfBlock": 55, + "SelectStartOfDocument": 56, + "SelectEndOfDocument": 57, + "DeleteStartOfWord": 58, + "DeleteEndOfWord": 59, + "DeleteEndOfLine": 60, + "InsertParagraphSeparator": 61, + "InsertLineSeparator": 62, + "SaveAs": 63, + "Preferences": 64, + "Quit": 65, + "FullScreen": 66, + "Deselect": 67, + "DeleteCompleteLine": 68 + } + } + } + Component { + name: "QObject" + exports: ["QtQml/QtObject 2.0", "QtQuick/QtObject 2.0"] + exportMetaObjectRevisions: [0, 0] + Property { name: "objectName"; type: "string" } + Signal { + name: "objectNameChanged" + Parameter { name: "objectName"; type: "string" } + } + Method { name: "toString" } + Method { name: "destroy" } + Method { + name: "destroy" + Parameter { name: "delay"; type: "int" } + } + } + Component { + name: "QQmlApplication" + prototype: "QObject" + Property { name: "arguments"; type: "QStringList"; isReadonly: true } + Property { name: "name"; type: "string" } + Property { name: "version"; type: "string" } + Property { name: "organization"; type: "string" } + Property { name: "domain"; type: "string" } + Signal { name: "aboutToQuit" } + Method { + name: "setName" + Parameter { name: "arg"; type: "string" } + } + Method { + name: "setVersion" + Parameter { name: "arg"; type: "string" } + } + Method { + name: "setOrganization" + Parameter { name: "arg"; type: "string" } + } + Method { + name: "setDomain" + Parameter { name: "arg"; type: "string" } + } + } + Component { + name: "QQmlBind" + prototype: "QObject" + exports: ["QtQml/Binding 2.0", "QtQuick/Binding 2.0"] + exportMetaObjectRevisions: [0, 0] + Property { name: "target"; type: "QObject"; isPointer: true } + Property { name: "property"; type: "string" } + Property { name: "value"; type: "QVariant" } + Property { name: "when"; type: "bool" } + } + Component { + name: "QQmlComponent" + prototype: "QObject" + exports: [ + "QML/Component 1.0", + "QtQml/Component 2.0", + "QtQuick/Component 2.0" + ] + exportMetaObjectRevisions: [0, 0, 0] + attachedType: "QQmlComponentAttached" + Enum { + name: "CompilationMode" + values: { + "PreferSynchronous": 0, + "Asynchronous": 1 + } + } + Enum { + name: "Status" + values: { + "Null": 0, + "Ready": 1, + "Loading": 2, + "Error": 3 + } + } + Property { name: "progress"; type: "double"; isReadonly: true } + Property { name: "status"; type: "Status"; isReadonly: true } + Property { name: "url"; type: "QUrl"; isReadonly: true } + Signal { + name: "statusChanged" + Parameter { type: "QQmlComponent::Status" } + } + Signal { + name: "progressChanged" + Parameter { type: "double" } + } + Method { + name: "loadUrl" + Parameter { name: "url"; type: "QUrl" } + } + Method { + name: "loadUrl" + Parameter { name: "url"; type: "QUrl" } + Parameter { name: "mode"; type: "CompilationMode" } + } + Method { + name: "setData" + Parameter { type: "QByteArray" } + Parameter { name: "baseUrl"; type: "QUrl" } + } + Method { name: "errorString"; type: "string" } + } + Component { + name: "QQmlComponentAttached" + prototype: "QObject" + Signal { name: "completed" } + Signal { name: "destruction" } + } + Component { + name: "QQmlConnections" + prototype: "QObject" + exports: ["QtQml/Connections 2.0", "QtQuick/Connections 2.0"] + exportMetaObjectRevisions: [0, 0] + Property { name: "target"; type: "QObject"; isPointer: true } + Property { name: "ignoreUnknownSignals"; type: "bool" } + } + Component { + name: "QQmlDelegateModel" + defaultProperty: "delegate" + prototype: "QQmlInstanceModel" + exports: ["QtQuick/VisualDataModel 2.0"] + exportMetaObjectRevisions: [0] + attachedType: "QQmlDelegateModelAttached" + Property { name: "model"; type: "QVariant" } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "filterOnGroup"; type: "string" } + Property { name: "items"; type: "QQmlDelegateModelGroup"; isReadonly: true; isPointer: true } + Property { + name: "persistedItems" + type: "QQmlDelegateModelGroup" + isReadonly: true + isPointer: true + } + Property { name: "groups"; type: "QQmlDelegateModelGroup"; isList: true; isReadonly: true } + Property { name: "parts"; type: "QObject"; isReadonly: true; isPointer: true } + Property { name: "rootIndex"; type: "QVariant" } + Signal { name: "filterGroupChanged" } + Signal { name: "defaultGroupsChanged" } + Method { + name: "modelIndex" + type: "QVariant" + Parameter { name: "idx"; type: "int" } + } + Method { name: "parentModelIndex"; type: "QVariant" } + } + Component { + name: "QQmlDelegateModelAttached" + prototype: "QObject" + Property { name: "model"; type: "QQmlDelegateModel"; isReadonly: true; isPointer: true } + Property { name: "groups"; type: "QStringList" } + Property { name: "isUnresolved"; type: "bool"; isReadonly: true } + Signal { name: "unresolvedChanged" } + } + Component { + name: "QQmlDelegateModelGroup" + prototype: "QObject" + exports: ["QtQuick/VisualDataGroup 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "name"; type: "string" } + Property { name: "includeByDefault"; type: "bool" } + Signal { name: "defaultIncludeChanged" } + Signal { + name: "changed" + Parameter { name: "removed"; type: "QQmlV4Handle" } + Parameter { name: "inserted"; type: "QQmlV4Handle" } + } + Method { + name: "insert" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "create" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "resolve" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "remove" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "addGroups" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "removeGroups" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "setGroups" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "move" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "get" + type: "QQmlV4Handle" + Parameter { name: "index"; type: "int" } + } + } + Component { name: "QQmlDelegateModelParts"; prototype: "QObject" } + Component { + name: "QQmlEasingValueType" + prototype: "QQmlValueType" + exports: ["QtQuick/Easing 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Type" + values: { + "Linear": 0, + "InQuad": 1, + "OutQuad": 2, + "InOutQuad": 3, + "OutInQuad": 4, + "InCubic": 5, + "OutCubic": 6, + "InOutCubic": 7, + "OutInCubic": 8, + "InQuart": 9, + "OutQuart": 10, + "InOutQuart": 11, + "OutInQuart": 12, + "InQuint": 13, + "OutQuint": 14, + "InOutQuint": 15, + "OutInQuint": 16, + "InSine": 17, + "OutSine": 18, + "InOutSine": 19, + "OutInSine": 20, + "InExpo": 21, + "OutExpo": 22, + "InOutExpo": 23, + "OutInExpo": 24, + "InCirc": 25, + "OutCirc": 26, + "InOutCirc": 27, + "OutInCirc": 28, + "InElastic": 29, + "OutElastic": 30, + "InOutElastic": 31, + "OutInElastic": 32, + "InBack": 33, + "OutBack": 34, + "InOutBack": 35, + "OutInBack": 36, + "InBounce": 37, + "OutBounce": 38, + "InOutBounce": 39, + "OutInBounce": 40, + "InCurve": 41, + "OutCurve": 42, + "SineCurve": 43, + "CosineCurve": 44, + "Bezier": 45 + } + } + Property { name: "type"; type: "Type" } + Property { name: "amplitude"; type: "double" } + Property { name: "overshoot"; type: "double" } + Property { name: "period"; type: "double" } + Property { name: "bezierCurve"; type: "QVariantList" } + } + Component { + name: "QQmlInstanceModel" + prototype: "QObject" + Property { name: "count"; type: "int"; isReadonly: true } + Signal { + name: "modelUpdated" + Parameter { name: "changeSet"; type: "QQmlChangeSet" } + Parameter { name: "reset"; type: "bool" } + } + Signal { + name: "createdItem" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "initItem" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "destroyingItem" + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + } + Component { + name: "QQmlInstantiator" + defaultProperty: "delegate" + prototype: "QObject" + exports: ["QtQml/Instantiator 2.1", "QtQuick/Instantiator 2.1"] + exportMetaObjectRevisions: [0, 0] + Property { name: "active"; type: "bool" } + Property { name: "asynchronous"; type: "bool" } + Property { name: "model"; type: "QVariant" } + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "object"; type: "QObject"; isReadonly: true; isPointer: true } + Signal { + name: "objectAdded" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "objectRemoved" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Method { + name: "objectAt" + type: "QObject*" + Parameter { name: "index"; type: "int" } + } + } + Component { + name: "QQmlListElement" + prototype: "QObject" + exports: ["QtQuick/ListElement 2.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQmlListModel" + prototype: "QAbstractListModel" + exports: ["QtQuick/ListModel 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "dynamicRoles"; type: "bool" } + Method { name: "clear" } + Method { + name: "remove" + Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "append" + Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "insert" + Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "get" + type: "QQmlV4Handle" + Parameter { name: "index"; type: "int" } + } + Method { + name: "set" + Parameter { name: "index"; type: "int" } + Parameter { type: "QQmlV4Handle" } + } + Method { + name: "setProperty" + Parameter { name: "index"; type: "int" } + Parameter { name: "property"; type: "string" } + Parameter { name: "value"; type: "QVariant" } + } + Method { + name: "move" + Parameter { name: "from"; type: "int" } + Parameter { name: "to"; type: "int" } + Parameter { name: "count"; type: "int" } + } + Method { name: "sync" } + } + Component { + name: "QQmlLocale" + exports: ["QtQml/Locale 2.2", "QtQuick/Locale 2.0"] + exportMetaObjectRevisions: [0, 0] + Enum { + name: "MeasurementSystem" + values: { + "MetricSystem": 0, + "ImperialSystem": 1, + "ImperialUSSystem": 1, + "ImperialUKSystem": 2 + } + } + Enum { + name: "FormatType" + values: { + "LongFormat": 0, + "ShortFormat": 1, + "NarrowFormat": 2 + } + } + Enum { + name: "CurrencySymbolFormat" + values: { + "CurrencyIsoCode": 0, + "CurrencySymbol": 1, + "CurrencyDisplayName": 2 + } + } + Enum { + name: "DayOfWeek" + values: { + "Sunday": 0, + "Monday": 1, + "Tuesday": 2, + "Wednesday": 3, + "Thursday": 4, + "Friday": 5, + "Saturday": 6 + } + } + } + Component { + name: "QQmlObjectModel" + defaultProperty: "children" + prototype: "QQmlInstanceModel" + exports: ["QtQuick/VisualItemModel 2.0"] + exportMetaObjectRevisions: [0] + attachedType: "QQmlObjectModelAttached" + Property { name: "children"; type: "QObject"; isList: true; isReadonly: true } + } + Component { + name: "QQmlObjectModelAttached" + prototype: "QObject" + Property { name: "index"; type: "int"; isReadonly: true } + } + Component { + name: "QQmlTimer" + prototype: "QObject" + exports: ["QtQml/Timer 2.0", "QtQuick/Timer 2.0"] + exportMetaObjectRevisions: [0, 0] + Property { name: "interval"; type: "int" } + Property { name: "running"; type: "bool" } + Property { name: "repeat"; type: "bool" } + Property { name: "triggeredOnStart"; type: "bool" } + Property { name: "parent"; type: "QObject"; isReadonly: true; isPointer: true } + Signal { name: "triggered" } + Method { name: "start" } + Method { name: "stop" } + Method { name: "restart" } + } + Component { name: "QQmlValueType"; prototype: "QObject" } + Component { + name: "QQuickAbstractAnimation" + prototype: "QObject" + exports: ["QtQuick/Animation 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Loops" + values: { + "Infinite": -2 + } + } + Property { name: "running"; type: "bool" } + Property { name: "paused"; type: "bool" } + Property { name: "alwaysRunToEnd"; type: "bool" } + Property { name: "loops"; type: "int" } + Signal { name: "started" } + Signal { name: "stopped" } + Signal { + name: "runningChanged" + Parameter { type: "bool" } + } + Signal { + name: "pausedChanged" + Parameter { type: "bool" } + } + Signal { + name: "alwaysRunToEndChanged" + Parameter { type: "bool" } + } + Signal { + name: "loopCountChanged" + Parameter { type: "int" } + } + Method { name: "restart" } + Method { name: "start" } + Method { name: "pause" } + Method { name: "resume" } + Method { name: "stop" } + Method { name: "complete" } + } + Component { + name: "QQuickAccessibleAttached" + prototype: "QObject" + exports: ["QtQuick/Accessible 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "role"; type: "QAccessible::Role" } + Property { name: "name"; type: "string" } + Property { name: "description"; type: "string" } + Method { name: "valueChanged" } + Method { name: "cursorPositionChanged" } + } + Component { + name: "QQuickAnchorAnimation" + prototype: "QQuickAbstractAnimation" + exports: ["QtQuick/AnchorAnimation 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "targets"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "duration"; type: "int" } + Property { name: "easing"; type: "QEasingCurve" } + Signal { + name: "durationChanged" + Parameter { type: "int" } + } + Signal { + name: "easingChanged" + Parameter { type: "QEasingCurve" } + } + } + Component { + name: "QQuickAnchorChanges" + prototype: "QQuickStateOperation" + exports: ["QtQuick/AnchorChanges 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "target"; type: "QQuickItem"; isPointer: true } + Property { name: "anchors"; type: "QQuickAnchorSet"; isReadonly: true; isPointer: true } + } + Component { + name: "QQuickAnchorSet" + prototype: "QObject" + Property { name: "left"; type: "QQmlScriptString" } + Property { name: "right"; type: "QQmlScriptString" } + Property { name: "horizontalCenter"; type: "QQmlScriptString" } + Property { name: "top"; type: "QQmlScriptString" } + Property { name: "bottom"; type: "QQmlScriptString" } + Property { name: "verticalCenter"; type: "QQmlScriptString" } + Property { name: "baseline"; type: "QQmlScriptString" } + } + Component { + name: "QQuickAnchors" + prototype: "QObject" + Property { name: "left"; type: "QQuickAnchorLine" } + Property { name: "right"; type: "QQuickAnchorLine" } + Property { name: "horizontalCenter"; type: "QQuickAnchorLine" } + Property { name: "top"; type: "QQuickAnchorLine" } + Property { name: "bottom"; type: "QQuickAnchorLine" } + Property { name: "verticalCenter"; type: "QQuickAnchorLine" } + Property { name: "baseline"; type: "QQuickAnchorLine" } + Property { name: "margins"; type: "double" } + Property { name: "leftMargin"; type: "double" } + Property { name: "rightMargin"; type: "double" } + Property { name: "horizontalCenterOffset"; type: "double" } + Property { name: "topMargin"; type: "double" } + Property { name: "bottomMargin"; type: "double" } + Property { name: "verticalCenterOffset"; type: "double" } + Property { name: "baselineOffset"; type: "double" } + Property { name: "fill"; type: "QQuickItem"; isPointer: true } + Property { name: "centerIn"; type: "QQuickItem"; isPointer: true } + Property { name: "alignWhenCentered"; type: "bool" } + Signal { name: "centerAlignedChanged" } + } + Component { + name: "QQuickAnimatedImage" + defaultProperty: "data" + prototype: "QQuickImage" + exports: ["QtQuick/AnimatedImage 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "playing"; type: "bool" } + Property { name: "paused"; type: "bool" } + Property { name: "currentFrame"; type: "int" } + Property { name: "frameCount"; type: "int"; isReadonly: true } + Property { name: "sourceSize"; type: "QSize"; isReadonly: true } + Signal { name: "frameChanged" } + } + Component { + name: "QQuickAnimatedSprite" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/AnimatedSprite 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "LoopParameters" + values: { + "Infinite": -1 + } + } + Property { name: "running"; type: "bool" } + Property { name: "interpolate"; type: "bool" } + Property { name: "source"; type: "QUrl" } + Property { name: "reverse"; type: "bool" } + Property { name: "frameSync"; type: "bool" } + Property { name: "frameCount"; type: "int" } + Property { name: "frameHeight"; type: "int" } + Property { name: "frameWidth"; type: "int" } + Property { name: "frameX"; type: "int" } + Property { name: "frameY"; type: "int" } + Property { name: "frameRate"; type: "double" } + Property { name: "frameDuration"; type: "int" } + Property { name: "loops"; type: "int" } + Property { name: "paused"; type: "bool" } + Property { name: "currentFrame"; type: "int" } + Signal { + name: "pausedChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "runningChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "interpolateChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "sourceChanged" + Parameter { name: "arg"; type: "QUrl" } + } + Signal { + name: "reverseChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "frameSyncChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "frameCountChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameHeightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameWidthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameXChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameYChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameRateChanged" + Parameter { name: "arg"; type: "double" } + } + Signal { + name: "frameDurationChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "loopsChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "currentFrameChanged" + Parameter { name: "arg"; type: "int" } + } + Method { name: "start" } + Method { name: "stop" } + Method { name: "restart" } + Method { + name: "advance" + Parameter { name: "frames"; type: "int" } + } + Method { name: "advance" } + Method { name: "pause" } + Method { name: "resume" } + Method { + name: "setRunning" + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "setPaused" + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "setInterpolate" + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "setSource" + Parameter { name: "arg"; type: "QUrl" } + } + Method { + name: "setReverse" + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "setFrameSync" + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "setFrameCount" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameHeight" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameWidth" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameX" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameY" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameRate" + Parameter { name: "arg"; type: "double" } + } + Method { + name: "setFrameDuration" + Parameter { name: "arg"; type: "int" } + } + Method { name: "resetFrameRate" } + Method { name: "resetFrameDuration" } + Method { + name: "setLoops" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setCurrentFrame" + Parameter { name: "arg"; type: "int" } + } + } + Component { + name: "QQuickAnimationController" + defaultProperty: "animation" + prototype: "QObject" + exports: ["QtQuick/AnimationController 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "progress"; type: "double" } + Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true } + Method { name: "reload" } + Method { name: "completeToBeginning" } + Method { name: "completeToEnd" } + } + Component { + name: "QQuickAnimationGroup" + defaultProperty: "animations" + prototype: "QQuickAbstractAnimation" + Property { name: "animations"; type: "QQuickAbstractAnimation"; isList: true; isReadonly: true } + } + Component { + name: "QQuickAnimator" + prototype: "QQuickAbstractAnimation" + exports: ["QtQuick/Animator 2.2"] + exportMetaObjectRevisions: [0] + Property { name: "target"; type: "QQuickItem"; isPointer: true } + Property { name: "easing"; type: "QEasingCurve" } + Property { name: "duration"; type: "int" } + Property { name: "to"; type: "double" } + Property { name: "from"; type: "double" } + Signal { + name: "targetItemChanged" + Parameter { type: "QQuickItem"; isPointer: true } + } + Signal { + name: "durationChanged" + Parameter { name: "duration"; type: "int" } + } + Signal { + name: "easingChanged" + Parameter { name: "curve"; type: "QEasingCurve" } + } + Signal { + name: "toChanged" + Parameter { name: "to"; type: "double" } + } + Signal { + name: "fromChanged" + Parameter { name: "from"; type: "double" } + } + } + Component { + name: "QQuickApplication" + prototype: "QQmlApplication" + exports: ["QtQuick/Application 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "active"; type: "bool"; isReadonly: true } + Property { name: "layoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } + Property { name: "supportsMultipleWindows"; type: "bool"; isReadonly: true } + Property { name: "state"; type: "Qt::ApplicationState"; isReadonly: true } + Signal { + name: "stateChanged" + Parameter { name: "state"; type: "Qt::ApplicationState" } + } + } + Component { + name: "QQuickBasePositioner" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + exports: ["QtQuick/Positioner 2.0"] + exportMetaObjectRevisions: [0] + attachedType: "QQuickPositionerAttached" + Property { name: "spacing"; type: "double" } + Property { name: "populate"; type: "QQuickTransition"; isPointer: true } + Property { name: "move"; type: "QQuickTransition"; isPointer: true } + Property { name: "add"; type: "QQuickTransition"; isPointer: true } + } + Component { + name: "QQuickBehavior" + defaultProperty: "animation" + prototype: "QObject" + exports: ["QtQuick/Behavior 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true } + Property { name: "enabled"; type: "bool" } + } + Component { + name: "QQuickBorderImage" + defaultProperty: "data" + prototype: "QQuickImageBase" + exports: ["QtQuick/BorderImage 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "TileMode" + values: { + "Stretch": 0, + "Repeat": 1, + "Round": 2 + } + } + Property { name: "border"; type: "QQuickScaleGrid"; isReadonly: true; isPointer: true } + Property { name: "horizontalTileMode"; type: "TileMode" } + Property { name: "verticalTileMode"; type: "TileMode" } + Property { name: "sourceSize"; type: "QSize"; isReadonly: true } + } + Component { + name: "QQuickCanvasItem" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/Canvas 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "RenderTarget" + values: { + "Image": 0, + "FramebufferObject": 1 + } + } + Enum { + name: "RenderStrategy" + values: { + "Immediate": 0, + "Threaded": 1, + "Cooperative": 2 + } + } + Property { name: "available"; type: "bool"; isReadonly: true } + Property { name: "contextType"; type: "string" } + Property { name: "context"; type: "QQmlV4Handle"; isReadonly: true } + Property { name: "canvasSize"; type: "QSizeF" } + Property { name: "tileSize"; type: "QSize" } + Property { name: "canvasWindow"; type: "QRectF" } + Property { name: "renderTarget"; type: "RenderTarget" } + Property { name: "renderStrategy"; type: "RenderStrategy" } + Signal { + name: "paint" + Parameter { name: "region"; type: "QRect" } + } + Signal { name: "painted" } + Signal { name: "imageLoaded" } + Method { + name: "loadImage" + Parameter { name: "url"; type: "QUrl" } + } + Method { + name: "unloadImage" + Parameter { name: "url"; type: "QUrl" } + } + Method { + name: "isImageLoaded" + type: "bool" + Parameter { name: "url"; type: "QUrl" } + } + Method { + name: "isImageLoading" + type: "bool" + Parameter { name: "url"; type: "QUrl" } + } + Method { + name: "isImageError" + type: "bool" + Parameter { name: "url"; type: "QUrl" } + } + Method { + name: "getContext" + Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "requestAnimationFrame" + Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "cancelRequestAnimationFrame" + Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true } + } + Method { name: "requestPaint" } + Method { + name: "markDirty" + Parameter { name: "dirtyRect"; type: "QRectF" } + } + Method { name: "markDirty" } + Method { + name: "save" + type: "bool" + Parameter { name: "filename"; type: "string" } + } + Method { + name: "toDataURL" + type: "string" + Parameter { name: "type"; type: "string" } + } + Method { name: "toDataURL"; type: "string" } + } + Component { + name: "QQuickColorAnimation" + prototype: "QQuickPropertyAnimation" + exports: ["QtQuick/ColorAnimation 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "from"; type: "QColor" } + Property { name: "to"; type: "QColor" } + } + Component { + name: "QQuickColumn" + defaultProperty: "data" + prototype: "QQuickBasePositioner" + exports: ["QtQuick/Column 2.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickCurve" + prototype: "QQuickPathElement" + Property { name: "x"; type: "double" } + Property { name: "y"; type: "double" } + Property { name: "relativeX"; type: "double" } + Property { name: "relativeY"; type: "double" } + } + Component { + name: "QQuickDoubleValidator" + prototype: "QDoubleValidator" + exports: ["QtQuick/DoubleValidator 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "locale"; type: "string" } + Signal { name: "localeNameChanged" } + } + Component { + name: "QQuickDrag" + prototype: "QObject" + exports: ["QtQuick/Drag 2.0"] + exportMetaObjectRevisions: [0] + attachedType: "QQuickDragAttached" + Enum { + name: "DragType" + values: { + "None": 0, + "Automatic": 1, + "Internal": 2 + } + } + Enum { + name: "Axis" + values: { + "XAxis": 1, + "YAxis": 2, + "XAndYAxis": 3, + "XandYAxis": 3 + } + } + Property { name: "target"; type: "QQuickItem"; isPointer: true } + Property { name: "axis"; type: "Axis" } + Property { name: "minimumX"; type: "double" } + Property { name: "maximumX"; type: "double" } + Property { name: "minimumY"; type: "double" } + Property { name: "maximumY"; type: "double" } + Property { name: "active"; type: "bool"; isReadonly: true } + Property { name: "filterChildren"; type: "bool" } + Property { name: "threshold"; type: "double" } + } + Component { + name: "QQuickDragAttached" + prototype: "QObject" + Property { name: "active"; type: "bool" } + Property { name: "source"; type: "QObject"; isPointer: true } + Property { name: "target"; type: "QObject"; isReadonly: true; isPointer: true } + Property { name: "hotSpot"; type: "QPointF" } + Property { name: "keys"; type: "QStringList" } + Property { name: "mimeData"; type: "QVariantMap" } + Property { name: "supportedActions"; type: "Qt::DropActions" } + Property { name: "proposedAction"; type: "Qt::DropAction" } + Property { name: "dragType"; type: "QQuickDrag::DragType" } + Signal { name: "dragStarted" } + Signal { + name: "dragFinished" + Parameter { name: "dropAction"; type: "Qt::DropAction" } + } + Method { + name: "start" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "startDrag" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { name: "cancel" } + Method { name: "drop"; type: "int" } + } + Component { + name: "QQuickDropArea" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/DropArea 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "containsDrag"; type: "bool"; isReadonly: true } + Property { name: "keys"; type: "QStringList" } + Property { name: "drag"; type: "QQuickDropAreaDrag"; isReadonly: true; isPointer: true } + Signal { name: "sourceChanged" } + Signal { + name: "entered" + Parameter { name: "drag"; type: "QQuickDropEvent"; isPointer: true } + } + Signal { name: "exited" } + Signal { + name: "positionChanged" + Parameter { name: "drag"; type: "QQuickDropEvent"; isPointer: true } + } + Signal { + name: "dropped" + Parameter { name: "drop"; type: "QQuickDropEvent"; isPointer: true } + } + } + Component { + name: "QQuickDropAreaDrag" + prototype: "QObject" + Property { name: "x"; type: "double"; isReadonly: true } + Property { name: "y"; type: "double"; isReadonly: true } + Property { name: "source"; type: "QObject"; isReadonly: true; isPointer: true } + Signal { name: "positionChanged" } + } + Component { + name: "QQuickFlickable" + defaultProperty: "flickableData" + prototype: "QQuickItem" + exports: ["QtQuick/Flickable 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "BoundsBehavior" + values: { + "StopAtBounds": 0, + "DragOverBounds": 1, + "DragAndOvershootBounds": 2 + } + } + Enum { + name: "FlickableDirection" + values: { + "AutoFlickDirection": 0, + "HorizontalFlick": 1, + "VerticalFlick": 2, + "HorizontalAndVerticalFlick": 3 + } + } + Property { name: "contentWidth"; type: "double" } + Property { name: "contentHeight"; type: "double" } + Property { name: "contentX"; type: "double" } + Property { name: "contentY"; type: "double" } + Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "topMargin"; type: "double" } + Property { name: "bottomMargin"; type: "double" } + Property { name: "originY"; type: "double"; isReadonly: true } + Property { name: "leftMargin"; type: "double" } + Property { name: "rightMargin"; type: "double" } + Property { name: "originX"; type: "double"; isReadonly: true } + Property { name: "horizontalVelocity"; type: "double"; isReadonly: true } + Property { name: "verticalVelocity"; type: "double"; isReadonly: true } + Property { name: "boundsBehavior"; type: "BoundsBehavior" } + Property { name: "rebound"; type: "QQuickTransition"; isPointer: true } + Property { name: "maximumFlickVelocity"; type: "double" } + Property { name: "flickDeceleration"; type: "double" } + Property { name: "moving"; type: "bool"; isReadonly: true } + Property { name: "movingHorizontally"; type: "bool"; isReadonly: true } + Property { name: "movingVertically"; type: "bool"; isReadonly: true } + Property { name: "flicking"; type: "bool"; isReadonly: true } + Property { name: "flickingHorizontally"; type: "bool"; isReadonly: true } + Property { name: "flickingVertically"; type: "bool"; isReadonly: true } + Property { name: "dragging"; type: "bool"; isReadonly: true } + Property { name: "draggingHorizontally"; type: "bool"; isReadonly: true } + Property { name: "draggingVertically"; type: "bool"; isReadonly: true } + Property { name: "flickableDirection"; type: "FlickableDirection" } + Property { name: "interactive"; type: "bool" } + Property { name: "pressDelay"; type: "int" } + Property { name: "atXEnd"; type: "bool"; isReadonly: true } + Property { name: "atYEnd"; type: "bool"; isReadonly: true } + Property { name: "atXBeginning"; type: "bool"; isReadonly: true } + Property { name: "atYBeginning"; type: "bool"; isReadonly: true } + Property { + name: "visibleArea" + type: "QQuickFlickableVisibleArea" + isReadonly: true + isPointer: true + } + Property { name: "pixelAligned"; type: "bool" } + Property { name: "flickableData"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "flickableChildren"; type: "QQuickItem"; isList: true; isReadonly: true } + Signal { name: "isAtBoundaryChanged" } + Signal { name: "movementStarted" } + Signal { name: "movementEnded" } + Signal { name: "flickStarted" } + Signal { name: "flickEnded" } + Signal { name: "dragStarted" } + Signal { name: "dragEnded" } + Method { + name: "resizeContent" + Parameter { name: "w"; type: "double" } + Parameter { name: "h"; type: "double" } + Parameter { name: "center"; type: "QPointF" } + } + Method { name: "returnToBounds" } + Method { + name: "flick" + Parameter { name: "xVelocity"; type: "double" } + Parameter { name: "yVelocity"; type: "double" } + } + Method { name: "cancelFlick" } + } + Component { + name: "QQuickFlickableVisibleArea" + prototype: "QObject" + Property { name: "xPosition"; type: "double"; isReadonly: true } + Property { name: "yPosition"; type: "double"; isReadonly: true } + Property { name: "widthRatio"; type: "double"; isReadonly: true } + Property { name: "heightRatio"; type: "double"; isReadonly: true } + Signal { + name: "xPositionChanged" + Parameter { name: "xPosition"; type: "double" } + } + Signal { + name: "yPositionChanged" + Parameter { name: "yPosition"; type: "double" } + } + Signal { + name: "widthRatioChanged" + Parameter { name: "widthRatio"; type: "double" } + } + Signal { + name: "heightRatioChanged" + Parameter { name: "heightRatio"; type: "double" } + } + } + Component { + name: "QQuickFlipable" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/Flipable 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Side" + values: { + "Front": 0, + "Back": 1 + } + } + Property { name: "front"; type: "QQuickItem"; isPointer: true } + Property { name: "back"; type: "QQuickItem"; isPointer: true } + Property { name: "side"; type: "Side"; isReadonly: true } + } + Component { + name: "QQuickFlow" + defaultProperty: "data" + prototype: "QQuickBasePositioner" + exports: ["QtQuick/Flow 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Flow" + values: { + "LeftToRight": 0, + "TopToBottom": 1 + } + } + Property { name: "flow"; type: "Flow" } + Property { name: "layoutDirection"; type: "Qt::LayoutDirection" } + Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } + } + Component { + name: "QQuickFocusScope" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/FocusScope 2.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickFontLoader" + prototype: "QObject" + exports: ["QtQuick/FontLoader 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Status" + values: { + "Null": 0, + "Ready": 1, + "Loading": 2, + "Error": 3 + } + } + Property { name: "source"; type: "QUrl" } + Property { name: "name"; type: "string" } + Property { name: "status"; type: "Status"; isReadonly: true } + } + Component { + name: "QQuickFontValueType" + prototype: "QQmlValueType" + exports: ["QtQuick/Font 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "FontWeight" + values: { + "Light": 25, + "Normal": 50, + "DemiBold": 63, + "Bold": 75, + "Black": 87 + } + } + Enum { + name: "Capitalization" + values: { + "MixedCase": 0, + "AllUppercase": 1, + "AllLowercase": 2, + "SmallCaps": 3, + "Capitalize": 4 + } + } + Property { name: "family"; type: "string" } + Property { name: "bold"; type: "bool" } + Property { name: "weight"; type: "FontWeight" } + Property { name: "italic"; type: "bool" } + Property { name: "underline"; type: "bool" } + Property { name: "overline"; type: "bool" } + Property { name: "strikeout"; type: "bool" } + Property { name: "pointSize"; type: "double" } + Property { name: "pixelSize"; type: "int" } + Property { name: "capitalization"; type: "Capitalization" } + Property { name: "letterSpacing"; type: "double" } + Property { name: "wordSpacing"; type: "double" } + } + Component { + name: "QQuickGradient" + defaultProperty: "stops" + prototype: "QObject" + exports: ["QtQuick/Gradient 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "stops"; type: "QQuickGradientStop"; isList: true; isReadonly: true } + Signal { name: "updated" } + } + Component { + name: "QQuickGradientStop" + prototype: "QObject" + exports: ["QtQuick/GradientStop 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "position"; type: "double" } + Property { name: "color"; type: "QColor" } + } + Component { + name: "QQuickGrid" + defaultProperty: "data" + prototype: "QQuickBasePositioner" + exports: ["QtQuick/Grid 2.0", "QtQuick/Grid 2.1"] + exportMetaObjectRevisions: [0, 1] + Enum { + name: "Flow" + values: { + "LeftToRight": 0, + "TopToBottom": 1 + } + } + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Property { name: "rows"; type: "int" } + Property { name: "columns"; type: "int" } + Property { name: "rowSpacing"; type: "double" } + Property { name: "columnSpacing"; type: "double" } + Property { name: "flow"; type: "Flow" } + Property { name: "layoutDirection"; type: "Qt::LayoutDirection" } + Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } + Property { name: "horizontalItemAlignment"; revision: 1; type: "HAlignment" } + Property { + name: "effectiveHorizontalItemAlignment" + revision: 1 + type: "HAlignment" + isReadonly: true + } + Property { name: "verticalItemAlignment"; revision: 1; type: "VAlignment" } + Signal { + name: "horizontalAlignmentChanged" + revision: 1 + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "effectiveHorizontalAlignmentChanged" + revision: 1 + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + revision: 1 + Parameter { name: "alignment"; type: "VAlignment" } + } + } + Component { + name: "QQuickGridMesh" + prototype: "QQuickShaderEffectMesh" + exports: ["QtQuick/GridMesh 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "resolution"; type: "QSize" } + } + Component { + name: "QQuickGridView" + defaultProperty: "data" + prototype: "QQuickItemView" + exports: ["QtQuick/GridView 2.0", "QtQuick/GridView 2.1"] + exportMetaObjectRevisions: [0, 1] + attachedType: "QQuickGridViewAttached" + Enum { + name: "Flow" + values: { + "FlowLeftToRight": 0, + "FlowTopToBottom": 2 + } + } + Enum { + name: "SnapMode" + values: { + "NoSnap": 0, + "SnapToRow": 1, + "SnapOneRow": 2 + } + } + Property { name: "flow"; type: "Flow" } + Property { name: "cellWidth"; type: "double" } + Property { name: "cellHeight"; type: "double" } + Property { name: "snapMode"; type: "SnapMode" } + Signal { name: "highlightMoveDurationChanged" } + Method { name: "moveCurrentIndexUp" } + Method { name: "moveCurrentIndexDown" } + Method { name: "moveCurrentIndexLeft" } + Method { name: "moveCurrentIndexRight" } + } + Component { + name: "QQuickGridViewAttached" + prototype: "QQuickItemViewAttached" + Property { name: "view"; type: "QQuickGridView"; isReadonly: true; isPointer: true } + } + Component { + name: "QQuickImage" + defaultProperty: "data" + prototype: "QQuickImageBase" + exports: ["QtQuick/Image 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Enum { + name: "FillMode" + values: { + "Stretch": 0, + "PreserveAspectFit": 1, + "PreserveAspectCrop": 2, + "Tile": 3, + "TileVertically": 4, + "TileHorizontally": 5, + "Pad": 6 + } + } + Property { name: "fillMode"; type: "FillMode" } + Property { name: "paintedWidth"; type: "double"; isReadonly: true } + Property { name: "paintedHeight"; type: "double"; isReadonly: true } + Property { name: "horizontalAlignment"; type: "HAlignment" } + Property { name: "verticalAlignment"; type: "VAlignment" } + Signal { name: "paintedGeometryChanged" } + Signal { + name: "horizontalAlignmentChanged" + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + Parameter { name: "alignment"; type: "VAlignment" } + } + } + Component { + name: "QQuickImageBase" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + Enum { + name: "Status" + values: { + "Null": 0, + "Ready": 1, + "Loading": 2, + "Error": 3 + } + } + Property { name: "status"; type: "Status"; isReadonly: true } + Property { name: "source"; type: "QUrl" } + Property { name: "progress"; type: "double"; isReadonly: true } + Property { name: "asynchronous"; type: "bool" } + Property { name: "cache"; type: "bool" } + Property { name: "sourceSize"; type: "QSize" } + Property { name: "mirror"; type: "bool" } + Signal { + name: "sourceChanged" + Parameter { type: "QUrl" } + } + Signal { + name: "statusChanged" + Parameter { type: "QQuickImageBase::Status" } + } + Signal { + name: "progressChanged" + Parameter { name: "progress"; type: "double" } + } + } + Component { + name: "QQuickImplicitSizeItem" + defaultProperty: "data" + prototype: "QQuickItem" + Property { name: "implicitWidth"; type: "double"; isReadonly: true } + Property { name: "implicitHeight"; type: "double"; isReadonly: true } + Signal { name: "implicitWidthChanged2"; revision: 1 } + Signal { name: "implicitHeightChanged2"; revision: 1 } + } + Component { + name: "QQuickIntValidator" + prototype: "QIntValidator" + exports: ["QtQuick/IntValidator 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "locale"; type: "string" } + Signal { name: "localeNameChanged" } + } + Component { + name: "QQuickItem" + defaultProperty: "data" + prototype: "QObject" + exports: ["QtQuick/Item 2.0", "QtQuick/Item 2.1"] + exportMetaObjectRevisions: [0, 1] + Enum { + name: "TransformOrigin" + values: { + "TopLeft": 0, + "Top": 1, + "TopRight": 2, + "Left": 3, + "Center": 4, + "Right": 5, + "BottomLeft": 6, + "Bottom": 7, + "BottomRight": 8 + } + } + Property { name: "parent"; type: "QQuickItem"; isPointer: true } + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "x"; type: "double" } + Property { name: "y"; type: "double" } + Property { name: "z"; type: "double" } + Property { name: "width"; type: "double" } + Property { name: "height"; type: "double" } + Property { name: "opacity"; type: "double" } + Property { name: "enabled"; type: "bool" } + Property { name: "visible"; type: "bool" } + Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true } + Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true } + Property { name: "state"; type: "string" } + Property { name: "childrenRect"; type: "QRectF"; isReadonly: true } + Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true } + Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true } + Property { name: "baselineOffset"; type: "double" } + Property { name: "clip"; type: "bool" } + Property { name: "focus"; type: "bool" } + Property { name: "activeFocus"; type: "bool"; isReadonly: true } + Property { name: "activeFocusOnTab"; revision: 1; type: "bool" } + Property { name: "rotation"; type: "double" } + Property { name: "scale"; type: "double" } + Property { name: "transformOrigin"; type: "TransformOrigin" } + Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true } + Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true } + Property { name: "smooth"; type: "bool" } + Property { name: "antialiasing"; type: "bool" } + Property { name: "implicitWidth"; type: "double" } + Property { name: "implicitHeight"; type: "double" } + Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true } + Signal { + name: "childrenRectChanged" + Parameter { type: "QRectF" } + } + Signal { + name: "baselineOffsetChanged" + Parameter { type: "double" } + } + Signal { + name: "stateChanged" + Parameter { type: "string" } + } + Signal { + name: "focusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusChanged" + Parameter { type: "bool" } + } + Signal { + name: "activeFocusOnTabChanged" + revision: 1 + Parameter { type: "bool" } + } + Signal { + name: "parentChanged" + Parameter { type: "QQuickItem"; isPointer: true } + } + Signal { + name: "transformOriginChanged" + Parameter { type: "TransformOrigin" } + } + Signal { + name: "smoothChanged" + Parameter { type: "bool" } + } + Signal { + name: "antialiasingChanged" + Parameter { type: "bool" } + } + Signal { + name: "clipChanged" + Parameter { type: "bool" } + } + Signal { + name: "windowChanged" + revision: 1 + Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } + } + Method { name: "update" } + Method { + name: "contains" + type: "bool" + Parameter { name: "point"; type: "QPointF" } + } + Method { + name: "mapFromItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "mapToItem" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + Method { name: "forceActiveFocus" } + Method { + name: "forceActiveFocus" + Parameter { name: "reason"; type: "Qt::FocusReason" } + } + Method { + name: "nextItemInFocusChain" + revision: 1 + type: "QQuickItem*" + Parameter { name: "forward"; type: "bool" } + } + Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" } + Method { + name: "childAt" + type: "QQuickItem*" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } + Component { + name: "QQuickItemLayer" + prototype: "QObject" + Property { name: "enabled"; type: "bool" } + Property { name: "textureSize"; type: "QSize" } + Property { name: "sourceRect"; type: "QRectF" } + Property { name: "mipmap"; type: "bool" } + Property { name: "smooth"; type: "bool" } + Property { name: "wrapMode"; type: "QQuickShaderEffectSource::WrapMode" } + Property { name: "format"; type: "QQuickShaderEffectSource::Format" } + Property { name: "samplerName"; type: "QByteArray" } + Property { name: "effect"; type: "QQmlComponent"; isPointer: true } + Signal { + name: "enabledChanged" + Parameter { name: "enabled"; type: "bool" } + } + Signal { + name: "sizeChanged" + Parameter { name: "size"; type: "QSize" } + } + Signal { + name: "mipmapChanged" + Parameter { name: "mipmap"; type: "bool" } + } + Signal { + name: "wrapModeChanged" + Parameter { name: "mode"; type: "QQuickShaderEffectSource::WrapMode" } + } + Signal { + name: "nameChanged" + Parameter { name: "name"; type: "QByteArray" } + } + Signal { + name: "effectChanged" + Parameter { name: "component"; type: "QQmlComponent"; isPointer: true } + } + Signal { + name: "smoothChanged" + Parameter { name: "smooth"; type: "bool" } + } + Signal { + name: "formatChanged" + Parameter { name: "format"; type: "QQuickShaderEffectSource::Format" } + } + Signal { + name: "sourceRectChanged" + Parameter { name: "sourceRect"; type: "QRectF" } + } + } + Component { + name: "QQuickItemView" + defaultProperty: "flickableData" + prototype: "QQuickFlickable" + exports: ["QtQuick/ItemView 2.1"] + exportMetaObjectRevisions: [1] + Enum { + name: "LayoutDirection" + values: { + "LeftToRight": 0, + "RightToLeft": 1, + "VerticalTopToBottom": 2, + "VerticalBottomToTop": 3 + } + } + Enum { + name: "VerticalLayoutDirection" + values: { + "TopToBottom": 2, + "BottomToTop": 3 + } + } + Enum { + name: "HighlightRangeMode" + values: { + "NoHighlightRange": 0, + "ApplyRange": 1, + "StrictlyEnforceRange": 2 + } + } + Enum { + name: "PositionMode" + values: { + "Beginning": 0, + "Center": 1, + "End": 2, + "Visible": 3, + "Contain": 4, + "SnapPosition": 5 + } + } + Property { name: "model"; type: "QVariant" } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "currentIndex"; type: "int" } + Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "keyNavigationWraps"; type: "bool" } + Property { name: "cacheBuffer"; type: "int" } + Property { name: "layoutDirection"; type: "Qt::LayoutDirection" } + Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } + Property { name: "verticalLayoutDirection"; type: "VerticalLayoutDirection" } + Property { name: "header"; type: "QQmlComponent"; isPointer: true } + Property { name: "headerItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "footer"; type: "QQmlComponent"; isPointer: true } + Property { name: "footerItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "populate"; type: "QQuickTransition"; isPointer: true } + Property { name: "add"; type: "QQuickTransition"; isPointer: true } + Property { name: "addDisplaced"; type: "QQuickTransition"; isPointer: true } + Property { name: "move"; type: "QQuickTransition"; isPointer: true } + Property { name: "moveDisplaced"; type: "QQuickTransition"; isPointer: true } + Property { name: "remove"; type: "QQuickTransition"; isPointer: true } + Property { name: "removeDisplaced"; type: "QQuickTransition"; isPointer: true } + Property { name: "displaced"; type: "QQuickTransition"; isPointer: true } + Property { name: "highlight"; type: "QQmlComponent"; isPointer: true } + Property { name: "highlightItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "highlightFollowsCurrentItem"; type: "bool" } + Property { name: "highlightRangeMode"; type: "HighlightRangeMode" } + Property { name: "preferredHighlightBegin"; type: "double" } + Property { name: "preferredHighlightEnd"; type: "double" } + Property { name: "highlightMoveDuration"; type: "int" } + Signal { name: "populateTransitionChanged" } + Signal { name: "addTransitionChanged" } + Signal { name: "addDisplacedTransitionChanged" } + Signal { name: "moveTransitionChanged" } + Signal { name: "moveDisplacedTransitionChanged" } + Signal { name: "removeTransitionChanged" } + Signal { name: "removeDisplacedTransitionChanged" } + Signal { name: "displacedTransitionChanged" } + Method { + name: "positionViewAtIndex" + Parameter { name: "index"; type: "int" } + Parameter { name: "mode"; type: "int" } + } + Method { + name: "indexAt" + type: "int" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + Method { + name: "itemAt" + type: "QQuickItem*" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + Method { name: "positionViewAtBeginning" } + Method { name: "positionViewAtEnd" } + Method { name: "forceLayout"; revision: 1 } + } + Component { + name: "QQuickItemViewAttached" + prototype: "QObject" + Property { name: "isCurrentItem"; type: "bool"; isReadonly: true } + Property { name: "delayRemove"; type: "bool" } + Property { name: "section"; type: "string"; isReadonly: true } + Property { name: "previousSection"; type: "string"; isReadonly: true } + Property { name: "nextSection"; type: "string"; isReadonly: true } + Signal { name: "currentItemChanged" } + Signal { name: "add" } + Signal { name: "remove" } + Signal { name: "prevSectionChanged" } + } + Component { + name: "QQuickKeyNavigationAttached" + prototype: "QObject" + exports: ["QtQuick/KeyNavigation 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Priority" + values: { + "BeforeItem": 0, + "AfterItem": 1 + } + } + Property { name: "left"; type: "QQuickItem"; isPointer: true } + Property { name: "right"; type: "QQuickItem"; isPointer: true } + Property { name: "up"; type: "QQuickItem"; isPointer: true } + Property { name: "down"; type: "QQuickItem"; isPointer: true } + Property { name: "tab"; type: "QQuickItem"; isPointer: true } + Property { name: "backtab"; type: "QQuickItem"; isPointer: true } + Property { name: "priority"; type: "Priority" } + } + Component { + name: "QQuickKeysAttached" + prototype: "QObject" + exports: ["QtQuick/Keys 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Priority" + values: { + "BeforeItem": 0, + "AfterItem": 1 + } + } + Property { name: "enabled"; type: "bool" } + Property { name: "forwardTo"; type: "QQuickItem"; isList: true; isReadonly: true } + Property { name: "priority"; type: "Priority" } + Signal { + name: "pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "released" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit0Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit1Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit2Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit3Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit4Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit5Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit6Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit7Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit8Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "digit9Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "leftPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "rightPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "upPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "downPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "tabPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "backtabPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "asteriskPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "numberSignPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "escapePressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "returnPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "enterPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "deletePressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "spacePressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "backPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "cancelPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "selectPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "yesPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "noPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "context1Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "context2Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "context3Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "context4Pressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "callPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "hangupPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "flipPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "menuPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "volumeUpPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + Signal { + name: "volumeDownPressed" + Parameter { name: "event"; type: "QQuickKeyEvent"; isPointer: true } + } + } + Component { + name: "QQuickLayoutMirroringAttached" + prototype: "QObject" + exports: ["QtQuick/LayoutMirroring 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "enabled"; type: "bool" } + Property { name: "childrenInherit"; type: "bool" } + } + Component { + name: "QQuickListView" + defaultProperty: "data" + prototype: "QQuickItemView" + exports: ["QtQuick/ListView 2.0", "QtQuick/ListView 2.1"] + exportMetaObjectRevisions: [0, 1] + attachedType: "QQuickListViewAttached" + Enum { + name: "Orientation" + values: { + "Horizontal": 1, + "Vertical": 2 + } + } + Enum { + name: "SnapMode" + values: { + "NoSnap": 0, + "SnapToItem": 1, + "SnapOneItem": 2 + } + } + Property { name: "highlightMoveVelocity"; type: "double" } + Property { name: "highlightResizeVelocity"; type: "double" } + Property { name: "highlightResizeDuration"; type: "int" } + Property { name: "spacing"; type: "double" } + Property { name: "orientation"; type: "Orientation" } + Property { name: "section"; type: "QQuickViewSection"; isReadonly: true; isPointer: true } + Property { name: "currentSection"; type: "string"; isReadonly: true } + Property { name: "snapMode"; type: "SnapMode" } + Method { name: "incrementCurrentIndex" } + Method { name: "decrementCurrentIndex" } + } + Component { + name: "QQuickListViewAttached" + prototype: "QQuickItemViewAttached" + Property { name: "view"; type: "QQuickListView"; isReadonly: true; isPointer: true } + } + Component { + name: "QQuickLoader" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + exports: ["QtQuick/Loader 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Status" + values: { + "Null": 0, + "Ready": 1, + "Loading": 2, + "Error": 3 + } + } + Property { name: "active"; type: "bool" } + Property { name: "source"; type: "QUrl" } + Property { name: "sourceComponent"; type: "QQmlComponent"; isPointer: true } + Property { name: "item"; type: "QObject"; isReadonly: true; isPointer: true } + Property { name: "status"; type: "Status"; isReadonly: true } + Property { name: "progress"; type: "double"; isReadonly: true } + Property { name: "asynchronous"; type: "bool" } + Signal { name: "loaded" } + Method { + name: "setSource" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + } + Component { + name: "QQuickMouseArea" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/MouseArea 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "mouseX"; type: "double"; isReadonly: true } + Property { name: "mouseY"; type: "double"; isReadonly: true } + Property { name: "containsMouse"; type: "bool"; isReadonly: true } + Property { name: "pressed"; type: "bool"; isReadonly: true } + Property { name: "enabled"; type: "bool" } + Property { name: "pressedButtons"; type: "Qt::MouseButtons"; isReadonly: true } + Property { name: "acceptedButtons"; type: "Qt::MouseButtons" } + Property { name: "hoverEnabled"; type: "bool" } + Property { name: "drag"; type: "QQuickDrag"; isReadonly: true; isPointer: true } + Property { name: "preventStealing"; type: "bool" } + Property { name: "propagateComposedEvents"; type: "bool" } + Property { name: "cursorShape"; type: "Qt::CursorShape" } + Signal { name: "hoveredChanged" } + Signal { + name: "positionChanged" + Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "mouseXChanged" + Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "mouseYChanged" + Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "pressed" + Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "pressAndHold" + Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "released" + Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "clicked" + Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "doubleClicked" + Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true } + } + Signal { + name: "wheel" + Parameter { name: "wheel"; type: "QQuickWheelEvent"; isPointer: true } + } + Signal { name: "entered" } + Signal { name: "exited" } + Signal { name: "canceled" } + } + Component { + name: "QQuickMouseEvent" + prototype: "QObject" + Property { name: "x"; type: "double"; isReadonly: true } + Property { name: "y"; type: "double"; isReadonly: true } + Property { name: "button"; type: "int"; isReadonly: true } + Property { name: "buttons"; type: "int"; isReadonly: true } + Property { name: "modifiers"; type: "int"; isReadonly: true } + Property { name: "wasHeld"; type: "bool"; isReadonly: true } + Property { name: "isClick"; type: "bool"; isReadonly: true } + Property { name: "accepted"; type: "bool" } + } + Component { + name: "QQuickMultiPointTouchArea" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/MultiPointTouchArea 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "touchPoints"; type: "QQuickTouchPoint"; isList: true; isReadonly: true } + Property { name: "minimumTouchPoints"; type: "int" } + Property { name: "maximumTouchPoints"; type: "int" } + Signal { + name: "pressed" + Parameter { name: "touchPoints"; type: "QList" } + } + Signal { + name: "updated" + Parameter { name: "touchPoints"; type: "QList" } + } + Signal { + name: "released" + Parameter { name: "touchPoints"; type: "QList" } + } + Signal { + name: "canceled" + Parameter { name: "touchPoints"; type: "QList" } + } + Signal { + name: "gestureStarted" + Parameter { name: "gesture"; type: "QQuickGrabGestureEvent"; isPointer: true } + } + Signal { + name: "touchUpdated" + Parameter { name: "touchPoints"; type: "QList" } + } + } + Component { + name: "QQuickNumberAnimation" + prototype: "QQuickPropertyAnimation" + exports: ["QtQuick/NumberAnimation 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "from"; type: "double" } + Property { name: "to"; type: "double" } + } + Component { + name: "QQuickOpacityAnimator" + prototype: "QQuickAnimator" + exports: ["QtQuick/OpacityAnimator 2.2"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickPackage" + defaultProperty: "data" + prototype: "QObject" + exports: ["QtQuick/Package 2.0"] + exportMetaObjectRevisions: [0] + attachedType: "QQuickPackageAttached" + Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } + } + Component { + name: "QQuickPackageAttached" + prototype: "QObject" + Property { name: "name"; type: "string" } + } + Component { + name: "QQuickPaintedItem" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/PaintedItem 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "RenderTarget" + values: { + "Image": 0, + "FramebufferObject": 1, + "InvertedYFramebufferObject": 2 + } + } + Property { name: "contentsSize"; type: "QSize" } + Property { name: "fillColor"; type: "QColor" } + Property { name: "contentsScale"; type: "double" } + Property { name: "renderTarget"; type: "RenderTarget" } + } + Component { + name: "QQuickParallelAnimation" + defaultProperty: "animations" + prototype: "QQuickAnimationGroup" + exports: ["QtQuick/ParallelAnimation 2.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickParentAnimation" + defaultProperty: "animations" + prototype: "QQuickAnimationGroup" + exports: ["QtQuick/ParentAnimation 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "target"; type: "QQuickItem"; isPointer: true } + Property { name: "newParent"; type: "QQuickItem"; isPointer: true } + Property { name: "via"; type: "QQuickItem"; isPointer: true } + } + Component { + name: "QQuickParentChange" + prototype: "QQuickStateOperation" + exports: ["QtQuick/ParentChange 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "target"; type: "QQuickItem"; isPointer: true } + Property { name: "parent"; type: "QQuickItem"; isPointer: true } + Property { name: "x"; type: "QQmlScriptString" } + Property { name: "y"; type: "QQmlScriptString" } + Property { name: "width"; type: "QQmlScriptString" } + Property { name: "height"; type: "QQmlScriptString" } + Property { name: "scale"; type: "QQmlScriptString" } + Property { name: "rotation"; type: "QQmlScriptString" } + } + Component { + name: "QQuickPath" + defaultProperty: "pathElements" + prototype: "QObject" + exports: ["QtQuick/Path 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "pathElements"; type: "QQuickPathElement"; isList: true; isReadonly: true } + Property { name: "startX"; type: "double" } + Property { name: "startY"; type: "double" } + Property { name: "closed"; type: "bool"; isReadonly: true } + Signal { name: "changed" } + } + Component { + name: "QQuickPathAnimation" + prototype: "QQuickAbstractAnimation" + exports: ["QtQuick/PathAnimation 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Orientation" + values: { + "Fixed": 0, + "RightFirst": 1, + "LeftFirst": 2, + "BottomFirst": 3, + "TopFirst": 4 + } + } + Property { name: "duration"; type: "int" } + Property { name: "easing"; type: "QEasingCurve" } + Property { name: "path"; type: "QQuickPath"; isPointer: true } + Property { name: "target"; type: "QQuickItem"; isPointer: true } + Property { name: "orientation"; type: "Orientation" } + Property { name: "anchorPoint"; type: "QPointF" } + Property { name: "orientationEntryDuration"; type: "int" } + Property { name: "orientationExitDuration"; type: "int" } + Property { name: "endRotation"; type: "double" } + Signal { + name: "durationChanged" + Parameter { type: "int" } + } + Signal { + name: "easingChanged" + Parameter { type: "QEasingCurve" } + } + Signal { + name: "orientationChanged" + Parameter { type: "Orientation" } + } + Signal { + name: "anchorPointChanged" + Parameter { type: "QPointF" } + } + Signal { + name: "orientationEntryDurationChanged" + Parameter { type: "double" } + } + Signal { + name: "orientationExitDurationChanged" + Parameter { type: "double" } + } + Signal { + name: "endRotationChanged" + Parameter { type: "double" } + } + } + Component { + name: "QQuickPathArc" + prototype: "QQuickCurve" + exports: ["QtQuick/PathArc 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "ArcDirection" + values: { + "Clockwise": 0, + "Counterclockwise": 1 + } + } + Property { name: "radiusX"; type: "double" } + Property { name: "radiusY"; type: "double" } + Property { name: "useLargeArc"; type: "bool" } + Property { name: "direction"; type: "ArcDirection" } + } + Component { + name: "QQuickPathAttribute" + prototype: "QQuickPathElement" + exports: ["QtQuick/PathAttribute 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "name"; type: "string" } + Property { name: "value"; type: "double" } + } + Component { + name: "QQuickPathCatmullRomCurve" + prototype: "QQuickCurve" + exports: ["QtQuick/PathCurve 2.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickPathCubic" + prototype: "QQuickCurve" + exports: ["QtQuick/PathCubic 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "control1X"; type: "double" } + Property { name: "control1Y"; type: "double" } + Property { name: "control2X"; type: "double" } + Property { name: "control2Y"; type: "double" } + Property { name: "relativeControl1X"; type: "double" } + Property { name: "relativeControl1Y"; type: "double" } + Property { name: "relativeControl2X"; type: "double" } + Property { name: "relativeControl2Y"; type: "double" } + } + Component { + name: "QQuickPathElement" + prototype: "QObject" + Signal { name: "changed" } + } + Component { + name: "QQuickPathInterpolator" + prototype: "QObject" + exports: ["QtQuick/PathInterpolator 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "path"; type: "QQuickPath"; isPointer: true } + Property { name: "progress"; type: "double" } + Property { name: "x"; type: "double"; isReadonly: true } + Property { name: "y"; type: "double"; isReadonly: true } + Property { name: "angle"; type: "double"; isReadonly: true } + } + Component { + name: "QQuickPathLine" + prototype: "QQuickCurve" + exports: ["QtQuick/PathLine 2.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickPathPercent" + prototype: "QQuickPathElement" + exports: ["QtQuick/PathPercent 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "value"; type: "double" } + } + Component { + name: "QQuickPathQuad" + prototype: "QQuickCurve" + exports: ["QtQuick/PathQuad 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "controlX"; type: "double" } + Property { name: "controlY"; type: "double" } + Property { name: "relativeControlX"; type: "double" } + Property { name: "relativeControlY"; type: "double" } + } + Component { + name: "QQuickPathSvg" + prototype: "QQuickCurve" + exports: ["QtQuick/PathSvg 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "path"; type: "string" } + } + Component { + name: "QQuickPathView" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/PathView 2.0"] + exportMetaObjectRevisions: [0] + attachedType: "QQuickPathViewAttached" + Enum { + name: "HighlightRangeMode" + values: { + "NoHighlightRange": 0, + "ApplyRange": 1, + "StrictlyEnforceRange": 2 + } + } + Enum { + name: "SnapMode" + values: { + "NoSnap": 0, + "SnapToItem": 1, + "SnapOneItem": 2 + } + } + Enum { + name: "PositionMode" + values: { + "Beginning": 0, + "Center": 1, + "End": 2, + "Contain": 4, + "SnapPosition": 5 + } + } + Property { name: "model"; type: "QVariant" } + Property { name: "path"; type: "QQuickPath"; isPointer: true } + Property { name: "currentIndex"; type: "int" } + Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "offset"; type: "double" } + Property { name: "highlight"; type: "QQmlComponent"; isPointer: true } + Property { name: "highlightItem"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "preferredHighlightBegin"; type: "double" } + Property { name: "preferredHighlightEnd"; type: "double" } + Property { name: "highlightRangeMode"; type: "HighlightRangeMode" } + Property { name: "highlightMoveDuration"; type: "int" } + Property { name: "dragMargin"; type: "double" } + Property { name: "maximumFlickVelocity"; type: "double" } + Property { name: "flickDeceleration"; type: "double" } + Property { name: "interactive"; type: "bool" } + Property { name: "moving"; type: "bool"; isReadonly: true } + Property { name: "flicking"; type: "bool"; isReadonly: true } + Property { name: "dragging"; type: "bool"; isReadonly: true } + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "pathItemCount"; type: "int" } + Property { name: "snapMode"; type: "SnapMode" } + Property { name: "cacheItemCount"; type: "int" } + Signal { name: "snapPositionChanged" } + Signal { name: "movementStarted" } + Signal { name: "movementEnded" } + Signal { name: "flickStarted" } + Signal { name: "flickEnded" } + Signal { name: "dragStarted" } + Signal { name: "dragEnded" } + Method { name: "incrementCurrentIndex" } + Method { name: "decrementCurrentIndex" } + Method { + name: "positionViewAtIndex" + Parameter { name: "index"; type: "int" } + Parameter { name: "mode"; type: "int" } + } + Method { + name: "indexAt" + type: "int" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + Method { + name: "itemAt" + type: "QQuickItem*" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + } + Component { + name: "QQuickPathViewAttached" + prototype: "QObject" + Property { name: "view"; type: "QQuickPathView"; isReadonly: true; isPointer: true } + Property { name: "isCurrentItem"; type: "bool"; isReadonly: true } + Property { name: "onPath"; type: "bool"; isReadonly: true } + Signal { name: "currentItemChanged" } + Signal { name: "pathChanged" } + } + Component { + name: "QQuickPauseAnimation" + prototype: "QQuickAbstractAnimation" + exports: ["QtQuick/PauseAnimation 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "duration"; type: "int" } + Signal { + name: "durationChanged" + Parameter { type: "int" } + } + } + Component { + name: "QQuickPen" + prototype: "QObject" + Property { name: "width"; type: "double" } + Property { name: "color"; type: "QColor" } + Property { name: "pixelAligned"; type: "bool" } + Signal { name: "penChanged" } + } + Component { + name: "QQuickPinch" + prototype: "QObject" + exports: ["QtQuick/Pinch 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "Axis" + values: { + "NoDrag": 0, + "XAxis": 1, + "YAxis": 2, + "XAndYAxis": 3, + "XandYAxis": 3 + } + } + Property { name: "target"; type: "QQuickItem"; isPointer: true } + Property { name: "minimumScale"; type: "double" } + Property { name: "maximumScale"; type: "double" } + Property { name: "minimumRotation"; type: "double" } + Property { name: "maximumRotation"; type: "double" } + Property { name: "dragAxis"; type: "Axis" } + Property { name: "minimumX"; type: "double" } + Property { name: "maximumX"; type: "double" } + Property { name: "minimumY"; type: "double" } + Property { name: "maximumY"; type: "double" } + Property { name: "active"; type: "bool"; isReadonly: true } + } + Component { + name: "QQuickPinchArea" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/PinchArea 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "enabled"; type: "bool" } + Property { name: "pinch"; type: "QQuickPinch"; isReadonly: true; isPointer: true } + Signal { + name: "pinchStarted" + Parameter { name: "pinch"; type: "QQuickPinchEvent"; isPointer: true } + } + Signal { + name: "pinchUpdated" + Parameter { name: "pinch"; type: "QQuickPinchEvent"; isPointer: true } + } + Signal { + name: "pinchFinished" + Parameter { name: "pinch"; type: "QQuickPinchEvent"; isPointer: true } + } + } + Component { + name: "QQuickPositionerAttached" + prototype: "QObject" + Property { name: "index"; type: "int"; isReadonly: true } + Property { name: "isFirstItem"; type: "bool"; isReadonly: true } + Property { name: "isLastItem"; type: "bool"; isReadonly: true } + } + Component { + name: "QQuickPropertyAction" + prototype: "QQuickAbstractAnimation" + exports: ["QtQuick/PropertyAction 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "target"; type: "QObject"; isPointer: true } + Property { name: "property"; type: "string" } + Property { name: "properties"; type: "string" } + Property { name: "targets"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "exclude"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "value"; type: "QVariant" } + Signal { + name: "valueChanged" + Parameter { type: "QVariant" } + } + Signal { + name: "propertiesChanged" + Parameter { type: "string" } + } + } + Component { + name: "QQuickPropertyAnimation" + prototype: "QQuickAbstractAnimation" + exports: ["QtQuick/PropertyAnimation 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "duration"; type: "int" } + Property { name: "from"; type: "QVariant" } + Property { name: "to"; type: "QVariant" } + Property { name: "easing"; type: "QEasingCurve" } + Property { name: "target"; type: "QObject"; isPointer: true } + Property { name: "property"; type: "string" } + Property { name: "properties"; type: "string" } + Property { name: "targets"; type: "QObject"; isList: true; isReadonly: true } + Property { name: "exclude"; type: "QObject"; isList: true; isReadonly: true } + Signal { + name: "durationChanged" + Parameter { type: "int" } + } + Signal { + name: "fromChanged" + Parameter { type: "QVariant" } + } + Signal { + name: "toChanged" + Parameter { type: "QVariant" } + } + Signal { + name: "easingChanged" + Parameter { type: "QEasingCurve" } + } + Signal { + name: "propertiesChanged" + Parameter { type: "string" } + } + } + Component { + name: "QQuickPropertyChanges" + prototype: "QQuickStateOperation" + exports: ["QtQuick/PropertyChanges 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "target"; type: "QObject"; isPointer: true } + Property { name: "restoreEntryValues"; type: "bool" } + Property { name: "explicit"; type: "bool" } + } + Component { + name: "QQuickRectangle" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/Rectangle 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "color"; type: "QColor" } + Property { name: "gradient"; type: "QQuickGradient"; isPointer: true } + Property { name: "border"; type: "QQuickPen"; isReadonly: true; isPointer: true } + Property { name: "radius"; type: "double" } + } + Component { + name: "QQuickRepeater" + defaultProperty: "delegate" + prototype: "QQuickItem" + exports: ["QtQuick/Repeater 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "model"; type: "QVariant" } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "count"; type: "int"; isReadonly: true } + Signal { + name: "itemAdded" + Parameter { name: "index"; type: "int" } + Parameter { name: "item"; type: "QQuickItem"; isPointer: true } + } + Signal { + name: "itemRemoved" + Parameter { name: "index"; type: "int" } + Parameter { name: "item"; type: "QQuickItem"; isPointer: true } + } + Method { + name: "itemAt" + type: "QQuickItem*" + Parameter { name: "index"; type: "int" } + } + } + Component { + name: "QQuickRotation" + prototype: "QQuickTransform" + exports: ["QtQuick/Rotation 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "origin"; type: "QVector3D" } + Property { name: "angle"; type: "double" } + Property { name: "axis"; type: "QVector3D" } + } + Component { + name: "QQuickRotationAnimation" + prototype: "QQuickPropertyAnimation" + exports: ["QtQuick/RotationAnimation 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "RotationDirection" + values: { + "Numerical": 0, + "Shortest": 1, + "Clockwise": 2, + "Counterclockwise": 3 + } + } + Property { name: "from"; type: "double" } + Property { name: "to"; type: "double" } + Property { name: "direction"; type: "RotationDirection" } + } + Component { + name: "QQuickRotationAnimator" + prototype: "QQuickAnimator" + exports: ["QtQuick/RotationAnimator 2.2"] + exportMetaObjectRevisions: [0] + Enum { + name: "RotationDirection" + values: { + "Numerical": 0, + "Shortest": 1, + "Clockwise": 2, + "Counterclockwise": 3 + } + } + Property { name: "direction"; type: "RotationDirection" } + Signal { + name: "directionChanged" + Parameter { name: "dir"; type: "RotationDirection" } + } + } + Component { + name: "QQuickRow" + defaultProperty: "data" + prototype: "QQuickBasePositioner" + exports: ["QtQuick/Row 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "layoutDirection"; type: "Qt::LayoutDirection" } + Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } + } + Component { + name: "QQuickScale" + prototype: "QQuickTransform" + exports: ["QtQuick/Scale 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "origin"; type: "QVector3D" } + Property { name: "xScale"; type: "double" } + Property { name: "yScale"; type: "double" } + Property { name: "zScale"; type: "double" } + Signal { name: "scaleChanged" } + } + Component { + name: "QQuickScaleAnimator" + prototype: "QQuickAnimator" + exports: ["QtQuick/ScaleAnimator 2.2"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickScaleGrid" + prototype: "QObject" + Property { name: "left"; type: "int" } + Property { name: "top"; type: "int" } + Property { name: "right"; type: "int" } + Property { name: "bottom"; type: "int" } + Signal { name: "borderChanged" } + } + Component { + name: "QQuickScriptAction" + prototype: "QQuickAbstractAnimation" + exports: ["QtQuick/ScriptAction 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "script"; type: "QQmlScriptString" } + Property { name: "scriptName"; type: "string" } + } + Component { + name: "QQuickSequentialAnimation" + defaultProperty: "animations" + prototype: "QQuickAnimationGroup" + exports: ["QtQuick/SequentialAnimation 2.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickShaderEffect" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/ShaderEffect 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "CullMode" + values: { + "NoCulling": 0, + "BackFaceCulling": 1, + "FrontFaceCulling": 2 + } + } + Enum { + name: "Status" + values: { + "Compiled": 0, + "Uncompiled": 1, + "Error": 2 + } + } + Property { name: "fragmentShader"; type: "QByteArray" } + Property { name: "vertexShader"; type: "QByteArray" } + Property { name: "blending"; type: "bool" } + Property { name: "mesh"; type: "QVariant" } + Property { name: "cullMode"; type: "CullMode" } + Property { name: "log"; type: "string"; isReadonly: true } + Property { name: "status"; type: "Status"; isReadonly: true } + } + Component { + name: "QQuickShaderEffectMesh" + prototype: "QObject" + exports: ["QtQuick/ShaderEffectMesh 2.0"] + exportMetaObjectRevisions: [0] + Signal { name: "geometryChanged" } + } + Component { + name: "QQuickShaderEffectSource" + defaultProperty: "data" + prototype: "QQuickItem" + exports: ["QtQuick/ShaderEffectSource 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "WrapMode" + values: { + "ClampToEdge": 0, + "RepeatHorizontally": 1, + "RepeatVertically": 2, + "Repeat": 3 + } + } + Enum { + name: "Format" + values: { + "Alpha": 6406, + "RGB": 6407, + "RGBA": 6408 + } + } + Property { name: "wrapMode"; type: "WrapMode" } + Property { name: "sourceItem"; type: "QQuickItem"; isPointer: true } + Property { name: "sourceRect"; type: "QRectF" } + Property { name: "textureSize"; type: "QSize" } + Property { name: "format"; type: "Format" } + Property { name: "live"; type: "bool" } + Property { name: "hideSource"; type: "bool" } + Property { name: "mipmap"; type: "bool" } + Property { name: "recursive"; type: "bool" } + Signal { name: "scheduledUpdateCompleted" } + Method { name: "scheduleUpdate" } + } + Component { + name: "QQuickSmoothedAnimation" + prototype: "QQuickNumberAnimation" + exports: ["QtQuick/SmoothedAnimation 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "ReversingMode" + values: { + "Eased": 0, + "Immediate": 1, + "Sync": 2 + } + } + Property { name: "velocity"; type: "double" } + Property { name: "reversingMode"; type: "ReversingMode" } + Property { name: "maximumEasingTime"; type: "double" } + } + Component { + name: "QQuickSpringAnimation" + prototype: "QQuickNumberAnimation" + exports: ["QtQuick/SpringAnimation 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "velocity"; type: "double" } + Property { name: "spring"; type: "double" } + Property { name: "damping"; type: "double" } + Property { name: "epsilon"; type: "double" } + Property { name: "modulus"; type: "double" } + Property { name: "mass"; type: "double" } + Signal { name: "syncChanged" } + } + Component { + name: "QQuickSprite" + prototype: "QQuickStochasticState" + exports: ["QtQuick/Sprite 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "source"; type: "QUrl" } + Property { name: "reverse"; type: "bool" } + Property { name: "frameSync"; type: "bool" } + Property { name: "frames"; type: "int" } + Property { name: "frameCount"; type: "int" } + Property { name: "frameHeight"; type: "int" } + Property { name: "frameWidth"; type: "int" } + Property { name: "frameX"; type: "int" } + Property { name: "frameY"; type: "int" } + Property { name: "frameRate"; type: "double" } + Property { name: "frameRateVariation"; type: "double" } + Property { name: "frameDuration"; type: "int" } + Property { name: "frameDurationVariation"; type: "int" } + Signal { + name: "sourceChanged" + Parameter { name: "arg"; type: "QUrl" } + } + Signal { + name: "frameHeightChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameWidthChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "reverseChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "frameCountChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameXChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameYChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameRateChanged" + Parameter { name: "arg"; type: "double" } + } + Signal { + name: "frameRateVariationChanged" + Parameter { name: "arg"; type: "double" } + } + Signal { + name: "frameDurationChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameDurationVariationChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "frameSyncChanged" + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "setSource" + Parameter { name: "arg"; type: "QUrl" } + } + Method { + name: "setFrameHeight" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameWidth" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setReverse" + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "setFrames" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameCount" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameX" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameY" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameRate" + Parameter { name: "arg"; type: "double" } + } + Method { + name: "setFrameRateVariation" + Parameter { name: "arg"; type: "double" } + } + Method { + name: "setFrameDuration" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameDurationVariation" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setFrameSync" + Parameter { name: "arg"; type: "bool" } + } + } + Component { + name: "QQuickSpriteSequence" + defaultProperty: "sprites" + prototype: "QQuickItem" + exports: ["QtQuick/SpriteSequence 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "running"; type: "bool" } + Property { name: "interpolate"; type: "bool" } + Property { name: "goalSprite"; type: "string" } + Property { name: "currentSprite"; type: "string"; isReadonly: true } + Property { name: "sprites"; type: "QQuickSprite"; isList: true; isReadonly: true } + Signal { + name: "runningChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "interpolateChanged" + Parameter { name: "arg"; type: "bool" } + } + Signal { + name: "goalSpriteChanged" + Parameter { name: "arg"; type: "string" } + } + Signal { + name: "currentSpriteChanged" + Parameter { name: "arg"; type: "string" } + } + Method { + name: "jumpTo" + Parameter { name: "sprite"; type: "string" } + } + Method { + name: "setGoalSprite" + Parameter { name: "sprite"; type: "string" } + } + Method { + name: "setRunning" + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "setInterpolate" + Parameter { name: "arg"; type: "bool" } + } + } + Component { + name: "QQuickState" + defaultProperty: "changes" + prototype: "QObject" + exports: ["QtQuick/State 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "name"; type: "string" } + Property { name: "when"; type: "QQmlBinding"; isPointer: true } + Property { name: "extend"; type: "string" } + Property { name: "changes"; type: "QQuickStateOperation"; isList: true; isReadonly: true } + Signal { name: "completed" } + } + Component { + name: "QQuickStateChangeScript" + prototype: "QQuickStateOperation" + exports: ["QtQuick/StateChangeScript 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "script"; type: "QQmlScriptString" } + Property { name: "name"; type: "string" } + } + Component { + name: "QQuickStateGroup" + prototype: "QObject" + exports: ["QtQuick/StateGroup 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "state"; type: "string" } + Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true } + Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true } + Signal { + name: "stateChanged" + Parameter { type: "string" } + } + } + Component { name: "QQuickStateOperation"; prototype: "QObject" } + Component { + name: "QQuickStochasticState" + prototype: "QObject" + Property { name: "duration"; type: "int" } + Property { name: "durationVariation"; type: "int" } + Property { name: "randomStart"; type: "bool" } + Property { name: "to"; type: "QVariantMap" } + Property { name: "name"; type: "string" } + Signal { + name: "durationChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { + name: "nameChanged" + Parameter { name: "arg"; type: "string" } + } + Signal { + name: "toChanged" + Parameter { name: "arg"; type: "QVariantMap" } + } + Signal { + name: "durationVariationChanged" + Parameter { name: "arg"; type: "int" } + } + Signal { name: "entered" } + Signal { + name: "randomStartChanged" + Parameter { name: "arg"; type: "bool" } + } + Method { + name: "setDuration" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setName" + Parameter { name: "arg"; type: "string" } + } + Method { + name: "setTo" + Parameter { name: "arg"; type: "QVariantMap" } + } + Method { + name: "setDurationVariation" + Parameter { name: "arg"; type: "int" } + } + Method { + name: "setRandomStart" + Parameter { name: "arg"; type: "bool" } + } + } + Component { + name: "QQuickSystemPalette" + prototype: "QObject" + exports: ["QtQuick/SystemPalette 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "ColorGroup" + values: { + "Active": 0, + "Inactive": 2, + "Disabled": 1 + } + } + Property { name: "colorGroup"; type: "QQuickSystemPalette::ColorGroup" } + Property { name: "window"; type: "QColor"; isReadonly: true } + Property { name: "windowText"; type: "QColor"; isReadonly: true } + Property { name: "base"; type: "QColor"; isReadonly: true } + Property { name: "text"; type: "QColor"; isReadonly: true } + Property { name: "alternateBase"; type: "QColor"; isReadonly: true } + Property { name: "button"; type: "QColor"; isReadonly: true } + Property { name: "buttonText"; type: "QColor"; isReadonly: true } + Property { name: "light"; type: "QColor"; isReadonly: true } + Property { name: "midlight"; type: "QColor"; isReadonly: true } + Property { name: "dark"; type: "QColor"; isReadonly: true } + Property { name: "mid"; type: "QColor"; isReadonly: true } + Property { name: "shadow"; type: "QColor"; isReadonly: true } + Property { name: "highlight"; type: "QColor"; isReadonly: true } + Property { name: "highlightedText"; type: "QColor"; isReadonly: true } + Signal { name: "paletteChanged" } + } + Component { + name: "QQuickText" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + exports: ["QtQuick/Text 2.0", "QtQuick/Text 2.2"] + exportMetaObjectRevisions: [0, 2] + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4, + "AlignJustify": 8 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Enum { + name: "TextStyle" + values: { + "Normal": 0, + "Outline": 1, + "Raised": 2, + "Sunken": 3 + } + } + Enum { + name: "TextFormat" + values: { + "PlainText": 0, + "RichText": 1, + "AutoText": 2, + "StyledText": 4 + } + } + Enum { + name: "TextElideMode" + values: { + "ElideLeft": 0, + "ElideRight": 1, + "ElideMiddle": 2, + "ElideNone": 3 + } + } + Enum { + name: "WrapMode" + values: { + "NoWrap": 0, + "WordWrap": 1, + "WrapAnywhere": 3, + "WrapAtWordBoundaryOrAnywhere": 4, + "Wrap": 4 + } + } + Enum { + name: "RenderType" + values: { + "QtRendering": 0, + "NativeRendering": 1 + } + } + Enum { + name: "LineHeightMode" + values: { + "ProportionalHeight": 0, + "FixedHeight": 1 + } + } + Enum { + name: "FontSizeMode" + values: { + "FixedSize": 0, + "HorizontalFit": 1, + "VerticalFit": 2, + "Fit": 3 + } + } + Property { name: "text"; type: "string" } + Property { name: "font"; type: "QFont" } + Property { name: "color"; type: "QColor" } + Property { name: "linkColor"; type: "QColor" } + Property { name: "style"; type: "TextStyle" } + Property { name: "styleColor"; type: "QColor" } + Property { name: "horizontalAlignment"; type: "HAlignment" } + Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true } + Property { name: "verticalAlignment"; type: "VAlignment" } + Property { name: "wrapMode"; type: "WrapMode" } + Property { name: "lineCount"; type: "int"; isReadonly: true } + Property { name: "truncated"; type: "bool"; isReadonly: true } + Property { name: "maximumLineCount"; type: "int" } + Property { name: "textFormat"; type: "TextFormat" } + Property { name: "elide"; type: "TextElideMode" } + Property { name: "contentWidth"; type: "double"; isReadonly: true } + Property { name: "contentHeight"; type: "double"; isReadonly: true } + Property { name: "paintedWidth"; type: "double"; isReadonly: true } + Property { name: "paintedHeight"; type: "double"; isReadonly: true } + Property { name: "lineHeight"; type: "double" } + Property { name: "lineHeightMode"; type: "LineHeightMode" } + Property { name: "baseUrl"; type: "QUrl" } + Property { name: "minimumPixelSize"; type: "int" } + Property { name: "minimumPointSize"; type: "int" } + Property { name: "fontSizeMode"; type: "FontSizeMode" } + Property { name: "renderType"; type: "RenderType" } + Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true } + Signal { + name: "textChanged" + Parameter { name: "text"; type: "string" } + } + Signal { + name: "linkActivated" + Parameter { name: "link"; type: "string" } + } + Signal { + name: "linkHovered" + revision: 2 + Parameter { name: "link"; type: "string" } + } + Signal { + name: "fontChanged" + Parameter { name: "font"; type: "QFont" } + } + Signal { + name: "styleChanged" + Parameter { name: "style"; type: "TextStyle" } + } + Signal { + name: "horizontalAlignmentChanged" + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + Parameter { name: "alignment"; type: "VAlignment" } + } + Signal { + name: "textFormatChanged" + Parameter { name: "textFormat"; type: "TextFormat" } + } + Signal { + name: "elideModeChanged" + Parameter { name: "mode"; type: "TextElideMode" } + } + Signal { name: "contentSizeChanged" } + Signal { + name: "lineHeightChanged" + Parameter { name: "lineHeight"; type: "double" } + } + Signal { + name: "lineHeightModeChanged" + Parameter { name: "mode"; type: "LineHeightMode" } + } + Signal { + name: "lineLaidOut" + Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true } + } + Method { name: "doLayout" } + } + Component { name: "QQuickTextDocument"; prototype: "QObject" } + Component { + name: "QQuickTextEdit" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + exports: [ + "QtQuick/TextEdit 2.0", + "QtQuick/TextEdit 2.1", + "QtQuick/TextEdit 2.2" + ] + exportMetaObjectRevisions: [0, 1, 2] + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4, + "AlignJustify": 8 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Enum { + name: "TextFormat" + values: { + "PlainText": 0, + "RichText": 1, + "AutoText": 2 + } + } + Enum { + name: "WrapMode" + values: { + "NoWrap": 0, + "WordWrap": 1, + "WrapAnywhere": 3, + "WrapAtWordBoundaryOrAnywhere": 4, + "Wrap": 4 + } + } + Enum { + name: "SelectionMode" + values: { + "SelectCharacters": 0, + "SelectWords": 1 + } + } + Enum { + name: "RenderType" + values: { + "QtRendering": 0, + "NativeRendering": 1 + } + } + Property { name: "text"; type: "string" } + Property { name: "color"; type: "QColor" } + Property { name: "selectionColor"; type: "QColor" } + Property { name: "selectedTextColor"; type: "QColor" } + Property { name: "font"; type: "QFont" } + Property { name: "horizontalAlignment"; type: "HAlignment" } + Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true } + Property { name: "verticalAlignment"; type: "VAlignment" } + Property { name: "wrapMode"; type: "WrapMode" } + Property { name: "lineCount"; type: "int"; isReadonly: true } + Property { name: "length"; type: "int"; isReadonly: true } + Property { name: "contentWidth"; type: "double"; isReadonly: true } + Property { name: "contentHeight"; type: "double"; isReadonly: true } + Property { name: "paintedWidth"; type: "double"; isReadonly: true } + Property { name: "paintedHeight"; type: "double"; isReadonly: true } + Property { name: "textFormat"; type: "TextFormat" } + Property { name: "readOnly"; type: "bool" } + Property { name: "cursorVisible"; type: "bool" } + Property { name: "cursorPosition"; type: "int" } + Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true } + Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "selectionStart"; type: "int"; isReadonly: true } + Property { name: "selectionEnd"; type: "int"; isReadonly: true } + Property { name: "selectedText"; type: "string"; isReadonly: true } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "persistentSelection"; type: "bool" } + Property { name: "textMargin"; type: "double" } + Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" } + Property { name: "selectByKeyboard"; revision: 1; type: "bool" } + Property { name: "selectByMouse"; type: "bool" } + Property { name: "mouseSelectionMode"; type: "SelectionMode" } + Property { name: "canPaste"; type: "bool"; isReadonly: true } + Property { name: "canUndo"; type: "bool"; isReadonly: true } + Property { name: "canRedo"; type: "bool"; isReadonly: true } + Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true } + Property { name: "baseUrl"; type: "QUrl" } + Property { name: "renderType"; type: "RenderType" } + Property { + name: "textDocument" + revision: 1 + type: "QQuickTextDocument" + isReadonly: true + isPointer: true + } + Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true } + Signal { name: "contentSizeChanged" } + Signal { + name: "colorChanged" + Parameter { name: "color"; type: "QColor" } + } + Signal { + name: "selectionColorChanged" + Parameter { name: "color"; type: "QColor" } + } + Signal { + name: "selectedTextColorChanged" + Parameter { name: "color"; type: "QColor" } + } + Signal { + name: "fontChanged" + Parameter { name: "font"; type: "QFont" } + } + Signal { + name: "horizontalAlignmentChanged" + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + Parameter { name: "alignment"; type: "VAlignment" } + } + Signal { + name: "textFormatChanged" + Parameter { name: "textFormat"; type: "TextFormat" } + } + Signal { + name: "readOnlyChanged" + Parameter { name: "isReadOnly"; type: "bool" } + } + Signal { + name: "cursorVisibleChanged" + Parameter { name: "isCursorVisible"; type: "bool" } + } + Signal { + name: "activeFocusOnPressChanged" + Parameter { name: "activeFocusOnPressed"; type: "bool" } + } + Signal { + name: "persistentSelectionChanged" + Parameter { name: "isPersistentSelection"; type: "bool" } + } + Signal { + name: "textMarginChanged" + Parameter { name: "textMargin"; type: "double" } + } + Signal { + name: "selectByKeyboardChanged" + revision: 1 + Parameter { name: "selectByKeyboard"; type: "bool" } + } + Signal { + name: "selectByMouseChanged" + Parameter { name: "selectByMouse"; type: "bool" } + } + Signal { + name: "mouseSelectionModeChanged" + Parameter { name: "mode"; type: "SelectionMode" } + } + Signal { + name: "linkActivated" + Parameter { name: "link"; type: "string" } + } + Signal { + name: "linkHovered" + revision: 2 + Parameter { name: "link"; type: "string" } + } + Method { name: "selectAll" } + Method { name: "selectWord" } + Method { + name: "select" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { name: "deselect" } + Method { + name: "isRightToLeft" + type: "bool" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { name: "cut" } + Method { name: "copy" } + Method { name: "paste" } + Method { name: "undo" } + Method { name: "redo" } + Method { + name: "insert" + Parameter { name: "position"; type: "int" } + Parameter { name: "text"; type: "string" } + } + Method { + name: "remove" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { + name: "append" + revision: 2 + Parameter { name: "text"; type: "string" } + } + Method { + name: "positionToRectangle" + type: "QRectF" + Parameter { type: "int" } + } + Method { + name: "positionAt" + type: "int" + Parameter { name: "x"; type: "double" } + Parameter { name: "y"; type: "double" } + } + Method { + name: "moveCursorSelection" + Parameter { name: "pos"; type: "int" } + } + Method { + name: "moveCursorSelection" + Parameter { name: "pos"; type: "int" } + Parameter { name: "mode"; type: "SelectionMode" } + } + Method { + name: "getText" + type: "string" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { + name: "getFormattedText" + type: "string" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + } + Component { + name: "QQuickTextInput" + defaultProperty: "data" + prototype: "QQuickImplicitSizeItem" + exports: ["QtQuick/TextInput 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "EchoMode" + values: { + "Normal": 0, + "NoEcho": 1, + "Password": 2, + "PasswordEchoOnEdit": 3 + } + } + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } + Enum { + name: "WrapMode" + values: { + "NoWrap": 0, + "WordWrap": 1, + "WrapAnywhere": 3, + "WrapAtWordBoundaryOrAnywhere": 4, + "Wrap": 4 + } + } + Enum { + name: "SelectionMode" + values: { + "SelectCharacters": 0, + "SelectWords": 1 + } + } + Enum { + name: "CursorPosition" + values: { + "CursorBetweenCharacters": 0, + "CursorOnCharacter": 1 + } + } + Enum { + name: "RenderType" + values: { + "QtRendering": 0, + "NativeRendering": 1 + } + } + Property { name: "text"; type: "string" } + Property { name: "length"; type: "int"; isReadonly: true } + Property { name: "color"; type: "QColor" } + Property { name: "selectionColor"; type: "QColor" } + Property { name: "selectedTextColor"; type: "QColor" } + Property { name: "font"; type: "QFont" } + Property { name: "horizontalAlignment"; type: "HAlignment" } + Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true } + Property { name: "verticalAlignment"; type: "VAlignment" } + Property { name: "wrapMode"; type: "WrapMode" } + Property { name: "readOnly"; type: "bool" } + Property { name: "cursorVisible"; type: "bool" } + Property { name: "cursorPosition"; type: "int" } + Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true } + Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "selectionStart"; type: "int"; isReadonly: true } + Property { name: "selectionEnd"; type: "int"; isReadonly: true } + Property { name: "selectedText"; type: "string"; isReadonly: true } + Property { name: "maximumLength"; type: "int" } + Property { name: "validator"; type: "QValidator"; isPointer: true } + Property { name: "inputMask"; type: "string" } + Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" } + Property { name: "acceptableInput"; type: "bool"; isReadonly: true } + Property { name: "echoMode"; type: "EchoMode" } + Property { name: "activeFocusOnPress"; type: "bool" } + Property { name: "passwordCharacter"; type: "string" } + Property { name: "displayText"; type: "string"; isReadonly: true } + Property { name: "autoScroll"; type: "bool" } + Property { name: "selectByMouse"; type: "bool" } + Property { name: "mouseSelectionMode"; type: "SelectionMode" } + Property { name: "persistentSelection"; type: "bool" } + Property { name: "canPaste"; type: "bool"; isReadonly: true } + Property { name: "canUndo"; type: "bool"; isReadonly: true } + Property { name: "canRedo"; type: "bool"; isReadonly: true } + Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true } + Property { name: "contentWidth"; type: "double"; isReadonly: true } + Property { name: "contentHeight"; type: "double"; isReadonly: true } + Property { name: "renderType"; type: "RenderType" } + Signal { name: "accepted" } + Signal { + name: "fontChanged" + Parameter { name: "font"; type: "QFont" } + } + Signal { + name: "horizontalAlignmentChanged" + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + Parameter { name: "alignment"; type: "VAlignment" } + } + Signal { + name: "readOnlyChanged" + Parameter { name: "isReadOnly"; type: "bool" } + } + Signal { + name: "cursorVisibleChanged" + Parameter { name: "isCursorVisible"; type: "bool" } + } + Signal { + name: "maximumLengthChanged" + Parameter { name: "maximumLength"; type: "int" } + } + Signal { + name: "inputMaskChanged" + Parameter { name: "inputMask"; type: "string" } + } + Signal { + name: "echoModeChanged" + Parameter { name: "echoMode"; type: "EchoMode" } + } + Signal { + name: "activeFocusOnPressChanged" + Parameter { name: "activeFocusOnPress"; type: "bool" } + } + Signal { + name: "autoScrollChanged" + Parameter { name: "autoScroll"; type: "bool" } + } + Signal { + name: "selectByMouseChanged" + Parameter { name: "selectByMouse"; type: "bool" } + } + Signal { + name: "mouseSelectionModeChanged" + Parameter { name: "mode"; type: "SelectionMode" } + } + Signal { name: "contentSizeChanged" } + Method { name: "selectAll" } + Method { name: "selectWord" } + Method { + name: "select" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { name: "deselect" } + Method { + name: "isRightToLeft" + type: "bool" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { name: "cut" } + Method { name: "copy" } + Method { name: "paste" } + Method { name: "undo" } + Method { name: "redo" } + Method { + name: "insert" + Parameter { name: "position"; type: "int" } + Parameter { name: "text"; type: "string" } + } + Method { + name: "remove" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + Method { + name: "positionAt" + Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true } + } + Method { + name: "positionToRectangle" + type: "QRectF" + Parameter { name: "pos"; type: "int" } + } + Method { + name: "moveCursorSelection" + Parameter { name: "pos"; type: "int" } + } + Method { + name: "moveCursorSelection" + Parameter { name: "pos"; type: "int" } + Parameter { name: "mode"; type: "SelectionMode" } + } + Method { + name: "getText" + type: "string" + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + } + } + Component { + name: "QQuickTouchPoint" + prototype: "QObject" + exports: ["QtQuick/TouchPoint 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "pointId"; type: "int"; isReadonly: true } + Property { name: "pressed"; type: "bool"; isReadonly: true } + Property { name: "x"; type: "double"; isReadonly: true } + Property { name: "y"; type: "double"; isReadonly: true } + Property { name: "pressure"; type: "double"; isReadonly: true } + Property { name: "velocity"; type: "QVector2D"; isReadonly: true } + Property { name: "area"; type: "QRectF"; isReadonly: true } + Property { name: "startX"; type: "double"; isReadonly: true } + Property { name: "startY"; type: "double"; isReadonly: true } + Property { name: "previousX"; type: "double"; isReadonly: true } + Property { name: "previousY"; type: "double"; isReadonly: true } + Property { name: "sceneX"; type: "double"; isReadonly: true } + Property { name: "sceneY"; type: "double"; isReadonly: true } + } + Component { name: "QQuickTransform"; prototype: "QObject" } + Component { + name: "QQuickTransition" + defaultProperty: "animations" + prototype: "QObject" + exports: ["QtQuick/Transition 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "from"; type: "string" } + Property { name: "to"; type: "string" } + Property { name: "reversible"; type: "bool" } + Property { name: "running"; type: "bool"; isReadonly: true } + Property { name: "animations"; type: "QQuickAbstractAnimation"; isList: true; isReadonly: true } + Property { name: "enabled"; type: "bool" } + } + Component { + name: "QQuickTranslate" + prototype: "QQuickTransform" + exports: ["QtQuick/Translate 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "x"; type: "double" } + Property { name: "y"; type: "double" } + } + Component { + name: "QQuickUniformAnimator" + prototype: "QQuickAnimator" + exports: ["QtQuick/UniformAnimator 2.2"] + exportMetaObjectRevisions: [0] + Property { name: "uniform"; type: "string" } + Signal { + name: "uniformChanged" + Parameter { type: "string" } + } + } + Component { + name: "QQuickVector3dAnimation" + prototype: "QQuickPropertyAnimation" + exports: ["QtQuick/Vector3dAnimation 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "from"; type: "QVector3D" } + Property { name: "to"; type: "QVector3D" } + } + Component { + name: "QQuickViewSection" + prototype: "QObject" + exports: ["QtQuick/ViewSection 2.0"] + exportMetaObjectRevisions: [0] + Enum { + name: "SectionCriteria" + values: { + "FullString": 0, + "FirstCharacter": 1 + } + } + Enum { + name: "LabelPositioning" + values: { + "InlineLabels": 1, + "CurrentLabelAtStart": 2, + "NextLabelAtEnd": 4 + } + } + Property { name: "property"; type: "string" } + Property { name: "criteria"; type: "SectionCriteria" } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "labelPositioning"; type: "int" } + Signal { name: "sectionsChanged" } + } + Component { + name: "QQuickViewTransitionAttached" + prototype: "QObject" + exports: ["QtQuick/ViewTransition 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "index"; type: "int"; isReadonly: true } + Property { name: "item"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "destination"; type: "QPointF"; isReadonly: true } + Property { name: "targetIndexes"; type: "QList"; isReadonly: true } + Property { name: "targetItems"; type: "QObject"; isList: true; isReadonly: true } + } + Component { + name: "QQuickWorkerScript" + prototype: "QObject" + exports: ["QtQuick/WorkerScript 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "source"; type: "QUrl" } + Signal { + name: "message" + Parameter { name: "messageObject"; type: "QQmlV4Handle" } + } + Method { + name: "sendMessage" + Parameter { type: "QQmlV4Function"; isPointer: true } + } + } + Component { + name: "QQuickXAnimator" + prototype: "QQuickAnimator" + exports: ["QtQuick/XAnimator 2.2"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQuickYAnimator" + prototype: "QQuickAnimator" + exports: ["QtQuick/YAnimator 2.2"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QRegExpValidator" + prototype: "QValidator" + exports: ["QtQuick/RegExpValidator 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "regExp"; type: "QRegExp" } + Signal { + name: "regExpChanged" + Parameter { name: "regExp"; type: "QRegExp" } + } + } + Component { + name: "QValidator" + prototype: "QObject" + Signal { name: "changed" } + } + Component { + name: "Qt" + Enum { + name: "GlobalColor" + values: { + "color0": 0, + "color1": 1, + "black": 2, + "white": 3, + "darkGray": 4, + "gray": 5, + "lightGray": 6, + "red": 7, + "green": 8, + "blue": 9, + "cyan": 10, + "magenta": 11, + "yellow": 12, + "darkRed": 13, + "darkGreen": 14, + "darkBlue": 15, + "darkCyan": 16, + "darkMagenta": 17, + "darkYellow": 18, + "transparent": 19 + } + } + Enum { + name: "KeyboardModifiers" + values: { + "NoModifier": 0, + "ShiftModifier": 33554432, + "ControlModifier": 67108864, + "AltModifier": 134217728, + "MetaModifier": 268435456, + "KeypadModifier": 536870912, + "GroupSwitchModifier": 1073741824, + "KeyboardModifierMask": -33554432 + } + } + Enum { + name: "MouseButtons" + values: { + "NoButton": 0, + "LeftButton": 1, + "RightButton": 2, + "MidButton": 4, + "MiddleButton": 4, + "BackButton": 8, + "XButton1": 8, + "ExtraButton1": 8, + "ForwardButton": 16, + "XButton2": 16, + "ExtraButton2": 16, + "TaskButton": 32, + "ExtraButton3": 32, + "ExtraButton4": 64, + "ExtraButton5": 128, + "ExtraButton6": 256, + "ExtraButton7": 512, + "ExtraButton8": 1024, + "ExtraButton9": 2048, + "ExtraButton10": 4096, + "ExtraButton11": 8192, + "ExtraButton12": 16384, + "ExtraButton13": 32768, + "ExtraButton14": 65536, + "ExtraButton15": 131072, + "ExtraButton16": 262144, + "ExtraButton17": 524288, + "ExtraButton18": 1048576, + "ExtraButton19": 2097152, + "ExtraButton20": 4194304, + "ExtraButton21": 8388608, + "ExtraButton22": 16777216, + "ExtraButton23": 33554432, + "ExtraButton24": 67108864, + "AllButtons": 134217727, + "MaxMouseButton": 67108864, + "MouseButtonMask": -1 + } + } + Enum { + name: "Orientation" + values: { + "Horizontal": 1, + "Vertical": 2 + } + } + Enum { + name: "Orientations" + values: { + "Horizontal": 1, + "Vertical": 2 + } + } + Enum { + name: "FocusPolicy" + values: { + "NoFocus": 0, + "TabFocus": 1, + "ClickFocus": 2, + "StrongFocus": 11, + "WheelFocus": 15 + } + } + Enum { + name: "SortOrder" + values: { + "AscendingOrder": 0, + "DescendingOrder": 1 + } + } + Enum { + name: "Alignment" + values: { + "AlignLeft": 1, + "AlignLeading": 1, + "AlignRight": 2, + "AlignTrailing": 2, + "AlignHCenter": 4, + "AlignJustify": 8, + "AlignAbsolute": 16, + "AlignHorizontal_Mask": 31, + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128, + "AlignBaseline": 256, + "AlignVertical_Mask": 480, + "AlignCenter": 132 + } + } + Enum { + name: "TextElideMode" + values: { + "ElideLeft": 0, + "ElideRight": 1, + "ElideMiddle": 2, + "ElideNone": 3 + } + } + Enum { + name: "WindowType" + values: { + "Widget": 0, + "Window": 1, + "Dialog": 3, + "Sheet": 5, + "Drawer": 7, + "Popup": 9, + "Tool": 11, + "ToolTip": 13, + "SplashScreen": 15, + "Desktop": 17, + "SubWindow": 18, + "ForeignWindow": 33, + "CoverWindow": 65, + "WindowType_Mask": 255, + "MSWindowsFixedSizeDialogHint": 256, + "MSWindowsOwnDC": 512, + "BypassWindowManagerHint": 1024, + "X11BypassWindowManagerHint": 1024, + "FramelessWindowHint": 2048, + "WindowTitleHint": 4096, + "WindowSystemMenuHint": 8192, + "WindowMinimizeButtonHint": 16384, + "WindowMaximizeButtonHint": 32768, + "WindowMinMaxButtonsHint": 49152, + "WindowContextHelpButtonHint": 65536, + "WindowShadeButtonHint": 131072, + "WindowStaysOnTopHint": 262144, + "WindowTransparentForInput": 524288, + "WindowOverridesSystemGestures": 1048576, + "WindowDoesNotAcceptFocus": 2097152, + "CustomizeWindowHint": 33554432, + "WindowStaysOnBottomHint": 67108864, + "WindowCloseButtonHint": 134217728, + "MacWindowToolBarButtonHint": 268435456, + "BypassGraphicsProxyWidget": 536870912, + "WindowOkButtonHint": 524288, + "WindowCancelButtonHint": 1048576, + "NoDropShadowWindowHint": 1073741824, + "WindowFullscreenButtonHint": -2147483648 + } + } + Enum { + name: "WindowFlags" + values: { + "Widget": 0, + "Window": 1, + "Dialog": 3, + "Sheet": 5, + "Drawer": 7, + "Popup": 9, + "Tool": 11, + "ToolTip": 13, + "SplashScreen": 15, + "Desktop": 17, + "SubWindow": 18, + "ForeignWindow": 33, + "CoverWindow": 65, + "WindowType_Mask": 255, + "MSWindowsFixedSizeDialogHint": 256, + "MSWindowsOwnDC": 512, + "BypassWindowManagerHint": 1024, + "X11BypassWindowManagerHint": 1024, + "FramelessWindowHint": 2048, + "WindowTitleHint": 4096, + "WindowSystemMenuHint": 8192, + "WindowMinimizeButtonHint": 16384, + "WindowMaximizeButtonHint": 32768, + "WindowMinMaxButtonsHint": 49152, + "WindowContextHelpButtonHint": 65536, + "WindowShadeButtonHint": 131072, + "WindowStaysOnTopHint": 262144, + "WindowTransparentForInput": 524288, + "WindowOverridesSystemGestures": 1048576, + "WindowDoesNotAcceptFocus": 2097152, + "CustomizeWindowHint": 33554432, + "WindowStaysOnBottomHint": 67108864, + "WindowCloseButtonHint": 134217728, + "MacWindowToolBarButtonHint": 268435456, + "BypassGraphicsProxyWidget": 536870912, + "WindowOkButtonHint": 524288, + "WindowCancelButtonHint": 1048576, + "NoDropShadowWindowHint": 1073741824, + "WindowFullscreenButtonHint": -2147483648 + } + } + Enum { + name: "WindowState" + values: { + "WindowNoState": 0, + "WindowMinimized": 1, + "WindowMaximized": 2, + "WindowFullScreen": 4, + "WindowActive": 8 + } + } + Enum { + name: "WindowStates" + values: { + "WindowNoState": 0, + "WindowMinimized": 1, + "WindowMaximized": 2, + "WindowFullScreen": 4, + "WindowActive": 8 + } + } + Enum { + name: "ApplicationState" + values: { + "ApplicationSuspended": 0, + "ApplicationHidden": 1, + "ApplicationInactive": 2, + "ApplicationActive": 4 + } + } + Enum { + name: "ScreenOrientation" + values: { + "PrimaryOrientation": 0, + "PortraitOrientation": 1, + "LandscapeOrientation": 2, + "InvertedPortraitOrientation": 4, + "InvertedLandscapeOrientation": 8 + } + } + Enum { + name: "ScreenOrientations" + values: { + "PrimaryOrientation": 0, + "PortraitOrientation": 1, + "LandscapeOrientation": 2, + "InvertedPortraitOrientation": 4, + "InvertedLandscapeOrientation": 8 + } + } + Enum { + name: "WidgetAttribute" + values: { + "WA_Disabled": 0, + "WA_UnderMouse": 1, + "WA_MouseTracking": 2, + "WA_ContentsPropagated": 3, + "WA_OpaquePaintEvent": 4, + "WA_NoBackground": 4, + "WA_StaticContents": 5, + "WA_LaidOut": 7, + "WA_PaintOnScreen": 8, + "WA_NoSystemBackground": 9, + "WA_UpdatesDisabled": 10, + "WA_Mapped": 11, + "WA_MacNoClickThrough": 12, + "WA_InputMethodEnabled": 14, + "WA_WState_Visible": 15, + "WA_WState_Hidden": 16, + "WA_ForceDisabled": 32, + "WA_KeyCompression": 33, + "WA_PendingMoveEvent": 34, + "WA_PendingResizeEvent": 35, + "WA_SetPalette": 36, + "WA_SetFont": 37, + "WA_SetCursor": 38, + "WA_NoChildEventsFromChildren": 39, + "WA_WindowModified": 41, + "WA_Resized": 42, + "WA_Moved": 43, + "WA_PendingUpdate": 44, + "WA_InvalidSize": 45, + "WA_MacBrushedMetal": 46, + "WA_MacMetalStyle": 46, + "WA_CustomWhatsThis": 47, + "WA_LayoutOnEntireRect": 48, + "WA_OutsideWSRange": 49, + "WA_GrabbedShortcut": 50, + "WA_TransparentForMouseEvents": 51, + "WA_PaintUnclipped": 52, + "WA_SetWindowIcon": 53, + "WA_NoMouseReplay": 54, + "WA_DeleteOnClose": 55, + "WA_RightToLeft": 56, + "WA_SetLayoutDirection": 57, + "WA_NoChildEventsForParent": 58, + "WA_ForceUpdatesDisabled": 59, + "WA_WState_Created": 60, + "WA_WState_CompressKeys": 61, + "WA_WState_InPaintEvent": 62, + "WA_WState_Reparented": 63, + "WA_WState_ConfigPending": 64, + "WA_WState_Polished": 66, + "WA_WState_DND": 67, + "WA_WState_OwnSizePolicy": 68, + "WA_WState_ExplicitShowHide": 69, + "WA_ShowModal": 70, + "WA_MouseNoMask": 71, + "WA_GroupLeader": 72, + "WA_NoMousePropagation": 73, + "WA_Hover": 74, + "WA_InputMethodTransparent": 75, + "WA_QuitOnClose": 76, + "WA_KeyboardFocusChange": 77, + "WA_AcceptDrops": 78, + "WA_DropSiteRegistered": 79, + "WA_ForceAcceptDrops": 79, + "WA_WindowPropagation": 80, + "WA_NoX11EventCompression": 81, + "WA_TintedBackground": 82, + "WA_X11OpenGLOverlay": 83, + "WA_AlwaysShowToolTips": 84, + "WA_MacOpaqueSizeGrip": 85, + "WA_SetStyle": 86, + "WA_SetLocale": 87, + "WA_MacShowFocusRect": 88, + "WA_MacNormalSize": 89, + "WA_MacSmallSize": 90, + "WA_MacMiniSize": 91, + "WA_LayoutUsesWidgetRect": 92, + "WA_StyledBackground": 93, + "WA_MSWindowsUseDirect3D": 94, + "WA_CanHostQMdiSubWindowTitleBar": 95, + "WA_MacAlwaysShowToolWindow": 96, + "WA_StyleSheet": 97, + "WA_ShowWithoutActivating": 98, + "WA_X11BypassTransientForHint": 99, + "WA_NativeWindow": 100, + "WA_DontCreateNativeAncestors": 101, + "WA_MacVariableSize": 102, + "WA_DontShowOnScreen": 103, + "WA_X11NetWmWindowTypeDesktop": 104, + "WA_X11NetWmWindowTypeDock": 105, + "WA_X11NetWmWindowTypeToolBar": 106, + "WA_X11NetWmWindowTypeMenu": 107, + "WA_X11NetWmWindowTypeUtility": 108, + "WA_X11NetWmWindowTypeSplash": 109, + "WA_X11NetWmWindowTypeDialog": 110, + "WA_X11NetWmWindowTypeDropDownMenu": 111, + "WA_X11NetWmWindowTypePopupMenu": 112, + "WA_X11NetWmWindowTypeToolTip": 113, + "WA_X11NetWmWindowTypeNotification": 114, + "WA_X11NetWmWindowTypeCombo": 115, + "WA_X11NetWmWindowTypeDND": 116, + "WA_MacFrameworkScaled": 117, + "WA_SetWindowModality": 118, + "WA_WState_WindowOpacitySet": 119, + "WA_TranslucentBackground": 120, + "WA_AcceptTouchEvents": 121, + "WA_WState_AcceptedTouchBeginEvent": 122, + "WA_TouchPadAcceptSingleTouchEvents": 123, + "WA_X11DoNotAcceptFocus": 126, + "WA_MacNoShadow": 127, + "WA_AttributeCount": 128 + } + } + Enum { + name: "ApplicationAttribute" + values: { + "AA_ImmediateWidgetCreation": 0, + "AA_MSWindowsUseDirect3DByDefault": 1, + "AA_DontShowIconsInMenus": 2, + "AA_NativeWindows": 3, + "AA_DontCreateNativeWidgetSiblings": 4, + "AA_MacPluginApplication": 5, + "AA_DontUseNativeMenuBar": 6, + "AA_MacDontSwapCtrlAndMeta": 7, + "AA_Use96Dpi": 8, + "AA_X11InitThreads": 10, + "AA_SynthesizeTouchForUnhandledMouseEvents": 11, + "AA_SynthesizeMouseForUnhandledTouchEvents": 12, + "AA_UseHighDpiPixmaps": 13, + "AA_AttributeCount": 14 + } + } + Enum { + name: "ImageConversionFlags" + values: { + "ColorMode_Mask": 3, + "AutoColor": 0, + "ColorOnly": 3, + "MonoOnly": 2, + "AlphaDither_Mask": 12, + "ThresholdAlphaDither": 0, + "OrderedAlphaDither": 4, + "DiffuseAlphaDither": 8, + "NoAlpha": 12, + "Dither_Mask": 48, + "DiffuseDither": 0, + "OrderedDither": 16, + "ThresholdDither": 32, + "DitherMode_Mask": 192, + "AutoDither": 0, + "PreferDither": 64, + "AvoidDither": 128, + "NoOpaqueDetection": 256, + "NoFormatConversion": 512 + } + } + Enum { + name: "BGMode" + values: { + "TransparentMode": 0, + "OpaqueMode": 1 + } + } + Enum { + name: "Key" + values: { + "Key_Escape": 16777216, + "Key_Tab": 16777217, + "Key_Backtab": 16777218, + "Key_Backspace": 16777219, + "Key_Return": 16777220, + "Key_Enter": 16777221, + "Key_Insert": 16777222, + "Key_Delete": 16777223, + "Key_Pause": 16777224, + "Key_Print": 16777225, + "Key_SysReq": 16777226, + "Key_Clear": 16777227, + "Key_Home": 16777232, + "Key_End": 16777233, + "Key_Left": 16777234, + "Key_Up": 16777235, + "Key_Right": 16777236, + "Key_Down": 16777237, + "Key_PageUp": 16777238, + "Key_PageDown": 16777239, + "Key_Shift": 16777248, + "Key_Control": 16777249, + "Key_Meta": 16777250, + "Key_Alt": 16777251, + "Key_CapsLock": 16777252, + "Key_NumLock": 16777253, + "Key_ScrollLock": 16777254, + "Key_F1": 16777264, + "Key_F2": 16777265, + "Key_F3": 16777266, + "Key_F4": 16777267, + "Key_F5": 16777268, + "Key_F6": 16777269, + "Key_F7": 16777270, + "Key_F8": 16777271, + "Key_F9": 16777272, + "Key_F10": 16777273, + "Key_F11": 16777274, + "Key_F12": 16777275, + "Key_F13": 16777276, + "Key_F14": 16777277, + "Key_F15": 16777278, + "Key_F16": 16777279, + "Key_F17": 16777280, + "Key_F18": 16777281, + "Key_F19": 16777282, + "Key_F20": 16777283, + "Key_F21": 16777284, + "Key_F22": 16777285, + "Key_F23": 16777286, + "Key_F24": 16777287, + "Key_F25": 16777288, + "Key_F26": 16777289, + "Key_F27": 16777290, + "Key_F28": 16777291, + "Key_F29": 16777292, + "Key_F30": 16777293, + "Key_F31": 16777294, + "Key_F32": 16777295, + "Key_F33": 16777296, + "Key_F34": 16777297, + "Key_F35": 16777298, + "Key_Super_L": 16777299, + "Key_Super_R": 16777300, + "Key_Menu": 16777301, + "Key_Hyper_L": 16777302, + "Key_Hyper_R": 16777303, + "Key_Help": 16777304, + "Key_Direction_L": 16777305, + "Key_Direction_R": 16777312, + "Key_Space": 32, + "Key_Any": 32, + "Key_Exclam": 33, + "Key_QuoteDbl": 34, + "Key_NumberSign": 35, + "Key_Dollar": 36, + "Key_Percent": 37, + "Key_Ampersand": 38, + "Key_Apostrophe": 39, + "Key_ParenLeft": 40, + "Key_ParenRight": 41, + "Key_Asterisk": 42, + "Key_Plus": 43, + "Key_Comma": 44, + "Key_Minus": 45, + "Key_Period": 46, + "Key_Slash": 47, + "Key_0": 48, + "Key_1": 49, + "Key_2": 50, + "Key_3": 51, + "Key_4": 52, + "Key_5": 53, + "Key_6": 54, + "Key_7": 55, + "Key_8": 56, + "Key_9": 57, + "Key_Colon": 58, + "Key_Semicolon": 59, + "Key_Less": 60, + "Key_Equal": 61, + "Key_Greater": 62, + "Key_Question": 63, + "Key_At": 64, + "Key_A": 65, + "Key_B": 66, + "Key_C": 67, + "Key_D": 68, + "Key_E": 69, + "Key_F": 70, + "Key_G": 71, + "Key_H": 72, + "Key_I": 73, + "Key_J": 74, + "Key_K": 75, + "Key_L": 76, + "Key_M": 77, + "Key_N": 78, + "Key_O": 79, + "Key_P": 80, + "Key_Q": 81, + "Key_R": 82, + "Key_S": 83, + "Key_T": 84, + "Key_U": 85, + "Key_V": 86, + "Key_W": 87, + "Key_X": 88, + "Key_Y": 89, + "Key_Z": 90, + "Key_BracketLeft": 91, + "Key_Backslash": 92, + "Key_BracketRight": 93, + "Key_AsciiCircum": 94, + "Key_Underscore": 95, + "Key_QuoteLeft": 96, + "Key_BraceLeft": 123, + "Key_Bar": 124, + "Key_BraceRight": 125, + "Key_AsciiTilde": 126, + "Key_nobreakspace": 160, + "Key_exclamdown": 161, + "Key_cent": 162, + "Key_sterling": 163, + "Key_currency": 164, + "Key_yen": 165, + "Key_brokenbar": 166, + "Key_section": 167, + "Key_diaeresis": 168, + "Key_copyright": 169, + "Key_ordfeminine": 170, + "Key_guillemotleft": 171, + "Key_notsign": 172, + "Key_hyphen": 173, + "Key_registered": 174, + "Key_macron": 175, + "Key_degree": 176, + "Key_plusminus": 177, + "Key_twosuperior": 178, + "Key_threesuperior": 179, + "Key_acute": 180, + "Key_mu": 181, + "Key_paragraph": 182, + "Key_periodcentered": 183, + "Key_cedilla": 184, + "Key_onesuperior": 185, + "Key_masculine": 186, + "Key_guillemotright": 187, + "Key_onequarter": 188, + "Key_onehalf": 189, + "Key_threequarters": 190, + "Key_questiondown": 191, + "Key_Agrave": 192, + "Key_Aacute": 193, + "Key_Acircumflex": 194, + "Key_Atilde": 195, + "Key_Adiaeresis": 196, + "Key_Aring": 197, + "Key_AE": 198, + "Key_Ccedilla": 199, + "Key_Egrave": 200, + "Key_Eacute": 201, + "Key_Ecircumflex": 202, + "Key_Ediaeresis": 203, + "Key_Igrave": 204, + "Key_Iacute": 205, + "Key_Icircumflex": 206, + "Key_Idiaeresis": 207, + "Key_ETH": 208, + "Key_Ntilde": 209, + "Key_Ograve": 210, + "Key_Oacute": 211, + "Key_Ocircumflex": 212, + "Key_Otilde": 213, + "Key_Odiaeresis": 214, + "Key_multiply": 215, + "Key_Ooblique": 216, + "Key_Ugrave": 217, + "Key_Uacute": 218, + "Key_Ucircumflex": 219, + "Key_Udiaeresis": 220, + "Key_Yacute": 221, + "Key_THORN": 222, + "Key_ssharp": 223, + "Key_division": 247, + "Key_ydiaeresis": 255, + "Key_AltGr": 16781571, + "Key_Multi_key": 16781600, + "Key_Codeinput": 16781623, + "Key_SingleCandidate": 16781628, + "Key_MultipleCandidate": 16781629, + "Key_PreviousCandidate": 16781630, + "Key_Mode_switch": 16781694, + "Key_Kanji": 16781601, + "Key_Muhenkan": 16781602, + "Key_Henkan": 16781603, + "Key_Romaji": 16781604, + "Key_Hiragana": 16781605, + "Key_Katakana": 16781606, + "Key_Hiragana_Katakana": 16781607, + "Key_Zenkaku": 16781608, + "Key_Hankaku": 16781609, + "Key_Zenkaku_Hankaku": 16781610, + "Key_Touroku": 16781611, + "Key_Massyo": 16781612, + "Key_Kana_Lock": 16781613, + "Key_Kana_Shift": 16781614, + "Key_Eisu_Shift": 16781615, + "Key_Eisu_toggle": 16781616, + "Key_Hangul": 16781617, + "Key_Hangul_Start": 16781618, + "Key_Hangul_End": 16781619, + "Key_Hangul_Hanja": 16781620, + "Key_Hangul_Jamo": 16781621, + "Key_Hangul_Romaja": 16781622, + "Key_Hangul_Jeonja": 16781624, + "Key_Hangul_Banja": 16781625, + "Key_Hangul_PreHanja": 16781626, + "Key_Hangul_PostHanja": 16781627, + "Key_Hangul_Special": 16781631, + "Key_Dead_Grave": 16781904, + "Key_Dead_Acute": 16781905, + "Key_Dead_Circumflex": 16781906, + "Key_Dead_Tilde": 16781907, + "Key_Dead_Macron": 16781908, + "Key_Dead_Breve": 16781909, + "Key_Dead_Abovedot": 16781910, + "Key_Dead_Diaeresis": 16781911, + "Key_Dead_Abovering": 16781912, + "Key_Dead_Doubleacute": 16781913, + "Key_Dead_Caron": 16781914, + "Key_Dead_Cedilla": 16781915, + "Key_Dead_Ogonek": 16781916, + "Key_Dead_Iota": 16781917, + "Key_Dead_Voiced_Sound": 16781918, + "Key_Dead_Semivoiced_Sound": 16781919, + "Key_Dead_Belowdot": 16781920, + "Key_Dead_Hook": 16781921, + "Key_Dead_Horn": 16781922, + "Key_Back": 16777313, + "Key_Forward": 16777314, + "Key_Stop": 16777315, + "Key_Refresh": 16777316, + "Key_VolumeDown": 16777328, + "Key_VolumeMute": 16777329, + "Key_VolumeUp": 16777330, + "Key_BassBoost": 16777331, + "Key_BassUp": 16777332, + "Key_BassDown": 16777333, + "Key_TrebleUp": 16777334, + "Key_TrebleDown": 16777335, + "Key_MediaPlay": 16777344, + "Key_MediaStop": 16777345, + "Key_MediaPrevious": 16777346, + "Key_MediaNext": 16777347, + "Key_MediaRecord": 16777348, + "Key_MediaPause": 16777349, + "Key_MediaTogglePlayPause": 16777350, + "Key_HomePage": 16777360, + "Key_Favorites": 16777361, + "Key_Search": 16777362, + "Key_Standby": 16777363, + "Key_OpenUrl": 16777364, + "Key_LaunchMail": 16777376, + "Key_LaunchMedia": 16777377, + "Key_Launch0": 16777378, + "Key_Launch1": 16777379, + "Key_Launch2": 16777380, + "Key_Launch3": 16777381, + "Key_Launch4": 16777382, + "Key_Launch5": 16777383, + "Key_Launch6": 16777384, + "Key_Launch7": 16777385, + "Key_Launch8": 16777386, + "Key_Launch9": 16777387, + "Key_LaunchA": 16777388, + "Key_LaunchB": 16777389, + "Key_LaunchC": 16777390, + "Key_LaunchD": 16777391, + "Key_LaunchE": 16777392, + "Key_LaunchF": 16777393, + "Key_MonBrightnessUp": 16777394, + "Key_MonBrightnessDown": 16777395, + "Key_KeyboardLightOnOff": 16777396, + "Key_KeyboardBrightnessUp": 16777397, + "Key_KeyboardBrightnessDown": 16777398, + "Key_PowerOff": 16777399, + "Key_WakeUp": 16777400, + "Key_Eject": 16777401, + "Key_ScreenSaver": 16777402, + "Key_WWW": 16777403, + "Key_Memo": 16777404, + "Key_LightBulb": 16777405, + "Key_Shop": 16777406, + "Key_History": 16777407, + "Key_AddFavorite": 16777408, + "Key_HotLinks": 16777409, + "Key_BrightnessAdjust": 16777410, + "Key_Finance": 16777411, + "Key_Community": 16777412, + "Key_AudioRewind": 16777413, + "Key_BackForward": 16777414, + "Key_ApplicationLeft": 16777415, + "Key_ApplicationRight": 16777416, + "Key_Book": 16777417, + "Key_CD": 16777418, + "Key_Calculator": 16777419, + "Key_ToDoList": 16777420, + "Key_ClearGrab": 16777421, + "Key_Close": 16777422, + "Key_Copy": 16777423, + "Key_Cut": 16777424, + "Key_Display": 16777425, + "Key_DOS": 16777426, + "Key_Documents": 16777427, + "Key_Excel": 16777428, + "Key_Explorer": 16777429, + "Key_Game": 16777430, + "Key_Go": 16777431, + "Key_iTouch": 16777432, + "Key_LogOff": 16777433, + "Key_Market": 16777434, + "Key_Meeting": 16777435, + "Key_MenuKB": 16777436, + "Key_MenuPB": 16777437, + "Key_MySites": 16777438, + "Key_News": 16777439, + "Key_OfficeHome": 16777440, + "Key_Option": 16777441, + "Key_Paste": 16777442, + "Key_Phone": 16777443, + "Key_Calendar": 16777444, + "Key_Reply": 16777445, + "Key_Reload": 16777446, + "Key_RotateWindows": 16777447, + "Key_RotationPB": 16777448, + "Key_RotationKB": 16777449, + "Key_Save": 16777450, + "Key_Send": 16777451, + "Key_Spell": 16777452, + "Key_SplitScreen": 16777453, + "Key_Support": 16777454, + "Key_TaskPane": 16777455, + "Key_Terminal": 16777456, + "Key_Tools": 16777457, + "Key_Travel": 16777458, + "Key_Video": 16777459, + "Key_Word": 16777460, + "Key_Xfer": 16777461, + "Key_ZoomIn": 16777462, + "Key_ZoomOut": 16777463, + "Key_Away": 16777464, + "Key_Messenger": 16777465, + "Key_WebCam": 16777466, + "Key_MailForward": 16777467, + "Key_Pictures": 16777468, + "Key_Music": 16777469, + "Key_Battery": 16777470, + "Key_Bluetooth": 16777471, + "Key_WLAN": 16777472, + "Key_UWB": 16777473, + "Key_AudioForward": 16777474, + "Key_AudioRepeat": 16777475, + "Key_AudioRandomPlay": 16777476, + "Key_Subtitle": 16777477, + "Key_AudioCycleTrack": 16777478, + "Key_Time": 16777479, + "Key_Hibernate": 16777480, + "Key_View": 16777481, + "Key_TopMenu": 16777482, + "Key_PowerDown": 16777483, + "Key_Suspend": 16777484, + "Key_ContrastAdjust": 16777485, + "Key_LaunchG": 16777486, + "Key_LaunchH": 16777487, + "Key_TouchpadToggle": 16777488, + "Key_TouchpadOn": 16777489, + "Key_TouchpadOff": 16777490, + "Key_MicMute": 16777491, + "Key_Red": 16777492, + "Key_Green": 16777493, + "Key_Yellow": 16777494, + "Key_Blue": 16777495, + "Key_ChannelUp": 16777496, + "Key_ChannelDown": 16777497, + "Key_MediaLast": 16842751, + "Key_Select": 16842752, + "Key_Yes": 16842753, + "Key_No": 16842754, + "Key_Cancel": 16908289, + "Key_Printer": 16908290, + "Key_Execute": 16908291, + "Key_Sleep": 16908292, + "Key_Play": 16908293, + "Key_Zoom": 16908294, + "Key_Context1": 17825792, + "Key_Context2": 17825793, + "Key_Context3": 17825794, + "Key_Context4": 17825795, + "Key_Call": 17825796, + "Key_Hangup": 17825797, + "Key_Flip": 17825798, + "Key_ToggleCallHangup": 17825799, + "Key_VoiceDial": 17825800, + "Key_LastNumberRedial": 17825801, + "Key_Camera": 17825824, + "Key_CameraFocus": 17825825, + "Key_unknown": 33554431 + } + } + Enum { + name: "ArrowType" + values: { + "NoArrow": 0, + "UpArrow": 1, + "DownArrow": 2, + "LeftArrow": 3, + "RightArrow": 4 + } + } + Enum { + name: "PenStyle" + values: { + "NoPen": 0, + "SolidLine": 1, + "DashLine": 2, + "DotLine": 3, + "DashDotLine": 4, + "DashDotDotLine": 5, + "CustomDashLine": 6 + } + } + Enum { + name: "PenCapStyle" + values: { + "FlatCap": 0, + "SquareCap": 16, + "RoundCap": 32, + "MPenCapStyle": 48 + } + } + Enum { + name: "PenJoinStyle" + values: { + "MiterJoin": 0, + "BevelJoin": 64, + "RoundJoin": 128, + "SvgMiterJoin": 256, + "MPenJoinStyle": 448 + } + } + Enum { + name: "BrushStyle" + values: { + "NoBrush": 0, + "SolidPattern": 1, + "Dense1Pattern": 2, + "Dense2Pattern": 3, + "Dense3Pattern": 4, + "Dense4Pattern": 5, + "Dense5Pattern": 6, + "Dense6Pattern": 7, + "Dense7Pattern": 8, + "HorPattern": 9, + "VerPattern": 10, + "CrossPattern": 11, + "BDiagPattern": 12, + "FDiagPattern": 13, + "DiagCrossPattern": 14, + "LinearGradientPattern": 15, + "RadialGradientPattern": 16, + "ConicalGradientPattern": 17, + "TexturePattern": 24 + } + } + Enum { + name: "SizeMode" + values: { + "AbsoluteSize": 0, + "RelativeSize": 1 + } + } + Enum { + name: "CursorShape" + values: { + "ArrowCursor": 0, + "UpArrowCursor": 1, + "CrossCursor": 2, + "WaitCursor": 3, + "IBeamCursor": 4, + "SizeVerCursor": 5, + "SizeHorCursor": 6, + "SizeBDiagCursor": 7, + "SizeFDiagCursor": 8, + "SizeAllCursor": 9, + "BlankCursor": 10, + "SplitVCursor": 11, + "SplitHCursor": 12, + "PointingHandCursor": 13, + "ForbiddenCursor": 14, + "WhatsThisCursor": 15, + "BusyCursor": 16, + "OpenHandCursor": 17, + "ClosedHandCursor": 18, + "DragCopyCursor": 19, + "DragMoveCursor": 20, + "DragLinkCursor": 21, + "LastCursor": 21, + "BitmapCursor": 24, + "CustomCursor": 25 + } + } + Enum { + name: "TextFormat" + values: { + "PlainText": 0, + "RichText": 1, + "AutoText": 2 + } + } + Enum { + name: "AspectRatioMode" + values: { + "IgnoreAspectRatio": 0, + "KeepAspectRatio": 1, + "KeepAspectRatioByExpanding": 2 + } + } + Enum { + name: "DockWidgetArea" + values: { + "LeftDockWidgetArea": 1, + "RightDockWidgetArea": 2, + "TopDockWidgetArea": 4, + "BottomDockWidgetArea": 8, + "DockWidgetArea_Mask": 15, + "AllDockWidgetAreas": 15, + "NoDockWidgetArea": 0 + } + } + Enum { + name: "DockWidgetAreas" + values: { + "LeftDockWidgetArea": 1, + "RightDockWidgetArea": 2, + "TopDockWidgetArea": 4, + "BottomDockWidgetArea": 8, + "DockWidgetArea_Mask": 15, + "AllDockWidgetAreas": 15, + "NoDockWidgetArea": 0 + } + } + Enum { + name: "ToolBarArea" + values: { + "LeftToolBarArea": 1, + "RightToolBarArea": 2, + "TopToolBarArea": 4, + "BottomToolBarArea": 8, + "ToolBarArea_Mask": 15, + "AllToolBarAreas": 15, + "NoToolBarArea": 0 + } + } + Enum { + name: "ToolBarAreas" + values: { + "LeftToolBarArea": 1, + "RightToolBarArea": 2, + "TopToolBarArea": 4, + "BottomToolBarArea": 8, + "ToolBarArea_Mask": 15, + "AllToolBarAreas": 15, + "NoToolBarArea": 0 + } + } + Enum { + name: "DateFormat" + values: { + "TextDate": 0, + "ISODate": 1, + "SystemLocaleDate": 2, + "LocalDate": 2, + "LocaleDate": 3, + "SystemLocaleShortDate": 4, + "SystemLocaleLongDate": 5, + "DefaultLocaleShortDate": 6, + "DefaultLocaleLongDate": 7, + "RFC2822Date": 8 + } + } + Enum { + name: "TimeSpec" + values: { + "LocalTime": 0, + "UTC": 1, + "OffsetFromUTC": 2, + "TimeZone": 3 + } + } + Enum { + name: "DayOfWeek" + values: { + "Monday": 1, + "Tuesday": 2, + "Wednesday": 3, + "Thursday": 4, + "Friday": 5, + "Saturday": 6, + "Sunday": 7 + } + } + Enum { + name: "ScrollBarPolicy" + values: { + "ScrollBarAsNeeded": 0, + "ScrollBarAlwaysOff": 1, + "ScrollBarAlwaysOn": 2 + } + } + Enum { + name: "CaseSensitivity" + values: { + "CaseInsensitive": 0, + "CaseSensitive": 1 + } + } + Enum { + name: "Corner" + values: { + "TopLeftCorner": 0, + "TopRightCorner": 1, + "BottomLeftCorner": 2, + "BottomRightCorner": 3 + } + } + Enum { + name: "Edge" + values: { + "TopEdge": 1, + "LeftEdge": 2, + "RightEdge": 4, + "BottomEdge": 8 + } + } + Enum { + name: "ConnectionType" + values: { + "AutoConnection": 0, + "DirectConnection": 1, + "QueuedConnection": 2, + "BlockingQueuedConnection": 3, + "UniqueConnection": 128 + } + } + Enum { + name: "ShortcutContext" + values: { + "WidgetShortcut": 0, + "WindowShortcut": 1, + "ApplicationShortcut": 2, + "WidgetWithChildrenShortcut": 3 + } + } + Enum { + name: "FillRule" + values: { + "OddEvenFill": 0, + "WindingFill": 1 + } + } + Enum { + name: "MaskMode" + values: { + "MaskInColor": 0, + "MaskOutColor": 1 + } + } + Enum { + name: "ClipOperation" + values: { + "NoClip": 0, + "ReplaceClip": 1, + "IntersectClip": 2 + } + } + Enum { + name: "ItemSelectionMode" + values: { + "ContainsItemShape": 0, + "IntersectsItemShape": 1, + "ContainsItemBoundingRect": 2, + "IntersectsItemBoundingRect": 3 + } + } + Enum { + name: "TransformationMode" + values: { + "FastTransformation": 0, + "SmoothTransformation": 1 + } + } + Enum { + name: "Axis" + values: { + "XAxis": 0, + "YAxis": 1, + "ZAxis": 2 + } + } + Enum { + name: "ContextMenuPolicy" + values: { + "NoContextMenu": 0, + "DefaultContextMenu": 1, + "ActionsContextMenu": 2, + "CustomContextMenu": 3, + "PreventContextMenu": 4 + } + } + Enum { + name: "InputMethodQuery" + values: { + "ImEnabled": 1, + "ImCursorRectangle": 2, + "ImMicroFocus": 2, + "ImFont": 4, + "ImCursorPosition": 8, + "ImSurroundingText": 16, + "ImCurrentSelection": 32, + "ImMaximumTextLength": 64, + "ImAnchorPosition": 128, + "ImHints": 256, + "ImPreferredLanguage": 512, + "ImPlatformData": -2147483648, + "ImQueryInput": 186, + "ImQueryAll": -1 + } + } + Enum { + name: "InputMethodQueries" + values: { + "ImEnabled": 1, + "ImCursorRectangle": 2, + "ImMicroFocus": 2, + "ImFont": 4, + "ImCursorPosition": 8, + "ImSurroundingText": 16, + "ImCurrentSelection": 32, + "ImMaximumTextLength": 64, + "ImAnchorPosition": 128, + "ImHints": 256, + "ImPreferredLanguage": 512, + "ImPlatformData": -2147483648, + "ImQueryInput": 186, + "ImQueryAll": -1 + } + } + Enum { + name: "InputMethodHint" + values: { + "ImhNone": 0, + "ImhHiddenText": 1, + "ImhSensitiveData": 2, + "ImhNoAutoUppercase": 4, + "ImhPreferNumbers": 8, + "ImhPreferUppercase": 16, + "ImhPreferLowercase": 32, + "ImhNoPredictiveText": 64, + "ImhDate": 128, + "ImhTime": 256, + "ImhPreferLatin": 512, + "ImhMultiLine": 1024, + "ImhDigitsOnly": 65536, + "ImhFormattedNumbersOnly": 131072, + "ImhUppercaseOnly": 262144, + "ImhLowercaseOnly": 524288, + "ImhDialableCharactersOnly": 1048576, + "ImhEmailCharactersOnly": 2097152, + "ImhUrlCharactersOnly": 4194304, + "ImhLatinOnly": 8388608, + "ImhExclusiveInputMask": -65536 + } + } + Enum { + name: "InputMethodHints" + values: { + "ImhNone": 0, + "ImhHiddenText": 1, + "ImhSensitiveData": 2, + "ImhNoAutoUppercase": 4, + "ImhPreferNumbers": 8, + "ImhPreferUppercase": 16, + "ImhPreferLowercase": 32, + "ImhNoPredictiveText": 64, + "ImhDate": 128, + "ImhTime": 256, + "ImhPreferLatin": 512, + "ImhMultiLine": 1024, + "ImhDigitsOnly": 65536, + "ImhFormattedNumbersOnly": 131072, + "ImhUppercaseOnly": 262144, + "ImhLowercaseOnly": 524288, + "ImhDialableCharactersOnly": 1048576, + "ImhEmailCharactersOnly": 2097152, + "ImhUrlCharactersOnly": 4194304, + "ImhLatinOnly": 8388608, + "ImhExclusiveInputMask": -65536 + } + } + Enum { + name: "ToolButtonStyle" + values: { + "ToolButtonIconOnly": 0, + "ToolButtonTextOnly": 1, + "ToolButtonTextBesideIcon": 2, + "ToolButtonTextUnderIcon": 3, + "ToolButtonFollowStyle": 4 + } + } + Enum { + name: "LayoutDirection" + values: { + "LeftToRight": 0, + "RightToLeft": 1, + "LayoutDirectionAuto": 2 + } + } + Enum { + name: "DropAction" + values: { + "CopyAction": 1, + "MoveAction": 2, + "LinkAction": 4, + "ActionMask": 255, + "TargetMoveAction": 32770, + "IgnoreAction": 0 + } + } + Enum { + name: "DropActions" + values: { + "CopyAction": 1, + "MoveAction": 2, + "LinkAction": 4, + "ActionMask": 255, + "TargetMoveAction": 32770, + "IgnoreAction": 0 + } + } + Enum { + name: "CheckState" + values: { + "Unchecked": 0, + "PartiallyChecked": 1, + "Checked": 2 + } + } + Enum { + name: "ItemFlags" + values: { + "NoItemFlags": 0, + "ItemIsSelectable": 1, + "ItemIsEditable": 2, + "ItemIsDragEnabled": 4, + "ItemIsDropEnabled": 8, + "ItemIsUserCheckable": 16, + "ItemIsEnabled": 32, + "ItemIsTristate": 64, + "ItemNeverHasChildren": 128 + } + } + Enum { + name: "MatchFlags" + values: { + "MatchExactly": 0, + "MatchContains": 1, + "MatchStartsWith": 2, + "MatchEndsWith": 3, + "MatchRegExp": 4, + "MatchWildcard": 5, + "MatchFixedString": 8, + "MatchCaseSensitive": 16, + "MatchWrap": 32, + "MatchRecursive": 64 + } + } + Enum { + name: "WindowModality" + values: { + "NonModal": 0, + "WindowModal": 1, + "ApplicationModal": 2 + } + } + Enum { + name: "TextInteractionFlag" + values: { + "NoTextInteraction": 0, + "TextSelectableByMouse": 1, + "TextSelectableByKeyboard": 2, + "LinksAccessibleByMouse": 4, + "LinksAccessibleByKeyboard": 8, + "TextEditable": 16, + "TextEditorInteraction": 19, + "TextBrowserInteraction": 13 + } + } + Enum { + name: "TextInteractionFlags" + values: { + "NoTextInteraction": 0, + "TextSelectableByMouse": 1, + "TextSelectableByKeyboard": 2, + "LinksAccessibleByMouse": 4, + "LinksAccessibleByKeyboard": 8, + "TextEditable": 16, + "TextEditorInteraction": 19, + "TextBrowserInteraction": 13 + } + } + Enum { + name: "SizeHint" + values: { + "MinimumSize": 0, + "PreferredSize": 1, + "MaximumSize": 2, + "MinimumDescent": 3, + "NSizeHints": 4 + } + } + Enum { + name: "GestureState" + values: { + "NoGesture": 0, + "GestureStarted": 1, + "GestureUpdated": 2, + "GestureFinished": 3, + "GestureCanceled": 4 + } + } + Enum { + name: "GestureType" + values: { + "TapGesture": 1, + "TapAndHoldGesture": 2, + "PanGesture": 3, + "PinchGesture": 4, + "SwipeGesture": 5, + "CustomGesture": 256, + "LastGestureType": -1 + } + } + Enum { + name: "CursorMoveStyle" + values: { + "LogicalMoveStyle": 0, + "VisualMoveStyle": 1 + } + } + Enum { + name: "TimerType" + values: { + "PreciseTimer": 0, + "CoarseTimer": 1, + "VeryCoarseTimer": 2 + } + } + Enum { + name: "ScrollPhase" + values: { + "ScrollBegin": 1, + "ScrollUpdate": 2, + "ScrollEnd": 3 + } + } + } + Component { name: "QEasingCurve"; prototype: "QQmlEasingValueType" } +} diff --git a/tests/auto/qml/codemodel/importscheck/base/QtQuick.2/qmldir b/tests/auto/qml/codemodel/importscheck/base/QtQuick.2/qmldir new file mode 100644 index 00000000000..4a79c82e769 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/base/QtQuick.2/qmldir @@ -0,0 +1,4 @@ +module QtQuick +plugin qtquick2plugin +classname QtQuick2Plugin +typeinfo plugins.qmltypes diff --git a/tests/auto/qml/codemodel/importscheck/importscheck.pro b/tests/auto/qml/codemodel/importscheck/importscheck.pro new file mode 100644 index 00000000000..b36550a10a2 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/importscheck.pro @@ -0,0 +1,19 @@ +QTC_LIB_DEPENDS += cplusplus utils +include(../../../qttest.pri) +include($$IDE_SOURCE_TREE/src/rpath.pri) +DEFINES += QMLJS_BUILD_DIR + +QT +=script xml +# direct dependency on qmljs for quicker turnaround when editing them +INCLUDEPATH+=$$IDE_SOURCE_TREE/src/libs +INCLUDEPATH+=$$IDE_SOURCE_TREE/src/libs/qmljs +include($$IDE_SOURCE_TREE/src/libs/qmljs/qmljs-lib.pri) +include($$IDE_SOURCE_TREE/src/libs/languageutils/languageutils-lib.pri) +DEFINES+=QTCREATORDIR=\\\"$$IDE_SOURCE_TREE\\\" +DEFINES+=TESTSRCDIR=\\\"$$PWD\\\" +LIBS += "-L$$IDE_LIBRARY_PATH" + +TARGET = tst_qml_imports_check + +SOURCES += \ + tst_importscheck.cpp diff --git a/tests/auto/qml/codemodel/importscheck/importscheck.qbs b/tests/auto/qml/codemodel/importscheck/importscheck.qbs new file mode 100644 index 00000000000..943a3e0d4db --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/importscheck.qbs @@ -0,0 +1,15 @@ +import qbs +import QtcAutotest + +QtcAutotest { + name: "QML code model imports check autotest" + Depends { name: "LanguageUtils" } + Depends { name: "QmlJS" } + Depends { name: "Qt.widgets" } + files: "tst_importscheck.cpp" + cpp.defines: base.concat([ + 'QT_CREATOR', + 'QTCREATORDIR="' + project.ide_source_tree + '"', + 'TESTSRCDIR="' + path + '"' + ]) +} diff --git a/tests/auto/qml/codemodel/importscheck/tst_importscheck.cpp b/tests/auto/qml/codemodel/importscheck/tst_importscheck.cpp new file mode 100644 index 00000000000..ed421afe277 --- /dev/null +++ b/tests/auto/qml/codemodel/importscheck/tst_importscheck.cpp @@ -0,0 +1,247 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +using namespace QmlJS; +using namespace QmlJS::AST; +using namespace QmlJS::StaticAnalysis; + +class tst_ImportCheck : public QObject +{ + Q_OBJECT +public: + tst_ImportCheck(); + +private slots: + void test(); + void test_data(); + + void initTestCase(); +private: + QStringList m_basePaths; +}; + +void scanDir(const QString &dir) +{ + QFutureInterface result; + PathsAndLanguages paths; + paths.maybeInsert(Utils::FileName::fromString(dir), Dialect::Qml); + ModelManagerInterface::importScan(result, ModelManagerInterface::workingCopy(), paths, + ModelManagerInterface::instance(), false); + ViewerContext vCtx = ViewerContext(QStringList(), QStringList(dir)); + Snapshot snap = ModelManagerInterface::instance()->snapshot(); + + ImportDependencies *iDeps = snap.importDependencies(); + qDebug() << "libs:"; + foreach (const ImportKey &importK, iDeps->libraryImports(vCtx)) + qDebug() << "libImport: " << importK.toString(); + qDebug() << "qml files:"; + foreach (const ImportKey &importK, iDeps->subdirImports(ImportKey(ImportType::Directory, dir), + vCtx)) + qDebug() << importK.toString(); +} + +tst_ImportCheck::tst_ImportCheck() +{ +} + +#ifdef Q_OS_MAC +# define SHARE_PATH "/Resources" +#else +# define SHARE_PATH "/share/qtcreator" +#endif + +QString resourcePath() +{ + return QDir::cleanPath(QTCREATORDIR + QLatin1String(SHARE_PATH)); +} + +void tst_ImportCheck::initTestCase() +{ + QLoggingCategory::setFilterRules(QLatin1String("qtc.*.debug=false")); + if (!ModelManagerInterface::instance()) + new ModelManagerInterface; + + // the resource path is wrong, have to load things manually + QFileInfo builtins(QString::fromLocal8Bit(TESTSRCDIR) + QLatin1String("/base")); + if (builtins.exists()) + m_basePaths.append(builtins.filePath()); +} + +#define QCOMPARE_NOEXIT(actual, expected) \ + QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__) + +void tst_ImportCheck::test_data() +{ + QTest::addColumn("paths"); + QTest::addColumn("expectedLibraries"); + QTest::addColumn("expectedFiles"); + QTest::newRow("base") << QStringList(QLatin1String(TESTSRCDIR "/base")) + << (QStringList() << QLatin1String("QML 1.0") + << QLatin1String("QtQml 2.2") + << QLatin1String("QtQml 2.1") + << QLatin1String("QtQuick 2.0") + << QLatin1String("QtQml 2.0") + << QLatin1String("QtQuick 2.-1") + << QLatin1String("QtQuick 2.1") + << QLatin1String("QtQuick 2.2") + << QLatin1String("")) + << QStringList(); + QTest::newRow("001_flatQmlOnly") << QStringList(QLatin1String(TESTSRCDIR "/001_flatQmlOnly")) + << QStringList() + << QStringList(); + QTest::newRow("002_nestedQmlOnly") << QStringList(QLatin1String(TESTSRCDIR "/002_nestedQmlOnly")) + << QStringList() + << QStringList(); + /*QTest::newRow("003_packageQmlOnly") << QStringList(QLatin1String(TESTSRCDIR "/003_packageQmlOnly")) + << (QStringList() << QLatin1String("QtGraphicalEffects")) + << (QStringList() + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/ZoomBlur.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/private/FastGlow.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/private/GaussianInnerShadow.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/private/SourceProxy.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/GammaAdjust.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/HueSaturation.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/Colorize.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/RadialBlur.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/ColorOverlay.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/MaskedBlur.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/RectangularGlow.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/Displace.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/private/FastMaskedBlur.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/Desaturate.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/private/GaussianDirectionalBlur.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/GaussianBlur.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/InnerShadow.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/LinearGradient.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/Blend.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/Glow.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/RecursiveBlur.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/private/GaussianMaskedBlur.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/DropShadow.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/DirectionalBlur.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/OpacityMask.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/BrightnessContrast.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/private/GaussianGlow.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/RadialGradient.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/private/FastInnerShadow.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/ConicalGradient.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/ThresholdMask.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/LevelAdjust.qml") + << QLatin1String(TESTSRCDIR "/003_packageQmlOnly/QtGraphicalEffects/FastBlur.qml")); + QTest::newRow("004_cppOnly copy") << QStringList(QLatin1String(TESTSRCDIR "004_cppOnly copy")) + << (QStringList() << QLatin1String("QML 1.0") + << QLatin1String("QtQml 2.2") + << QLatin1String("QtQml 2.1") + << QLatin1String("QtQuick 2.0") + << QLatin1String("QtQml 2.0") + << QLatin1String("QtQuick 2.-1") + << QLatin1String("QtQuick 2.1") + << QLatin1String("QtQuick 2.2") + << QLatin1String("")) + << QStringList();*/ +} + +void tst_ImportCheck::test() +{ + QFETCH(QStringList, paths); + QFETCH(QStringList, expectedLibraries); + QFETCH(QStringList, expectedFiles); + + QFutureInterface result; + PathsAndLanguages lPaths; + foreach (const QString &path, paths) + lPaths.maybeInsert(Utils::FileName::fromString(path), Dialect::Qml); + ModelManagerInterface::importScan(result, ModelManagerInterface::workingCopy(), lPaths, + ModelManagerInterface::instance(), false); + ViewerContext vCtx(QStringList(), paths); + Snapshot snap = ModelManagerInterface::instance()->snapshot(); + + ImportDependencies *iDeps = snap.importDependencies(); + QStringList detectedLibraries; + QStringList detectedFiles; + foreach (const ImportKey &importK, iDeps->libraryImports(vCtx)) + detectedLibraries << importK.toString(); + foreach (const QString &path, paths) + foreach (const ImportKey &importK, iDeps->subdirImports(ImportKey(ImportType::Directory, + path), vCtx)) + detectedFiles << QFileInfo(importK.toString()).canonicalFilePath(); + + expectedLibraries.sort(); + expectedFiles.sort(); + detectedLibraries.sort(); + detectedFiles.sort(); + QCOMPARE(expectedLibraries, detectedLibraries); + QCOMPARE(expectedFiles, detectedFiles); +} + +#ifdef MANUAL_IMPORT_SCANNER + +int main(int argc, char *argv[]) +{ + QGuiApplication a(argc, argv); + new ModelManagerInterface; + if (argc != 2 || !QFileInfo(QString::fromLocal8Bit(argv[1])).isDir()) { + printf("usage: %s dir/to/scan\n", ((argc > 0) ? argv[0] : "importScan")); + exit(1); + } + tst_ImportCheck checker; + QTimer::singleShot(1, &checker, SLOT(doScan())); + a.exec(); + return 0; +} + +#else + +QTEST_MAIN(tst_ImportCheck) + +#endif // MANUAL_IMPORT_SCANNER + +#include "tst_importscheck.moc"