<commit_before>// Copyright (c) 2015 Ultimaker B.V.
// Uranium is released under the terms of the AGPLv3 or higher.

import QtQuick 2.1
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1

import UM 1.1 as UM

PreferencesPage {
    title: catalog.i18nc("@title:tab", "Setting Visibility");

    signal scrollToSection( string key )
    onScrollToSection: {
        var index = Math.max(0, settingList.model.find("id", key));
        var offsetY = settingList.itemAt(index).mapToItem(settingList, 0, 0).y;

        scrollView.flickableItem.contentY = offsetY;
    }

    function reset() {
    }
    resetEnabled: false;

    Item {
        id: base;
        anchors.fill: parent;
        TextField {
            id: filter;

            anchors {
                top: parent.top;
                left: parent.left;
                right: parent.right;
            }

            placeholderText: catalog.i18nc("@label:textbox", "Filter...");

            onTextChanged: settingCategoriesModel.filter(text);
        }
<commit_msg>Fix scrolling SettingVisibility page to the selected section<commit_after>// Copyright (c) 2015 Ultimaker B.V.
// Uranium is released under the terms of the AGPLv3 or higher.

import QtQuick 2.1
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1

import UM 1.1 as UM

PreferencesPage {
    title: catalog.i18nc("@title:tab", "Setting Visibility");

    property int scrollToIndex: 0

    signal scrollToSection( string key )
    onScrollToSection: {
        scrollToIndex = Math.max(0, settingList.model.find("id", key));
        //Delay finding the scroll offset until the scrollview has had time to fill up
        scrollToTimer.start()
    }

    function reset() {
    }
    resetEnabled: false;

    Item {
        id: base;
        anchors.fill: parent;

        Timer {
            id: scrollToTimer
            interval: 1
            repeat: false
            onTriggered: scrollView.flickableItem.contentY = settingList.itemAt(scrollToIndex).mapToItem(settingList, 0, 0).y 
        }

        TextField {
            id: filter;

            anchors {
                top: parent.top;
                left: parent.left;
                right: parent.right;
            }

            placeholderText: catalog.i18nc("@label:textbox", "Filter...");

            onTextChanged: settingCategoriesModel.filter(text);
        }

{'fraction_non_alphanumeric': 0.09773489932885907, 'fraction_numerical': 0.01761744966442953, 'mean_word_length': 2.1135770234986944, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1882195', 'n_tokens_mistral': 732, 'n_tokens_neox': 675, 'n_words': 184}