This commit is contained in:
朱子楚\zhuzi 2024-04-04 01:10:14 +08:00
parent ef96618151
commit fe08b08c1f
24 changed files with 53 additions and 47 deletions

View File

@ -71,7 +71,7 @@ FluScrollablePage{
anchors.centerIn: parent
text: "Acrylic"
color: "#FFFFFF"
font.bold: true
font: FluTextStyle.Subtitle
}
MouseArea {
property point clickPos: Qt.point(0,0)

View File

@ -58,6 +58,7 @@ FluContentPage {
FluText {
id:item_name
font.pixelSize: 10
font.family: FluTextStyle.family
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: item_icon.bottom
width:parent.width

View File

@ -103,7 +103,6 @@ FluScrollablePage{
horizontalAlignment: Qt.AlignHCenter
text:model.title
color: FluColors.Grey10
font.pixelSize: 15
}
}
}

View File

@ -122,6 +122,7 @@ FluScrollablePage{
Layout.leftMargin: 20
color: FluColors.Grey120
font.pixelSize: 12
font.family: FluTextStyle.family
wrapMode: Text.WrapAnywhere
}
}

View File

@ -42,8 +42,7 @@ FluContentPage{
FluText{
color:"#FFFFFF"
text:model.index
font.bold: true
font.pixelSize: 18
font: FluTextStyle.Title
anchors.centerIn: parent
}
}

View File

@ -41,7 +41,7 @@ FluWindow {
}
FluText{
text: qsTr("Drag in a qml file")
font.pixelSize: 26
font: FluTextStyle.Title
anchors.centerIn: parent
visible: !loader.itemLodaer().item && loader.statusMode === FluStatusLayoutType.Success
}

View File

