Compare commits

..

No commits in common. "da8aa59b0a069a20d51d175bd3d43c5b8c34ac3b" and "8429ff3739866dafffdbada43feddfdc60480db7" have entirely different histories.

4 changed files with 33 additions and 74 deletions

View file

@ -16,9 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQml.Models import QtQuick
/*! /*!
\qmltype InsertCharacter \qmltype InsertCharacter
@ -43,18 +42,15 @@ Popup {
*/ */
property string category: 'all' property string category: 'all'
width: insertGrid.width + 10 width: 280
height: insertGrid.height + 10 height: Math.ceil(insertGrid.insertChars.length/insertGrid.columns)*(width/insertGrid.columns)+5
modal: true modal: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
GridView { Grid {
id: insertGrid id: insertGrid
width: 280 width: parent.width
height: Math.ceil(model.count/columns)*cellHeight columns: 7
property int columns: 7
cellWidth: width/columns
cellHeight: cellWidth
property var insertCharsExpression: [ property var insertCharsExpression: [
"∞","π","¹","²","³","⁴","⁵", "∞","π","¹","²","³","⁴","⁵",
@ -90,34 +86,21 @@ Popup {
}[insertPopup.category] }[insertPopup.category]
} }
model: ListModel {} Repeater {
model: parent.insertChars.length
delegate: Button {
id: insertBtn Button {
width: insertGrid.cellWidth id: insertBtn
height: insertGrid.cellHeight width: insertGrid.width/insertGrid.columns
text: chr height: width
flat: text == " " text: insertGrid.insertChars[modelData]
font.pixelSize: 18 flat: text == " "
font.pixelSize: 18
onClicked: {
insertPopup.selected(text) onClicked: {
insertPopup.close() selected(text)
} }
}
Component.onCompleted: function() {
for(const chr of insertChars) {
console.log("Appending", chr)
model.append({ 'chr': chr })
} }
} }
} }
function setFocus() {
insertGrid.currentIndex = 0
insertGrid.forceActiveFocus()
}
Keys.onEscapePressed: close()
} }

View file

@ -500,41 +500,29 @@ Item {
Button { Button {
id: insertButton id: insertButton
text: "α"
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 5 anchors.rightMargin: 5
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: 20 width: 20
height: width height: width
Icon {
id: icon
width: 12
height: 12
anchors.centerIn: parent
color: sysPalette.windowText
source: '../icons/properties/expression.svg'
}
onClicked: { onClicked: {
insertPopup.open() insertPopup.open()
insertPopup.setFocus() insertPopup.focus = true
} }
} }
P.InsertCharacter { P.InsertCharacter {
id: insertPopup id: insertPopup
x: parent.width - width x: Math.round((parent.width - width) / 2)
y: parent.height y: Math.round((parent.height - height) / 2)
category: "expression" category: "expression"
onSelected: function(c) { onSelected: function(c) {
editor.insert(editor.cursorPosition, c) editor.insert(editor.cursorPosition, c)
} insertPopup.close()
onClosed: function() {
focus = false focus = false
editor.focus = true editor.focus = true
} }

View file

@ -144,40 +144,28 @@ Item {
Button { Button {
id: insertButton id: insertButton
text: "α"
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 5 anchors.rightMargin: 5
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: 20 width: 20
height: width height: width
visible: !isInt && !isDouble visible: !isInt && !isDouble
Icon {
id: icon
width: 12
height: 12
anchors.centerIn: parent
color: sysPalette.windowText
source: '../icons/properties/expression.svg'
}
onClicked: { onClicked: {
insertPopup.open() insertPopup.open()
insertPopup.setFocus() insertPopup.focus = true
} }
} }
Popup.InsertCharacter { Popup.InsertCharacter {
id: insertPopup id: insertPopup
x: parent.width - width x: Math.round((parent.width - width) / 2)
y: parent.height y: Math.round((parent.height - height) / 2)
onSelected: function(c) { onSelected: function(c) {
input.insert(input.cursorPosition, c) input.insert(input.cursorPosition, c)
} insertPopup.close()
onClosed: function() {
focus = false focus = false
input.focus = true input.focus = true
} }

View file

@ -27,9 +27,9 @@ rm $(find . -name "*.pyc")
pyinstaller --add-data "LogarithmPlotter/qml:qml" \ pyinstaller --add-data "LogarithmPlotter/qml:qml" \
--add-data "LogarithmPlotter/i18n:i18n" \ --add-data "LogarithmPlotter/i18n:i18n" \
--add-data "../../LICENSE.md:." \ --add-data "LICENSE.md:." \
--add-data "../../assets/native/mac/logarithmplotterfile.icns:." \ --add-data "../assets/native/mac/logarithmplotterfile.icns:." \
--add-data "../../README.md:." \ --add-data "README.md:." \
--exclude-module "FixTk" \ --exclude-module "FixTk" \
--exclude-module "tcl" \ --exclude-module "tcl" \
--exclude-module "tk" \ --exclude-module "tk" \