阻抗弹窗

This commit is contained in:
zxj
2024-11-29 17:47:45 +08:00
parent d5f31c8108
commit 4ce8544582
997 changed files with 255048 additions and 1110 deletions

View File

@@ -0,0 +1,51 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Quick Extras module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** 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 https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls.Private 1.0
/*!
\internal
*/
Button {
id: button
style: Settings.styleComponent(Settings.style, "CircularButtonStyle.qml", button)
}

View File

@@ -0,0 +1,136 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Quick Extras module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** 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 https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.2
import QtQuick.Extras 1.4
import QtQuick.Extras.Private 1.0
QtObject {
id: circularButtonStyleHelper
property Item control
property color buttonColorUpTop: "#e3e3e3"
property color buttonColorUpBottom: "#b3b3b3"
property color buttonColorDownTop: "#d3d3d3"
property color buttonColorDownBottom: "#939393"
property color outerArcColorTop: "#9c9c9c"
property color outerArcColorBottom: Qt.rgba(0.941, 0.941, 0.941, 0.29)
property color innerArcColorTop: "#e3e3e3"
property color innerArcColorBottom: "#acacac"
property real innerArcColorBottomStop: 0.4
property color shineColor: Qt.rgba(1, 1, 1, 0.29)
property real smallestAxis: control ? Math.min(control.width, control.height) : 0
property real outerArcLineWidth: smallestAxis * 0.04
property real innerArcLineWidth: Math.max(1, outerArcLineWidth * 0.1)
property real shineArcLineWidth: Math.max(1, outerArcLineWidth * 0.1)
property real implicitWidth: Math.round(TextSingleton.implicitHeight * 8)
property real implicitHeight: Math.round(TextSingleton.implicitHeight * 8)
property color textColorUp: "#4e4e4e"
property color textColorDown: "#303030"
property color textRaisedColorUp: "#ffffff"
property color textRaisedColorDown: "#e3e3e3"
property real radius: (smallestAxis * 0.5) - outerArcLineWidth - innerArcLineWidth
property real halfRadius: radius / 2
property real outerArcRadius: innerArcRadius + outerArcLineWidth / 2
property real innerArcRadius: radius + innerArcLineWidth / 2
property real shineArcRadius: outerArcRadius + outerArcLineWidth / 2 - shineArcLineWidth / 2
property real zeroAngle: Math.PI * 0.5
property color buttonColorTop: control && control.pressed ? buttonColorDownTop : buttonColorUpTop
property color buttonColorBottom: control && control.pressed ? buttonColorDownBottom : buttonColorUpBottom
function toPixels(percentageOfSmallestAxis) {
return percentageOfSmallestAxis * smallestAxis;
}
function paintBackground(ctx) {
ctx.reset();
if (outerArcRadius < 0 || radius < 0)
return;
var xCenter = ctx.canvas.width / 2;
var yCenter = ctx.canvas.height / 2;
/* Draw outer arc */
ctx.beginPath();
ctx.lineWidth = outerArcLineWidth;
ctx.arc(xCenter, yCenter, outerArcRadius, 0, Math.PI * 2, false);
var gradient = ctx.createRadialGradient(xCenter, yCenter - halfRadius,
0, xCenter, yCenter - halfRadius, radius * 1.5);
gradient.addColorStop(0, outerArcColorTop);
gradient.addColorStop(1, outerArcColorBottom);
ctx.strokeStyle = gradient;
ctx.stroke();
/* Draw the shine along the bottom */
ctx.beginPath();
ctx.lineWidth = shineArcLineWidth;
ctx.arc(xCenter, yCenter, shineArcRadius, 0, Math.PI, false);
gradient = ctx.createLinearGradient(xCenter, yCenter + radius, xCenter, yCenter);
gradient.addColorStop(0, shineColor);
gradient.addColorStop(0.5, "rgba(255, 255, 255, 0)");
ctx.strokeStyle = gradient;
ctx.stroke();
/* Draw inner arc */
ctx.beginPath();
ctx.lineWidth = innerArcLineWidth + 1;
ctx.arc(xCenter, yCenter, innerArcRadius, 0, Math.PI * 2, false);
gradient = ctx.createLinearGradient(xCenter, yCenter - halfRadius,
xCenter, yCenter + halfRadius);
gradient.addColorStop(0, innerArcColorTop);
gradient.addColorStop(innerArcColorBottomStop, innerArcColorBottom);
ctx.strokeStyle = gradient;
ctx.stroke();
/* Draw the button's body */
ctx.beginPath();
ctx.ellipse(xCenter - radius, yCenter - radius, radius * 2, radius * 2);
gradient = ctx.createRadialGradient(xCenter, yCenter + radius * 0.85, 0,
xCenter, yCenter + radius * 0.85, radius * (0.85 * 2));
gradient.addColorStop(1, buttonColorTop);
gradient.addColorStop(0, buttonColorBottom);
ctx.fillStyle = gradient;
ctx.fill();
}
}

