add ShortcutPicker

This commit is contained in:
zhuzichu 2023-12-01 18:14:10 +08:00
parent 4f60459166
commit 9a48880e84
15 changed files with 129 additions and 18 deletions

View File

@ -189,5 +189,6 @@
<file>qml/page/T_3D.qml</file>
<file>qml/global/Lang.qml</file>
<file>qml/page/T_Network.qml</file>
<file>qml/page/T_ShortcutPicker.qml</file>
</qresource>
</RCC>

View File

@ -140,7 +140,8 @@ FluExpander{
"FluProgressButton",
"FluLoadingButton",
"FluClip",
"FluNetwork"
"FluNetwork",
"FluShortcutPicker"
];
code = code.replace(/\n/g, "<br>");
code = code.replace(/ /g, "&nbsp;");

View File

@ -150,6 +150,12 @@ FluObject{
url:"qrc:/example/qml/page/T_ColorPicker.qml"
onTap:{ navigationView.push(url) }
}
FluPaneItem{
title:"ShortcutPicker(ToDo)"
menuDelegate: paneItemMenu
url:"qrc:/example/qml/page/T_ShortcutPicker.qml"
onTap:{ navigationView.push(url) }
}
}
FluPaneItemExpander{

View File

@ -0,0 +1,30 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Window
import FluentUI
import "qrc:///example/qml/component"
FluScrollablePage{
title:"ShortcutPicker"
FluArea{
Layout.fillWidth: true
Layout.topMargin: 20
height: 100
paddings: 10
FluShortcutPicker{
anchors.verticalCenter: parent.verticalCenter
}
}
CodeExpander{
Layout.fillWidth: true
Layout.topMargin: -1
code:'FluShortcutPicker{
}'
}
}

View File

@ -140,7 +140,8 @@ FluExpander{
"FluProgressButton",
"FluLoadingButton",
"FluClip",
"FluNetwork"
"FluNetwork",
"FluShortcutPicker"
];
code = code.replace(/\n/g, "<br>");
code = code.replace(/ /g, "&nbsp;");

View File

