Project

General

Profile

Actions

Known bugs and solutions

Desktop UI elements (QML Desktop components)

ToolBar

The following sample doesn't work correctly:

import QtQuick 1.1
import QtDesktop 0.1
ApplicationWindow {
   ToolBar {
        ToolButton {text: qsTr("Add account"); onClicked: {textItem.visible = !textItem.visible}}
    }

    Rectangle {
        anchors.fill: parent
        Text { id: textItem; text: "Test"}
    }
}

Because Rectangle override ToolBar. To fix it use the following

import QtQuick 1.1
import QtDesktop 0.1
ApplicationWindow {
   ToolBar {
        id: accountTools
        ToolButton {text: qsTr("Add account"); onClicked: {textItem.visible = !textItem.visible}}
    }

    Rectangle {
        anchors.top: accountTools.bottom
        anchors.bottom: parent.bottom
        anchors.left: parent.left
        anchors.right: parent.right
        Text { id: textItem; text: "Test"}
    }
}

Updated by Кирилл Кулаков over 12 years ago · 1 revisions