From 78966dc00419a4f5fe5fec4725062a4a0f380228 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 5 Jul 2015 15:11:13 +0200 Subject: Embedded QML into C++ application --- EmbeddedTerminal.qml | 88 ---------------------------------------------------- 1 file changed, 88 deletions(-) delete mode 100644 EmbeddedTerminal.qml (limited to 'EmbeddedTerminal.qml') diff --git a/EmbeddedTerminal.qml b/EmbeddedTerminal.qml deleted file mode 100644 index f4f104e..0000000 --- a/EmbeddedTerminal.qml +++ /dev/null @@ -1,88 +0,0 @@ -import QtQuick 2.0 -import QMLTermWidget 1.0 -import QtQuick.Controls 1.2 - -Item { - id: embeddedTerminal - property string program - property string workingDirectory - property int columns - property int lines - - width: container.width - height: container.height - - function select() { highlighter.select() } - function deselect() { highlighter.deselect() } - - Row { - id: container - - Rectangle { - id: highlighter - - width: 10 - height: terminal.height - - color: "#909636" - - Behavior on opacity { - NumberAnimation { - duration: 300 - easing.type: Easing.OutCubic - } - } - - function select() { opacity = 1 } - function deselect() { opacity = 0 } - function focus() { color = "#352F6A" } - function unfocus() { color = "#909636" } - } - - Rectangle { - width: terminal.width - height: terminal.height - - color: "#ffffff" - - QMLTermWidget { - id: terminal - - font.family: "Monospace" - font.pointSize: 8 - - width: fontMetrics.width * embeddedTerminal.columns - height: fontMetrics.height * embeddedTerminal.lines - - session: QMLTermSession { - initialWorkingDirectory: embeddedTerminal.workingDirectory - - shellProgram: { - return (embeddedTerminal.program).split(" ")[0]; - } - - shellProgramArgs: { - var elements = (embeddedTerminal.program).split(" "); - elements.shift(); - - return elements; - } - } - - onTermGetFocus: highlighter.focus() - onTermLostFocus: highlighter.unfocus() - - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.NoButton - onWheel: { } - } - - Component.onCompleted: { - terminal.forceActiveFocus(); - session.startShellProgram(); - } - } - } - } -} -- cgit v1.2.3