View File

@@ -0,0 +1,145 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Quick Extras module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** 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 https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.2
// Workaround for QTBUG-37751; we need this import for RangeModel, although we shouldn't.
import QtQuick.Controls 1.1
import QtQuick.Controls.Private 1.0
import QtQuick.Extras 1.4
import QtQuick.Extras.Private 1.0
Control {
id: label
style: Settings.styleComponent(Settings.style, "CircularTickmarkLabelStyle.qml", label)
property alias minimumValue: range.minimumValue
property alias maximumValue: range.maximumValue
property alias stepSize: range.stepSize
RangeModel {
id: range
minimumValue: 0
maximumValue: 100
stepSize: 0
// Not used.
value: minimumValue
}
/*!
This property determines the angle at which the first tickmark is drawn.
*/
property real minimumValueAngle: -145
/*!
This property determines the angle at which the last tickmark is drawn.
*/
property real maximumValueAngle: 145
/*!
The range between \l minimumValueAngle and \l maximumValueAngle, in
degrees.
*/
readonly property real angleRange: maximumValueAngle - minimumValueAngle
/*!
The interval at which tickmarks are displayed.
*/
property real tickmarkStepSize: 10
/*!
The distance in pixels from the outside of the control (outerRadius) at
which the outermost point of the tickmark line is drawn.
*/
property real tickmarkInset: 0.0
/*!
The amount of tickmarks displayed.
*/
readonly property int tickmarkCount: __tickmarkCount
/*!
The amount of minor tickmarks between each tickmark.
*/
property int minorTickmarkCount: 4
/*!
The distance in pixels from the outside of the control (outerRadius) at
which the outermost point of the minor tickmark line is drawn.
*/
property real minorTickmarkInset: 0.0
/*!
The distance in pixels from the outside of the control (outerRadius) at
which the center of the value marker text is drawn.
*/
property real labelInset: __style.__protectedScope.toPixels(0.19)
/*!
The interval at which tickmark labels are displayed.
*/
property real labelStepSize: tickmarkStepSize
/*!
The amount of tickmark labels displayed.
*/
readonly property int labelCount: (maximumValue - minimumValue) / labelStepSize + 1
/*! \internal */
readonly property real __tickmarkCount: tickmarkStepSize > 0 ? (maximumValue - minimumValue) / tickmarkStepSize + 1 : 0
/*!
This property determines whether or not the control displays tickmarks,
minor tickmarks, and labels.
*/
property bool tickmarksVisible: true
/*!
Returns \a value as an angle in degrees.
For example, if minimumValueAngle is set to \c 270 and maximumValueAngle
is set to \c 90, this function will return \c 270 when passed
minimumValue and \c 90 when passed maximumValue.
*/
function valueToAngle(value) {
var normalised = (value - minimumValue) / (maximumValue - minimumValue);
return (maximumValueAngle - minimumValueAngle) * normalised + minimumValueAngle;
}
}

View File

