C

Qt Quick Ultralite swipe_game Demo

/****************************************************************************** ** ** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Ultralite module. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ******************************************************************************/
import QtQuick 2.0 import StyleModule 1.0 /* A simple button with text. If not overwritten, the button adjusts its width to the length of the text */ MouseArea { id: root // NOTE: overwrite the Style value assignments if you want to use the component outside of this project property color borderColor: pressed ? Style.colorHighlight : Style.colorLines property int borderWidth: Style.lineSize property color backgroundColor: Style.colorButtonBackground property int radius: Style.buttonRadius property color textColor: Style.colorText property alias font: label.font property alias text: label.text implicitHeight: Style.buttonHeight implicitWidth: Math.max(height * 2, label.width + Style.buttonTextMargins * 2) Rectangle { id: border anchors.fill: parent radius: root.radius color: root.borderColor Rectangle { id: background anchors.fill: parent anchors.margins: root.borderWidth radius: root.radius color: root.backgroundColor Text { id: label anchors.centerIn: parent color: root.textColor } } } }