@ -150,6 +150,12 @@ FluObject{
url:"qrc:/example/qml/page/T_ColorPicker.qml"
onTap:{ navigationView.push(url) }
}
FluPaneItem{
title:"ShortcutPicker(ToDo)"
menuDelegate: paneItemMenu
url:"qrc:/example/qml/page/T_ShortcutPicker.qml"
onTap:{ navigationView.push(url) }
}
}
FluPaneItemExpander{

View File

@ -11,26 +11,26 @@ FluTextStyle::FluTextStyle(QObject *parent):QObject{parent}{
QFont bodyStrong;
bodyStrong.setPixelSize(13);
bodyStrong.setBold(true);
bodyStrong.setWeight(QFont::DemiBold);
BodyStrong(bodyStrong);
QFont subtitle;
subtitle.setPixelSize(20);
subtitle.setBold(true);
subtitle.setWeight(QFont::DemiBold);
Subtitle(subtitle);
QFont title;
title.setPixelSize(28);
title.setBold(true);
title.setWeight(QFont::DemiBold);
Title(title);
QFont titleLarge;
titleLarge.setPixelSize(40);
titleLarge.setBold(true);
titleLarge.setWeight(QFont::DemiBold);
TitleLarge(titleLarge);
QFont display;
display.setPixelSize(68);
display.setBold(true);
display.setWeight(QFont::DemiBold);
Display(display);
}

View File

@ -159,7 +159,7 @@ void FluentUI::registerTypes(const char *uri){
void FluentUI::initializeEngine(QQmlEngine *engine, const char *uri){
#ifdef Q_OS_WIN
QFont font;
font.setFamily("Microsoft YaHei");
font.setFamily("Microsoft YaHei UI");
QGuiApplication::setFont(font);
#endif
FluApp* app = FluApp::getInstance();

View File

@ -66,7 +66,7 @@ FluPopup {
}
Rectangle{
id:layout_actions
height: 68
height: 60
radius: 5
color: FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
anchors{
@ -85,7 +85,6 @@ FluPopup {
FluButton{
id:neutral_btn
Layout.fillWidth: true
Layout.fillHeight: true
visible: popup.buttonFlags&FluContentDialogType.NeutralButton
text: neutralText
onClicked: {
@ -97,7 +96,6 @@ FluPopup {
FluButton{
id:negative_btn
Layout.fillWidth: true
Layout.fillHeight: true
visible: popup.buttonFlags&FluContentDialogType.NegativeButton
text: negativeText
onClicked: {
@ -109,7 +107,6 @@ FluPopup {
FluFilledButton{
id:positive_btn
Layout.fillWidth: true
Layout.fillHeight: true
visible: popup.buttonFlags&FluContentDialogType.PositiveButton
text: positiveText
onClicked: {

View File

@ -254,7 +254,7 @@ Window {
id:loader_window_border
anchors.fill: parent
z:999
sourceComponent: window.useSystemAppBar ? undefined : com_window_border
sourceComponent: FluApp.useSystemAppBar ? undefined : com_window_border
}
Component{
id:com_window_border

View File

@ -96,4 +96,5 @@ FluProgressButton 1.0 Controls/FluProgressButton.qml
FluLoadingButton 1.0 Controls/FluLoadingButton.qml
FluClip 1.0 Controls/FluClip.qml
FluLoader 1.0 Controls/FluLoader.qml
FluShortcutPicker 1.0 Controls/FluShortcutPicker.qml
plugin fluentuiplugin

View File

@ -96,5 +96,6 @@
<file>FluentUI/Controls/FluLoadingButton.qml</file>
<file>FluentUI/Controls/FluClip.qml</file>
<file>FluentUI/Controls/FluLoader.qml</file>
<file>FluentUI/Controls/FluShortcutPicker.qml</file>
</qresource>
</RCC>

View File

@ -66,7 +66,7 @@ FluPopup {
}
Rectangle{
id:layout_actions
height: 68
height: 60
radius: 5
color: FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
anchors{
@ -85,7 +85,6 @@ FluPopup {
FluButton{
id:neutral_btn
Layout.fillWidth: true
Layout.fillHeight: true
visible: popup.buttonFlags&FluContentDialogType.NeutralButton
text: neutralText
onClicked: {
@ -97,7 +96,6 @@ FluPopup {
FluButton{
id:negative_btn
Layout.fillWidth: true
Layout.fillHeight: true
visible: popup.buttonFlags&FluContentDialogType.NegativeButton
text: negativeText
onClicked: {
@ -109,7 +107,6 @@ FluPopup {
FluFilledButton{
id:positive_btn
Layout.fillWidth: true
Layout.fillHeight: true
visible: popup.buttonFlags&FluContentDialogType.PositiveButton
text: positiveText
onClicked: {

View File

@ -0,0 +1,70 @@
import QtQuick
import QtQuick.Controls
import FluentUI
FluIconButton {
id:control
background: Rectangle{
border.color: FluTheme.dark ? "#505050" : "#DFDFDF"
border.width: 1
implicitHeight: 42
implicitWidth: layout_row.width+28
radius: control.radius
color:control.color
FluFocusRectangle{
visible: control.activeFocus
}
}
component ItemKey:Rectangle{
id:item_key_control
property string text : ""
color:FluTheme.primaryColor
width: Math.max(item_text.implicitWidth + 12,28)
height: Math.max(item_text.implicitHeight + 12,28)
radius: 4
Text{
id:item_text
color: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
font.pixelSize: 13
text: item_key_control.text
anchors.centerIn: parent
}
}
Row{
id:layout_row
spacing: 5
anchors.centerIn: parent
ItemKey{
text:"Ctrl"
}
ItemKey{
text:"A"
}
Item{
width: 3
height: 1
}
FluIcon{
iconSource: FluentIcons.EditMirrored
iconSize: 13
anchors{
verticalCenter: parent.verticalCenter
}
}
}
FluContentDialog{
id:content_dialog
}
onClicked: {
content_dialog.open()
}
}

View File

@ -253,7 +253,7 @@ Window {
id:loader_window_border
anchors.fill: parent
z:999
sourceComponent: window.useSystemAppBar ? undefined : com_window_border
sourceComponent: FluApp.useSystemAppBar ? undefined : com_window_border
}
Component{
id:com_window_border