Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Desktop/components/JASP/Widgets/MainPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ Item
"functionCall" : functionCall
};

customMenu.toggle(resultsView, props, (optionsJSON['rXright'] + 10) * preferencesModel.uiScale, optionsJSON['rY'] * preferencesModel.uiScale);
customMenu.toggle(resultsView, props, (optionsJSON['rXright'] + 10 ) * preferencesModel.uiScale, optionsJSON['rY'] );

customMenu.scrollOri = resultsView.scrollPosition;
customMenu.menuScroll.x = Qt.binding(function() { return -1 * (resultsView.scrollPosition.x - customMenu.scrollOri.x) / resultsView.zoomFactor; });
Expand Down
60 changes: 60 additions & 0 deletions Desktop/components/JASP/Widgets/PlotEditor/PlotEditTabHead.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import JASP.Widgets as JASPW
import JASP.Theme
import JASP.Controls as JASPC
import JASP.PlotEditor

TabButton
{
id: refTab
height: axes.tabBarHeight + 2
clip: true

property string buttonText: "Fill me"

background: Rectangle
{
color: refTab.checked ? jaspTheme.uiBackground : jaspTheme.grayLighter
radius: axes.tabButtonRadius
border.width: 1
border.color: refTab.checked ? jaspTheme.uiBorder : jaspTheme.borderColor
height: axes.tabBarHeight + axes.tabButtonRadius


Rectangle
{
color: jaspTheme.uiBorder
height: 1
visible: !refTab.checked
anchors
{
left: parent.left
right: parent.right
top: parent.top
topMargin: axes.tabBarHeight + 1
}
}
}

contentItem: Text
{
// The bottom of buttons are hidden to remove their bottom line with the radius
// So the text has to be moved higher from the horizontal middle line.
topPadding: -axes.tabButtonRadius * 3/4
font: jaspTheme.font
color: jaspTheme.black
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
opacity: refTab.checked ? 1 : .6
text: buttonText
}

MouseArea
{
anchors.fill : parent
cursorShape : refTab.checked ? Qt.ArrowCursor : Qt.PointingHandCursor
acceptedButtons : Qt.NoButton
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import JASP

*/

Column
ColumnLayout
{
id: axis
spacing: jaspTheme.columnGroupSpacing
Expand All @@ -37,6 +37,8 @@ Column
label : qsTr("Show title")
checked : axisModel.titleType !== AxisModel.TitleNull
onClicked : axisModel.titleType = (checked ? AxisModel.TitleCharacter : AxisModel.TitleNull)

Layout.fillWidth: true

JASPC.TextField
{
Expand All @@ -56,6 +58,8 @@ Column
checked : axisModel.breaksType !== AxisModel.BreaksNull
onClicked : axisModel.breaksType = (checked ? lastBreakType : AxisModel.BreaksNull)
columns : 1

Layout.fillWidth: true

property int lastBreakType: AxisModel.BreaksRange

Expand Down Expand Up @@ -151,6 +155,7 @@ Column
{
title : qsTr("Advanced")
columns : 1
Layout.fillWidth: true

JASPC.CheckBox
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import JASP.Widgets as JASPW
import JASP.Theme
import JASP.Controls as JASPC
import JASP.PlotEditor
import JASP


JASPW.JASPDataView
{
id: jaspDataView
model: plotEditorModel.references

onWidthChanged: plotEditorModel.references.viewWidth = width

rowNumberDelegate: null

itemDelegate: Component { Loader
{

property int rowIdx: rowIndex
property int columnIdx: columnIndex
property string modelText: itemText
property var modelData: itemData
property bool modelEnabled: itemEnabled

sourceComponent: columnIndex === 0 ? typeSelector : columnIndex == 4 ? eraseButton : textView;
}}


editDelegate: Component { Loader
{

property int rowIdx: rowIndex
property int columnIdx: columnIndex
property string modelText: itemText
property var modelData: itemData
//property bool modelEnabled: itemEnabled

sourceComponent: textEdit
}}

Component
{
id: textView

Text
{
text: modelText == "" ? "..." : modelText;
font: jaspTheme.font;
color: enabled ? jaspTheme.textEnabled : jaspTheme.textDisabled;
enabled: modelEnabled
visible: enabled
MouseArea
{
anchors.fill: parent;
onClicked: jaspDataView.view.edit(rowIdx, columnIdx)
}

// opacity: rowIdx < jaspDataView.view.rowCount - 1 ? 1.0 : 0.5

}
}

Component
{
id: textEdit

TextInput
{
id: editItem
text: modelText
color: enabled ? jaspTheme.textEnabled : jaspTheme.textDisabled;
font: jaspTheme.font
focus: true
clip: true
//onTextEdited: jaspDataView.view.model.setData(jaspDataView.view.model.index(rowIdx, columnIdx), text)
onEditingFinished: {saveEdit(); jaspDataView.view.forceActiveFocus(); }
Keys.onReturnPressed: {saveEdit(); jaspDataView.view.forceActiveFocus(); }
Component.onCompleted: forceActiveFocus()
//enabled: modelEnabled
onActiveFocusChanged:
{
if(!activeFocus)
{

text = Qt.binding(function() {return modelText;});
}
}

function saveEdit()
{
jaspDataView.view.commitEdit(rowIdx, columnIdx, text);
jaspDataView.view.clearEdit();
}

//opacity: rowIdx < jaspDataView.view.rowCount - 1 ? 1.0 : 0.5
}
}

ListModel
{
id: typeModel

ListElement { value: 0; name: qsTr("Point") }
ListElement { value: 1; name: qsTr("Horizontal Line") }
ListElement { value: 2; name: qsTr("Vertical Line") }
}

Component
{
id: typeSelector

JASPC.DropDown
{
fieldWidth: width
source: typeModel
currentIndex: modelData
onValueChanged:
{
if(modelData != currentIndex)
jaspDataView.view.model.setData(jaspDataView.view.model.index(rowIdx, columnIdx), currentIndex);
}

//opacity: rowIdx < jaspDataView.view.rowCount - 1 ? 1.0 : 0.5
}
}

Component
{
id: eraseButton


JASPC.RectangularButton
{
text: "X"
onClicked: model.setData(model.index(rowIdx, columnIdx), true);
//visible: rowIdx < jaspDataView.view.rowCount - 1
}
}

}
Loading
Loading