Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion Editor/Qml/EButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,29 @@ import QtQuick.Controls
import QtQuick.Controls.Basic

Button {
enum Style {
Primary,
Secondary,
Disabled,
Outline,
Dashed
}

function getBackgroundColor(style, focus)
{
if (style === EButton.Style.Secondary) {
return focus ? ETheme.secondaryFocusColor : ETheme.secondaryColor;
} else if (style === EButton.Style.Disabled) {
return ETheme.disabledColor;
}
// TODO more
return focus ? ETheme.primaryFocusColor : ETheme.primaryColor;
}

property int style: EButton.Style.Primary

// TODO disable onclick when disabled

contentItem: Text {
text: parent.text
font.pixelSize: ETheme.contentFontSize
Expand All @@ -15,7 +38,7 @@ Button {

background: Rectangle {
implicitWidth: 50
color: parent.down ? ETheme.focusColor : ETheme.primaryColor
color: getBackgroundColor(style, parent.down)
radius: 10
}
}
6 changes: 4 additions & 2 deletions Editor/Qml/ETheme.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import QtQuick
QtObject {
property color bgColor: Qt.color('#212121')
property color primaryColor: Qt.color('#e74c3c')
property color focusColor: Qt.color('#c0392b')
property color secondaryColor: Qt.color('#f1c40f')
property color primaryFocusColor: Qt.color('#c0392b')
property color secondaryColor: Qt.color('#d58845')
property color secondaryFocusColor: Qt.color('#9b6a40')
property color disabledColor: Qt.color('#676563')
property color fontColor: Qt.color('#ecf0f1')

property FontLoader normalFont: FontLoader { source: Qt.url('Resource/Font/MiSans-Normal.ttf') }
Expand Down
33 changes: 8 additions & 25 deletions Editor/Qml/EWidgetSamples.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,16 @@ Rectangle {
}

EButton {
text: 'TODO Secondary Button'
style: EButton.Style.Secondary
text: 'Secondary Button'
}

EButton {
text: 'TODO Disabled Button'
style: EButton.Style.Disabled
text: 'Disabled Button'
}

EButton {
text: 'TODO Icon Button'
}

EButton {
text: 'TODO Outline Button'
}
}

RowLayout {
Layout.margins: 5

EButton {
text: 'TODO Dashed Button'
}

EButton {
text: 'TODO Dashed Button'
}

EButton {
text: 'TODO Text Button'
}
// TODO icon button
}

RowLayout {
Expand Down Expand Up @@ -93,6 +73,9 @@ Rectangle {
text: 'Content'
style: EText.Style.Content
}

// TODO superlink text
// TODO button text
}
}
}
Expand Down
Loading