You are not logged in.

1

Wednesday, January 10th 2018, 2:36pm

Qt Quick Controls - Change Header Size

Hello everyone,

Can I change the Size of an "header:" Section in QML? Every time I try to get more then one line something like that on this happens:



... but both lines should be (on this one) orange with text centered etc.! for just the Toolbar or just the text it works perfectly fine, both together and it looks like on the image.

The Code I use:

Source code

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
    header: ColumnLayout {
        spacing: 0
        id: topBar
        ToolBar {
            z: 99
            RowLayout {




                anchors.fill: parent
                ToolButton {
                    contentItem: Image {
                        horizontalAlignment: Image.AlignHCenter
                        verticalAlignment: Image.AlignVCenter
                        width: menu.Width * 0.40
                        height: menu.Height * 0.40
                        anchors.fill: iconFill
                        source: stackView.depth
                                > 1 ? "qrc:/images/ic_arrow_back.svg" : "qrc:/images/ic_menu.svg"
                        fillMode: Image.PreserveAspectFit
                    }
                    onClicked: {
                        if (stackView.depth > 1) {
                            stackView.pop()
                            listView.currentIndex = -1
                        }
                    }
                }
                Label {
                    text: "abv"
                    elide: Label.ElideRight
                    horizontalAlignment: Qt.AlignHCenter
                    verticalAlignment: Qt.AlignVCenter
                    Layout.fillWidth: true
                }
                ToolButton {
                    text: qsTr("⋮")
                    onClicked: menu.open()
                    Menu {
                        id: menu
                        y: parent.height


                        MenuItem {
                            text: "New..."
                        }
                        MenuItem {
                            text: "Open..."
                        }
                        MenuItem {
                            text: "Save"
                        }
                    }
                }
            }
        }


        Label {
            text: "Data Data Data"
            elide: Label.ElideRight
            horizontalAlignment: Qt.AlignHCenter
            verticalAlignment: Qt.AlignVCenter
            Layout.fillWidth: true
        }
    }





Thanks for your Help!