aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/codemodel/importscheck/005_compositeQmlCopyAndCpp/QtQuick/Controls/Private/style.js
blob: 54c81c73d154f513763341ff543cc6f11d42599a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

.pragma library

function underlineAmpersands(match, p1, p2, p3) {
    if (p2 === "&")
        return p1.concat(p2, p3)
    return p1.concat("<u>", p2, "</u>", 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)
}