~bzoltan/kubuntu-packaging/decouple_cmake_plugin

« back to all changes in this revision

Viewing changes to share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FontSection.qml

  • Committer: Timo Jyrinki
  • Date: 2013-11-15 12:25:23 UTC
  • mfrom: (1.1.28)
  • Revision ID: timo.jyrinki@canonical.com-20131115122523-i2kyamsu4gs2mu1m
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 
4
** Contact: http://www.qt-project.org/legal
 
5
**
 
6
** This file is part of the Qt Quick Controls module of the Qt Toolkit.
 
7
**
 
8
** $QT_BEGIN_LICENSE:BSD$
 
9
** You may use this file under the terms of the BSD license as follows:
 
10
**
 
11
** "Redistribution and use in source and binary forms, with or without
 
12
** modification, are permitted provided that the following conditions are
 
13
** met:
 
14
**   * Redistributions of source code must retain the above copyright
 
15
**     notice, this list of conditions and the following disclaimer.
 
16
**   * Redistributions in binary form must reproduce the above copyright
 
17
**     notice, this list of conditions and the following disclaimer in
 
18
**     the documentation and/or other materials provided with the
 
19
**     distribution.
 
20
**   * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
 
21
**     of its contributors may be used to endorse or promote products derived
 
22
**     from this software without specific prior written permission.
 
23
**
 
24
**
 
25
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
26
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
27
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 
28
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 
29
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
30
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 
31
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 
32
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 
33
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
34
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
35
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
 
36
**
 
37
** $QT_END_LICENSE$
 
38
**
 
39
****************************************************************************/
 
40
 
 
41
import QtQuick 2.1
 
42
import HelperWidgets 2.0
 
43
import QtQuick.Layouts 1.0
 
44
import QtQuick.Controls 1.0 as Controls
 
45
 
 
46
Section {
 
47
    anchors.left: parent.left
 
48
    anchors.right: parent.right
 
49
    caption: qsTr("Font")
 
50
 
 
51
    property bool showStyle: false
 
52
 
 
53
    property variant fontFamily: backendValues.font_family
 
54
    property variant pointSize: backendValues.font_pointSize
 
55
    property variant pixelSize: backendValues.font_pixelSize
 
56
 
 
57
    property variant boldStyle: backendValues.font_bold
 
58
    property variant italicStyle: backendValues.font_italic
 
59
    property variant underlineStyle: backendValues.font_underline
 
60
    property variant strikeoutStyle: backendValues.font_strikeout
 
61
 
 
62
    GridLayout {
 
63
        columns: 2
 
64
        rows: 3
 
65
        Label {
 
66
            text: qsTr("Font")
 
67
        }
 
68
        ComboBox {
 
69
            backendValue: backendValues.fontFamily
 
70
            Layout.fillWidth: true
 
71
            model: ["Arial"]
 
72
        }
 
73
 
 
74
        Label {
 
75
            text: qsTr("Size")
 
76
        }
 
77
 
 
78
        RowLayout {
 
79
            id: sizeWidget
 
80
            property bool selectionFlag: selectionChanged
 
81
 
 
82
            property bool pixelSize: sizeType.currentText === "pixels"
 
83
            property bool isSetup;
 
84
 
 
85
            onSelectionFlagChanged: {
 
86
                print("selection changed");
 
87
                isSetup = true;
 
88
                sizeType.currentText = "points";
 
89
                if (pixelSize.isInModel)
 
90
                    sizeType.currentText = "pixels";
 
91
                isSetup = false;
 
92
            }
 
93
 
 
94
            SpinBox {
 
95
                minimumValue: 0
 
96
                visible: !sizeWidget.pixelSize
 
97
                maximumValue: 400
 
98
                backendValue: pointSize
 
99
            }
 
100
 
 
101
            SpinBox {
 
102
                minimumValue: 0
 
103
                visible: sizeWidget.pixelSize
 
104
                maximumValue: 400
 
105
                backendValue: pixelSize
 
106
            }
 
107
 
 
108
            Controls.ComboBox {
 
109
                id: sizeType
 
110
                model: ["pixels", "points"]
 
111
                onCurrentIndexChanged: {
 
112
                    if (sizeWidget.isSetup)
 
113
                        return;
 
114
                    if (currentText == "pixels") {
 
115
                        pointSize.resetValue();
 
116
                        pixelSize.value = 8;
 
117
                    } else {
 
118
                        pixelSize.resetValue();
 
119
                    }
 
120
 
 
121
                }
 
122
 
 
123
                style: CustomComboBoxStyle {
 
124
                }
 
125
 
 
126
            }
 
127
 
 
128
        }
 
129
 
 
130
        Label {
 
131
            text: qsTr("Font style")
 
132
        }
 
133
        FontStyleButtons {
 
134
 
 
135
        }
 
136
 
 
137
        Label {
 
138
            visible: showStyle
 
139
            text: qsTr("Style")
 
140
        }
 
141
 
 
142
        ComboBox {
 
143
            visible: showStyle
 
144
            Layout.fillWidth: true
 
145
            backendValue: (backendValues.style === undefined) ? dummyBackendValue : backendValues.style
 
146
            model:  ["Normal", "Outline", "Raised", "Sunken"]
 
147
        }
 
148
    }
 
149
}