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.Controls 1.2
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1
import org.subsurfacedivelog.mobile 1.0 import org.subsurfacedivelog.mobile 1.0
ApplicationWindow { ApplicationWindow {
title: qsTr("Subsurface") title: qsTr("Subsurface")
width: 500; width: 500;
height: 700
FileDialog { FileDialog {
id: fileOpen id: fileOpen
@ -23,24 +23,45 @@ ApplicationWindow {
id: manager id: manager
} }
menuBar: MenuBar { Preferences {
Menu { id: prefsWindow
title: qsTr("File")
MenuItem {
text: qsTr("Open")
onTriggered: fileOpen.open()
} }
MenuItem { ColumnLayout {
text: qsTr("Exit") id: layout
onTriggered: Qt.quit(); 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 { Rectangle {
id: page id: page
width: parent.width; height: parent.height Layout.fillHeight: true
Layout.fillWidth: true
Component { Component {
id: diveDelegate id: diveDelegate
@ -198,4 +219,5 @@ ApplicationWindow {
section.delegate: tripHeading section.delegate: tripHeading
} }
} }
}
} }