Commit b789050f authored by Georgiy Yankovskiy's avatar Georgiy Yankovskiy

QtQuick.Controls used for Button template, tabs switching with simple template, UI constants

parent dcaf96fa
import QtQuick import QtQuick
import QtQuick.Controls as C
Rectangle { C.Button {
id: rectangle
// control.down
// control.activeFocus
id: control
width: 150 width: 150
height: 50 height: 50
radius: 5 text: qsTr("Button")
color: "#ffffff"
Text { contentItem: Text {
id: text1 text: control.text
text: qsTr("Text") font: control.font
anchors.fill: parent opacity: enabled ? 1.0 : 0.3
font.pixelSize: 12 color: control.down ? "#000000" : (control.activeFocus ? "#ff0000" : "#555555")
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
background: Rectangle {
implicitWidth: 100
implicitHeight: 40
opacity: enabled ? 1 : 0.3
border.color: control.down ? "#000000" : (control.activeFocus ? "#ff0000" : "#555555")
border.width: 1
radius: 8
} }
} }
import QtQuick import QtQuick
import "../constants/tabs.js" as TabConstants
Rectangle { Rectangle {
// PROPERTIES
property string currentTab: TabConstants.systemManagementTab
// FIELDS
id: tabs id: tabs
x: 0 x: 0
y: 0 y: 0
...@@ -8,16 +13,52 @@ Rectangle { ...@@ -8,16 +13,52 @@ Rectangle {
height: 480 height: 480
color: "#ffffff" color: "#ffffff"
// COMPONENTS
Grid { Grid {
id: grid id: systemManagementGrid
y: 60 visible: tabs.currentTab == TabConstants.systemManagementTab
height: 420
columns: 3
spacing: 2
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.topMargin: 60
anchors.rightMargin: 0 anchors.rightMargin: 0
anchors.leftMargin: 0 anchors.leftMargin: 0
anchors.bottomMargin: 0 anchors.bottomMargin: 0
Rectangle { color: "red"; width: 50; height: 50 }
Rectangle { color: "green"; width: 20; height: 50 }
Rectangle { color: "blue"; width: 50; height: 20 }
Rectangle { color: "cyan"; width: 50; height: 50 }
Rectangle { color: "magenta"; width: 10; height: 10 }
}
Grid {
id: gamesGrid
visible: tabs.currentTab == TabConstants.gamesTab
columns: 3
spacing: 2
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.topMargin: 60
anchors.rightMargin: 0
anchors.leftMargin: 0
anchors.bottomMargin: 0
Text {
id: text2
text: qsTr("Text")
font.pixelSize: 12
}
} }
Rectangle { Rectangle {
...@@ -45,16 +86,26 @@ Rectangle { ...@@ -45,16 +86,26 @@ Rectangle {
topPadding: 5 topPadding: 5
Button { Button {
id: button1 id: buttonSystemManagement
} text: "System management"
onClicked: function(){
Button { tabs.currentTab = TabConstants.systemManagementTab;
id: button2 // tabs.changeTab();
// console.log(tabs.currentTab);
}
} }
Button { Button {
id: button3 id: buttonGames
text: "Games"
onClicked: function(){
tabs.currentTab = TabConstants.gamesTab;
// tabs.changeTab();
// console.log(tabs.currentTab);
}
} }
} }
} }
} }
var backColor = "red";
\ No newline at end of file
var systemManagementTab = "systemManagement";
var gamesTab = "games";
\ No newline at end of file
import QtQuick import QtQuick
import QtQuick.Controls
import "../components" import "../components"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment