Files
qt-creator/share/qtcreator/qmldesigner/welcomepage/FigmaButton.qml
Thomas Hartmann 14b63a2ba0 QmlDesigner: Change Twitter Button to Figma Button
Change-Id: I9c0ab2c6211c2d1ebc607401123497058fdb717d
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Brook Cronin <brook.cronin@qt.io>
2024-01-23 08:28:08 +00:00

126 lines
3.0 KiB
QML

// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick
import WelcomeScreen 1.0
import StudioTheme 1.0 as StudioTheme
Item {
id: figmaButton
state: "darkNormal"
property bool isHovered: mouseArea.containsMouse
Image {
id: figmaDarkNormal
anchors.fill: parent
source: "images/figmaDarkNormal.png"
fillMode: Image.PreserveAspectFit
}
Image {
id: figmaLightNormal
anchors.fill: parent
source: "images/figmaLightNormal.png"
fillMode: Image.PreserveAspectFit
}
Image {
id: figmaHover
anchors.fill: parent
source: "images/figmaHover.png"
fillMode: Image.PreserveAspectFit
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
Connections {
target: mouseArea
function onClicked(mouse) { Qt.openUrlExternally("https://www.figma.com/@qtdesignstudio/") }
}
}
states: [
State {
name: "darkNormal"
when: !StudioTheme.Values.isLightTheme && !mouseArea.containsMouse && !mouseArea.pressed
PropertyChanges {
target: figmaDarkNormal
visible: true
}
PropertyChanges {
target: figmaLightNormal
visible: false
}
PropertyChanges {
target: figmaHover
visible: false
}
},
State {
name: "lightNormal"
when: StudioTheme.Values.isLightTheme && !mouseArea.containsMouse && !mouseArea.pressed
PropertyChanges {
target: figmaHover
visible: false
}
PropertyChanges {
target: figmaLightNormal
visible: true
}
PropertyChanges {
target: figmaDarkNormal
visible: false
}
},
State {
name: "hover"
when: mouseArea.containsMouse && !mouseArea.pressed
PropertyChanges {
target: figmaHover
visible: true
}
PropertyChanges {
target: figmaLightNormal
visible: false
}
PropertyChanges {
target: figmaDarkNormal
visible: false
}
},
State {
name: "press"
when: (mouseArea.containsMouse || !mouseArea.containsMouse) && mouseArea.pressed
PropertyChanges {
target: figmaHover
visible: true
scale: 1.1
}
PropertyChanges {
target: figmaLightNormal
visible: false
}
PropertyChanges {
target: figmaDarkNormal
visible: false
}
}
]
}