@ -101,7 +101,7 @@ FluWindow {
width: 186
FluMenuItem{
text: qsTr("Open in Separate Window")
font.pixelSize: 12
font: FluTextStyle.Caption
onClicked: {
FluRouter.navigate("/pageWindow",{title:modelData.title,url:modelData.url})
}

View File

@ -76,7 +76,7 @@ void FluFrameless::componentComplete(){
HWND hwnd = reinterpret_cast<HWND>(window()->winId());
DWORD style = ::GetWindowLongPtr(hwnd, GWL_STYLE);
if(_fixSize){
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME);
::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME | WS_CAPTION);
for (int i = 0; i < qApp->screens().count(); ++i) {
connect( qApp->screens().at(i),&QScreen::logicalDotsPerInchChanged,this,[=]{
SetWindowPos(hwnd,nullptr,0,0,0,0,SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_FRAMECHANGED);
@ -228,12 +228,6 @@ bool FluFrameless::nativeEventFilter(const QByteArray &eventType, void *message,
return true;
}else if(uMsg == WM_GETMINMAXINFO){
MINMAXINFO* minmaxInfo = reinterpret_cast<MINMAXINFO *>(lParam);
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
minmaxInfo->ptMaxPosition.x = 0;
minmaxInfo->ptMaxPosition.y = 0;
minmaxInfo->ptMaxSize.x = 0;
minmaxInfo->ptMaxSize.y = 0;
#else
auto pixelRatio = window()->devicePixelRatio();
auto geometry = window()->screen()->availableGeometry();
RECT rect;
@ -242,7 +236,6 @@ bool FluFrameless::nativeEventFilter(const QByteArray &eventType, void *message,
minmaxInfo->ptMaxPosition.y = rect.top - offsetXY.x();
minmaxInfo->ptMaxSize.x = geometry.width()*pixelRatio + offsetXY.x() * 2;
minmaxInfo->ptMaxSize.y = geometry.height()*pixelRatio + offsetXY.y() * 2;
#endif
return false;
}else if(uMsg == WM_NCRBUTTONDOWN){
if (wParam == HTCAPTION) {

View File

@ -1,35 +1,47 @@
#include "FluTextStyle.h"
FluTextStyle::FluTextStyle(QObject *parent):QObject{parent}{
_family = QFont().defaultFamily();
#ifdef Q_OS_WIN
_family = "微软雅黑";
#endif
QFont caption;
caption.setFamily(_family);
caption.setPixelSize(12);
Caption(caption);
QFont body;
body.setFamily(_family);
body.setPixelSize(13);
Body(body);
QFont bodyStrong;
bodyStrong.setFamily(_family);
bodyStrong.setPixelSize(13);
bodyStrong.setWeight(QFont::DemiBold);
BodyStrong(bodyStrong);
QFont subtitle;
subtitle.setFamily(_family);
subtitle.setPixelSize(20);
subtitle.setWeight(QFont::DemiBold);
Subtitle(subtitle);
QFont title;
title.setFamily(_family);
title.setPixelSize(28);
title.setWeight(QFont::DemiBold);
Title(title);
QFont titleLarge;
titleLarge.setFamily(_family);
titleLarge.setPixelSize(40);
titleLarge.setWeight(QFont::DemiBold);
TitleLarge(titleLarge);
QFont display;
display.setFamily(_family);
display.setPixelSize(68);
display.setWeight(QFont::DemiBold);
Display(display);

View File

@ -14,6 +14,7 @@ class FluTextStyle : public QObject
{
Q_OBJECT
public:
Q_PROPERTY_AUTO(QString,family)
Q_PROPERTY_AUTO(QFont,Caption);
Q_PROPERTY_AUTO(QFont,Body);
Q_PROPERTY_AUTO(QFont,BodyStrong);

View File

@ -149,11 +149,6 @@ void FluentUI::registerTypes(const char *uri){
}
void FluentUI::initializeEngine(QQmlEngine *engine, const char *uri){
#ifdef Q_OS_WIN
QFont font;
font.setFamily("微软雅黑");
QGuiApplication::setFont(font);
#endif
engine->rootContext()->setContextProperty("FluApp",FluApp::getInstance());
engine->rootContext()->setContextProperty("FluColors",FluColors::getInstance());
engine->rootContext()->setContextProperty("FluTheme",FluTheme::getInstance());

View File

@ -449,7 +449,7 @@ FluButton {
DayOfWeekRow {
id: dayOfWeekRow
locale: FluApp.locale
font.bold: false
font: FluTextStyle.Body
delegate: Label {
text: model.shortName
font: dayOfWeekRow.font

View File

@ -68,7 +68,12 @@ T.ComboBox {
rightInset:1
background: FluTextBoxBackground{
border.width: 0
bottomMargin: 0
bottomMargin: {
if(!control.editable){
return 0
}
return contentItem && contentItem.activeFocus ? 2 : 1
}
inputItem: contentItem
}
Component.onCompleted: {

View File

@ -42,7 +42,7 @@ FluButton {
id:divider_1
width: 1
x: parent.width/3
height: parent.height
height: parent.height - 1
color: control.dividerColor
visible: showYear
}
@ -50,7 +50,7 @@ FluButton {
id:divider_2
width: 1
x: showYear ? parent.width*2/3 : parent.width/2
height: parent.height
height: parent.height - 1
color: control.dividerColor
}
FluText{

View File

@ -7,19 +7,18 @@ Page {
property alias currentIndex: nav_list.currentIndex
property color textNormalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120
property color textHoverColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black
property int textSize: 28
property bool textBold: true
property int textSpacing: 10
property int headerSpacing: 20
property int headerHeight: 40
id:control
width: 400
height: 300
font: FluTextStyle.Title
implicitHeight: height
implicitWidth: width
FluObject{
id:d
property int tabY: control.headerHeight/2+control.textSize/2 + 3
property int tabY: control.headerHeight/2+control.font.pixelSize/2 + 3
}
background:Item{}
header:ListView{
@ -65,8 +64,7 @@ Page {
id:item_title
text: modelData.title
anchors.centerIn: parent
font.pixelSize: control.textSize
font.bold: control.textBold
font: control.font
color: {
if(item_button.hovered)
return textHoverColor

View File

@ -131,10 +131,9 @@ FluIconButton {
width: Math.max(item_text.implicitWidth+12,28)
height: Math.max(item_text.implicitHeight,28)
radius: 4
Text{
FluText{
id:item_text
color: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
font.pixelSize: 13
text: keyText
anchors.centerIn: parent
}

View File

@ -58,14 +58,14 @@ FluButton {
id: divider_1
width: 1
x: isH ? parent.width/3 : parent.width/2
height: parent.height
height: parent.height - 1
color: dividerColor
}
Rectangle{
id: divider_2
width: 1
x: parent.width*2/3
height: parent.height
height: parent.height - 1
color: dividerColor
visible: isH
}

View File

@ -448,7 +448,7 @@ FluButton {
DayOfWeekRow {
id: dayOfWeekRow
locale: FluApp.locale
font.bold: false
font: FluTextStyle.Body
delegate: Label {
text: model.shortName
font: dayOfWeekRow.font

View File

@ -68,7 +68,12 @@ T.ComboBox {
rightInset:1
background: FluTextBoxBackground{
border.width: 0
bottomMargin: 0
bottomMargin: {
if(!control.editable){
return 0
}
return contentItem && contentItem.activeFocus ? 2 : 1
}
inputItem: contentItem
}
Component.onCompleted: {

View File

@ -41,7 +41,7 @@ FluButton {
id:divider_1
width: 1
x: parent.width/3
height: parent.height
height: parent.height-1
color: control.dividerColor
visible: showYear
}
@ -49,7 +49,7 @@ FluButton {
id:divider_2
width: 1
x: showYear ? parent.width*2/3 : parent.width/2
height: parent.height
height: parent.height-1
color: control.dividerColor
}
FluText{

View File

@ -8,19 +8,18 @@ Page {
property alias currentIndex: nav_list.currentIndex
property color textNormalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120
property color textHoverColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black
property int textSize: 28
property bool textBold: true
property int textSpacing: 10
property int headerSpacing: 20
property int headerHeight: 40
id:control
width: 400
height: 300
font: FluTextStyle.Title
implicitHeight: height
implicitWidth: width
FluObject{
id:d
property int tabY: control.headerHeight/2+control.textSize/2 + 3
property int tabY: control.headerHeight/2+control.font.pixelSize/2 + 3
}
background:Item{}
header:ListView{
@ -66,10 +65,9 @@ Page {
id:item_title
text: modelData.title
anchors.centerIn: parent
font.pixelSize: control.textSize
font.bold: control.textBold
font: control.font
color: {
if(item_button.hovered || nav_list.currentIndex === index)
if(item_button.hovered)
return textHoverColor
return textNormalColor
}

View File

@ -131,10 +131,9 @@ FluIconButton {
width: Math.max(item_text.implicitWidth+12,28)
height: Math.max(item_text.implicitHeight,28)
radius: 4
Text{
FluText{
id:item_text
color: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
font.pixelSize: 13
text: keyText
anchors.centerIn: parent
}

View File

@ -20,12 +20,13 @@ FluControlBackground{
border.width: 1
gradient: Gradient {
GradientStop { position: 0.0; color: d.startColor }
GradientStop { position: 0.92; color: d.startColor }
GradientStop { position: d.position; color: d.startColor }
GradientStop { position: 1.0; color: d.endColor }
}
bottomMargin: inputItem && inputItem.activeFocus ? 2 : 1
QtObject{
id:d
property real position: 1 - 3/control.height
property color startColor: FluTheme.dark ? Qt.rgba(66/255,66/255,66/255,1) : Qt.rgba(232/255,232/255,232/255,1)
property color endColor: {
if(!control.enabled){

View File

@ -58,14 +58,14 @@ FluButton {
id: divider_1
width: 1
x: isH ? parent.width/3 : parent.width/2
height: parent.height
height: parent.height-1
color: dividerColor
}
Rectangle{
id: divider_2
width: 1
x: parent.width*2/3
height: parent.height
height: parent.height-1
color: dividerColor
visible: isH
}