This commit is contained in:
朱子楚\zhuzi
2024-03-09 15:35:48 +08:00
parent 2a03f24941
commit 7c0c4cc451
167 changed files with 7567 additions and 1816 deletions

128
src/.cmake/QmlPlugin.cmake Normal file
View File

@ -0,0 +1,128 @@
include(CMakeParseArguments)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
function(FindQmlPluginDump)
get_target_property (QT_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
execute_process(
COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_BINS
OUTPUT_VARIABLE QT_BIN_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endfunction()
function(FindQtInstallQml)
execute_process(
COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_QML
OUTPUT_VARIABLE PROC_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(QT_INSTALL_QML ${PROC_RESULT} PARENT_SCOPE)
endfunction()
function(add_qmlplugin TARGET)
set(options NO_AUTORCC NO_AUTOMOC)
set(oneValueArgs URI VERSION BINARY_DIR QMLDIR LIBTYPE)
set(multiValueArgs SOURCES QMLFILES QMLFILESALIAS)
cmake_parse_arguments(QMLPLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT QMLPLUGIN_URI OR NOT QMLPLUGIN_VERSION OR NOT QMLPLUGIN_QMLDIR OR NOT QMLPLUGIN_LIBTYPE)
message(WARNING "TARGET,URI,VERSION,qmldir and LIBTYPE must be set, no files generated")
return()
endif()
if(NOT QMLPLUGIN_BINARY_DIR)
set(QMLPLUGIN_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${QMLPLUGIN_URI})
endif()
add_library(${TARGET} ${QMLPLUGIN_LIBTYPE}
${QMLPLUGIN_SOURCES}
)
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib)
if(QMLPLUGIN_NO_AUTORCC)
set_target_properties(${TARGET} PROPERTIES AUTOMOC OFF)
else()
set_target_properties(${TARGET} PROPERTIES AUTOMOC ON)
endif()
if(QMLPLUGIN_NO_AUTOMOC)
set_target_properties(${TARGET} PROPERTIES AUTOMOC OFF)
else()
set_target_properties(${TARGET} PROPERTIES AUTOMOC ON)
endif()
if (${QMLPLUGIN_LIBTYPE} MATCHES "SHARED")
FindQmlPluginDump()
FindQtInstallQml()
if(QMLPLUGIN_BINARY_DIR)
set(MAKE_QMLPLUGINDIR_COMMAND ${CMAKE_COMMAND} -E make_directory ${QMLPLUGIN_BINARY_DIR})
endif()
set(COPY_QMLDIR_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Qt5/${QMLPLUGIN_QMLDIR}/qmldir $<TARGET_FILE_DIR:${TARGET}>/${QMLPLUGIN_URI}/qmldir)
set(INSTALL_QMLDIR_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Qt5/${QMLPLUGIN_QMLDIR}/qmldir ${QMLPLUGIN_BINARY_DIR}/qmldir)
set(COPY_QMLTYPES_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Qt5/${QMLPLUGIN_QMLDIR}/plugins.qmltypes $<TARGET_FILE_DIR:${TARGET}>/${QMLPLUGIN_URI}/plugins.qmltypes)
set(INSTALL_QMLTYPES_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Qt5/${QMLPLUGIN_QMLDIR}/plugins.qmltypes ${QMLPLUGIN_BINARY_DIR}/plugins.qmltypes)
set(COPY_LIBRARY_COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE_DIR:${TARGET}>/$<TARGET_FILE_NAME:${TARGET}> $<TARGET_FILE_DIR:${TARGET}>/${QMLPLUGIN_URI})
set(INSTALL_LIBRARY_COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE_DIR:${TARGET}>/$<TARGET_FILE_NAME:${TARGET}> ${QMLPLUGIN_BINARY_DIR})
if(QMLPLUGIN_QMLDIR)
set(COPY_QMLFILES_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Qt5/${QMLPLUGIN_QMLDIR} $<TARGET_FILE_DIR:${TARGET}>/${QMLPLUGIN_URI})
else()
set(COPY_QMLFILES_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${QMLPLUGIN_QMLFILES} $<TARGET_FILE_DIR:${TARGET}>/${QMLPLUGIN_URI})
endif()
set(INSTALL_QMLFILES_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Qt5/${QMLPLUGIN_QMLDIR} ${QMLPLUGIN_BINARY_DIR})
if(QMLPLUGIN_BINARY_DIR)
add_custom_command(
TARGET ${TARGET}
POST_BUILD
COMMAND ${MAKE_QMLPLUGINDIR_COMMAND}
COMMAND ${COPY_QMLDIR_COMMAND}
COMMENT "Copying qmldir to binary directory"
)
else()
add_custom_command(
TARGET ${TARGET}
POST_BUILD
COMMAND ${COPY_QMLDIR_COMMAND}
COMMENT "Copying qmldir to binary directory"
)
endif()
if(QMLPLUGIN_BINARY_DIR)
add_custom_command(
TARGET ${TARGET}
POST_BUILD
COMMAND ${MAKE_QMLPLUGINDIR_COMMAND}
COMMAND ${COPY_QMLTYPES_COMMAND}
COMMENT "Copying qmltypes to binary directory"
)
else()
add_custom_command(
TARGET ${TARGET}
POST_BUILD
COMMAND ${COPY_QMLTYPES_COMMAND}
COMMENT "Copying qmltypes to binary directory"
)
endif()
add_custom_command(
TARGET ${TARGET}
POST_BUILD
COMMAND ${COPY_LIBRARY_COMMAND}
COMMENT "Copying Lib to binary plugin directory"
)
if(QMLPLUGIN_QMLFILES)
add_custom_command(
TARGET ${TARGET}
POST_BUILD
COMMAND ${COPY_QMLFILES_COMMAND}
COMMENT "Copying QML files to binary directory"
)
endif()
add_custom_command(
TARGET ${TARGET}
POST_BUILD
COMMAND ${GENERATE_QMLTYPES_COMMAND}
COMMENT "Generating plugin.qmltypes"
)
string(REPLACE "." "/" QMLPLUGIN_INSTALL_URI ${QMLPLUGIN_URI})
add_custom_command(
TARGET ${TARGET}
POST_BUILD
COMMAND ${INSTALL_QMLTYPES_COMMAND}
COMMAND ${INSTALL_QMLDIR_COMMAND}
COMMAND ${INSTALL_LIBRARY_COMMAND}
COMMAND ${INSTALL_QMLFILES_COMMAND}
COMMAND ${INSTALL_QMLTYPES_COMMAND}
COMMENT "Install library and aditional files"
)
endif()
endfunction()

View File

@ -0,0 +1,32 @@
1 VERSIONINFO
FILEVERSION ${GIT_TAG_WITH_COMMA},${GIT_COMMIT_COUNT}
PRODUCTVERSION ${GIT_TAG_WITH_COMMA},${GIT_COMMIT_COUNT}
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080404b0"
BEGIN
VALUE "CompanyName", "ZhuZiChu"
VALUE "FileDescription", "${PROJECT_DESCRIPTION}"
VALUE "FileVersion", "${GIT_SEMVER}.${GIT_COMMIT_COUNT}"
VALUE "InternalName", "${PROJECT_NAME}.dll"
VALUE "LegalCopyright", "Copyright (C) 2023 ZhuZiChu. All rights reserved."
VALUE "OriginalFilename", "${PROJECT_NAME}.dll"
VALUE "ProductName", "${PROJECT_NAME}"
VALUE "ProductVersion", "${GIT_SEMVER}.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x804, 1200
END
END

View File

@ -6,6 +6,8 @@ else()
project(fluentuiplugin VERSION 1.0)
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.cmake/)
#配置通用编译
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -81,9 +83,9 @@ endif()
#如果是Windows平台则生成rc文件
set(FLUENTUI_VERSION_RC_PATH "")
if(WIN32)
set(FLUENTUI_VERSION_RC_PATH ${CMAKE_BINARY_DIR}/version_${PROJECT_NAME}.rc)
set(FLUENTUI_VERSION_RC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/version_${PROJECT_NAME}.rc)
configure_file(
${FLUENTUI_DIRECTORY}/.cmake/version_dll.rc.in
${CMAKE_CURRENT_SOURCE_DIR}/.cmake/version_dll.rc.in
${FLUENTUI_VERSION_RC_PATH}
)
endif()
@ -91,7 +93,7 @@ endif()
if(QT_VERSION VERSION_GREATER_EQUAL "6.2")
#如果是Qt6.2版本以上则使用qt_add_libraryqt_add_qml_module函数添加资源文件
if(FLUENTUI_BUILD_STATIC_LIB)
set(FLUENTUI_QML_PLUGIN_DIRECTORY ${CMAKE_BINARY_DIR}/FluentUI)
set(FLUENTUI_QML_PLUGIN_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/FluentUI)
endif()
qt_add_library(${PROJECT_NAME} ${LIB_TYPE})
qt_add_qml_module(${PROJECT_NAME}

View File

@ -29,7 +29,7 @@ FluTheme::FluTheme(QObject *parent):QObject{parent}{
void FluTheme::refreshColors(){
auto isDark = dark();
primaryColor(isDark ? _accentColor->lighter() : _accentColor->dark());
backgroundColor(isDark ? QColor(0,0,0,255) : QColor(1,1,1,255));
backgroundColor(isDark ? QColor(0,0,0,255) : QColor(255,255,255,255));
dividerColor(isDark ? QColor(80,80,80,255) : QColor(210,210,210,255));
windowBackgroundColor(isDark ? QColor(32,32,32,255) : QColor(237,237,237,255));
windowActiveBackgroundColor(isDark ? QColor(26,26,26,255) : QColor(243,243,243,255));

View File

@ -41,7 +41,7 @@ FluPopup {
FluText{
id:text_message
font: FluTextStyle.Body
wrapMode: Text.WrapAnywhere
wrapMode: Text.WordWrap
text:message
width: parent.width
topPadding: 4
@ -67,7 +67,7 @@ FluPopup {
topPadding: 20
leftPadding: 20
rightPadding: 20
wrapMode: Text.WrapAnywhere
wrapMode: Text.WordWrap
}
FluLoader{
sourceComponent: com_message

View File

@ -10,6 +10,11 @@ Rectangle {
property color normalColor: FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
property bool showYear: true
property var current
property string yearText: "年"
property string monthText: "月"
property string dayText: "日"
property string cancelText: "取消"
property string okText: "确定"
signal accepted()
id:control
color: {
@ -26,9 +31,9 @@ Rectangle {
Component.onCompleted: {
if(current){
const now = current;
var year = text_year.text === "年"? now.getFullYear() : Number(text_year.text);
var month = text_month.text === "月"? now.getMonth() + 1 : Number(text_month.text);
var day = text_day.text === "日" ? now.getDate() : Number(text_day.text);
var year = text_year.text === control.yearText? now.getFullYear() : Number(text_year.text);
var month = text_month.text === control.monthText? now.getMonth() + 1 : Number(text_month.text);
var day = text_day.text === control.dayText ? now.getDate() : Number(text_day.text);
text_year.text = year
text_month.text = month
text_day.text = day
@ -75,7 +80,7 @@ Rectangle {
visible: showYear
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text:"年"
text:control.yearText
}
FluText{
id:text_month
@ -87,7 +92,7 @@ Rectangle {
}
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text:"月"
text:control.monthText
}
FluText{
id:text_day
@ -99,7 +104,7 @@ Rectangle {
}
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text:"日"
text:control.dayText
}
Menu{
id:popup
@ -315,7 +320,7 @@ Rectangle {
right: divider.left
verticalCenter: parent.verticalCenter
}
text: "取消"
text: control.cancelText
onClicked: {
popup.close()
}
@ -328,7 +333,7 @@ Rectangle {
leftMargin: 10
verticalCenter: parent.verticalCenter
}
text: "确定"
text: control.okText
onClicked: {
d.changeFlag = false
popup.close()
@ -356,9 +361,9 @@ Rectangle {
d.rowData[1] = text_month.text
d.rowData[2] = text_day.text
const now = new Date();
var year = text_year.text === "年"? now.getFullYear() : Number(text_year.text);
var month = text_month.text === "月"? now.getMonth() + 1 : Number(text_month.text);
var day = text_day.text === "日" ? now.getDate() : Number(text_day.text);
var year = text_year.text === control.yearText? now.getFullYear() : Number(text_year.text);
var month = text_month.text === control.monthText? now.getMonth() + 1 : Number(text_month.text);
var day = text_day.text === control.dayText ? now.getDate() : Number(text_day.text);
list_view_1.currentIndex = list_view_1.model.indexOf(year)
text_year.text = year
list_view_2.model = generateMonthArray(1,12)

View File

@ -38,17 +38,17 @@ Button {
radius:4
}
gradient: Gradient {
GradientStop { position: 0.33; color: control.normalColor }
GradientStop { position: 1.0; color: Qt.darker(control.normalColor,1.3) }
GradientStop { position: 0.33; color: control.enabled ? control.normalColor : Qt.rgba(0,0,0,0) }
GradientStop { position: 1.0; color: control.enabled ? Qt.darker(control.normalColor,1.3) : Qt.rgba(0,0,0,0) }
}
Rectangle{
radius: parent.radius
anchors{
fill: parent
topMargin: 1
leftMargin: 1
rightMargin: 1
bottomMargin: 2
topMargin: control.enabled ? 1 : 0
leftMargin: control.enabled ? 1 : 0
rightMargin: control.enabled ? 1 : 0
bottomMargin: control.enabled ? 2 : 0
}
color:{
if(!enabled){

View File

@ -192,7 +192,7 @@ FluObject {
spacing: 5
FluText{
text:_super.text
wrapMode: Text.WrapAnywhere
wrapMode: Text.WordWrap
width: Math.min(implicitWidth,mcontrol.maxWidth)
}
FluText{

View File

@ -20,7 +20,7 @@ TextArea{
return normalColor
}
font:FluTextStyle.Body
wrapMode: Text.WrapAnywhere
wrapMode: Text.WordWrap
padding: 8
leftPadding: padding+4
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering

View File

@ -141,7 +141,7 @@ Rectangle {
id:item_text
text: String(display)
elide: Text.ElideRight
wrapMode: Text.WrapAnywhere
wrapMode: Text.WordWrap
anchors{
fill: parent
leftMargin: 11

View File

@ -11,6 +11,12 @@ Rectangle {
property int hourFormat: FluTimePickerType.H
property int isH: hourFormat === FluTimePickerType.H
property var current
property string amText: "上午"
property string pmText: "下午"
property string hourText: "时"
property string minuteText: "分"
property string cancelText: "取消"
property string okText: "确定"
signal accepted()
id:control
color: {
@ -32,17 +38,17 @@ Rectangle {
if(isH){
hour = now.getHours();
if(hour>12){
ampm = "下午"
ampm = control.pmText
hour = hour-12
}else{
ampm = "上午"
ampm = control.amText
}
}else{
hour = now.getHours();
}
hour = text_hour.text === "时"? hour.toString().padStart(2, '0') : text_hour.text
var minute = text_minute.text === "分"? now.getMinutes().toString().padStart(2, '0') : text_minute.text
ampm = text_ampm.text === "AM/PM"?ampm:text_ampm.text
hour = text_hour.text === control.hourText ? hour.toString().padStart(2, '0') : text_hour.text
var minute = text_minute.text === control.minuteText ? now.getMinutes().toString().padStart(2, '0') : text_minute.text
ampm = text_ampm.text === "%1/%2".arg(control.amText).arg(control.pmText) ? ampm : text_ampm.text
text_hour.text = hour
text_minute.text = minute
if(isH){
@ -60,7 +66,7 @@ Rectangle {
}
MouseArea{
id:mouse_area
id: mouse_area
hoverEnabled: true
anchors.fill: parent
onClicked: {
@ -68,22 +74,22 @@ Rectangle {
}
}
Rectangle{
id:divider_1
id: divider_1
width: 1
x: isH ? parent.width/3 : parent.width/2
height: parent.height
color: dividerColor
}
Rectangle{
id:divider_2
id: divider_2
width: 1
x:parent.width*2/3
x: parent.width*2/3
height: parent.height
color: dividerColor
visible: isH
}
FluText{
id:text_hour
id: text_hour
anchors{
left: parent.left
right: divider_1.left
@ -92,10 +98,10 @@ Rectangle {
}
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text:"时"
text: control.hourText
}
FluText{
id:text_minute
id: text_minute
anchors{
left: divider_1.right
right: isH ? divider_2.left : parent.right
@ -104,7 +110,7 @@ Rectangle {
}
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text:"分"
text: control.minuteText
}
FluText{
id:text_ampm
@ -117,7 +123,7 @@ Rectangle {
}
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text:"AM/PM"
text: "%1/%2".arg(control.amText).arg(control.pmText)
}
Menu{
id:popup
@ -278,7 +284,7 @@ Rectangle {
id:list_view_3
width: 100
height: 76
model: ["上午","下午"]
model: [control.amText,control.pmText]
clip: true
visible: isH
preferredHighlightBegin: 0
@ -325,7 +331,7 @@ Rectangle {
right: divider.left
verticalCenter: parent.verticalCenter
}
text: "取消"
text: control.cancelText
onClicked: {
popup.close()
}
@ -338,7 +344,7 @@ Rectangle {
leftMargin: 10
verticalCenter: parent.verticalCenter
}
text: "确定"
text: control.okText
onClicked: {
d.changeFlag = false
popup.close()
@ -349,9 +355,9 @@ Rectangle {
var hours24 = parseInt(hours);
if(control.hourFormat === FluTimePickerType.H){
if (hours === "12") {
hours24 = (period === "上午") ? 0 : 12;
hours24 = (period === control.amText) ? 0 : 12;
} else {
hours24 = (period === "上午") ? hours24 : hours24 + 12;
hours24 = (period === control.pmText) ? hours24 : hours24 + 12;
}
}
date.setHours(hours24);
@ -376,17 +382,17 @@ Rectangle {
if(isH){
hour = now.getHours();
if(hour>12){
ampm = "下午"
ampm = control.pmText
hour = hour-12
}else{
ampm = "上午"
ampm = control.amText
}
}else{
hour = now.getHours();
}
hour = text_hour.text === "时"? hour.toString().padStart(2, '0') : text_hour.text
var minute = text_minute.text === "分"? now.getMinutes().toString().padStart(2, '0') : text_minute.text
ampm = text_ampm.text === "AM/PM"?ampm:text_ampm.text
hour = text_hour.text === control.hourText ? hour.toString().padStart(2, '0') : text_hour.text
var minute = text_minute.text === control.minuteText ? now.getMinutes().toString().padStart(2, '0') : text_minute.text
ampm = text_ampm.text === "%1/%2".arg(control.amText).arg(control.pmText) ? ampm : text_ampm.text
list_view_1.currentIndex = list_view_1.model.indexOf(hour);
list_view_2.currentIndex = list_view_2.model.indexOf(minute);
list_view_3.currentIndex = list_view_3.model.indexOf(ampm);
@ -421,4 +427,3 @@ Rectangle {
return arr;
}
}

View File

@ -95,7 +95,7 @@ Item{
Component{
id:com_lable
FluText{
wrapMode: Text.WrapAnywhere
wrapMode: Text.WordWrap
horizontalAlignment: isRight ? Qt.AlignRight : Qt.AlignLeft
text: {
if(modelData.lable){
@ -110,7 +110,7 @@ Item{
Component{
id:com_text
FluText{
wrapMode: Text.WrapAnywhere
wrapMode: Text.WordWrap
horizontalAlignment: isRight ? Qt.AlignRight : Qt.AlignLeft
text: modelData.text
textFormat: Text.RichText

View File

@ -39,6 +39,11 @@ Button {
enabled: !disabled
verticalPadding: 0
horizontalPadding:12
onCheckableChanged: {
if(checkable){
checkable = false
}
}
onClicked: clickListener()
background: Rectangle{
implicitWidth: 28
@ -49,17 +54,17 @@ Button {
radius:4
}
gradient: Gradient {
GradientStop { position: 0.33; color: control.normalColor }
GradientStop { position: 1.0; color: Qt.darker(control.normalColor,1.3) }
GradientStop { position: 0.33; color: control.enabled ? control.normalColor : Qt.rgba(0,0,0,0) }
GradientStop { position: 1.0; color: control.enabled ? Qt.darker(control.normalColor,1.3) : Qt.rgba(0,0,0,0) }
}
Rectangle{
radius: parent.radius
anchors{
fill: parent
topMargin: checked ? 1 : 0
leftMargin: checked ? 1 : 0
rightMargin: checked ? 1 : 0
bottomMargin: checked ? 2 : 0
topMargin: checked && enabled ? 1 : 0
leftMargin: checked && enabled ? 1 : 0
rightMargin: checked && enabled ? 1 : 0
bottomMargin: checked && enabled ? 2 : 0
}
color:{
if(!enabled){

View File

@ -10,6 +10,9 @@ Popup{
property Component nextButton: com_next_button
property Component prevButton: com_prev_button
property int index : 0
property string finishText: "结束导览"
property string nextText: "下一步"
property string previousText: "上一步"
id:control
padding: 0
parent: Overlay.overlay
@ -26,9 +29,9 @@ Popup{
canvas.requestPaint()
}
Component{
id:com_next_button
id: com_next_button
FluFilledButton{
text: isEnd ? "结束导览" :"下一步"
text: isEnd ? control.finishText : control.nextText
onClicked: {
if(isEnd){
control.close()
@ -39,9 +42,9 @@ Popup{
}
}
Component{
id:com_prev_button
id: com_prev_button
FluButton{
text: "上一步"
text: control.previousText
onClicked: {
control.index = control.index - 1
}
@ -51,8 +54,8 @@ Popup{
id:d
property var window: Window.window
property point pos: Qt.point(0,0)
property var step : steps[index]
property var target : step.target()
property var step: steps[index]
property var target: step.target()
}
Connections{
target: d.window
@ -66,14 +69,14 @@ Popup{
}
}
Timer{
id:timer_delay
id: timer_delay
interval: 200
onTriggered: {
canvas.requestPaint()
}
}
Canvas{
id:canvas
id: canvas
anchors.fill: parent
onPaint: {
d.pos = d.target.mapToGlobal(0,0)
@ -105,7 +108,7 @@ Popup{
}
}
FluArea{
id:layout_panne
id: layout_panne
radius: 5
width: 500
height: 88 + text_desc.height
@ -116,7 +119,7 @@ Popup{
return 0
}
x: Math.min(Math.max(0,d.pos.x+d.target.width/2-width/2),control.width-width)
y:{
y: {
var ty=d.pos.y+d.target.height+control.targetMargins + 15
if((ty+height)>control.height)
return d.pos.y-height-control.targetMargins - 15
@ -140,9 +143,9 @@ Popup{
}
}
FluText{
id:text_desc
id: text_desc
font: FluTextStyle.Body
wrapMode: Text.WrapAnywhere
wrapMode: Text.WordWrap
maximumLineCount: 4
elide: Text.ElideRight
text: d.step.description
@ -156,22 +159,22 @@ Popup{
}
}
FluLoader{
id:loader_next
id: loader_next
property bool isEnd: control.index === steps.length-1
sourceComponent: com_next_button
anchors{
top:text_desc.bottom
top: text_desc.bottom
topMargin: 10
right: parent.right
rightMargin: 15
}
}
FluLoader{
id:loader_prev
id: loader_prev
visible: control.index !== 0
sourceComponent: com_prev_button
anchors{
right:loader_next.left
right: loader_next.left
top: loader_next.top
rightMargin: 14
}
@ -187,7 +190,7 @@ Popup{
verticalPadding: 0
horizontalPadding: 0
iconSize: 12
iconSource : FluentIcons.ChromeClose
iconSource: FluentIcons.ChromeClose
onClicked: {
control.close()
}

View File

@ -7,7 +7,6 @@ import FluentUI 1.0
Window {
default property alias content: layout_content.data
property string windowIcon: FluApp.windowIcon
property bool closeDestory: true
property int launchMode: FluWindowType.Standard
property var argument:({})
property var background : com_background
@ -39,6 +38,7 @@ Window {
property bool autoMaximize: false
property bool autoVisible: true
property bool autoCenter: true
property bool autoDestory: true
property bool useSystemAppBar
property color resizeBorderColor: {
if(window.active){
@ -48,7 +48,7 @@ Window {
}
property int resizeBorderWidth: 1
property var closeListener: function(event){
if(closeDestory){
if(autoDestory){
destoryOnClose()
}else{
visible = false

View File

@ -41,7 +41,7 @@ FluPopup {
FluText{
id:text_message
font: FluTextStyle.Body
wrapMode: Text.WrapAnywhere
wrapMode: Text.WordWrap
text:message
width: parent.width
topPadding: 4
@ -67,7 +67,7 @@ FluPopup {
topPadding: 20
leftPadding: 20
rightPadding: 20
wrapMode: Text.WrapAnywhere
wrapMode: Text.WordWrap
}
FluLoader{
sourceComponent: com_message

View File

@ -10,6 +10,11 @@ Rectangle {
property color normalColor: FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
property bool showYear: true
property var current
property string yearText: "年"
property string monthText: "月"
property string dayText: "日"
property string cancelText: "取消"
property string okText: "确定"
signal accepted()
id:control
color: {
@ -26,9 +31,9 @@ Rectangle {
Component.onCompleted: {
if(current){
const now = current;
var year = text_year.text === "年"? now.getFullYear() : Number(text_year.text);
var month = text_month.text === "月"? now.getMonth() + 1 : Number(text_month.text);
var day = text_day.text === "日" ? now.getDate() : Number(text_day.text);
var year = text_year.text === control.yearText? now.getFullYear() : Number(text_year.text);
var month = text_month.text === control.monthText? now.getMonth() + 1 : Number(text_month.text);
var day = text_day.text === control.dayText ? now.getDate() : Number(text_day.text);
text_year.text = year
text_month.text = month
text_day.text = day
@ -75,7 +80,7 @@ Rectangle {
visible: showYear
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text:"年"
text:control.yearText
}
FluText{
id:text_month
@ -87,7 +92,7 @@ Rectangle {
}
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text:"月"
text:control.monthText
}
FluText{
id:text_day
@ -99,7 +104,7 @@ Rectangle {
}
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text:"日"
text:control.dayText
}
Menu{
id:popup
@ -315,7 +320,7 @@ Rectangle {
right: divider.left
verticalCenter: parent.verticalCenter
}
text: "取消"
text: control.cancelText
onClicked: {
popup.close()
}
@ -328,7 +333,7 @@ Rectangle {
leftMargin: 10
verticalCenter: parent.verticalCenter
}
text: "确定"
text: control.okText
onClicked: {
d.changeFlag = false
popup.close()
@ -356,9 +361,9 @@ Rectangle {
d.rowData[1] = text_month.text
d.rowData[2] = text_day.text
const now = new Date();
var year = text_year.text === "年"? now.getFullYear() : Number(text_year.text);
var month = text_month.text === "月"? now.getMonth() + 1 : Number(text_month.text);
var day = text_day.text === "日" ? now.getDate() : Number(text_day.text);
var year = text_year.text === control.yearText? now.getFullYear() : Number(text_year.text);
var month = text_month.text === control.monthText? now.getMonth() + 1 : Number(text_month.text);
var day = text_day.text === control.dayText ? now.getDate() : Number(text_day.text);
list_view_1.currentIndex = list_view_1.model.indexOf(year)
text_year.text = year
list_view_2.model = generateMonthArray(1,12)

View File

@ -39,17 +39,17 @@ Button {
radius:4
}
gradient: Gradient {
GradientStop { position: 0.33; color: control.normalColor }
GradientStop { position: 1.0; color: Qt.darker(control.normalColor,1.3) }
GradientStop { position: 0.33; color: control.enabled ? control.normalColor : Qt.rgba(0,0,0,0) }
GradientStop { position: 1.0; color: control.enabled ? Qt.darker(control.normalColor,1.3) : Qt.rgba(0,0,0,0) }
}
Rectangle{
radius: parent.radius
anchors{
fill: parent
topMargin: 1
leftMargin: 1
rightMargin: 1
bottomMargin: 2
topMargin: control.enabled ? 1 : 0
leftMargin: control.enabled ? 1 : 0
rightMargin: control.enabled ? 1 : 0
bottomMargin: control.enabled ? 2 : 0
}
color:{
if(!enabled){

View File

@ -192,7 +192,7 @@ FluObject {
spacing: 5
FluText{
text:_super.text
wrapMode: Text.WrapAnywhere
wrapMode: Text.WordWrap
width: Math.min(implicitWidth,mcontrol.maxWidth)
}
FluText{

View File

@ -21,7 +21,7 @@ TextArea{
return normalColor
}
font:FluTextStyle.Body
wrapMode: Text.WrapAnywhere
wrapMode: Text.WordWrap
padding: 8
leftPadding: padding+4
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering

View File

@ -142,7 +142,7 @@ Rectangle {
id:item_text
text: String(display)
elide: Text.ElideRight
wrapMode: Text.WrapAnywhere
wrapMode: Text.WordWrap
anchors{
fill: parent
leftMargin: 11

View File

@ -11,6 +11,12 @@ Rectangle {
property int hourFormat: FluTimePickerType.H
property int isH: hourFormat === FluTimePickerType.H
property var current
property string amText: "上午"
property string pmText: "下午"
property string hourText: "时"
property string minuteText: "分"
property string cancelText: "取消"
property string okText: "确定"
signal accepted()
id:control
color: {
@ -32,17 +38,17 @@ Rectangle {
if(isH){
hour = now.getHours();
if(hour>12){
ampm = "下午"
ampm = control.pmText
hour = hour-12
}else{
ampm = "上午"
ampm = control.amText
}
}else{
hour = now.getHours();
}
hour = text_hour.text === "时"? hour.toString().padStart(2, '0') : text_hour.text
var minute = text_minute.text === "分"? now.getMinutes().toString().padStart(2, '0') : text_minute.text
ampm = text_ampm.text === "AM/PM"?ampm:text_ampm.text
hour = text_hour.text === control.hourText ? hour.toString().padStart(2, '0') : text_hour.text
var minute = text_minute.text === control.minuteText ? now.getMinutes().toString().padStart(2, '0') : text_minute.text
ampm = text_ampm.text === "%1/%2".arg(control.amText).arg(control.pmText) ? ampm : text_ampm.text
text_hour.text = hour
text_minute.text = minute
if(isH){
@ -60,7 +66,7 @@ Rectangle {
}
MouseArea{
id:mouse_area
id: mouse_area
hoverEnabled: true
anchors.fill: parent
onClicked: {
@ -68,22 +74,22 @@ Rectangle {
}
}
Rectangle{
id:divider_1
id: divider_1
width: 1
x: isH ? parent.width/3 : parent.width/2
height: parent.height
color: dividerColor
}
Rectangle{
id:divider_2
id: divider_2
width: 1
x:parent.width*2/3
x: parent.width*2/3
height: parent.height
color: dividerColor
visible: isH
}
FluText{
id:text_hour
id: text_hour
anchors{
left: parent.left
right: divider_1.left
@ -92,10 +98,10 @@ Rectangle {
}
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text:"时"
text: control.hourText
}
FluText{
id:text_minute
id: text_minute
anchors{
left: divider_1.right
right: isH ? divider_2.left : parent.right
@ -104,7 +110,7 @@ Rectangle {
}
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text:"分"
text: control.minuteText
}
FluText{
id:text_ampm
@ -117,7 +123,7 @@ Rectangle {
}
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text:"AM/PM"
text: "%1/%2".arg(control.amText).arg(control.pmText)
}
Menu{
id:popup
@ -278,7 +284,7 @@ Rectangle {
id:list_view_3
width: 100
height: 76
model: ["上午","下午"]
model: [control.amText,control.pmText]
clip: true
visible: isH
preferredHighlightBegin: 0
@ -325,7 +331,7 @@ Rectangle {
right: divider.left
verticalCenter: parent.verticalCenter
}
text: "取消"
text: control.cancelText
onClicked: {
popup.close()
}
@ -338,7 +344,7 @@ Rectangle {
leftMargin: 10
verticalCenter: parent.verticalCenter
}
text: "确定"
text: control.okText
onClicked: {
d.changeFlag = false
popup.close()
@ -349,9 +355,9 @@ Rectangle {
var hours24 = parseInt(hours);
if(control.hourFormat === FluTimePickerType.H){
if (hours === "12") {
hours24 = (period === "上午") ? 0 : 12;
hours24 = (period === control.amText) ? 0 : 12;
} else {
hours24 = (period === "上午") ? hours24 : hours24 + 12;
hours24 = (period === control.pmText) ? hours24 : hours24 + 12;
}
}
date.setHours(hours24);
@ -376,17 +382,17 @@ Rectangle {
if(isH){
hour = now.getHours();
if(hour>12){
ampm = "下午"
ampm = control.pmText
hour = hour-12
}else{
ampm = "上午"
ampm = control.amText
}
}else{
hour = now.getHours();
}
hour = text_hour.text === "时"? hour.toString().padStart(2, '0') : text_hour.text
var minute = text_minute.text === "分"? now.getMinutes().toString().padStart(2, '0') : text_minute.text
ampm = text_ampm.text === "AM/PM"?ampm:text_ampm.text
hour = text_hour.text === control.hourText ? hour.toString().padStart(2, '0') : text_hour.text
var minute = text_minute.text === control.minuteText ? now.getMinutes().toString().padStart(2, '0') : text_minute.text
ampm = text_ampm.text === "%1/%2".arg(control.amText).arg(control.pmText) ? ampm : text_ampm.text
list_view_1.currentIndex = list_view_1.model.indexOf(hour);
list_view_2.currentIndex = list_view_2.model.indexOf(minute);
list_view_3.currentIndex = list_view_3.model.indexOf(ampm);

View File

@ -95,7 +95,7 @@ Item{
Component{
id:com_lable
FluText{
wrapMode: Text.WrapAnywhere
wrapMode: Text.WordWrap
horizontalAlignment: isRight ? Qt.AlignRight : Qt.AlignLeft
text: {
if(modelData.lable){
@ -110,7 +110,7 @@ Item{
Component{
id:com_text
FluText{
wrapMode: Text.WrapAnywhere
wrapMode: Text.WordWrap
horizontalAlignment: isRight ? Qt.AlignRight : Qt.AlignLeft
text: modelData.text
textFormat: Text.RichText

View File

@ -50,17 +50,17 @@ Button {
radius:4
}
gradient: Gradient {
GradientStop { position: 0.33; color: control.normalColor }
GradientStop { position: 1.0; color: Qt.darker(control.normalColor,1.3) }
GradientStop { position: 0.33; color: control.enabled ? control.normalColor : Qt.rgba(0,0,0,0) }
GradientStop { position: 1.0; color: control.enabled ? Qt.darker(control.normalColor,1.3) : Qt.rgba(0,0,0,0) }
}
Rectangle{
radius: parent.radius
anchors{
fill: parent
topMargin: checked ? 1 : 0
leftMargin: checked ? 1 : 0
rightMargin: checked ? 1 : 0
bottomMargin: checked ? 2 : 0
topMargin: checked && enabled ? 1 : 0
leftMargin: checked && enabled ? 1 : 0
rightMargin: checked && enabled ? 1 : 0
bottomMargin: checked && enabled ? 2 : 0
}
color:{
if(!enabled){

View File

@ -10,6 +10,9 @@ Popup{
property Component nextButton: com_next_button
property Component prevButton: com_prev_button
property int index : 0
property string finishText: "结束导览"
property string nextText: "下一步"
property string previousText: "上一步"
id:control
padding: 0
parent: Overlay.overlay
@ -26,9 +29,9 @@ Popup{
canvas.requestPaint()
}
Component{
id:com_next_button
id: com_next_button
FluFilledButton{
text: isEnd ? "结束导览" :"下一步"
text: isEnd ? control.finishText : control.nextText
onClicked: {
if(isEnd){
control.close()
@ -39,9 +42,9 @@ Popup{
}
}
Component{
id:com_prev_button
id: com_prev_button
FluButton{
text: "上一步"
text: control.previousText
onClicked: {
control.index = control.index - 1
}
@ -51,8 +54,8 @@ Popup{
id:d
property var window: Window.window
property point pos: Qt.point(0,0)
property var step : steps[index]
property var target : step.target()
property var step: steps[index]
property var target: step.target()
}
Connections{
target: d.window
@ -66,14 +69,14 @@ Popup{
}
}
Timer{
id:timer_delay
id: timer_delay
interval: 200
onTriggered: {
canvas.requestPaint()
}
}
Canvas{
id:canvas
id: canvas
anchors.fill: parent
onPaint: {
d.pos = d.target.mapToGlobal(0,0)
@ -105,7 +108,7 @@ Popup{
}
}
FluArea{
id:layout_panne
id: layout_panne
radius: 5
width: 500
height: 88 + text_desc.height
@ -116,7 +119,7 @@ Popup{
return 0
}
x: Math.min(Math.max(0,d.pos.x+d.target.width/2-width/2),control.width-width)
y:{
y: {
var ty=d.pos.y+d.target.height+control.targetMargins + 15
if((ty+height)>control.height)
return d.pos.y-height-control.targetMargins - 15
@ -140,9 +143,9 @@ Popup{
}
}
FluText{
id:text_desc
id: text_desc
font: FluTextStyle.Body
wrapMode: Text.WrapAnywhere
wrapMode: Text.WordWrap
maximumLineCount: 4
elide: Text.ElideRight
text: d.step.description
@ -156,22 +159,22 @@ Popup{
}
}
FluLoader{
id:loader_next
id: loader_next
property bool isEnd: control.index === steps.length-1
sourceComponent: com_next_button
anchors{
top:text_desc.bottom
top: text_desc.bottom
topMargin: 10
right: parent.right
rightMargin: 15
}
}
FluLoader{
id:loader_prev
id: loader_prev
visible: control.index !== 0
sourceComponent: com_prev_button
anchors{
right:loader_next.left
right: loader_next.left
top: loader_next.top
rightMargin: 14
}
@ -187,7 +190,7 @@ Popup{
verticalPadding: 0
horizontalPadding: 0
iconSize: 12
iconSource : FluentIcons.ChromeClose
iconSource: FluentIcons.ChromeClose
onClicked: {
control.close()
}

View File

@ -6,7 +6,6 @@ import FluentUI
Window {
default property alias content: layout_content.data
property string windowIcon: FluApp.windowIcon
property bool closeDestory: true
property int launchMode: FluWindowType.Standard
property var argument:({})
property var background : com_background
@ -38,6 +37,7 @@ Window {
property bool autoMaximize: false
property bool autoVisible: true
property bool autoCenter: true
property bool autoDestory: true
property bool useSystemAppBar
property color resizeBorderColor: {
if(window.active){
@ -47,7 +47,7 @@ Window {
}
property int resizeBorderWidth: 1
property var closeListener: function(event){
if(closeDestory){
if(autoDestory){
destoryOnClose()
}else{
visible = false

View File

@ -0,0 +1,32 @@
1 VERSIONINFO
FILEVERSION 1,6,9,1176
PRODUCTVERSION 1,6,9,1176
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080404b0"
BEGIN
VALUE "CompanyName", "ZhuZiChu"
VALUE "FileDescription", ""
VALUE "FileVersion", "1.6.9.1176"
VALUE "InternalName", "fluentuiplugin.dll"
VALUE "LegalCopyright", "Copyright (C) 2023 ZhuZiChu. All rights reserved."
VALUE "OriginalFilename", "fluentuiplugin.dll"
VALUE "ProductName", "fluentuiplugin"
VALUE "ProductVersion", "1.6.9.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x804, 1200
END
END