aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/quickcontrols/fonts/main.qml
blob: 1610b5abb4b0490915b0a70c64ffecfeabda34b6 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick
import QtQuick.Controls
import QtQuick.Dialogs
import QtQuick.Layouts

ApplicationWindow {
    id: window
    visible: true
    width: 640
    height: 640
    title: qsTr("Font and Color Inheritance Test")
    font.pointSize: pointSizeSlider.value
    font.family: fontDialog.selectedFont.family
    palette.text: textColorDialog.selectedColor
    palette.buttonText: buttonTextColorDialog.selectedColor
    SystemPalette { id: systemPalette }

    header: ToolBar {
        RowLayout {
            width: parent.width
            Slider {
                id: pointSizeSlider
                from: 6
                to: 48
                value: 12
                stepSize: 1
                Layout.fillWidth: false
            }
            Label {
                text: pointSizeSlider.value + " pt " + font.family
            }
            Button {
                text: "Font…"
                palette.buttonText: systemPalette.buttonText
                Layout.fillWidth: false
                onClicked: fontDialog.open()
                FontDialog { id: fontDialog }
                Component.onCompleted: fontDialog.selectedFont = window.font
            }
            Item { Layout.fillWidth: true }
            Button {
                text: "Text…"
                palette.buttonText: textColorDialog.selectedColor
                Layout.fillWidth: false
                onClicked: textColorDialog.open()
                ColorDialog { id: textColorDialog }
                Component.onCompleted: textColorDialog.selectedColor = systemPalette.text
                Layout.margins: 3
                Layout.alignment: Qt.AlignRight
            }
            Button {
                text: "Buttons…"
                Layout.fillWidth: false
                onClicked: buttonTextColorDialog.open()
                ColorDialog { id: buttonTextColorDialog }
                Component.onCompleted: buttonTextColorDialog.selectedColor = systemPalette.buttonText
                Layout.margins: 3
                Layout.alignment: Qt.AlignRight
            }
        }
    }

    Flickable {
        anchors.fill: parent
        contentWidth: layout.implicitWidth + 40
        contentHeight: layout.implicitHeight + 40

        ColumnLayout {
            id: layout
            anchors.fill: parent
            anchors.margins: 20
            Label {
                text: "Label with **Bold** *Italics* _Underline_ ~~Strikethrough~~ `Mono`"
                textFormat: Label.MarkdownText
            }
            Button {
                text: "Button"
                Layout.fillWidth: false
            }
            GroupBox {
                title: "GroupBox"
                Layout.fillWidth: false
                Layout.fillHeight: false
                ColumnLayout {
                    RadioButton { text: "RadioButton" }
                    CheckBox { text: "CheckBox" }
                }
            }
            Switch {
                text: "Switch"
                Layout.fillWidth: false
            }
            TabButton {
                text: "TabButton"
                Layout.fillWidth: false
            }
            TextField {
                placeholderText: "TextField"
                Layout.fillWidth: false
            }
            TextArea {
                placeholderText: "TextArea"
                Layout.fillWidth: false
                Layout.fillHeight: false
            }
            ToolButton {
                text: "ToolButton"
            }
            Tumbler {
                model: 3
                Layout.fillWidth: false
                Layout.fillHeight: false
            }
        }

        ScrollBar.vertical: ScrollBar { }
    }
}