<commit_before>import QtQuick 2.0
import QuickAndroid 0.1
import QuickAndroid.style 0.1

Item {
    id : spinner

    property int currentIndex : -1
    property var currentItem;
    implicitWidth : button.implicitWidth
    height:  48 * A.dp

    property string mode : "Dropdown"

    property SpinnerStyle style: Style.theme.spinner
    property SpinnerItemStyle itemStyle : Style.theme.spinnerItem

    property alias delegate : dropDownList.delegate
    property alias model : dropDownList.model

    signal itemSelected(int index,Item item,var model);

    QuickButton {
        id : button
        background: spinner.style.background

        onClicked: {
            dropDownList.toggle();
        }

        height : 48 * A.dp
//        contentHeight : content.implicitHeight

        content: Text {
                id : content
                anchors.verticalCenter: parent.verticalCenter
                color : itemStyle.textStyle.textColor
                font.pixelSize: itemStyle.textStyle.textSize * A.dp
                elide : Text.ElideLeft
                maximumLineCount : 1
                wrapMode: Text.WrapAnywhere
        }
    }

    PopupMenu {
        id : dropDownList
        anchors.left: button.left
        anchors.top: button.bottom
        onItemSelected: {
            dropDownList.active = false;
            currentIndex = index;
            spinner.itemSelected(index,item,model);
        }
    }

    onCurrentIndexChanged: {
        if (currentIndex < 0 || currentIndex >= model.count) {
            content.text = "";
            return;
        }
        var item = model.get(currentIndex);
        currentItem = dropDownList.itemAt(currentIndex);
        content.text = item.title;
    }

    onModelChanged: {<commit_msg>Spinner.qml : The button text style should use the "style" property instead of "itemStyle" property<commit_after>import QtQuick 2.0
import QuickAndroid 0.1
import QuickAndroid.style 0.1

Item {
    id : spinner

    property int currentIndex : -1
    property var currentItem;
    implicitWidth : button.implicitWidth
    height:  48 * A.dp

    property string mode : "Dropdown"

    property SpinnerStyle style: Style.theme.spinner
    property SpinnerItemStyle itemStyle : Style.theme.spinnerItem

    property alias delegate : dropDownList.delegate
    property alias model : dropDownList.model

    signal itemSelected(int index,Item item,var model);

    QuickButton {
        id : button
        background: spinner.style.background

        onClicked: {
            dropDownList.toggle();
        }

        height : 48 * A.dp
//        contentHeight : content.implicitHeight

        content: Text {
                id : content
                anchors.verticalCenter: parent.verticalCenter
                elide : Text.ElideLeft
                maximumLineCount : 1
                wrapMode: Text.WrapAnywhere
                textStyle: spinner.style.textStyle
        }
    }

    PopupMenu {
        id : dropDownList
        anchors.left: button.left
        anchors.top: button.bottom
        onItemSelected: {
            dropDownList.active = false;
            currentIndex = index;
            spinner.itemSelected(index,item,model);
        }
    }

    onCurrentIndexChanged: {
        if (currentIndex < 0 || currentIndex >= model.count) {
            content.text = "";
            return;
        }
        var item = model.get(currentIndex);
        currentItem = dropDownList.itemAt(currentIndex);
        content.text = item.title;
    }

    onModelChanged: {
{'fraction_non_alphanumeric': 0.07534439134101771, 'fraction_numerical': 0.007309530503233062, 'mean_word_length': 1.9576059850374066, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5796901', 'n_tokens_mistral': 980, 'n_tokens_neox': 930, 'n_words': 224}