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

Abstract the ComboBox out

parent 85328440
import QtQuick 2.0
import QtQuick.Layouts 1.0
import QtQuick.Controls 1.4 as Controls
import org.kde.analitza 1.0
import widgets 1.0
......@@ -8,6 +7,12 @@ KAlgebraPage
{
id: page
anchors.margins: 0
function updateGraph() {
app.functionsModel().clear();
view.resetViewport();
view.addFunction(operators.data(operators.index(chosebox.currentIndex,3)), app.variables);
}
ColumnLayout {
id: descriptioncol
......@@ -15,30 +20,17 @@ KAlgebraPage
anchors.fill: parent
spacing: 10
Controls.ComboBox {
anchors {
left: parent.left
right: parent.right
}
ComboBox {
id: chosebox
currentIndex: 29
activeFocusOnPress: true
Layout.fillWidth: true
textRole: "display"
model: OperatorsModel {
id: operators
}
function updateGraph() {
app.functionsModel().clear();
view.resetViewport();
view.addFunction(operators.data(operators.index(chosebox.currentIndex,3)), app.variables);
console.log("falala", operators.itemData(operators.index(chosebox.currentIndex,3)))
}
onCurrentIndexChanged: {
updateGraph();
page.updateGraph();
}
}
......@@ -69,7 +61,7 @@ KAlgebraPage
}
model: app.functionsModel()
Component.onCompleted: {
chosebox.updateGraph();
page.updateGraph();
}
}
}
......
install( FILES
Label.qml Button.qml CalcButton.qml ExpressionInput.qml
RealInput.qml SimpleListView.qml
AddButton.qml Dialog.qml
AddButton.qml Dialog.qml ComboBox.qml
KAlgebraPage.qml KAlgebraMobile.qml
DESTINATION ${KDE_INSTALL_DATADIR}/kalgebramobile/plugins/widgets/
......
import Material 0.1
MenuField {
id: root
property alias currentIndex: root.selectedIndex
}
......@@ -9,3 +9,4 @@ KAlgebraPage 1.0 KAlgebraPage.qml
KAlgebraMobile 1.0 KAlgebraMobile.qml
AddButton 1.0 AddButton.qml
Dialog 1.0 Dialog.qml
ComboBox 1.0 ComboBox.qml
......@@ -2,6 +2,6 @@ install( FILES
Label.qml Button.qml CalcButton.qml ExpressionInput.qml
RealInput.qml SimpleListView.qml
KAlgebraPage.qml KAlgebraMobile.qml AddButton.qml Dialog.qml
KAlgebraPage.qml KAlgebraMobile.qml AddButton.qml Dialog.qml ComboBox.qml
DESTINATION ${KDE_INSTALL_DATADIR}/kalgebramobile/plugins/widgets/
)
import QtQuick.Controls 1.3
ComboBox
{}
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