QML UI: add button to show the preferences window

Add a button in the main qml file to show the preferences window. This
window is linked to the QMLManager class, so any changes made will be
saved to the user's settings file.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
This commit is contained in:
Grace Karanja 2015-07-10 11:05:13 +03:00 committed by Dirk Hohndel
parent 956336ae1a
commit f01ec470e7

View file

@ -2,12 +2,12 @@ import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1
import org.subsurfacedivelog.mobile 1.0
ApplicationWindow {
title: qsTr("Subsurface")
width: 500;
height: 700
FileDialog {
id: fileOpen
@ -23,24 +23,45 @@ ApplicationWindow {
id: manager
}
menuBar: MenuBar {
Menu {
title: qsTr("File")
MenuItem {
text: qsTr("Open")
onTriggered: fileOpen.open()
Preferences {
id: prefsWindow
}
MenuItem {
text: qsTr("Exit")
onTriggered: Qt.quit();
ColumnLayout {
id: layout
anchors.fill: parent
spacing: 4
Rectangle {
id: topPart
height: 35
Layout.fillWidth: true
Layout.maximumHeight: 35
RowLayout {
Button {
id: prefsButton
text: "Preferences"
onClicked: {
prefsWindow.show()
}
}
Button {
id: openFile
text: "Open File"
onClicked: {
fileOpen.open();
}
}
}
}
Rectangle {
id: page
width: parent.width; height: parent.height
Layout.fillHeight: true
Layout.fillWidth: true
Component {
id: diveDelegate
@ -199,3 +220,4 @@ ApplicationWindow {
}
}
}
}