Commit eacb5bda authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Port to QtQuick.Controls 2.0

Hopefully will allow us to drop the material version, at least.
parent ec4e94bd
import QtQuick.Controls 1.1
import QtQuick.Controls 2.1
Button
RoundButton
{
id: root
text: "+"
anchors {
right: parent.right
bottom: parent.bottom
margins: 20
}
iconName: "list-add"
}
import QtQuick.Controls 1.0
import QtQuick.Controls 2.0
Button {
readonly property var iconDictionary: {
"list-add": "+"
}
property var iconName: "" //TODO
text: iconDictionary[iconName]
}
import QtQuick.Controls 1.3
import QtQuick.Controls 2.1
ComboBox
{}
import QtQuick 2.1
import QtQuick.Dialogs 1.2
import QtQuick.Controls 2.1
Dialog {
width: 100
Drawer {
edge: Qt.BottomEdge
width: parent.width
height: 100
default property Item fu
contentItem: fu
}
import QtQuick.Controls 1.0
import QtQuick.Controls 2.0
TextField
{
......
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick 2.2
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.1
import org.kde.analitza 1.0
import org.kde.kalgebra.mobile 1.0
......@@ -9,67 +10,70 @@ ApplicationWindow
height: 600
width: 600
visible: true
function goToPage(path, deco) {
header: ToolBar {
RowLayout {
anchors.fill: parent
ToolButton {
text: "\u2630"
onClicked: drawer.open()
}
Label {
text: "KAlgebra"
}
Item {
Layout.fillWidth: true
}
}
}
property string currentPath: pluginsModel.pluginPath(0)
onCurrentPathChanged: {
var component = Qt.createComponent(currentPath);
if (component.status == Component.Error) {
console.log("error", component.errorString());
return;
}
try {
var component = Qt.createComponent(path)
if (component.status == Component.Ready)
pageStack.push(component);
else
console.log("Error loading component:", component.errorString());
} catch (e) {
console.log("error: "+e)
stack.replace(component)
} catch(e) {
console.log("error", e)
}
drawer.position = 0
}
Component {
id: pluginsView
ListView {
spacing: 10
header: Image {
source: "qrc:/kalgebra.png"
anchors.horizontalCenter: parent.horizontalCenter
MouseArea {
anchors.fill: parent
onClicked: Qt.openUrlExternally("http://edu.kde.org/applications/mathematics/kalgebra/")
}
}
footer: Image {
source: "qrc:/kde-edu-logo.png"
anchors.horizontalCenter: parent.horizontalCenter
Drawer {
id: drawer
edge: Qt.LeftEdge
width: parent.width - 56 * 1
height: parent.height
MouseArea {
anchors.fill: parent
onClicked: Qt.openUrlExternally("http://edu.kde.org")
}
}
delegate:
Button {
ColumnLayout {
anchors.fill: parent
Repeater {
delegate: ItemDelegate {
Layout.fillWidth: true
text: title
onClicked: goToPage(model.path)
anchors.horizontalCenter: parent.horizontalCenter
highlighted: model.path == rootItem.currentPath
onClicked: {
rootItem.currentPath = model.path
}
}
model: PluginsModel { id: plugins }
}
}
model: PluginsModel {
id: pluginsModel
}
}
Action {
id: backAction
text: "Back"
shortcut: "Back"
tooltip: "Go back"
onTriggered: {
if (pageStack.depth==1)
Qt.quit();
else
pageStack.pop();
Item {
width: 5
Layout.fillHeight: true
}
}
}
StackView {
id: pageStack
initialItem: pluginsView
id: stack
anchors.fill: parent
}
}
import QtQuick 2.0
import QtQuick.Controls 2.0
Item
Page
{
property real dp: 1
}
import QtQuick.Controls 1.0
import QtQuick.Controls 2.0
Label {
}
import QtQuick.Controls 1.0
import QtQuick 2.0
import QtQuick.Controls 2.0
TextField
SpinBox
{
id: input
property alias minimumValue: realvalidator.bottom
property alias maximumValue: realvalidator.top
property alias minimumValue: input.from
property alias maximumValue: input.to
property string text
value: valueFromText(text)
property double value: parseFloat(text)
inputMethodHints: Qt.ImhDigitsOnly | Qt.ImhNoPredictiveText
validator: DoubleValidator { id: realvalidator }
onTextChanged: value=parseFloat(text)
Component.onCompleted: text=value
Row {
anchors {
right: parent.right
rightMargin: 2
}
spacing: 2
height: parent.height-4
y:2
Button {
text: "+"
height: parent.height
onClicked: {
if(input.value+1<maximumValue) {
input.text=(input.value+1)
}
}
}
Button {
text: "-"
onClicked: {
if(input.value-1>minimumValue) {
input.text=(input.value-1)
}
}
height: parent.height
}
}
signal accepted()
}
import QtQuick.Controls 2.1
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.1
ColumnLayout
ListView
{
id: viewItem
id: scrollList
property string role: ""
property string title: ""
property alias currentIndex: table.currentRow
property alias model: table.model
property Component delegate
property Component header
property Component footer
Loader {
Layout.fillWidth: true
sourceComponent: parent.header
}
TableView
{
id: table
Layout.fillWidth: true
Layout.fillHeight: true
TableViewColumn {
role: viewItem.role
title: viewItem.title
}
itemDelegate: Item {
Label {
anchors.verticalCenter: parent.verticalCenter
text: styleData.value
}
delegate: ItemDelegate {
Label {
text: model[role]
}
}
Loader {
Layout.fillWidth: true
sourceComponent: parent.footer
}
header: Label { visible: ListView.view.title!=""; text: ListView.view.title }
clip: true
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment