Compare commits

..

7 Commits

Author SHA1 Message Date
cd577c5599 update 2023-06-25 11:44:13 +08:00
d43532986a update 2023-06-25 11:30:25 +08:00
4c9e576072 update 2023-06-25 10:13:50 +08:00
b254064e26 Merge pull request #168 from mentalfl0w/dev
Fix qt_standard_project_setup for Qt 6.2 and below.
2023-06-25 09:03:12 +08:00
ffd8072826 Fix qt_standard_project_setup for Qt 6.2 and below. 2023-06-24 21:57:00 +08:00
9a1db0b230 update 2023-06-24 11:56:32 +08:00
9786e69fc2 update 2023-06-24 10:27:28 +08:00
10 changed files with 132 additions and 83 deletions

View File

@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.20)
project(example VERSION 0.1 LANGUAGES CXX)
#配置通用编译
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(APPLE)
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
@ -20,10 +19,17 @@ endif()
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
#设置版本号
add_definitions(-DVERSION=1,3,6,0)
add_definitions(-DVERSION=1,3,6,1)
find_package(Qt6 REQUIRED COMPONENTS Quick)
qt_standard_project_setup()
if(QT_VERSION VERSION_GREATER_EQUAL "6.3")
qt_standard_project_setup()
else()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
endif()
#遍历所有Cpp文件
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
@ -105,10 +111,3 @@ install(TARGETS example
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
qt_generate_deploy_app_script(
TARGET example
OUTPUT_SCRIPT deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})

View File

@ -23,6 +23,9 @@ FluScrollablePage{
text:"showYear=true"
}
FluDatePicker{
onCurrentChanged: {
showSuccess(current.toLocaleDateString())
}
}
}
}
@ -50,7 +53,9 @@ FluScrollablePage{
FluDatePicker{
showYear:false
onCurrentChanged: {
showSuccess(current.toLocaleDateString())
}
}
}
}

View File

@ -27,6 +27,9 @@ FluScrollablePage{
}
FluTimePicker{
onCurrentChanged: {
showSuccess(current.toLocaleTimeString(Qt.locale("de_DE")))
}
}
}
@ -53,11 +56,14 @@ FluScrollablePage{
}
FluText{
text:"hourFormat=FluTimePicker.H"
text:"hourFormat=FluTimePicker.HH"
}
FluTimePicker{
hourFormat:FluTimePicker.HH
onCurrentChanged: {
showSuccess(current.toLocaleTimeString(Qt.locale("de_DE")))
}
}
}

View File

@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.20)
project(fluentuiplugin LANGUAGES CXX)
#配置通用编译
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(APPLE)
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
@ -13,10 +12,17 @@ endif()
set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
#设置版本号
add_definitions(-DVERSION=1,3,6,0)
add_definitions(-DVERSION=1,3,6,1)
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)
qt_standard_project_setup()
if(QT_VERSION VERSION_GREATER_EQUAL "6.3")
qt_standard_project_setup()
else()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
endif()
#遍历所有Cpp文件
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
@ -62,9 +68,9 @@ qt_add_qml_module(fluentuiplugin
#链接库
target_link_libraries(fluentuiplugin PUBLIC
Qt::Core
Qt::Quick
Qt::Qml
Qt::CorePrivate
Qt::QuickPrivate
Qt::QmlPrivate
)
#安装

View File

@ -38,13 +38,13 @@ void FluApp::run(){
void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegister* fluRegister){
if(!routes().contains(route)){
qErrnoWarning("没有找到当前路由");
qFatal()<<"No route found "<<route;
return;
}
QQmlEngine *engine = qmlEngine(appWindow);
QQmlComponent component(engine, routes().value(route).toString());
if (component.isError()) {
qWarning() << component.errors();
qFatal() << component.errors();
return;
}
QVariantMap properties;

View File

@ -243,8 +243,6 @@ Item {
}
FluTextButton{
id:title
leftPadding: 0
rightPadding: 0
anchors{
verticalCenter: parent.verticalCenter
left: parent.left

View File

@ -8,11 +8,9 @@ Rectangle {
property color dividerColor: FluTheme.dark ? Qt.rgba(77/255,77/255,77/255,1) : Qt.rgba(239/255,239/255,239/255,1)
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
property color normalColor: FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
property var window : Window.window
property bool showYear: true
property bool changeFlag: true
readonly property var rowData: ["","",""]
id:root
property var current
id:control
color: {
if(mouse_area.containsMouse){
return hoverColor
@ -24,6 +22,13 @@ Rectangle {
radius: 4
border.width: 1
border.color: dividerColor
Item{
id:d
property var window: Window.window
property bool changeFlag: true
property var rowData: ["","",""]
visible: false
}
MouseArea{
id:mouse_area
hoverEnabled: true
@ -317,8 +322,19 @@ Rectangle {
}
text: "确定"
onClicked: {
changeFlag = false
d.changeFlag = false
popup.close()
const year = text_year.text
const month = text_month.text
const day = text_day.text
const date = new Date()
date.setFullYear(parseInt(year));
date.setMonth(parseInt(month) - 1);
date.setDate(parseInt(day));
date.setHours(0);
date.setMinutes(0);
date.setSeconds(0);
current = date
}
}
}
@ -326,10 +342,10 @@ Rectangle {
}
y:35
function showPopup() {
changeFlag = true
rowData[0] = text_year.text
rowData[1] = text_month.text
rowData[2] = text_day.text
d.changeFlag = true
d.rowData[0] = text_year.text
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);
@ -342,21 +358,21 @@ Rectangle {
list_view_3.model = generateMonthDaysArray(year,month)
list_view_3.currentIndex = list_view_3.model.indexOf(day)
text_day.text = day
var pos = root.mapToItem(null, 0, 0)
if(window.height>pos.y+root.height+container.height){
popup.y = root.height
var pos = control.mapToItem(null, 0, 0)
if(d.window.height>pos.y+control.height+container.height){
popup.y = control.height
} else if(pos.y>container.height){
popup.y = -container.height
} else {
popup.y = window.height-(pos.y+container.height)
popup.y = d.window.height-(pos.y+container.height)
}
popup.open()
}
onClosed: {
if(changeFlag){
text_year.text = rowData[0]
text_month.text = rowData[1]
text_day.text = rowData[2]
if(d.changeFlag){
text_year.text = d.rowData[0]
text_month.text = d.rowData[1]
text_day.text = d.rowData[2]
}
}
}

View File

@ -121,8 +121,7 @@ Item {
}
Behavior on height {
NumberAnimation{
duration: 167
easing.type: Easing.InCubic
duration: 83
}
}
}
@ -138,8 +137,7 @@ Item {
}
Behavior on height {
NumberAnimation{
duration: 167
easing.type: Easing.InCubic
duration: 83
}
}
width: layout_list.width
@ -330,8 +328,7 @@ Item {
Item{
Behavior on height {
NumberAnimation{
duration: 167
easing.type: Easing.InCubic
duration: 83
}
}
clip: true
@ -685,7 +682,6 @@ Item {
}
return "transparent"
}
clip: true
x: visible ? 0 : -width
Behavior on width {
NumberAnimation{
@ -955,7 +951,6 @@ Item {
radius: 4
}
color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
}
function showPopup(pos,model){
control_popup.x = pos.x

View File

@ -42,27 +42,31 @@ T.Slider {
}
}
}
background: Item {
x: control.leftPadding + (control.horizontal ? 0 : (control.availableWidth - width) / 2)
y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : 0)
implicitWidth: control.horizontal ? 180 : 6
implicitHeight: control.horizontal ? 6 : 180
width: control.horizontal ? control.availableWidth : implicitWidth
height: control.horizontal ? implicitHeight : control.availableHeight
Rectangle{
anchors.fill: parent
anchors.margins: 1
radius: 2
color:FluTheme.dark ? Qt.rgba(162/255,162/255,162/255,1) : Qt.rgba(138/255,138/255,138/255,1)
}
scale: control.horizontal && control.mirrored ? -1 : 1
Rectangle {
y: control.horizontal ? 0 : control.visualPosition * parent.height
width: control.horizontal ? control.position * parent.width : 6
height: control.horizontal ? 6 : control.position * parent.height
radius: 3
color:FluTheme.dark ? FluTheme.primaryColor.lighter :FluTheme.primaryColor.dark
}
}
FluTooltip{
parent: control.handle
visible: control.tooltipEnabled && control.pressed
text:String(control.value)
}
background: Rectangle {
x: control.leftPadding + (control.horizontal ? 0 : (control.availableWidth - width) / 2)
y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : 0)
implicitWidth: control.horizontal ? 180 : 4
implicitHeight: control.horizontal ? 4 : 180
width: control.horizontal ? control.availableWidth : implicitWidth
height: control.horizontal ? implicitHeight : control.availableHeight
radius: 3
color:FluTheme.dark ? Qt.rgba(162/255,162/255,162/255,1) : Qt.rgba(138/255,138/255,138/255,1)
scale: control.horizontal && control.mirrored ? -1 : 1
Rectangle {
y: control.horizontal ? 0 : control.visualPosition * parent.height
width: control.horizontal ? control.position * parent.width : 4
height: control.horizontal ? 4 : control.position * parent.height
radius: 2
color:FluTheme.dark ? FluTheme.primaryColor.lighter :FluTheme.primaryColor.dark
}
}
}

View File

@ -12,10 +12,10 @@ Rectangle {
property color dividerColor: FluTheme.dark ? Qt.rgba(77/255,77/255,77/255,1) : Qt.rgba(239/255,239/255,239/255,1)
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
property color normalColor: FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
property var window : Window.window
property int hourFormat: FluTimePicker.H
property int isH: hourFormat === FluTimePicker.H
id:root
property var current
id:control
color: {
if(mouse_area.containsMouse){
return hoverColor
@ -27,6 +27,13 @@ Rectangle {
radius: 4
border.width: 1
border.color: dividerColor
Item{
id:d
property var window: Window.window
property bool changeFlag: true
property var rowData: ["","",""]
visible: false
}
MouseArea{
id:mouse_area
hoverEnabled: true
@ -312,8 +319,24 @@ Rectangle {
}
text: "确定"
onClicked: {
changeFlag = false
d.changeFlag = false
popup.close()
const hours = text_hour.text
const minutes = text_minute.text
const period = text_ampm.text
const date = new Date()
var hours24 = parseInt(hours);
if(control.hourFormat === FluTimePicker.H){
if (hours === "12") {
hours24 = (period === "上午") ? 0 : 12;
} else {
hours24 = (period === "上午") ? hours24 : hours24 + 12;
}
}
date.setHours(hours24);
date.setMinutes(parseInt(minutes));
date.setSeconds(0);
current = date
}
}
}
@ -321,10 +344,10 @@ Rectangle {
}
y:35
function showPopup() {
changeFlag = true
rowData[0] = text_hour.text
rowData[1] = text_minute.text
rowData[2] = text_ampm.text
d.changeFlag = true
d.rowData[0] = text_hour.text
d.rowData[1] = text_minute.text
d.rowData[2] = text_ampm.text
var now = new Date();
@ -353,27 +376,24 @@ Rectangle {
if(isH){
text_ampm.text = ampm
}
var pos = root.mapToItem(null, 0, 0)
if(window.height>pos.y+root.height+container.height){
popup.y = root.height
var pos = control.mapToItem(null, 0, 0)
if(d.window.height>pos.y+control.height+container.height){
popup.y = control.height
} else if(pos.y>container.height){
popup.y = -container.height
} else {
popup.y = window.height-(pos.y+container.height)
popup.y = d.window.height-(pos.y+container.height)
}
popup.open()
}
onClosed: {
if(changeFlag){
text_hour.text = rowData[0]
text_minute.text = rowData[1]
text_ampm.text = rowData[2]
if(d.changeFlag){
text_hour.text = d.rowData[0]
text_minute.text = d.rowData[1]
text_ampm.text = d.rowData[2]
}
}
}
property bool changeFlag: true
readonly property var rowData: ["","",""]
function generateArray(start, n) {
var arr = [];
for (var i = start; i <= n; i++) {