diff --git a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/InsertCharacter.qml b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/InsertCharacter.qml index 8162b09..7002539 100644 --- a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/InsertCharacter.qml +++ b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/InsertCharacter.qml @@ -16,9 +16,8 @@ * along with this program. If not, see . */ -import QtQuick import QtQuick.Controls -import QtQml.Models +import QtQuick /*! \qmltype InsertCharacter @@ -43,18 +42,15 @@ Popup { */ property string category: 'all' - width: insertGrid.width + 10 - height: insertGrid.height + 10 + width: 280 + height: Math.ceil(insertGrid.insertChars.length/insertGrid.columns)*(width/insertGrid.columns)+5 modal: true closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent - GridView { + Grid { id: insertGrid - width: 280 - height: Math.ceil(model.count/columns)*cellHeight - property int columns: 7 - cellWidth: width/columns - cellHeight: cellWidth + width: parent.width + columns: 7 property var insertCharsExpression: [ "∞","π","¹","²","³","⁴","⁵", @@ -90,34 +86,21 @@ Popup { }[insertPopup.category] } - model: ListModel {} - - delegate: Button { - id: insertBtn - width: insertGrid.cellWidth - height: insertGrid.cellHeight - text: chr - flat: text == " " - font.pixelSize: 18 - - onClicked: { - insertPopup.selected(text) - insertPopup.close() - } - } - - Component.onCompleted: function() { - for(const chr of insertChars) { - console.log("Appending", chr) - model.append({ 'chr': chr }) + Repeater { + model: parent.insertChars.length + + Button { + id: insertBtn + width: insertGrid.width/insertGrid.columns + height: width + text: insertGrid.insertChars[modelData] + flat: text == " " + font.pixelSize: 18 + + onClicked: { + selected(text) + } } } } - - function setFocus() { - insertGrid.currentIndex = 0 - insertGrid.forceActiveFocus() - } - - Keys.onEscapePressed: close() } diff --git a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/ExpressionEditor.qml b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/ExpressionEditor.qml index af32b43..8251a3f 100644 --- a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/ExpressionEditor.qml +++ b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/ExpressionEditor.qml @@ -500,41 +500,29 @@ Item { Button { id: insertButton + text: "α" anchors.right: parent.right anchors.rightMargin: 5 anchors.verticalCenter: parent.verticalCenter width: 20 height: width - - Icon { - id: icon - width: 12 - height: 12 - anchors.centerIn: parent - - color: sysPalette.windowText - source: '../icons/properties/expression.svg' - } - onClicked: { insertPopup.open() - insertPopup.setFocus() + insertPopup.focus = true } } P.InsertCharacter { id: insertPopup - x: parent.width - width - y: parent.height + x: Math.round((parent.width - width) / 2) + y: Math.round((parent.height - height) / 2) category: "expression" onSelected: function(c) { editor.insert(editor.cursorPosition, c) - } - - onClosed: function() { + insertPopup.close() focus = false editor.focus = true } diff --git a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/TextSetting.qml b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/TextSetting.qml index 8d1ca41..3689dc1 100644 --- a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/TextSetting.qml +++ b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/TextSetting.qml @@ -144,40 +144,28 @@ Item { Button { id: insertButton + text: "α" anchors.right: parent.right anchors.rightMargin: 5 anchors.verticalCenter: parent.verticalCenter width: 20 height: width visible: !isInt && !isDouble - - Icon { - id: icon - width: 12 - height: 12 - anchors.centerIn: parent - - color: sysPalette.windowText - source: '../icons/properties/expression.svg' - } - onClicked: { insertPopup.open() - insertPopup.setFocus() + insertPopup.focus = true } } Popup.InsertCharacter { id: insertPopup - x: parent.width - width - y: parent.height + x: Math.round((parent.width - width) / 2) + y: Math.round((parent.height - height) / 2) onSelected: function(c) { input.insert(input.cursorPosition, c) - } - - onClosed: function() { + insertPopup.close() focus = false input.focus = true } diff --git a/scripts/build-macosx.sh b/scripts/build-macosx.sh index 8f3f38d..2ccd626 100755 --- a/scripts/build-macosx.sh +++ b/scripts/build-macosx.sh @@ -27,9 +27,9 @@ rm $(find . -name "*.pyc") pyinstaller --add-data "LogarithmPlotter/qml:qml" \ --add-data "LogarithmPlotter/i18n:i18n" \ - --add-data "../../LICENSE.md:." \ - --add-data "../../assets/native/mac/logarithmplotterfile.icns:." \ - --add-data "../../README.md:." \ + --add-data "LICENSE.md:." \ + --add-data "../assets/native/mac/logarithmplotterfile.icns:." \ + --add-data "README.md:." \ --exclude-module "FixTk" \ --exclude-module "tcl" \ --exclude-module "tk" \