@@ -0,0 +1,123 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Quick Extras module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** 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 https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.0
import QtGraphicalEffects 1.0
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls.Private 1.0
import QtQuick.Extras.Private 1.1
import QtQuick.Extras.Private.CppUtils 1.0
Control {
id: root
x: handleArea.centerOfHandle.x - width / 2
y: handleArea.centerOfHandle.y - height / 2
style: Settings.styleComponent(Settings.style, "HandleStyle.qml", root)
/*!
The angle of the handle along the circumference of \l rotationRadius in
radians, scaled to be in the range of 0.0 to 1.0.
*/
property alias value: range.value
RangeModel {
id: range
minimumValue: 0.0
maximumValue: 1.0
stepSize: 0
value: minimumValue
}
/*!
The angle in radians where the dial starts.
*/
property real zeroAngle: 0
/*!
The radius of the rotation of this handle.
*/
property real rotationRadius: 50
/*!
The center of the dial. This is the origin point for the handle's
rotation.
*/
property real dialXCenter: 0
property real dialYCenter: 0
/*!
This property holds the amount of extra room added to each side of
the handle to make it easier to drag on touch devices.
*/
property real allowance: Math.max(width, height) * 1.5
/*
The function used to determine the handle's value from the position of
the mouse.
Can be set to provide custom value calculation. It expects these
parameters: \c mouseX, \c mouseY, \c xCenter, \c yCenter, \c zeroAngle
*/
property var valueFromMouse: handleArea.valueFromMouse
property alias handleArea: handleArea
MouseArea {
id: handleArea
// Respond to value changes by calculating the new center of the handle.
property point centerOfHandle: MathUtils.centerAlongCircle(dialXCenter, dialYCenter,
0, 0, MathUtils.valueToAngle(value, 1, zeroAngle), rotationRadius);
anchors.fill: parent
anchors.margins: -allowance
onPositionChanged: {
// Whenever the handle is moved with the mouse, update the value.
value = root.valueFromMouse(mouse.x + centerOfHandle.x - allowance,
mouse.y + centerOfHandle.y - allowance, dialXCenter, dialYCenter, zeroAngle);
}
// A helper function for onPositionChanged.
function valueFromMouse(mouseX, mouseY, xCenter, yCenter, zeroAngle) {
return MathUtils.angleToValue(
MathUtils.halfPi - Math.atan2(mouseX - xCenter, mouseY - yCenter), 1, zeroAngle);
}
}
}

View File

@@ -0,0 +1,102 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Quick Extras module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** 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 https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.3
import QtQuick.Extras 1.4
import QtQuick.Extras.Private 1.0
import QtQuick.Extras.Private.CppUtils 1.0
Loader {
id: iconLoader
active: iconSource != ""
property PieMenu control: null
property QtObject styleData: null
readonly property string iconSource: styleData && styleData.index < control.__protectedScope.visibleItems.length
? control.__protectedScope.visibleItems[styleData.index].iconSource
: ""
sourceComponent: Image {
id: iconImage
source: iconSource
x: pos.x
y: pos.y
scale: scaleFactor
readonly property point pos: MathUtils.centerAlongCircle(
iconLoader.parent.width / 2, iconLoader.parent.height / 2, width, height,
MathUtils.degToRadOffset(sectionCenterAngle(styleData.index)), control.__style.__iconOffset)
/*
The icons should scale with the menu at some point, so that they
stay within the bounds of each section. We down-scale the image by
whichever of the following amounts are larger:
a) The amount by which the largest dimension's diagonal size exceeds
the "selectable" radius. The selectable radius is the distance in pixels
between lines A and B in the incredibly visually appealing image below:
__________
- B -
/ \
/ ____ \
| / A \ |
--------| |--------
b) The amount by which the diagonal exceeds the circumference of
one section.
*/
readonly property real scaleFactor: {
var largestDimension = Math.max(iconImage.sourceSize.width, iconImage.sourceSize.height) * Math.sqrt(2);
// TODO: add padding
var radiusDifference = largestDimension - control.__style.__selectableRadius;
var circumferenceDifference = largestDimension - Math.abs(control.__protectedScope.circumferenceOfSection);
if (circumferenceDifference > 0 || radiusDifference > 0) {
// We need to down-scale.
if (radiusDifference > circumferenceDifference) {
return control.__style.__selectableRadius / largestDimension;
} else {
return Math.abs(control.__protectedScope.circumferenceOfSection) / largestDimension;
}
}
return 1;
}
}
}

View File

@@ -0,0 +1,44 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Quick Extras module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** 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 https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
pragma Singleton
import QtQuick 2.1
Text {
}

View File

@@ -0,0 +1 @@
module QtQuick.Extras.Private