Add stackview style

pull/3/head
cutefishd 5 years ago
parent 025fed5199
commit feac04d441

@ -0,0 +1,17 @@
{
"files.associations": {
"optional": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"system_error": "cpp",
"array": "cpp",
"functional": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"variant": "cpp",
"string_view": "cpp",
"initializer_list": "cpp",
"ranges": "cpp"
}
}

@ -25,6 +25,7 @@
#include <QQuickWindow>
#include <QPixmap>
#include <QImageReader>
#include <QPixmapCache>
#include "managedtexturenode.h"
@ -201,13 +202,11 @@ void IconItem::setSource(const QVariant &source)
m_source = source;
QString sourceString = source.toString();
// If the QIcon was created with QIcon::fromTheme(), try to load it as svg
if (source.canConvert<QIcon>() && !source.value<QIcon>().name().isEmpty()) {
sourceString = source.value<QIcon>().name();
}
if (!sourceString.isEmpty()) {
// If a file:// URL or a absolute path is passed, take the image pointed by that from disk
QString localFile;
if (sourceString.startsWith(QLatin1String("file:"))) {
localFile = QUrl(sourceString).toLocalFile();
@ -400,6 +399,8 @@ void IconItem::loadPixmap()
return;
}
QPixmapCache::clear();
int size = qMin(qRound(width()), qRound(height()));
QPixmap result;

@ -6,9 +6,8 @@ import QtQuick.Controls.impl 2.4
T.Button
{
id: control
implicitWidth: Math.max(background.implicitWidth + Meui.Units.extendBorderWidth + Meui.Theme.mediumRadius / 2,
contentItem.implicitWidth + Meui.Units.largeSpacing + Meui.Units.extendBorderWidth)
implicitHeight: background.implicitHeight + Meui.Units.extendBorderWidth
implicitWidth: Math.max(background.implicitWidth, contentItem.implicitWidth + Meui.Units.largeSpacing)
implicitHeight: background.implicitHeight
hoverEnabled: true
property color hoveredColor: Qt.tint(Meui.Theme.textColor, Qt.rgba(Meui.Theme.backgroundColor.r,
@ -31,7 +30,7 @@ T.Button
text: control.text
font: control.font
icon: control.icon
color: !control.enabled ? control.Meui.Theme.disabledTextColor : control.flat ? Meui.Theme.highlightColor : Meui.Theme.textColor
color: !control.enabled ? control.Meui.Theme.disabledTextColor : control.flat ? Meui.Theme.highlightedTextColor : Meui.Theme.textColor
spacing: control.spacing
mirrored: control.mirrored
display: control.display
@ -45,29 +44,25 @@ T.Button
Rectangle {
id: _border
anchors.fill: parent
visible: control.activeFocus
color: "transparent"
border.color: control.activeFocus ? Qt.rgba(Meui.Theme.highlightColor.r,
Meui.Theme.highlightColor.g,
Meui.Theme.highlightColor.b, 0.2) : "transparent"
border.color: Qt.rgba(Meui.Theme.highlightColor.r,
Meui.Theme.highlightColor.g,
Meui.Theme.highlightColor.b, 0.3)
border.width: Meui.Units.extendBorderWidth
radius: Meui.Theme.mediumRadius + Meui.Units.extendBorderWidth
Behavior on border.color {
ColorAnimation {
duration: 50
}
}
radius: Meui.Theme.mediumRadius
}
Rectangle {
anchors.fill: parent
anchors.margins: Meui.Units.extendBorderWidth
radius: Meui.Theme.mediumRadius
border.color: control.activeFocus || control.pressed ? Meui.Theme.highlightColor :
radius: Meui.Theme.mediumRadius - Meui.Units.extendBorderWidth
border.color: control.flat && control.enabled ? Meui.Theme.highlightColor : control.activeFocus || control.pressed ? Meui.Theme.highlightColor :
Qt.tint(Meui.Theme.textColor, Qt.rgba(Meui.Theme.backgroundColor.r, Meui.Theme.backgroundColor.g, Meui.Theme.backgroundColor.b, 0.7))
border.width: 1
color: control.pressed ? control.pressedColor : control.hovered ? control.hoveredColor : Meui.Theme.backgroundColor
color: control.flat && control.enabled ? control.pressed ? control.flatPressedColor : control.hovered ? control.flatHoveredColor : Meui.Theme.highlightColor
: control.pressed ? control.pressedColor : control.hovered ? control.hoveredColor : Meui.Theme.backgroundColor
}
}
}

@ -45,11 +45,11 @@ import MeuiKit 1.0 as Meui
T.ComboBox {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset + Meui.Units.extendBorderWidth,
implicitContentWidth + leftPadding + rightPadding + Meui.Units.extendBorderWidth)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset + Meui.Units.extendBorderWidth,
implicitContentHeight + topPadding + bottomPadding + Meui.Units.extendBorderWidth,
implicitIndicatorHeight + topPadding + bottomPadding + Meui.Units.extendBorderWidth)
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding,
implicitIndicatorHeight + topPadding + bottomPadding)
topInset: Meui.Units.smallSpacing
bottomInset: Meui.Units.smallSpacing

@ -60,7 +60,12 @@ T.Dialog {
contentItem: Item {}
background: Meui.RoundedRect {
background: Rectangle {
radius: Meui.Theme.mediumRadius
color: Meui.Theme.backgroundColor
border.width: 1
border.color: Meui.Theme.darkMode ? Qt.rgba(255, 255, 255, 0.2) : Qt.rgba(0, 0, 0, 0.1)
layer.enabled: true
layer.effect: DropShadow {
transparentBorder: true

@ -0,0 +1,43 @@
import QtQuick 2.12
import QtQuick.Templates 2.3 as T
T.StackView {
id: control
popEnter: Transition {
// slide_in_left
NumberAnimation { property: "x"; from: (control.mirrored ? -0.5 : 0.5) * -control.width; to: 0; duration: 200; easing.type: Easing.OutCubic }
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 200; easing.type: Easing.OutCubic }
}
popExit: Transition {
// slide_out_right
NumberAnimation { property: "x"; from: 0; to: (control.mirrored ? -0.5 : 0.5) * control.width; duration: 200; easing.type: Easing.OutCubic }
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 200; easing.type: Easing.OutCubic }
}
pushEnter: Transition {
// slide_in_right
NumberAnimation { property: "x"; from: (control.mirrored ? -0.5 : 0.5) * control.width; to: 0; duration: 200; easing.type: Easing.OutCubic }
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 200; easing.type: Easing.OutCubic }
}
pushExit: Transition {
// slide_out_left
NumberAnimation { property: "x"; from: 0; to: (control.mirrored ? -0.5 : 0.5) * -control.width; duration: 200; easing.type: Easing.OutCubic }
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 200; easing.type: Easing.OutCubic }
}
replaceEnter: Transition {
// slide_in_right
NumberAnimation { property: "x"; from: (control.mirrored ? -0.5 : 0.5) * control.width; to: 0; duration: 200; easing.type: Easing.OutCubic }
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 200; easing.type: Easing.OutCubic }
}
replaceExit: Transition {
// slide_out_left
NumberAnimation { property: "x"; from: 0; to: (control.mirrored ? -0.5 : 0.5) * -control.width; duration: 200; easing.type: Easing.OutCubic }
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 200; easing.type: Easing.OutCubic }
}
}
Loading…
Cancel
Save