From c6d52bd565f8dbcd7c8e4867b5c2178798ed01c4 Mon Sep 17 00:00:00 2001
From: Jens Bache-Wiig <jens.bache-wiig@nokia.com>
Date: Sun, 16 Oct 2011 17:04:57 +0200
Subject: [PATCH] Remove ChoiceList

It is completely redundant with ComboBox
---
 components/ChoiceList.qml        | 61 --------------------------------
 components/components.pro        |  1 -
 components/custom/ChoiceList.qml | 49 -------------------------
 components/custom/components.pro |  1 -
 components/custom/qmldir         |  1 -
 components/qmldir                |  1 -
 examples/TableViewGallery.qml    |  4 +--
 7 files changed, 2 insertions(+), 116 deletions(-)
 delete mode 100644 components/ChoiceList.qml
 delete mode 100644 components/custom/ChoiceList.qml

diff --git a/components/ChoiceList.qml b/components/ChoiceList.qml
deleted file mode 100644
index 82e624039..000000000
--- a/components/ChoiceList.qml
+++ /dev/null
@@ -1,61 +0,0 @@
-import QtQuick 1.1
-import "custom" as Components
-
-Components.ChoiceList {
-
-    id: choicelist
-
-    property int buttonHeight: backgroundItem.sizeFromContents(100, 18).height
-    property int buttonWidth: backgroundItem.sizeFromContents(100, 18).width
-
-    property string styleHint
-
-    implicitWidth: buttonHeight
-    implicitHeight: buttonWidth
-
-    topMargin: 4
-    bottomMargin: 4
-
-    background: StyleItem {
-        anchors.fill: parent
-        elementType: "combobox"
-        sunken: pressed
-        raised: !pressed
-        hover: containsMouse
-        enabled: choicelist.enabled
-        text: currentItemText
-        hasFocus: choicelist.focus
-        hint: choicelist.styleHint
-    }
-
-    listItem: Item {
-        id:item
-
-        height: 22
-        anchors.left: parent.left
-        width: choicelist.width
-        StyleItem {
-            anchors.fill: parent
-            elementType: "comboboxitem"
-            text: itemText
-            selected: highlighted
-
-        }
-    }
-    popupFrame: StyleItem {
-        property string popupLocation: backgroundItem.styleHint("comboboxpopup") ? "center" : "below"
-        property int fw: backgroundItem.pixelMetric("menupanelwidth");
-        anchors.leftMargin: backgroundItem.pixelMetric("menuhmargin") + fw
-        anchors.rightMargin: backgroundItem.pixelMetric("menuhmargin") + fw
-        anchors.topMargin: backgroundItem.pixelMetric("menuvmargin") + fw
-        anchors.bottomMargin: backgroundItem.pixelMetric("menuvmargin") + fw
-        elementType: "menu"
-
-        effect: DropShadow {
-            blurRadius: 18
-            color: "#90000000"
-            xOffset: 1
-            yOffset: 1
-        }
-    }
-}
diff --git a/components/components.pro b/components/components.pro
index 60f178fcc..a761830d0 100644
--- a/components/components.pro
+++ b/components/components.pro
@@ -34,7 +34,6 @@ QML_FILES = \
             SpinBox.qml \
             TabFrame.qml \
             TextArea.qml \
-            ChoiceList.qml \       
             ScrollArea.qml \
             SplitterRow.qml \
             SplitterColumn.qml \
diff --git a/components/custom/ChoiceList.qml b/components/custom/ChoiceList.qml
deleted file mode 100644
index 2f8818494..000000000
--- a/components/custom/ChoiceList.qml
+++ /dev/null
@@ -1,49 +0,0 @@
-import QtQuick 1.1
-import "./private" as Private
-
-Item {
-    id: choiceList
-
-    property alias model: popup.model
-    property alias currentIndex: popup.currentIndex
-    property alias currentText: popup.currentText
-    property alias popupOpen: popup.popupOpen
-    property alias containsMouse: popup.containsMouse
-    property alias pressed: popup.buttonPressed
-
-    property Component background: null
-    property Item backgroundItem: backgroundLoader.item
-    property Component listItem: null
-    property Component popupFrame: null
-
-    property int leftMargin: 0
-    property int topMargin: 0
-    property int rightMargin: 0
-    property int bottomMargin: 0
-
-    property string popupBehavior
-    width: 0
-    height: 0
-
-    property bool activeFocusOnPress: true
-
-    Loader {
-        id: backgroundLoader
-        property alias styledItem: choiceList
-        sourceComponent: background
-        anchors.fill: parent
-        property string currentItemText: model.get(currentIndex).text
-    }
-
-    Private.ChoiceListPopup {
-        // NB: This ChoiceListPopup is also the mouse area
-        // for the component (to enable drag'n'release)
-        id: popup
-        listItem: choiceList.listItem
-        popupFrame: choiceList.popupFrame
-    }
-
-    Keys.onSpacePressed: { choiceList.popupOpen = !choiceList.popupOpen }
-    Keys.onUpPressed: { if (currentIndex < model.count - 1) currentIndex++ }
-    Keys.onDownPressed: {if (currentIndex > 0) currentIndex-- }
-}
diff --git a/components/custom/components.pro b/components/custom/components.pro
index 4b4dffd48..e063d91d5 100644
--- a/components/custom/components.pro
+++ b/components/custom/components.pro
@@ -17,7 +17,6 @@ QML_FILES = \
         ButtonGroup.js \
         Button.qml \
         CheckBox.qml \
-        ChoiceList.qml \
         Splitter.qml \
         ProgressBar.qml \
         RadioButton.qml \
diff --git a/components/custom/qmldir b/components/custom/qmldir
index fb12b4aea..716e44fa0 100644
--- a/components/custom/qmldir
+++ b/components/custom/qmldir
@@ -6,7 +6,6 @@ Button 1.0 Button.qml
 ButtonColumn 1.0 ButtonColumn.qml
 ButtonRow 1.0 ButtonRow.qml
 CheckBox 1.0 CheckBox.qml
-ChoiceList 1.0 ChoiceList.qml
 ProgressBar 1.0 ProgressBar.qml
 Slider 1.0 Slider.qml
 SpinBox 1.0 SpinBox.qml
diff --git a/components/qmldir b/components/qmldir
index 433bfdf98..000c0218d 100644
--- a/components/qmldir
+++ b/components/qmldir
@@ -10,7 +10,6 @@ Tab 0.1 Tab.qml
 Frame 0.1 Frame.qml
 ScrollArea 0.1 ScrollArea.qml
 ScrollBar 0.1 ScrollBar.qml
-ChoiceList 0.1 ChoiceList.qml
 ComboBox 0.1 ComboBox.qml
 ToolButton 0.1 ToolButton.qml
 TextArea 0.1 TextArea.qml
diff --git a/examples/TableViewGallery.qml b/examples/TableViewGallery.qml
index cd642d2e1..e64a4429c 100644
--- a/examples/TableViewGallery.qml
+++ b/examples/TableViewGallery.qml
@@ -17,7 +17,7 @@ Rectangle {
             onPressed: editmenu.show(mouseX, mouseY)
         }
 
-        ChoiceList {
+        ComboBox {
             id: delegateChooser
             enabled: frame.current == 4 ? 1 : 0
             model: delegatemenu
@@ -117,7 +117,7 @@ Rectangle {
                 title: "DirModel"
 
                 TableView {
-                    model: FileSystemModel{}
+//                    model: FileSystemModel{}
                     anchors.fill: parent
                     anchors.margins: 12
 
-- 
GitLab