From 49ac1403a9e9c9d75492224bc86617c74a1bb654 Mon Sep 17 00:00:00 2001 From: talksik Date: Fri, 11 Apr 2025 13:17:55 -0700 Subject: [PATCH] feat: add ghost button --- AppGhostButton.qml | 21 +++++++++++++++++++++ CMakeLists.txt | 1 + gallery/Main.qml | 3 +++ 3 files changed, 25 insertions(+) create mode 100644 AppGhostButton.qml diff --git a/AppGhostButton.qml b/AppGhostButton.qml new file mode 100644 index 0000000..56e0d00 --- /dev/null +++ b/AppGhostButton.qml @@ -0,0 +1,21 @@ +import QtQuick +import QtQuick.Controls.Basic +import QtQuick.Controls.impl // Needed for features like the Control.blend() function +import DesignSystem + +Button { + id: control + font.family: Fonts.dotrice + font.bold: false + + background: Rectangle { + // NOTE: copied from ~/Qt/6.8.3/macos/qml/QtQuick/Controls/Basic/Button.qml + implicitWidth: 100 + implicitHeight: 40 + visible: !control.flat || control.down || control.checked || control.highlighted + color: control.down ? "transparent" : Theme.card + border.width: 0 + // custom + radius: Theme.radius + } +} diff --git a/CMakeLists.txt b/CMakeLists.txt index 9afcca8..8cf7a22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,7 @@ set(plain_qml_files AppIcon.qml AppPrimaryButton.qml AppSecondaryButton.qml + AppGhostButton.qml AppCard.qml AppCaption.qml AppHeadline.qml diff --git a/gallery/Main.qml b/gallery/Main.qml index 197e30d..69f357a 100644 --- a/gallery/Main.qml +++ b/gallery/Main.qml @@ -33,6 +33,9 @@ AppWindow { AppSecondaryButton { text: "Secondary button" } + AppGhostButton { + text: "Ghost" + } } AppCard {