Change toolbox tabs to controls2

CURA-6006
This commit is contained in:
Jaime van Kessel 2018-12-06 16:58:01 +01:00
parent 4b8e3c32cb
commit 717fb260c1

View file

@ -2,50 +2,49 @@
// Toolbox is released under the terms of the LGPLv3 or higher. // Toolbox is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 1.4 import QtQuick.Controls 2.0
import QtQuick.Controls.Styles 1.4
import UM 1.1 as UM import UM 1.1 as UM
Button Button
{ {
id: control
property bool active: false property bool active: false
style: ButtonStyle hoverEnabled: true
background: Item
{ {
background: Rectangle implicitWidth: UM.Theme.getSize("toolbox_header_tab").width
implicitHeight: UM.Theme.getSize("toolbox_header_tab").height
Rectangle
{ {
color: "transparent" visible: control.active
implicitWidth: UM.Theme.getSize("toolbox_header_tab").width color: UM.Theme.getColor("primary")
implicitHeight: UM.Theme.getSize("toolbox_header_tab").height anchors.bottom: parent.bottom
Rectangle width: parent.width
{ height: UM.Theme.getSize("toolbox_header_highlight").height
visible: control.active
color: UM.Theme.getColor("toolbox_header_highlight_hover")
anchors.bottom: parent.bottom
width: parent.width
height: UM.Theme.getSize("toolbox_header_highlight").height
}
}
label: Label
{
text: control.text
color:
{
if(control.hovered)
{
return UM.Theme.getColor("toolbox_header_button_text_hovered");
}
if(control.active)
{
return UM.Theme.getColor("toolbox_header_button_text_active");
}
else
{
return UM.Theme.getColor("toolbox_header_button_text_inactive");
}
}
font: control.enabled ? (control.active ? UM.Theme.getFont("medium_bold") : UM.Theme.getFont("medium")) : UM.Theme.getFont("default_italic")
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
} }
} }
} contentItem: Label
{
id: label
text: control.text
color:
{
if(control.hovered)
{
return UM.Theme.getColor("toolbox_header_button_text_hovered");
}
if(control.active)
{
return UM.Theme.getColor("toolbox_header_button_text_active");
}
else
{
return UM.Theme.getColor("toolbox_header_button_text_inactive");
}
}
font: control.enabled ? (control.active ? UM.Theme.getFont("medium_bold") : UM.Theme.getFont("medium")) : UM.Theme.getFont("default_italic")
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
}