From 252910d387ad72e28bc675cc661c3ffe39337b3c Mon Sep 17 00:00:00 2001 From: yann300 Date: Sat, 29 Nov 2014 01:11:07 +0100 Subject: [PATCH] tab indentation in QML --- mix/qml/BasicContent.qml | 63 +++++++++++++-------------- mix/qml/MainContent.qml | 92 ++++++++++++++++++++-------------------- mix/qml/TabStyle.qml | 34 +++++++-------- mix/qml/main.qml | 36 ++++++++-------- 4 files changed, 110 insertions(+), 115 deletions(-) diff --git a/mix/qml/BasicContent.qml b/mix/qml/BasicContent.qml index 6d5020d3d..0049e6127 100644 --- a/mix/qml/BasicContent.qml +++ b/mix/qml/BasicContent.qml @@ -2,37 +2,34 @@ import QtQuick 2.3 import QtQuick.Controls 1.2 Rectangle { - - anchors.fill: parent - width: parent.width - height: parent.height - color: "lightgray" - - Text { - font.pointSize: 7 - anchors.left: parent.left - anchors.top: parent.top - anchors.topMargin: 3 - anchors.leftMargin: 3 - height: 9 - font.family: "Sego UI light" - objectName: "status" - id: status - } - - TextArea { - readOnly: true - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.top: status.bottom - anchors.topMargin: 3 - font.pointSize: 7 - font.family: "Sego UI light" - height: parent.height * 0.8 - width: parent.width - 20 - wrapMode: Text.Wrap - backgroundVisible: false - objectName: "content" - id: content - } + anchors.fill: parent + width: parent.width + height: parent.height + color: "lightgray" + Text { + font.pointSize: 7 + anchors.left: parent.left + anchors.top: parent.top + anchors.topMargin: 3 + anchors.leftMargin: 3 + height: 9 + font.family: "Sego UI light" + objectName: "status" + id: status + } + TextArea { + readOnly: true + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.top: status.bottom + anchors.topMargin: 3 + font.pointSize: 7 + font.family: "Sego UI light" + height: parent.height * 0.8 + width: parent.width - 20 + wrapMode: Text.Wrap + backgroundVisible: false + objectName: "content" + id: content + } } diff --git a/mix/qml/MainContent.qml b/mix/qml/MainContent.qml index 80bbec3aa..f243b16ac 100644 --- a/mix/qml/MainContent.qml +++ b/mix/qml/MainContent.qml @@ -5,50 +5,50 @@ import QtQuick.Controls.Styles 1.2 import CodeEditorExtensionManager 1.0 Rectangle { - anchors.fill: parent - height: parent.height - width: parent.width; - id:root - SplitView { - anchors.fill: parent - orientation: Qt.Vertical - Rectangle { - anchors.top: parent.top - id: contentView - width: parent.width - height: parent.height * 0.7 - TextArea { - id: codeEditor - height: parent.height - font.family: "Verdana" - font.pointSize: 9 - width: parent.width - anchors.centerIn: parent - tabChangesFocus: false - Keys.onPressed: { - if (event.key === Qt.Key_Tab) { - codeEditor.insert(codeEditor.cursorPosition, "\t"); - event.accepted = true; - } - } - } - } - Rectangle { - anchors.bottom: parent.bottom - id: contextualView - width: parent.width - Layout.minimumHeight: 20 - height: parent.height * 0.3 - TabView { - id: contextualTabs - antialiasing: true - anchors.fill: parent - style: TabStyle{} - } - } - CodeEditorExtensionManager{ - tabView: contextualTabs - editor: codeEditor - } - } + anchors.fill: parent + height: parent.height + width: parent.width; + id:root + SplitView { + anchors.fill: parent + orientation: Qt.Vertical + Rectangle { + anchors.top: parent.top + id: contentView + width: parent.width + height: parent.height * 0.7 + TextArea { + id: codeEditor + height: parent.height + font.family: "Verdana" + font.pointSize: 9 + width: parent.width + anchors.centerIn: parent + tabChangesFocus: false + Keys.onPressed: { + if (event.key === Qt.Key_Tab) { + codeEditor.insert(codeEditor.cursorPosition, "\t"); + event.accepted = true; + } + } + } + } + Rectangle { + anchors.bottom: parent.bottom + id: contextualView + width: parent.width + Layout.minimumHeight: 20 + height: parent.height * 0.3 + TabView { + id: contextualTabs + antialiasing: true + anchors.fill: parent + style: TabStyle {} + } + } + CodeEditorExtensionManager{ + tabView: contextualTabs + editor: codeEditor + } + } } diff --git a/mix/qml/TabStyle.qml b/mix/qml/TabStyle.qml index 8f72fa12c..5f78f8947 100644 --- a/mix/qml/TabStyle.qml +++ b/mix/qml/TabStyle.qml @@ -3,21 +3,21 @@ import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 TabViewStyle { - frameOverlap: 1 - tabBar: Rectangle { - color: "lightgray" - } - tab: Rectangle { - color: "lightsteelblue" - implicitWidth: Math.max(text.width + 4, 80) - implicitHeight: 20 - radius: 2 - Text { - id: text - anchors.centerIn: parent - text: styleData.title - color: styleData.selected ? "white" : "black" - } - } - frame: Rectangle { color: "steelblue" } + frameOverlap: 1 + tabBar: Rectangle { + color: "lightgray" + } + tab: Rectangle { + color: "lightsteelblue" + implicitWidth: Math.max(text.width + 4, 80) + implicitHeight: 20 + radius: 2 + Text { + id: text + anchors.centerIn: parent + text: styleData.title + color: styleData.selected ? "white" : "black" + } + } + frame: Rectangle { color: "steelblue" } } diff --git a/mix/qml/main.qml b/mix/qml/main.qml index 331720f41..8a1b86cee 100644 --- a/mix/qml/main.qml +++ b/mix/qml/main.qml @@ -4,23 +4,21 @@ import QtQuick.Controls.Styles 1.2 import CodeEditorExtensionManager 1.0 ApplicationWindow { - visible: true - width: 1000 - height: 480 - minimumWidth: 400 - minimumHeight: 300 - title: qsTr("mix") - - menuBar: MenuBar { - Menu { - title: qsTr("File") - MenuItem { - text: qsTr("Exit") - onTriggered: Qt.quit(); - } - } - } - - MainContent{ - } + visible: true + width: 1000 + height: 480 + minimumWidth: 400 + minimumHeight: 300 + title: qsTr("mix") + menuBar: MenuBar { + Menu { + title: qsTr("File") + MenuItem { + text: qsTr("Exit") + onTriggered: Qt.quit(); + } + } + } + MainContent{ + } }