FontGroupBox.qml 3.06 KB
Newer Older
1
import Qt 4.7
2 3 4
import Bauhaus 1.0

GroupBox {
5
    id: fontGroupBox
6
    caption: qsTr("Font")
7
    property variant showStyle: false
8 9 10 11 12
    layout: VerticalLayout {

        QWidget {
            layout: HorizontalLayout {
                Label {
13
                    text: qsTr("Font")
14
                }
15

16
                FontComboBox {
17
                    backendValue: backendValues.font_family
18
                    baseStateFlag: isBaseState
19 20
                }
            }
21
        }        
22 23 24 25 26 27 28 29 30 31 32 33 34
        QWidget {
            id: sizeWidget
            property bool selectionFlag: selectionChanged
            
            property bool pixelSize: sizeType.currentText == "pixels"
            property bool isSetup;
            
            onSelectionFlagChanged: {
                isSetup = true;
                sizeType.currentText = "points";
                if (backendValues.font_pixelSize.isInModel)
                    sizeType.currentText = "pixels";
                isSetup = false;
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
            layout: HorizontalLayout {
                Label {
                    text: qsTr("Size")
                }
                SpinBox {
                    visible: !sizeWidget.pixelSize
                    backendValue: backendValues.font_pointSize
                    baseStateFlag: isBaseState;
                }                
                SpinBox {
                    visible: sizeWidget.pixelSize
                    backendValue: backendValues.font_pixelSize
                    baseStateFlag: isBaseState;
                }                
                QComboBox {
                    id: sizeType
                    maximumWidth: 60
                    items : { ["pixels", "points"] }
                    onCurrentTextChanged: {
                        if (sizeWidget.isSetup)
                            return;
                        if (currentText == "pixels") {
                            backendValues.font_pointSize.resetValue();
                            backendValues.font_pixelSize.value = 8;
                        } else {
                            backendValues.font_pixelSize.resetValue();
                            }
                    }
                }
            }
66
        }               
67 68 69
        QWidget {
            layout: HorizontalLayout {
                Label {
70
                    text: qsTr("Font style")
71
                }
72
                FontStyleButtons {}
73 74
            }
        }
75 76
        QWidget {
            visible: showStyle
77
            layout: HorizontalLayout {                
78
                Label {
79
                    text: qsTr("Style")
80 81
                }
                ComboBox {
82
                    baseStateFlag:isBaseState
83
                    backendValue: (backendValues.style === undefined) ? dummyBackendValue : backendValues.style
84
                    items : { ["Normal", "Outline", "Raised", "Sunken"] }
85
                    currentText: backendValue.value;
86
                    onItemsChanged: {
87
                        currentText =  backendValue.value;
88 89 90 91
                    }
                }
            }
        }
92 93
    }
}