diff options
author | Jens Bache-Wiig <jens.bache-wiig@nokia.com> | 2011-03-02 14:26:40 +0100 |
---|---|---|
committer | Jens Bache-Wiig <jens.bache-wiig@nokia.com> | 2011-03-02 14:28:06 +0100 |
commit | 259c6e5e754a9fd45737a47e2e84ca7add334b5b (patch) | |
tree | 34691e79f2be0ffd26c5c5c3e0ff0aa46a313dc9 /components/custom | |
parent | 5604df2a798012065a0a9aaea99873cb60a5035f (diff) | |
download | qtquickcontrols-259c6e5e754a9fd45737a47e2e84ca7add334b5b.tar.gz |
Clean up custom components and remove things that are
not needed for desktop.
Diffstat (limited to 'components/custom')
57 files changed, 56 insertions, 1643 deletions
diff --git a/components/custom/BasicButton.qml b/components/custom/BasicButton.qml index 258dc586..41f6935d 100644 --- a/components/custom/BasicButton.qml +++ b/components/custom/BasicButton.qml @@ -1,6 +1,5 @@ import QtQuick 1.1 import "./behaviors" // ButtonBehavior -import "./styles/default" as DefaultStyles Item { id: button @@ -11,7 +10,7 @@ Item { property alias checkable: behavior.checkable // button toggles between checked and !checked property alias checked: behavior.checked - property Component background: defaultStyle.background + property Component background: null property color backgroundColor: syspal.button property color textColor: syspal.text; @@ -51,6 +50,5 @@ Item { } } - DefaultStyles.BasicButtonStyle { id: defaultStyle } SystemPalette { id: syspal } } diff --git a/components/custom/Button.qml b/components/custom/Button.qml index 1bcd8335..ec01d9aa 100644 --- a/components/custom/Button.qml +++ b/components/custom/Button.qml @@ -1,5 +1,4 @@ import QtQuick 1.1 -import "./styles/default" as DefaultStyles BasicButton { id: button @@ -7,20 +6,20 @@ BasicButton { property string text property url iconSource - property Component label: defaultStyle.label + property Component label: null - property int leftMargin: defaultStyle.leftMargin - property int topMargin: defaultStyle.topMargin - property int rightMargin: defaultStyle.rightMargin - property int bottomMargin: defaultStyle.bottomMargin + property int leftMargin: 0 + property int topMargin: 0 + property int rightMargin: 0 + property int bottomMargin: 0 // implementation - implicitWidth: Math.max(minimumWidth, labelLoader.item.implicitWidth + leftMargin + rightMargin) - implicitHeight: Math.max(minimumHeight, labelLoader.item.implicitHeight + topMargin + bottomMargin) + implicitWidth: Math.max(minimumWidth, labelLoader.item ? labelLoader.item.implicitWidth : 0 + leftMargin + rightMargin) + implicitHeight: Math.max(minimumHeight, labelLoader.item ? labelLoader.item.implicitHeight : 0 + topMargin + bottomMargin) - minimumWidth: defaultStyle.minimumWidth - minimumHeight: defaultStyle.minimumHeight + minimumWidth: 0 + minimumHeight: 0 background: defaultStyle.background @@ -34,6 +33,4 @@ BasicButton { property alias styledItem: button sourceComponent: label } - - DefaultStyles.ButtonStyle { id: defaultStyle } } diff --git a/components/custom/ButtonBlock.qml b/components/custom/ButtonBlock.qml deleted file mode 100644 index 999d3dd0..00000000 --- a/components/custom/ButtonBlock.qml +++ /dev/null @@ -1,216 +0,0 @@ -import QtQuick 1.0 -import "./behaviors" // ButtonBehavior -import "./visuals" // AdjoiningVisual -import "./styles/default" as DefaultStyles - -// KNOWN ISSUES -// 1) When switching between horizontal and vertical orientation after block has been created, the Grid's move -// transition is called *before* the grid item's have actually moved, resulting in incorrect "adjoins" states -// 2) Can't make items in vertical groups all the same width without access to their implicitWidth, see QTBUG-14957 -// 3) Should be generalized into JoinedGroup and ButtonBlock made a specialization. -// 4) ExclusiveSelection support missing - -// NOTES -// 1) The ButtonBlock implementation has no ultimate dependency on AdjoiningVisual, and can therefor be made to work -// with any Component for the item instances. The use of AdjoiningVisual is only for simplifying the implementation -// and styling of the items in the block. The property defining how an item in the block should be joinged with its -// neighbours is "adjoins" which the ButtonBlock "attaches" to the items in the block (i.e. defines in their -// look-up scope) which means the "button" instances does not need to define this property, only read it to draw -// their border appropriately. This "adjoins" property is a *completely* separate concept from the AdjoiningVisual. -// I.e. the coupling between the ButtonGroup and the "button" elements making up the group is the weakest possible. - - -Item { - id: buttonBlock - - property alias model: repeater.model - property variant bindings: {"text":"text", "iconSource":"iconSource", "enabled":"enabled", "opacity":"opacity"} - - property Component buttonBackground: defaultStyle.background - property Component buttonLabel: defaultStyle.label - - property color backgroundColor: syspal.button - property color textColor: syspal.text; - - property int orientation: Qt.Horizontal - signal clicked(int index) - - property int leftMargin: defaultStyle.leftMargin - property int topMargin: defaultStyle.topMargin - property int rightMargin: defaultStyle.rightMargin - property int bottomMargin: defaultStyle.bottomMargin - - width: grid.width - height: grid.height - - Grid { - id: grid - columns: orientation == Qt.Vertical ? 1 : model.count - anchors.centerIn: parent - property int widestItemWidth: 0 - property int talestItemHeight: 0 - - move: Transition { //mm seems "move" transition is not always called after items has been moved - ScriptAction { script: { - if(orientation == Qt.Horizontal) { - grid.leftmostVisibleIndex = grid.__leftmostVisibleIndex(); - grid.rightmostVisibleIndex = grid.__rightmostVisibleIndex(); - } else { - grid.topmostVisibleIndex = grid.__topmostVisibleIndex(); - grid.bottommostVisibleIndex = grid.__bottommostVisibleIndex(); - } - } - } - } - - property int leftmostVisibleIndex - function __leftmostVisibleIndex() { - var leftmostVisibleIndex = 0; - var leftmostItemX = 10000000; - for(var i = 0; i < children.length; i++) { - var child = children[i]; - if(child.x < leftmostItemX && child.opacity > 0) { - leftmostItemX = child.x; - leftmostVisibleIndex = i; - } - } - return leftmostVisibleIndex; - } - - property int rightmostVisibleIndex - function __rightmostVisibleIndex() { - var rightmostVisibleIndex = 0; - var rightmostItemX = 0; - for(var i = 0; i < children.length; i++) { - var child = children[i]; -//mm print("rightmost child? at: " + child.x + "," + child.y) - if(child.x > rightmostItemX && child.opacity > 0) { - rightmostItemX = child.x; - rightmostVisibleIndex = i; - } - } - return rightmostVisibleIndex; - } - - property int topmostVisibleIndex - function __topmostVisibleIndex() { - var topmostVisibleIndex = 0; - var topmostItemY = 10000000; - for(var i = 0; i < children.length; i++) { - var child = children[i]; - if(child.y < topmostItemY && child.opacity > 0) { - topmostItemY = child.y; - topmostVisibleIndex = i; - } - } - return topmostVisibleIndex; - } - - property int bottommostVisibleIndex - function __bottommostVisibleIndex() { - var bottommostVisibleIndex = 0; - var bottommostItemY = 0; - for(var i = 0; i < children.length; i++) { - var child = children[i]; -//mm print("bottommost child? at: " + child.x + "," + child.y) - if(child.y > bottommostItemY && child.opacity > 0) { - bottommostItemY = child.y; - bottommostVisibleIndex = i; - } - } - return bottommostVisibleIndex; - } - - Repeater { - id: repeater - delegate: AdjoiningVisual { - id: blockButton - styledItem: blockButton - styling: buttonBackground - - property alias pressed: behavior.pressed - property alias containsMouse: behavior.containsMouse - property alias checkable: behavior.checkable // button toggles between checked and !checked - property alias checked: behavior.checked - - property string text - property url iconSource - property color textColor: buttonBlock.textColor - property color backgroundColor: buttonBlock.backgroundColor - - Component.onCompleted: { - // Create the Binding objects defined by the ButtonBlock's "bindings" map property to allow - // the properties of the buttons to be bound to properties in the model with different names - - if (bindings == undefined) // jb : bindings is undefined on Mac - return; - var keys = Object.keys(buttonBlock.bindings); - for(var i = 0; i < keys.length; i++) { - var key = keys[i]; - var bindingComponent = - 'import QtQuick 1.0;' + - 'Binding {' + - ' target: blockButton;' + - ' property: "' + key + '";' + - ' value: buttonBlock.model.get(' + index + ').' + bindings[key] + ';' + - '}'; - Qt.createQmlObject(bindingComponent, blockButton); //mm do we ever need to explicitly delete these? - } - - // Find the widest/talest item to make all buttons the same width/height - if(buttonBlock.orientation == Qt.Vertical) //mm Can't make this work without QTBUG-14957 - grid.widestItemWidth = Math.max(grid.widestItemWidth, width); - else - grid.talestItemHeight = Math.max(grid.talestItemHeight, height); - } - - ButtonBehavior { - id: behavior - anchors.fill: parent - onClicked: buttonBlock.clicked(index) - } - - property int adjoins - adjoins: { //mm see QTBUG-14987 - var adjoins; - if(orientation == Qt.Horizontal) { - adjoins = 0x1|0x2; // left and right - if(index == grid.leftmostVisibleIndex) adjoins &= ~0x1; // not left - if(index == grid.rightmostVisibleIndex) adjoins &= ~0x2; // not right - } else { - adjoins = 0x4|0x8; // top and bottom - if(index == grid.topmostVisibleIndex) adjoins &= ~0x4; // not top - if(index == grid.bottommostVisibleIndex) adjoins &= ~0x8; // not bottom - } - return adjoins; - } - - - // width: orientation == Qt.Vertical ? grid.widestItemWidth : item.width - // height: orientation == Qt.Vertical ? item.height : grid.talestItemHeight - property int minimumWidth: defaultStyle.minimumWidth - property int minimumHeight: defaultStyle.minimumHeight - - width: Math.max(minimumWidth, - labelComponent.item.width + leftMargin + rightMargin) - height: Math.max(minimumHeight, - labelComponent.item.height + topMargin + bottomMargin) - - Loader { - id: labelComponent - property variant styledItem: blockButton - anchors.fill: parent - anchors.leftMargin: leftMargin - anchors.rightMargin: rightMargin - anchors.topMargin: topMargin - anchors.bottomMargin: bottomMargin - sourceComponent: buttonLabel - } - - } - } - } - - SystemPalette { id: syspal; colorGroup: enabled ? SystemPalette.Active : SystemPalette.Disabled } - DefaultStyles.ButtonBlockStyle { id: defaultStyle } -} diff --git a/components/custom/CheckBox.qml b/components/custom/CheckBox.qml index 88c8d350..976f9695 100644 --- a/components/custom/CheckBox.qml +++ b/components/custom/CheckBox.qml @@ -1,6 +1,5 @@ import QtQuick 1.1 import "./behaviors" -import "./styles/default" as DefaultStyles Item { id: checkBox @@ -10,13 +9,12 @@ Item { property alias checked: behavior.checked property alias containsMouse: behavior.containsMouse - property Component background: defaultStyle.background - property Component checkmark: defaultStyle.checkmark + property Component background: null property color backgroundColor: syspal.base - property int minimumWidth: defaultStyle.minimumWidth - property int minimumHeight: defaultStyle.minimumHeight + property int minimumWidth: 0 + property int minimumHeight: 0 property bool activeFocusOnPress: true @@ -32,13 +30,6 @@ Item { sourceComponent: background } - Loader { - id: checkmarkLoader - anchors.centerIn: parent - property alias styledItem: checkBox - sourceComponent: checkmark - } - ButtonBehavior { id: behavior anchors.fill: parent @@ -46,6 +37,5 @@ Item { onClicked: {if (activeFocusOnPress)checkBox.focus = true; checkBox.clicked()} } - DefaultStyles.CheckBoxStyle { id: defaultStyle } SystemPalette { id: syspal } } diff --git a/components/custom/ChoiceList.qml b/components/custom/ChoiceList.qml index 02813491..4e50ba7b 100644 --- a/components/custom/ChoiceList.qml +++ b/components/custom/ChoiceList.qml @@ -1,5 +1,4 @@ import QtQuick 1.0 -import "./styles/default" as DefaultStyles import "./private" as Private // for ChoiceListPopup // KNOWN ISSUES @@ -20,18 +19,18 @@ Item { property color textColor: syspal.text property color backgroundColor: syspal.button - property Component background: defaultStyle.background - property Component label: defaultStyle.label - property Component listItem: defaultStyle.listItem - property Component popupFrame: defaultStyle.popupFrame + property Component background: null + property Component label: null + property Component listItem: null + property Component popupFrame: null - property int minimumWidth: defaultStyle.minimumWidth - property int minimumHeight: defaultStyle.minimumHeight + property int minimumWidth: 0 + property int minimumHeight: 0 - property int leftMargin: defaultStyle.leftMargin - property int topMargin: defaultStyle.topMargin - property int rightMargin: defaultStyle.rightMargin - property int bottomMargin: defaultStyle.bottomMargin + property int leftMargin: 0 + property int topMargin: 0 + property int rightMargin: 0 + property int bottomMargin: 0 property int labelWidth: label != null ? labelComponent.item.width : 0 property int labelHeight: label != null ? labelComponent.item.height : 0 @@ -88,6 +87,4 @@ Item { Keys.onUpPressed: { if (currentIndex < model.count - 1) currentIndex++ } Keys.onDownPressed: {if (currentIndex > 0) currentIndex-- } - - DefaultStyles.ChoiceListStyle { id: defaultStyle } } diff --git a/components/custom/ProgressBar.qml b/components/custom/ProgressBar.qml index fadbbc5e..b46861c7 100644 --- a/components/custom/ProgressBar.qml +++ b/components/custom/ProgressBar.qml @@ -1,32 +1,28 @@ import QtQuick 1.0 -import "./styles/default" as DefaultStyles Item { id: progressBar - SystemPalette{id:syspal} property real value: 0 property real minimumValue: 0 property real maximumValue: 1 property bool indeterminate: false - property color backgroundColor: syspal.base - property color progressColor: syspal.highlight - - property int leftMargin: defaultStyle.leftMargin - property int topMargin: defaultStyle.topMargin - property int rightMargin: defaultStyle.rightMargin - property int bottomMargin: defaultStyle.bottomMargin + property int leftMargin: 0 + property int topMargin: 0 + property int rightMargin: 0 + property int bottomMargin: 0 - property int minimumWidth: defaultStyle.minimumWidth - property int minimumHeight: defaultStyle.minimumHeight + property int minimumWidth: 0 + property int minimumHeight: 0 width: minimumWidth height: minimumHeight - property Component background: defaultStyle.background - property Component progress: defaultStyle.progress - property Component indeterminateProgress: defaultStyle.indeterminateProgress + property Component background: null + + property color backgroundColor: syspal.base + property color progressColor: syspal.highlight Loader { id: groove @@ -45,36 +41,5 @@ Item { anchors.rightMargin: rightMargin anchors.topMargin: topMargin anchors.bottomMargin: bottomMargin - - Loader { - id: progressComponent - property alias styledItem: progressBar - property alias indeterminate:progressBar.indeterminate - property alias value:progressBar.value - property alias maximumValue:progressBar.maximumValue - property alias minimumValue:progressBar.minimumValue - property real complete: (value-minimumValue)/(maximumValue-minimumValue) - - opacity: !indeterminate && value > 0 ? 1 : 0 - width: Math.round((progressBar.width-leftMargin-rightMargin)*(complete)) - height: progressBar.height-topMargin-bottomMargin - anchors.left:parent.left - sourceComponent: progressBar.progress - } - - Loader { - id: indeterminateComponent - property alias styledItem: progressBar - property alias indeterminate:progressBar.indeterminate - property alias value:progressBar.value - property alias maximumValue:progressBar.maximumValue - property alias minimumValue:progressBar.minimumValue - - opacity: indeterminate ? 1 : 0 - anchors.fill: parent - sourceComponent: indeterminateProgress - } } - - DefaultStyles.ProgressBarStyle { id: defaultStyle } } diff --git a/components/custom/RadioButton.qml b/components/custom/RadioButton.qml deleted file mode 100644 index 64d274bf..00000000 --- a/components/custom/RadioButton.qml +++ /dev/null @@ -1,12 +0,0 @@ -import QtQuick 1.1 -import "./styles/default" as DefaultStyles - -CheckBox { - id: radioButton - - // implementation - - checkmark: defaultStyle.checkmark - background: defaultStyle.background - DefaultStyles.RadioButtonStyle { id: defaultStyle} -} diff --git a/components/custom/ScrollDecorator.qml b/components/custom/ScrollDecorator.qml deleted file mode 100644 index e61a16d2..00000000 --- a/components/custom/ScrollDecorator.qml +++ /dev/null @@ -1,20 +0,0 @@ -import QtQuick 1.0 -import "./styles/default" as DefaultStyles - -Item { - id: scrollDecorator - - property Flickable flickableItem - - anchors.fill: parent - - ScrollIndicator { - horizontal: true - scrollItem: scrollDecorator.flickableItem - } - - ScrollIndicator { - horizontal: false - scrollItem: scrollDecorator.flickableItem - } -} diff --git a/components/custom/ScrollIndicator.qml b/components/custom/ScrollIndicator.qml deleted file mode 100644 index cba1dba8..00000000 --- a/components/custom/ScrollIndicator.qml +++ /dev/null @@ -1,56 +0,0 @@ -import QtQuick 1.0 -import "./styles/default" as DefaultStyles - -Item { - id: scrollIndicator - - property Flickable scrollItem - property bool horizontal: false - - property Component content: defaultStyle.content - - //private - anchors.left: horizontal ? parent.left : undefined - anchors.right: parent.right - anchors.top: horizontal ? undefined : parent.top - anchors.bottom: parent.bottom - width: horizontal ? parent.width : defaultStyle.minimumWidth - height: horizontal ? defaultStyle.minimumWidth : parent.height - - opacity: (horizontal ? scrollItem.movingHorizontally : scrollItem.movingVertically) ? 1 : 0 - Behavior on opacity { NumberAnimation { duration: 100 } } - - Item { - id: ratationContainer - - anchors.centerIn: parent - rotation: horizontal ? -90 : 0 - width: horizontal ? scrollIndicator.height : scrollIndicator.width // rotate width and heigh back - height: horizontal ? scrollIndicator.width : scrollIndicator.height - - property variant visibleArea: scrollItem.visibleArea - property real scrollItemSize: horizontal ? scrollItem.width : scrollItem.height - property real scrollItemVisibleAreaPos: horizontal ? visibleArea.xPosition : visibleArea.yPosition - property real scrollItemVisibleAreaScrollRatio: horizontal ? visibleArea.widthRatio : visibleArea.heightRatio - property real scrollItemContentPos: horizontal ? scrollItem.contentX : scrollItem.contentY - property real scrollItemContentSize: horizontal ? scrollItem.contentWidth : scrollItem.contentHeight - - property real offset: scrollItemVisibleAreaPos * scrollItemSize - property real length: scrollItemVisibleAreaScrollRatio * scrollItemSize - property real startOvershoot: Math.max(-scrollItemContentPos, 0) - property real endOvershoot: Math.max(scrollItemContentPos-(scrollItemContentSize-scrollItemSize), 0) - property real start: Math.max(offset + endOvershoot, 0) - property real end: Math.min(offset+length-startOvershoot, scrollItemSize) - - Loader { - x: 0 - y: parent.endOvershoot > 0 ? Math.min(parent.start, parent.scrollItemSize-width) : parent.start - width: 12 - height: Math.max(parent.end-parent.start, width) - - sourceComponent: content - } - } - - DefaultStyles.ScrollIndicatorStyle { id: defaultStyle } -} diff --git a/components/custom/Slider.qml b/components/custom/Slider.qml index 55d39ea1..6797e6e0 100644 --- a/components/custom/Slider.qml +++ b/components/custom/Slider.qml @@ -26,7 +26,6 @@ import QtQuick 1.0 import "../plugin" -import "./styles/default" as DefaultStyles Item { id: slider @@ -53,8 +52,8 @@ Item { property color progressColor: palette.highlight property color backgroundColor: palette.window - property int leftMargin: defaultStyle.leftMargin - property int rightMargin: defaultStyle.rightMargin + property int leftMargin: 0 + property int rightMargin: 0 // EXTENSIONS // Indicate that we want animations in the Slider, people customizing should @@ -73,13 +72,13 @@ Item { return Math.round(v); } - property int minimumWidth: defaultStyle.minimumWidth - property int minimumHeight: defaultStyle.minimumHeight + property int minimumWidth: 0 + property int minimumHeight: 0 // Hooks for customizing the pieces of the slider - property Component groove: defaultStyle.groove - property Component handle: defaultStyle.handle - property Component valueIndicator: defaultStyle.valueIndicator + property Component groove: null + property Component handle: null + property Component valueIndicator: null // PRIVATE/CONVENIENCE property bool _isVertical: orientation == Qt.Vertical @@ -87,8 +86,6 @@ Item { width: _isVertical ? minimumHeight : minimumWidth height: _isVertical ? minimumWidth : minimumHeight - DefaultStyles.SliderStyle { id: defaultStyle } - // This is a template slider, so every piece can be modified by passing a // different Component. The main elements in the implementation are // diff --git a/components/custom/SpinBox.qml b/components/custom/SpinBox.qml index 8d0b4474..0c1b2acd 100644 --- a/components/custom/SpinBox.qml +++ b/components/custom/SpinBox.qml @@ -1,17 +1,16 @@ import QtQuick 1.0 -import "./styles/default" as DefaultStyles Item { id: spinbox SystemPalette{id:syspal} - property int minimumWidth: defaultStyle.minimumWidth - property int minimumHeight: defaultStyle.minimumHeight + property int minimumWidth: 0 + property int minimumHeight: 0 - property int leftMargin: defaultStyle.leftMargin - property int topMargin: defaultStyle.topMargin - property int rightMargin: defaultStyle.rightMargin - property int bottomMargin: defaultStyle.bottomMargin + property int leftMargin: 0 + property int topMargin: 0 + property int rightMargin: 0 + property int bottomMargin: 0 width: Math.max(minimumWidth, input.width + leftMargin + rightMargin) @@ -40,7 +39,6 @@ Item { property Component background: defaultStyle.background property Component up: defaultStyle.up property Component down: defaultStyle.down - DefaultStyles.SpinBoxStyle { id: defaultStyle } function increment() { value += singlestep diff --git a/components/custom/Switch.qml b/components/custom/Switch.qml deleted file mode 100644 index 8bf18cfe..00000000 --- a/components/custom/Switch.qml +++ /dev/null @@ -1,85 +0,0 @@ -import QtQuick 1.1 -import "./styles/default" as DefaultStyles - -Item { - id: toggleSwitch // "switch" is a reserved word - - signal clicked - property bool pressed: mouseArea.pressed - property bool checked: false - property alias containsMouse: mouseArea.containsMouse - - property color switchColor: syspal.button - property color backgroundColor: syspal.alternateBase - property color positiveHighlightColor: syspal.highlight - property color negativeHighlightColor: "transparent" - property color textColor: syspal.text - - property Component groove: defaultStyle.groove - property Component handle: defaultStyle.handle - - property int minimumWidth: defaultStyle.minimumWidth - property int minimumHeight: defaultStyle.minimumHeight - - // implementation - - implicitWidth: Math.max(minimumWidth, grooveLoader.item.implicitWidth) - implicitHeight: Math.max(minimumHeight, grooveLoader.item.implicitHeight) - - onCheckedChanged: snapHandleIntoPlace(); - - Loader { - id: grooveLoader - anchors.fill: parent - property alias styledItem: toggleSwitch - property real handleCenterX: handleLoader.item.x + (handleLoader.item.width/2) - sourceComponent: groove - } - - Loader { - id: handleLoader - anchors.top: parent.top - anchors.bottom: parent.bottom - property alias styledItem: toggleSwitch - sourceComponent: handle - - Component.onCompleted: item.x = checked ? mouseArea.drag.maximumX : mouseArea.drag.minimumX - } - - MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: true - - drag.axis: Drag.XAxis - drag.minimumX: 0 - drag.maximumX: toggleSwitch.width - handleLoader.item.width - drag.target: handleLoader.item - - onPressed: toggleSwitch.pressed = true // needed when hover is enabled - onCanceled: { snapHandleIntoPlace(); toggleSwitch.pressed = false; } // mouse stolen e.g. by Flickable - onReleased: { - var wasChecked = checked; - if (drag.active) { - checked = (handleLoader.item.x > (drag.maximumX - drag.minimumX)/2) - } else if (toggleSwitch.pressed && enabled) { // No click if release outside area - checked = !checked; - } - - snapHandleIntoPlace(); - - toggleSwitch.pressed = false - if(checked != wasChecked) - toggleSwitch.clicked(); - } - } - - onWidthChanged: snapHandleIntoPlace() - function snapHandleIntoPlace() { - if(handleLoader.item) - handleLoader.item.x = checked ? mouseArea.drag.maximumX : mouseArea.drag.minimumX; - } - - DefaultStyles.SwitchStyle { id: defaultStyle } - SystemPalette { id: syspal } -} diff --git a/components/custom/TextArea.qml b/components/custom/TextArea.qml deleted file mode 100644 index 92263fe6..00000000 --- a/components/custom/TextArea.qml +++ /dev/null @@ -1,156 +0,0 @@ -import QtQuick 1.0 -import "./styles/default" as DefaultStyles -import "./behaviors" // TextEditMouseBehavior - -FocusScope { - id: textArea - - property alias text: textEdit.text - property alias placeholderText: placeholderTextComponent.text - property alias font: textEdit.font - property bool passwordMode: false - property bool readOnly: textEdit.readOnly // read only - property int inputHint; // values tbd (alias to TextEdit.inputMethodHints? - property alias selectedText: textEdit.selectedText - property alias selectionEnd: textEdit.selectionEnd - property alias selectionStart: textEdit.selectionStart - property alias horizontalAlignment: textEdit.horizontalAlignment - property alias verticalAlignment: textEdit.verticalAlignment - property alias wrapMode: textEdit.wrapMode //mm Missing from spec - property alias textFormat: textEdit.textFormat - property alias cursorPosition: textEdit.cursorPosition - - property color textColor: syspal.text - property color backgroundColor: syspal.base - property alias containsMouse: mouseEditBehavior.containsMouse - - property Component background: defaultStyle.background - property Component hints: defaultStyle.hints - - property int minimumWidth: defaultStyle.minimumWidth - property int minimumHeight: defaultStyle.minimumHeight - - property int leftMargin: defaultStyle.leftMargin - property int topMargin: defaultStyle.topMargin - property int rightMargin: defaultStyle.rightMargin - property int bottomMargin: defaultStyle.bottomMargin - - function copy() { - textEdit.copy() - } - - function paste() { - textEdit.paste() - } - - function cut() { - textEdit.cut() - } - - function forceActiveFocus() { - textEdit.forceActiveFocus() - } - - function select(start, end) { - textEdit.select(start, end) - } - - function selectAll() { - textEdit.selectAll() - } - - function selectWord() { - textEdit.selectWord() - } - - function positionAt(x, y) { - var p = mapToItem(textEdit, x, y); - return textEdit.positionAt(p.x, p.y); - } - - function positionToRectangle(pos) { - var p = mapToItem(textEdit, pos.x, pos.y); - return textEdit.positionToRectangle(p); - } - - width: Math.max(minimumWidth, - Math.max(textEdit.width, placeholderTextComponent.width) + leftMargin + rightMargin) - height: Math.max(minimumHeight, - Math.max(textEdit.height, placeholderTextComponent.height) + topMargin + bottomMargin) - - - // Implementation - - property alias activeFocus: textEdit.activeFocus // Forward active focus - property alias desktopBehavior: mouseEditBehavior.desktopBehavior - property alias _hints: hintsLoader.item - clip: true - - SystemPalette { id: syspal } - Loader { id: hintsLoader; sourceComponent: hints } - Loader { sourceComponent: background; anchors.fill: parent } - - Flickable { //mm is FocusScope, so TextArea's root doesn't need to be, no? - id: flickable - clip: true - - anchors.fill: parent - anchors.leftMargin: leftMargin - anchors.topMargin: topMargin - anchors.rightMargin: rightMargin - anchors.bottomMargin: bottomMargin - - function ensureVisible(r) { - if (contentX >= r.x) - contentX = r.x; - else if (contentX+width <= r.x+r.width) - contentX = r.x+r.width-width; - if (contentY >= r.y) - contentY = r.y; - else if (contentY+height <= r.y+r.height) - contentY = r.y+r.height-height; - } - - TextEdit { // see QTBUG-14936 - id: textEdit - font.pixelSize: _hints.fontPixelSize - font.bold: _hints.fontBold - - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - - color: enabled ? textColor: Qt.tint(textColor, "#80ffffff") - wrapMode: desktopBehavior ? TextEdit.NoWrap : TextEdit.WordWrap - onCursorRectangleChanged: flickable.ensureVisible(cursorRectangle) - - onActiveFocusChanged: activeFocus ? openSoftwareInputPanel() : closeSoftwareInputPanel() - } - } - - Text { - id: placeholderTextComponent - x: leftMargin; y: topMargin - font: textEdit.font - opacity: !textEdit.text.length && !textEdit.activeFocus ? 1 : 0 - color: "gray" - clip: true - text: "Enter text" - Behavior on opacity { NumberAnimation { duration: 90 } } - } - - - TextEditMouseBehavior { - id: mouseEditBehavior - anchors.fill: parent - textEdit: textEdit - desktopBehavior: false - copyPasteButtons: ButtonBlock { - opacity: 0 // initially hidden - Behavior on opacity { NumberAnimation { duration: 100 } } - } - } - - DefaultStyles.TextFieldStyle { id: defaultStyle } -} - diff --git a/components/custom/TextField.qml b/components/custom/TextField.qml index 2af29427..96f4f6ba 100644 --- a/components/custom/TextField.qml +++ b/components/custom/TextField.qml @@ -1,5 +1,4 @@ import QtQuick 1.0 -import "./styles/default" as DefaultStyles import "./behaviors" // TextEditMouseBehavior // KNOWN ISSUES @@ -30,16 +29,16 @@ FocusScope { property color backgroundColor: syspal.base property alias containsMouse: mouseEditBehavior.containsMouse - property Component background: defaultStyle.background - property Component hints: defaultStyle.hints + property Component background: null + property Component hints: null - property int minimumWidth: defaultStyle.minimumWidth - property int minimumHeight: defaultStyle.minimumHeight + property int minimumWidth: 0 + property int minimumHeight: 0 - property int leftMargin: defaultStyle.leftMargin - property int topMargin: defaultStyle.topMargin - property int rightMargin: defaultStyle.rightMargin - property int bottomMargin: defaultStyle.bottomMargin + property int leftMargin: 0 + property int topMargin: 0 + property int rightMargin: 0 + property int bottomMargin: 0 function copy() { textInput.copy() @@ -87,7 +86,6 @@ FocusScope { // Implementation property alias desktopBehavior: mouseEditBehavior.desktopBehavior - property alias _hints: hintsLoader.item clip: true SystemPalette { id: syspal } @@ -96,8 +94,8 @@ FocusScope { TextInput { // see QTBUG-14936 id: textInput - font.pixelSize: _hints.fontPixelSize - font.bold: _hints.fontBold + font.pixelSize: hintsLoader.item != null ? hintsLoader.item.fontPixelSize: 14 + font.bold: hintsLoader.item != null ? hintsLoader.item.fontBold : false anchors.leftMargin: leftMargin anchors.topMargin: topMargin @@ -171,13 +169,7 @@ FocusScope { anchors.fill: parent textInput: textInput desktopBehavior: false - copyPasteButtons: ButtonBlock { - opacity: 0 // initially hidden - Behavior on opacity { NumberAnimation { duration: 100 } } - } } - - DefaultStyles.TextFieldStyle { id: defaultStyle } } diff --git a/components/custom/qmldir b/components/custom/qmldir index 6e256a81..db08e22e 100644 --- a/components/custom/qmldir +++ b/components/custom/qmldir @@ -7,11 +7,6 @@ ButtonRow 1.0 ButtonRow.qml CheckBox 1.0 CheckBox.qml ChoiceList 1.0 ChoiceList.qml ProgressBar 1.0 ProgressBar.qml -RadioButton 1.0 RadioButton.qml -ScrollDecorator 1.0 ScrollDecorator.qml -ScrollIndicator 1.0 ScrollIndicator.qml Slider 1.0 Slider.qml SpinBox 1.0 SpinBox.qml -Switch 1.0 Switch.qml -TextArea 1.0 TextArea.qml TextField 1.0 TextField.qml diff --git a/components/custom/styles/default/BasicButtonStyle.qml b/components/custom/styles/default/BasicButtonStyle.qml deleted file mode 100644 index 08b18040..00000000 --- a/components/custom/styles/default/BasicButtonStyle.qml +++ /dev/null @@ -1,8 +0,0 @@ -import QtQuick 1.1 - -QtObject { - property int minimumWidth: 40 - property int minimumHeight: 25 - - property Component background: Component { Item { } } -} diff --git a/components/custom/styles/default/BusyIndicatorStyle.qml b/components/custom/styles/default/BusyIndicatorStyle.qml deleted file mode 100644 index 83ef46fd..00000000 --- a/components/custom/styles/default/BusyIndicatorStyle.qml +++ /dev/null @@ -1,21 +0,0 @@ -import QtQuick 1.0 - -QtObject { - property Component background: - Component { - Image { - opacity: running ? 1.0 : 0.7 //mm Should the rotation fade and stop when indicator is !enabled? - source: "images/spinner.png"; - fillMode: Image.PreserveAspectFit - smooth: true - - property int steps: 12 - property int rotationStep: 0 - rotation: rotationStep*(360/steps) - NumberAnimation on rotationStep { - running: busyIndicator.running; from: 0; to: steps; //mm see QTBUG-15652 - loops: Animation.Infinite; duration: 1000 // 1s per revolution - } - } - } -} diff --git a/components/custom/styles/default/ButtonBlockStyle.qml b/components/custom/styles/default/ButtonBlockStyle.qml deleted file mode 100644 index f0bed865..00000000 --- a/components/custom/styles/default/ButtonBlockStyle.qml +++ /dev/null @@ -1,77 +0,0 @@ -import QtQuick 1.0 - -QtObject { - property int minimumWidth: 90 - property int minimumHeight: 32 - - property int leftMargin : 8 - property int topMargin: 8 - property int rightMargin: 8 - property int bottomMargin: 8 - - property Component background: - Component { - id: defaultBackground - Item { - opacity: enabled ? 1 : 0.7 - Rectangle { // Background center fill - anchors.fill: parent - anchors.leftMargin: adjoining&Qt.Horizontal ? 0 : 2 - anchors.rightMargin: anchors.leftMargin - anchors.topMargin: adjoining&Qt.Vertical ? 0 : 2 - anchors.bottomMargin: anchors.topMargin - - radius: adjoining ? 0 : 5 - color: !styledItem.checked ? backgroundColor : Qt.darker(backgroundColor) - } - BorderImage { - anchors.fill: parent - smooth: true - source: { - if(!adjoining) - return styledItem.pressed || styledItem.checked ? "images/button_pressed.png" : "images/button_normal.png"; - else if(adjoining&Qt.Horizontal) - return styledItem.pressed || styledItem.checked ? "images/buttongroup_h_pressed.png" : "images/buttongroup_h_normal.png"; - else // adjoining&Qt.Vertical - return styledItem.pressed || styledItem.checked ? "images/buttongroup_v_pressed.png" : "images/buttongroup_v_normal.png"; - } - border.left: 6; border.top: 6 - border.right: 6; border.bottom: 6 - } - } - } - - property Component label: - Component { - id: defaultLabel - Item { - width: row.width - height: row.height - anchors.centerIn: parent //mm see QTBUG-15619 - opacity: styledItem.enabled ? 1 : 0.5 - transform: Translate { - x: styledItem.pressed || styledItem.checked ? 1 : 0 - y: styledItem.pressed || styledItem.checked ? 1 : 0 - } - - Row { - id: row - anchors.centerIn: parent - spacing: 4 - Image { - source: styledItem.iconSource - anchors.verticalCenter: parent.verticalCenter - fillMode: Image.Stretch //mm Image should shrink if button is too small, depends on QTBUG-14957 - } - - Text { - color: styledItem.textColor - anchors.verticalCenter: parent.verticalCenter - text: styledItem.text - horizontalAlignment: Text.Center - elide: Text.ElideRight //mm can't make layout work as desired without implicit size support, see QTBUG-14957 - } - } - } - } -} diff --git a/components/custom/styles/default/ButtonStyle.qml b/components/custom/styles/default/ButtonStyle.qml deleted file mode 100644 index a0e5f330..00000000 --- a/components/custom/styles/default/ButtonStyle.qml +++ /dev/null @@ -1,102 +0,0 @@ -import QtQuick 1.1 - -QtObject { - property int minimumWidth: 90 - property int minimumHeight: 32 - - property int leftMargin: 8 - property int topMargin: 8 - property int rightMargin: 8 - property int bottomMargin: 8 - - property Component background: Component { - Item { - opacity: enabled ? 1 : 0.7 - clip: true // clip connected buttons, as they overlap to remove the rounded edjes - property bool isPositioned: position != "only" // only evaluate for rows and columns - - Item { - anchors.fill: parent - // Give connected buttons a negative styling margin, to make - // them overlap and the rounded edge can be clipped away - anchors.leftMargin: isPositioned && (position == "rightmost" || position =="h_middle") ? -leftMargin : 0 - anchors.rightMargin: isPositioned && (position == "leftmost" || position =="h_middle") ? -rightMargin : 0 - anchors.topMargin: isPositioned && (position == "bottom" || position =="v_middle") ? -bottomMargin : 0 - anchors.bottomMargin: isPositioned && (position == "top" || position =="v_middle") ? -topMargin : 0 - - Rectangle { // Background center fill - anchors.fill: parent - anchors.leftMargin: anchors.leftMargin - anchors.rightMargin: anchors.rightMargin - anchors.topMargin: anchors.topMargin - anchors.bottomMargin: anchors.bottomMargin - radius: 5 - color: backgroundColor - } - BorderImage { - anchors.fill: parent - smooth: true - source: pressed || checked ? "images/button_pressed.png" : "images/button_normal.png"; - border.left: 6; border.top: 6 - border.right: 6; border.bottom: 6 - } - } - - // Draw straight border lines between connected buttons - Rectangle { - width: 1 - visible: isPositioned && !checked && !pressed && (position == "rightmost" || position == "h_middle") - anchors.top: parent.top - anchors.topMargin: 2 - anchors.bottomMargin: 2 - anchors.bottom: parent.bottom - anchors.left: parent.left - opacity: 0.4 - color: "white" - } - Rectangle { - width: 1 - opacity: 0.4 - visible: isPositioned && !checked && !pressed && (position == "leftmost" || position == "h_middle") - anchors.top: parent.top - anchors.topMargin: 2 - anchors.bottomMargin: 2 - anchors.bottom: parent.bottom - anchors.right: parent.right - color: "black" - } - } - } - - property Component label: Component { - Item { - implicitWidth: row.implicitWidth - implicitHeight: row.implicitHeight - - opacity: enabled ? 1 : 0.5 - transform: Translate { - x: pressed || checked ? 1 : 0 - y: pressed || checked ? 1 : 0 - } - - Row { - id: row - anchors.centerIn: parent - spacing: 4 - Image { - source: iconSource - anchors.verticalCenter: parent.verticalCenter - fillMode: Image.Stretch //mm Image should shrink if button is too small, depends on QTBUG-14957 - } - - Text { - color: textColor - anchors.verticalCenter: parent.verticalCenter - text: styledItem.text - horizontalAlignment: Text.Center - elide: Text.ElideRight //mm can't make layout work as desired without implicit size support, see QTBUG-14957 - } - } - } - } -} diff --git a/components/custom/styles/default/CheckBoxStyle.qml b/components/custom/styles/default/CheckBoxStyle.qml deleted file mode 100644 index f5e5fdde..00000000 --- a/components/custom/styles/default/CheckBoxStyle.qml +++ /dev/null @@ -1,34 +0,0 @@ -import QtQuick 1.1 - -QtObject { - property int minimumWidth: 32 - property int minimumHeight: 32 - - property Component background: Component { - Item { - width: styledItem.implicitWidth; height: styledItem.implicitHeight - opacity: enabled ? 1 : 0.7 - Rectangle { // Background center fill - anchors.fill: parent - anchors.margins: 1 - radius: 5 - color: backgroundColor - } - BorderImage { - anchors.fill: parent - source: "images/lineedit_normal.png" - smooth: true - border.left: 6; border.top: 3 - border.right: 6; border.bottom: 3 - } - } - } - - property Component checkmark: Component { - Image { - source: "images/checkbox_check.png" - opacity: (!enabled && checked) || pressed == true ? 0.5 : (!checked ? 0 : 1) - Behavior on opacity { NumberAnimation { duration: 150; easing.type: Easing.OutCubic } } - } - } -} diff --git a/components/custom/styles/default/ChoiceListStyle.qml b/components/custom/styles/default/ChoiceListStyle.qml deleted file mode 100644 index 12b10ffd..00000000 --- a/components/custom/styles/default/ChoiceListStyle.qml +++ /dev/null @@ -1,100 +0,0 @@ -import QtQuick 1.0 - -QtObject { - property int minimumWidth: 200 - property int minimumHeight: 32 - - property int leftMargin: 8 - property int topMargin: 8 - property int rightMargin: 34 - property int bottomMargin: 8 - - property Component background: Component { - Item { - opacity: enabled ? 1 : 0.8 - Rectangle { // Background center fill - anchors.fill: parent - anchors.margins: 1 - color: backgroundColor - radius: 5 - } - BorderImage { - anchors.fill: parent - id: backgroundimage - smooth: true - source: styledItem.pressed ? "images/button_pressed.png" : "images/button_normal.png" - width: 80; height: 24 - border.left: 3; border.top: 3 - border.right: 3; border.bottom: 3 - Image { - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: 10 - opacity: enabled ? 1 : 0.3 - source:"images/spinbox_down.png" - } - } - } - } - - property Component label: Component { - Text { - id:t - color: textColor - text: model && currentIndex >= 0 ? model.get(currentIndex).text : "" - opacity: enabled ? 1 : 0.5 - } - } - - // Popout styling - - property Component popupFrame: Component { - Item { - Behavior on opacity { NumberAnimation { easing.type: Easing.OutQuad; duration: 250 } } - - anchors.leftMargin: 6 - anchors.topMargin: 6 - anchors.rightMargin: 7 - anchors.bottomMargin: 6 - - Rectangle { // Background center fill - anchors.fill: parent - anchors.margins: 1 - color: backgroundColor - radius: 5 - } - BorderImage { - anchors.fill: parent - id: backgroundimage - smooth: true - source: "images/button_normal.png" - width: 80; height: 24 - border.left: 5; border.top: 5 - border.right: 5; border.bottom: 5 - } - } - } - - property Component listItem: Component { - Rectangle { - width: styledItem.width - height: Math.max(itemText.height, 28) - color: highlighted ? "#556699" : "transparent" - radius:2 - border.width:1 - border.color:Qt.darker(color) - clip:true - Text { - id: itemText - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 6 - - font.bold: index == currentIndex - color: highlighted ? "white" : styledItem.textColor - anchors.margins: 10 - text: model ? model.get(index).text : "" // list properties can't be automatically be added to the scope, so use get() - } - } - } -} diff --git a/components/custom/styles/default/ProgressBarStyle.qml b/components/custom/styles/default/ProgressBarStyle.qml deleted file mode 100644 index 7cb9795c..00000000 --- a/components/custom/styles/default/ProgressBarStyle.qml +++ /dev/null @@ -1,142 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Components project on Qt Labs. -** -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions contained -** in the Technology Preview License Agreement accompanying this package. -** -** 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -****************************************************************************/ - -import QtQuick 1.0 - -QtObject { - property int minimumWidth: 200 - property int minimumHeight: 25 - - property int leftMargin: 0 - property int rightMargin: 0 - property int topMargin: 0 - property int bottomMargin: 0 - - property Component background: Component { - Item{ - Rectangle{ - anchors.fill:parent - width: parent.width-2 - height: parent.height-2 - color: backgroundColor - radius: 5 - } - BorderImage { - anchors.fill:parent - source:"images/progressbar_groove.png" - border.left:10; border.right:10 - border.top:10; border.bottom:10 - } - } - } - - property Component progress: Component { // progress bar, known duration - BorderImage { // green progress indication - id:progress - opacity: styledItem.enabled ? 1: 0.7 - source: complete > 0.95 ? - "images/progressbar_indeterminate.png" : "images/progressbar_fill.png" - border.left:complete > 0.1 ? 6: 2; - border.right:complete > 0.1 ? 6: 2 - border.top:10; border.bottom:10 - clip:true - - Rectangle{ - anchors.fill:progress - color: styledItem.progressColor - z:-1 - radius:2 - smooth:true - clip:true - anchors.rightMargin:0 - anchors.margins:1 - Image { - id: overlay - NumberAnimation on x { - loops:Animation.Infinite; - from:0; - to:-overlay.sourceSize.width; - duration:2000 - } - width:styledItem.width + sourceSize.width - height:styledItem.height - fillMode:Image.Tile - source: "images/progressbar_overlay.png" - } - } - } - } - - property Component indeterminateProgress: Component { // progress bar, unknown duration - Item { - id: bar - anchors.fill:parent - onWidthChanged:indicator.x = width-indicator.width - BorderImage { - id:indicator - opacity: styledItem.enabled ? 1: 0.7 - Behavior on x { - NumberAnimation{easing.type:Easing.Linear; duration:1000} - } - onXChanged: { - var w = bar.width - indicator.width - if (x == w) x = 0 - else if (x==0) x = w - } - width: 80 - height: parent.height - source:"images/progressbar_indeterminate.png" - border.left:10 ; border.right:10 - border.top:10 ; border.bottom:10 - clip:true - - Rectangle{ - anchors.fill:indicator - color: styledItem.progressColor - z:-1 - radius:2 - smooth:true - clip:true - anchors.rightMargin:0 - anchors.margins:1 - Image { - id: overlay - NumberAnimation on x { - loops:Animation.Infinite; - from:0; - to:-overlay.sourceSize.width; - duration:2000 - } - width:styledItem.width + sourceSize.width - height:styledItem.height - fillMode:Image.Tile - source: "images/progressbar_overlay.png" - } - } - } - } - } -} diff --git a/components/custom/styles/default/RadioButtonStyle.qml b/components/custom/styles/default/RadioButtonStyle.qml deleted file mode 100644 index 0381993e..00000000 --- a/components/custom/styles/default/RadioButtonStyle.qml +++ /dev/null @@ -1,34 +0,0 @@ -import QtQuick 1.1 -import "tools" as StyleTools - -QtObject { - property int minimumWidth: 32 - property int minimumHeight: 32 - - property Component background: Component { - Item { - width: styledItem.implicitWidth; height: styledItem.implicitHeight - Rectangle { // Background center fill - anchors.fill: parent - anchors.margins: 1 - radius: width/2 - color: backgroundColor - } - Image { - opacity: enabled ? 1 : 0.7 - source: "images/radiobutton_normal.png" - fillMode: Image.Stretch - anchors.centerIn: parent - } - } - } - - property Component checkmark: Component { - Image { - StyleTools.ColorConverter { id: cc; color: backgroundColor } - source: cc.grayValue() < 70? "images/radiobutton_check_white.png" : "images/radiobutton_check.png" - opacity: (!enabled && checked) || pressed == true ? 0.5 : (!checked ? 0 : 1) - Behavior on opacity { NumberAnimation { duration: 150; easing.type: Easing.OutCubic } } - } - } -} diff --git a/components/custom/styles/default/ScrollIndicatorStyle.qml b/components/custom/styles/default/ScrollIndicatorStyle.qml deleted file mode 100644 index 8e8826cd..00000000 --- a/components/custom/styles/default/ScrollIndicatorStyle.qml +++ /dev/null @@ -1,18 +0,0 @@ -import QtQuick 1.0 - -QtObject { - property int minimumWidth: 12 - property int minimumHeight: 40 - - property Component content: Component { - Item { - Rectangle { - anchors.fill: parent - anchors.margins: 3 - border.color: "black" - color: "gray" - radius: width/2 - } - } - } -} diff --git a/components/custom/styles/default/SliderStyle.qml b/components/custom/styles/default/SliderStyle.qml deleted file mode 100644 index d32f13eb..00000000 --- a/components/custom/styles/default/SliderStyle.qml +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Components project on Qt Labs. -** -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions contained -** in the Technology Preview License Agreement accompanying this package. -** -** 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -****************************************************************************/ - -import QtQuick 1.0 - -QtObject { - - property int minimumWidth: 200 - property int minimumHeight: 40 - - property int leftMargin : 2 - property int topMargin: 0 - property int rightMargin: 2 - property int bottomMargin: 0 - - property Component groove: Item { - opacity: enabled ? 1.0 : 0.7 - - Rectangle { - color: backgroundColor - anchors.fill: sliderBackground - anchors.margins: 1 - radius: 2 - } - - Rectangle { - property real zeroPos : positionForValue(0) - property real handlePos: handlePosition - color: progressColor - height: 10 - radius: 4 - anchors.verticalCenter: parent.verticalCenter - x: zeroPos - width: handlePos - x - } - - BorderImage { - id: sliderBackground - anchors.verticalCenter: parent.verticalCenter - width: parent.width - border.top: 2 - border.bottom: 2 - border.left: 12 - border.right: 12 - source: "images/slider.png" - } - } - - property Component handle: Item { - width: handleImage.width - height: handleImage.height - anchors.verticalCenter: parent.verticalCenter - - Image { - id: handleImage - Rectangle { - anchors.centerIn: parent - anchors.horizontalCenterOffset: -1 - width: parent.width - 7 - height: parent.height - 7 - smooth: true - color: backgroundColor - radius: Math.floor(parent.width / 2) - z: -1 // behind the image - } - anchors.centerIn: parent; - source: "images/handle.png" - smooth: true - } - } - - property Component valueIndicator: Rectangle { - width: valueText.width + 20 - height: valueText.height + 20 - color: "gray" - opacity: pressed ? 0.9 : 0 - Behavior on opacity { NumberAnimation { duration: 100 } } - radius: 5 - - Text { - id: valueText - anchors.margins: 10 - anchors.centerIn: parent - text: indicatorText - } - } -} diff --git a/components/custom/styles/default/SpinBoxStyle.qml b/components/custom/styles/default/SpinBoxStyle.qml deleted file mode 100644 index d42267d8..00000000 --- a/components/custom/styles/default/SpinBoxStyle.qml +++ /dev/null @@ -1,73 +0,0 @@ -import QtQuick 1.0 - -QtObject { - - property int minimumWidth: 200 - property int minimumHeight: 25 - - property int leftMargin : 8 - property int topMargin: 8 - property int rightMargin: 8 - property int bottomMargin: 8 - - property Component background: - Component { - id: defaultBackground - Item { - opacity: enabled ? 1 : 0.7 - Rectangle { - x: 1 - y: 1 - width: parent.width-2 - height: parent.height-2 - color: backgroundColor - radius: 5 - } - - BorderImage { - anchors.fill: parent - id: backgroundimage - smooth: true - source: "images/lineedit_normal.png" - border.left: 6; border.top: 6 - border.right: 50; border.bottom: 6 - } - } - } - - property Component up: - Component { - id: defaultUp - Item { - anchors.right: parent.right - anchors.top: parent.top - width: 24 - height: parent.height/2 - Image { - anchors.left: parent.left; - anchors.top: parent.top; - anchors.topMargin: 7 - opacity: (upEnabled && enabled) ? (upPressed ? 1 : 0.8) : 0.3 - source: "images/spinbox_up.png" - } - } - } - - property Component down: - Component { - id: defaultDown - Item { - anchors.right: parent.right - anchors.bottom: parent.bottom - width: 24 - height: parent.height/2 - Image { - anchors.left: parent.left; - anchors.bottom: parent.bottom; - anchors.bottomMargin: 7 - opacity: (downEnabled && enabled) ? (downPressed ? 1 : 0.8) : 0.3 - source: "images/spinbox_down.png" - } - } - } -} diff --git a/components/custom/styles/default/SwitchStyle.qml b/components/custom/styles/default/SwitchStyle.qml deleted file mode 100644 index 35e6f235..00000000 --- a/components/custom/styles/default/SwitchStyle.qml +++ /dev/null @@ -1,71 +0,0 @@ -import QtQuick 1.1 - -QtObject { - property int minimumWidth: 80 - property int minimumHeight: 32 - - property Component groove: Component { - Item { - opacity: enabled ? 1 : 0.7 - Rectangle { // Background center fill - anchors.fill: parent - anchors.margins: 1 - radius: 5 - color: backgroundColor - } - - Item { // Clipping container of the positive and negative groove highlight - anchors.fill: parent - anchors.margins: 2 - clip: true - - Item { // The highlight item is twice the width of there switch, clipped by its parent, - // and sliding back and forth keeping the center under the handle - height: parent.height - width: 2*parent.width - x: handleCenterX-parent.width-parent.anchors.leftMargin - - Rectangle { // positive background highlight - color: positiveHighlightColor - opacity: 0.8 - anchors.top: parent.top; anchors.bottom: parent.bottom - anchors.left: parent.left; anchors.right: parent.horizontalCenter - } - Rectangle { // negative background highlight - color: negativeHighlightColor - opacity: 0.8 - anchors.top: parent.top; anchors.bottom: parent.bottom - anchors.left: parent.horizontalCenter; anchors.right: parent.right - } - } - } - - BorderImage { // Rounded border - anchors.fill: parent - source: "images/lineedit_normal.png" - border { left: 6; right: 6; top: 3; bottom: 3 } - smooth: true - } - } - } - - property Component handle: Component { - Item { - width: 42 - Rectangle { // center fill - anchors.fill: parent - anchors.margins: 1 - radius: 5 - color: switchColor - } - BorderImage { - anchors.fill: parent - opacity: enabled ? 1 : 0.7 - smooth: true - source: pressed ? "images/button_pressed.png" : "images/button_normal.png" - border { left: 4; top: 4; right: 4; bottom: 4 } - } - Behavior on x { NumberAnimation { easing.type: Easing.OutCubic; duration: 200 } } - } - } -} diff --git a/components/custom/styles/default/TextFieldStyle.qml b/components/custom/styles/default/TextFieldStyle.qml deleted file mode 100644 index 38da6b0d..00000000 --- a/components/custom/styles/default/TextFieldStyle.qml +++ /dev/null @@ -1,41 +0,0 @@ -import QtQuick 1.0 - -QtObject { - - property int minimumWidth: 200 - property int minimumHeight: 25 - - property int leftMargin : 8 - property int topMargin: 8 - property int rightMargin: 8 - property int bottomMargin: 8 - - property Component background: Component { - Item { // see QTBUG-14873 - Rectangle { // Background center fill - anchors.fill: parent - anchors.margins: 1 - radius: 5 - color: backgroundColor - } - BorderImage { // Background border - opacity: enabled ? 1 : 0.7 - anchors.fill: parent - border.left: 6; border.top: 6 - border.right: 6; border.bottom: 6 - smooth: true - source: "images/lineedit_normal.png" - } - } - } - - property Component hints: Component { - Item { - property color textColor: "#444" - property color backgroundColor: "white" - property int fontPixelSize: 14 - property bool fontBold: false - property int passwordEchoMode: TextInput.PasswordEchoOnEdit - } - } -} diff --git a/components/custom/styles/default/images/button_normal.png b/components/custom/styles/default/images/button_normal.png Binary files differdeleted file mode 100644 index e54f1acb..00000000 --- a/components/custom/styles/default/images/button_normal.png +++ /dev/null diff --git a/components/custom/styles/default/images/button_pressed.png b/components/custom/styles/default/images/button_pressed.png Binary files differdeleted file mode 100644 index b7a63f1a..00000000 --- a/components/custom/styles/default/images/button_pressed.png +++ /dev/null diff --git a/components/custom/styles/default/images/buttongroup_h_normal.png b/components/custom/styles/default/images/buttongroup_h_normal.png Binary files differdeleted file mode 100644 index bae59381..00000000 --- a/components/custom/styles/default/images/buttongroup_h_normal.png +++ /dev/null diff --git a/components/custom/styles/default/images/buttongroup_h_pressed.png b/components/custom/styles/default/images/buttongroup_h_pressed.png Binary files differdeleted file mode 100644 index e0c97fd5..00000000 --- a/components/custom/styles/default/images/buttongroup_h_pressed.png +++ /dev/null diff --git a/components/custom/styles/default/images/checkbox_check.png b/components/custom/styles/default/images/checkbox_check.png Binary files differdeleted file mode 100644 index a2f1f02d..00000000 --- a/components/custom/styles/default/images/checkbox_check.png +++ /dev/null diff --git a/components/custom/styles/default/images/handle.png b/components/custom/styles/default/images/handle.png Binary files differdeleted file mode 100644 index bd8fbddf..00000000 --- a/components/custom/styles/default/images/handle.png +++ /dev/null diff --git a/components/custom/styles/default/images/lineedit_normal.png b/components/custom/styles/default/images/lineedit_normal.png Binary files differdeleted file mode 100644 index 2253d33f..00000000 --- a/components/custom/styles/default/images/lineedit_normal.png +++ /dev/null diff --git a/components/custom/styles/default/images/progress-bar-background.png b/components/custom/styles/default/images/progress-bar-background.png Binary files differdeleted file mode 100644 index 4f30927e..00000000 --- a/components/custom/styles/default/images/progress-bar-background.png +++ /dev/null diff --git a/components/custom/styles/default/images/progress-bar-bar.png b/components/custom/styles/default/images/progress-bar-bar.png Binary files differdeleted file mode 100644 index 446c13f2..00000000 --- a/components/custom/styles/default/images/progress-bar-bar.png +++ /dev/null diff --git a/components/custom/styles/default/images/progressbar_fill.png b/components/custom/styles/default/images/progressbar_fill.png Binary files differdeleted file mode 100644 index 0f877896..00000000 --- a/components/custom/styles/default/images/progressbar_fill.png +++ /dev/null diff --git a/components/custom/styles/default/images/progressbar_groove.png b/components/custom/styles/default/images/progressbar_groove.png Binary files differdeleted file mode 100644 index 263ced8b..00000000 --- a/components/custom/styles/default/images/progressbar_groove.png +++ /dev/null diff --git a/components/custom/styles/default/images/progressbar_indeterminate.png b/components/custom/styles/default/images/progressbar_indeterminate.png Binary files differdeleted file mode 100644 index 7ea46460..00000000 --- a/components/custom/styles/default/images/progressbar_indeterminate.png +++ /dev/null diff --git a/components/custom/styles/default/images/progressbar_overlay.png b/components/custom/styles/default/images/progressbar_overlay.png Binary files differdeleted file mode 100644 index 8e351f96..00000000 --- a/components/custom/styles/default/images/progressbar_overlay.png +++ /dev/null diff --git a/components/custom/styles/default/images/qt-logo.png b/components/custom/styles/default/images/qt-logo.png Binary files differdeleted file mode 100644 index 005ee5ca..00000000 --- a/components/custom/styles/default/images/qt-logo.png +++ /dev/null diff --git a/components/custom/styles/default/images/radiobutton_check.png b/components/custom/styles/default/images/radiobutton_check.png Binary files differdeleted file mode 100644 index 3d433860..00000000 --- a/components/custom/styles/default/images/radiobutton_check.png +++ /dev/null diff --git a/components/custom/styles/default/images/radiobutton_check_white.png b/components/custom/styles/default/images/radiobutton_check_white.png Binary files differdeleted file mode 100644 index b68e7a69..00000000 --- a/components/custom/styles/default/images/radiobutton_check_white.png +++ /dev/null diff --git a/components/custom/styles/default/images/radiobutton_normal.png b/components/custom/styles/default/images/radiobutton_normal.png Binary files differdeleted file mode 100644 index 6ceab7ee..00000000 --- a/components/custom/styles/default/images/radiobutton_normal.png +++ /dev/null diff --git a/components/custom/styles/default/images/slider-background.png b/components/custom/styles/default/images/slider-background.png Binary files differdeleted file mode 100644 index 3ba9c473..00000000 --- a/components/custom/styles/default/images/slider-background.png +++ /dev/null diff --git a/components/custom/styles/default/images/slider-handle-active.png b/components/custom/styles/default/images/slider-handle-active.png Binary files differdeleted file mode 100644 index 83cec3f4..00000000 --- a/components/custom/styles/default/images/slider-handle-active.png +++ /dev/null diff --git a/components/custom/styles/default/images/slider-handle.png b/components/custom/styles/default/images/slider-handle.png Binary files differdeleted file mode 100644 index 765e610a..00000000 --- a/components/custom/styles/default/images/slider-handle.png +++ /dev/null diff --git a/components/custom/styles/default/images/slider.png b/components/custom/styles/default/images/slider.png Binary files differdeleted file mode 100644 index 3f310e37..00000000 --- a/components/custom/styles/default/images/slider.png +++ /dev/null diff --git a/components/custom/styles/default/images/spinbox_down.png b/components/custom/styles/default/images/spinbox_down.png Binary files differdeleted file mode 100644 index a6f3f79e..00000000 --- a/components/custom/styles/default/images/spinbox_down.png +++ /dev/null diff --git a/components/custom/styles/default/images/spinbox_up.png b/components/custom/styles/default/images/spinbox_up.png Binary files differdeleted file mode 100644 index a4841941..00000000 --- a/components/custom/styles/default/images/spinbox_up.png +++ /dev/null diff --git a/components/custom/styles/default/images/spinner.png b/components/custom/styles/default/images/spinner.png Binary files differdeleted file mode 100644 index 664c2b14..00000000 --- a/components/custom/styles/default/images/spinner.png +++ /dev/null diff --git a/components/custom/styles/default/images/switch_normal.png b/components/custom/styles/default/images/switch_normal.png Binary files differdeleted file mode 100644 index ac46b211..00000000 --- a/components/custom/styles/default/images/switch_normal.png +++ /dev/null diff --git a/components/custom/styles/default/images/switch_pressed.png b/components/custom/styles/default/images/switch_pressed.png Binary files differdeleted file mode 100644 index a04a3f4b..00000000 --- a/components/custom/styles/default/images/switch_pressed.png +++ /dev/null diff --git a/components/custom/styles/default/tools/ColorConverter.qml b/components/custom/styles/default/tools/ColorConverter.qml deleted file mode 100644 index 5070ff1e..00000000 --- a/components/custom/styles/default/tools/ColorConverter.qml +++ /dev/null @@ -1,59 +0,0 @@ -import QtQuick 1.0 - -// This helper element allows extracting color values -QtObject { - property color color; - - function intValue(dec) - { - var result; - switch (dec) { - case 'a': - result = 10; - break; - case 'b': - result = 11 - break; - case 'c': - result = 12; - break; - case 'd': - result = 13; - break; - case 'e': - result = 14 - case 'f': - result = 15 - break; - default: - result = dec - break; - } - return Number(result); - } - - function convertSubstring(val) { - return 16*intValue(val[0]) + intValue(val[1]) - } - - function grayValue() { - return (red + green + blue)/3 - } - - onColorChanged: { - var string = "" + color - var redString = string.substring(1, 3) - var greenString = string.substring(3,5) - var blueString = string.substring(5,7) - var alphaString = string.substring(7,9) - red = convertSubstring(string.substring(1, 3)) - green = convertSubstring(string.substring(3,5)) - blue = convertSubstring(string.substring(5,7)) - alpha = convertSubstring(string.substring(7,9)) - } - - property int red - property int green - property int blue - property int alpha -} diff --git a/components/custom/visuals/AdjoiningCorner.qml b/components/custom/visuals/AdjoiningCorner.qml deleted file mode 100644 index 92027cef..00000000 --- a/components/custom/visuals/AdjoiningCorner.qml +++ /dev/null @@ -1,31 +0,0 @@ -import QtQuick 1.0 - -Item { - property string corner: "" // Can we use Qt::Corner? see http://doc.trolltech.com/4.7/qt.html#Corner-enum - property alias styledItem: loader.styledItem - property alias adjoining: loader.adjoining - - clip: true - - anchors { - left: corner == "TopLeftCorner" || corner == "BottomLeftCorner" ? parent.left : parent.horizontalCenter - right: corner == "TopLeftCorner" || corner == "BottomLeftCorner" ? parent.horizontalCenter : parent.right - top: corner == "TopLeftCorner" || corner == "TopRightCorner" ? parent.top : parent.verticalCenter - bottom: corner == "TopLeftCorner" || corner == "TopRightCorner" ? parent.verticalCenter : parent.bottom - } - - Item { - width: parent.width*2 - height: parent.height*2 - x: corner == "TopLeftCorner" || corner == "BottomLeftCorner" ? 0 : -parent.width - y: corner == "TopLeftCorner" || corner == "TopRightCorner" ? 0 : -parent.height - - Loader { - id: loader - anchors.fill: parent - property Item styledItem:loader.styledItem - property int adjoining: 0x0 - sourceComponent: styling - } - } -} diff --git a/components/custom/visuals/AdjoiningVisual.qml b/components/custom/visuals/AdjoiningVisual.qml deleted file mode 100644 index 09bc34cc..00000000 --- a/components/custom/visuals/AdjoiningVisual.qml +++ /dev/null @@ -1,50 +0,0 @@ -import QtQuick 1.0 - -Item { - id: adjoiningVisual - property int adjoins: 0 // use enum Qt::DockWidgetArea? see http://doc.trolltech.com/4.7/qt.html#DockWidgetArea-enum - property Item styledItem - property Component styling - -// Qt::LeftDockWidgetArea 0x1 -// Qt::RightDockWidgetArea 0x2 -// Qt::TopDockWidgetArea 0x4 -// Qt::BottomDockWidgetArea 0x8 - - Item { - anchors.fill: parent - - AdjoiningCorner { corner: "TopLeftCorner"; adjoining: topLeftAdjoining(); styledItem: adjoiningVisual.styledItem } - AdjoiningCorner { corner: "TopRightCorner"; adjoining: topRightAdjoining(); styledItem: adjoiningVisual.styledItem } - AdjoiningCorner { corner: "BottomLeftCorner"; adjoining: bottomLeftAdjoining(); styledItem: adjoiningVisual.styledItem } - AdjoiningCorner { corner: "BottomRightCorner"; adjoining: bottomRightAdjoining(); styledItem: adjoiningVisual.styledItem } - } - - function topLeftAdjoining() { - var adjoining = 0; - if(adjoins&0x01) adjoining |= Qt.Horizontal; - if(adjoins&0x04) adjoining |= Qt.Vertical; - return adjoining; - } - - function topRightAdjoining() { - var adjoining = 0; - if(adjoins&0x02) adjoining |= Qt.Horizontal; - if(adjoins&0x04) adjoining |= Qt.Vertical; - return adjoining; - } - - function bottomLeftAdjoining() { - var adjoining = 0; - if(adjoins&0x01) adjoining |= Qt.Horizontal; - if(adjoins&0x08) adjoining |= Qt.Vertical; - return adjoining; - } - - function bottomRightAdjoining() { - var adjoining = 0; - if(adjoins&0x02) adjoining |= Qt.Horizontal; - if(adjoins&0x08) adjoining |= Qt.Vertical; - return adjoining; - } -} |