mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-04 00:55:30 +08:00
Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
0610f63f26 | |||
d741b3eb4f | |||
cb7d2097f2 | |||
dff77d3d4f | |||
6d0834c653 | |||
059a1b17cc | |||
e1096b8e22 | |||
cd577c5599 | |||
d43532986a | |||
4c9e576072 | |||
b254064e26 | |||
ffd8072826 | |||
9a1db0b230 | |||
9786e69fc2 |
@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.20)
|
|||||||
project(example VERSION 0.1 LANGUAGES CXX)
|
project(example VERSION 0.1 LANGUAGES CXX)
|
||||||
|
|
||||||
#配置通用编译
|
#配置通用编译
|
||||||
set(CMAKE_AUTOMOC ON)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
||||||
@ -20,10 +19,17 @@ endif()
|
|||||||
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
||||||
|
|
||||||
#设置版本号
|
#设置版本号
|
||||||
add_definitions(-DVERSION=1,3,6,0)
|
add_definitions(-DVERSION=1,3,6,2)
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Quick)
|
find_package(Qt6 REQUIRED COMPONENTS Quick)
|
||||||
|
|
||||||
|
if(QT_VERSION VERSION_GREATER_EQUAL "6.3")
|
||||||
qt_standard_project_setup()
|
qt_standard_project_setup()
|
||||||
|
else()
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
#遍历所有Cpp文件
|
#遍历所有Cpp文件
|
||||||
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
|
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
|
||||||
@ -105,10 +111,3 @@ install(TARGETS example
|
|||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_generate_deploy_app_script(
|
|
||||||
TARGET example
|
|
||||||
OUTPUT_SCRIPT deploy_script
|
|
||||||
NO_UNSUPPORTED_PLATFORM_ERROR
|
|
||||||
)
|
|
||||||
install(SCRIPT ${deploy_script})
|
|
||||||
|
@ -6,6 +6,7 @@ import FluentUI
|
|||||||
|
|
||||||
Window {
|
Window {
|
||||||
id: app
|
id: app
|
||||||
|
flags: Qt.SplashScreen
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
FluApp.init(app)
|
FluApp.init(app)
|
||||||
FluTheme.darkMode = FluDarkMode.System
|
FluTheme.darkMode = FluDarkMode.System
|
||||||
|
@ -23,6 +23,9 @@ FluScrollablePage{
|
|||||||
text:"showYear=true"
|
text:"showYear=true"
|
||||||
}
|
}
|
||||||
FluDatePicker{
|
FluDatePicker{
|
||||||
|
onCurrentChanged: {
|
||||||
|
showSuccess(current.toLocaleDateString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -50,7 +53,9 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluDatePicker{
|
FluDatePicker{
|
||||||
showYear:false
|
showYear:false
|
||||||
|
onCurrentChanged: {
|
||||||
|
showSuccess(current.toLocaleDateString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ FluContentPage{
|
|||||||
title:"TableView"
|
title:"TableView"
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
loadData(1,2000)
|
loadData(1,1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadData(page,count){
|
function loadData(page,count){
|
||||||
@ -40,7 +40,10 @@ FluContentPage{
|
|||||||
name: getRandomName(),
|
name: getRandomName(),
|
||||||
age:getRandomAge(),
|
age:getRandomAge(),
|
||||||
address: getRandomAddresses(),
|
address: getRandomAddresses(),
|
||||||
nickname: getRandomNickname()
|
nickname: getRandomNickname(),
|
||||||
|
height:40,
|
||||||
|
minimumHeight:40,
|
||||||
|
maximumHeight:200
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
table_view.dataSource = dataSource
|
table_view.dataSource = dataSource
|
||||||
@ -48,9 +51,9 @@ FluContentPage{
|
|||||||
|
|
||||||
Component{
|
Component{
|
||||||
id:com_combobox
|
id:com_combobox
|
||||||
|
|
||||||
FluComboBox {
|
FluComboBox {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
focus: true
|
||||||
currentIndex: display
|
currentIndex: display
|
||||||
editable: true
|
editable: true
|
||||||
model: ListModel {
|
model: ListModel {
|
||||||
@ -63,23 +66,30 @@ FluContentPage{
|
|||||||
currentIndex=[100,300,500,1000].findIndex((element) => element === Number(display))
|
currentIndex=[100,300,500,1000].findIndex((element) => element === Number(display))
|
||||||
selectAll()
|
selectAll()
|
||||||
}
|
}
|
||||||
TableView.onCommit: {
|
onCommit: {
|
||||||
display = editText
|
display = editText
|
||||||
|
tableView.closeEditor()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluTableView{
|
FluTableView{
|
||||||
id:table_view
|
id:table_view
|
||||||
anchors.fill: parent
|
anchors{
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
top: parent.top
|
||||||
|
bottom: gagination.top
|
||||||
|
}
|
||||||
anchors.topMargin: 20
|
anchors.topMargin: 20
|
||||||
columnSource:[
|
columnSource:[
|
||||||
{
|
{
|
||||||
title: '姓名',
|
title: '姓名',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
width:100,
|
width:100,
|
||||||
minimumWidth:50
|
minimumWidth:80,
|
||||||
|
maximumWidth:200,
|
||||||
|
readOnly:true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '年龄',
|
title: '年龄',
|
||||||
@ -92,14 +102,38 @@ FluContentPage{
|
|||||||
{
|
{
|
||||||
title: '住址',
|
title: '住址',
|
||||||
dataIndex: 'address',
|
dataIndex: 'address',
|
||||||
width:200
|
width:200,
|
||||||
|
minimumWidth:100,
|
||||||
|
maximumWidth:250
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '别名',
|
title: '别名',
|
||||||
dataIndex: 'nickname',
|
dataIndex: 'nickname',
|
||||||
width:100,
|
width:100,
|
||||||
|
minimumWidth:80,
|
||||||
|
maximumWidth:200
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FluPagination{
|
||||||
|
id:gagination
|
||||||
|
anchors{
|
||||||
|
bottom: parent.bottom
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
pageCurrent: 1
|
||||||
|
itemCount: 100000
|
||||||
|
pageButtonCount: 7
|
||||||
|
__itemPerPage: 1000
|
||||||
|
onRequestPage:
|
||||||
|
(page,count)=> {
|
||||||
|
table_view.closeEditor()
|
||||||
|
loadData(page,count)
|
||||||
|
table_view.resetPosition()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,9 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
FluTimePicker{
|
FluTimePicker{
|
||||||
|
onCurrentChanged: {
|
||||||
|
showSuccess(current.toLocaleTimeString(Qt.locale("de_DE")))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -53,11 +56,14 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text:"hourFormat=FluTimePicker.H"
|
text:"hourFormat=FluTimePicker.HH"
|
||||||
}
|
}
|
||||||
|
|
||||||
FluTimePicker{
|
FluTimePicker{
|
||||||
hourFormat:FluTimePicker.HH
|
hourFormat:FluTimePicker.HH
|
||||||
|
onCurrentChanged: {
|
||||||
|
showSuccess(current.toLocaleTimeString(Qt.locale("de_DE")))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -134,6 +134,7 @@ CustomWindow {
|
|||||||
|
|
||||||
FluRemoteLoader{
|
FluRemoteLoader{
|
||||||
id:loader
|
id:loader
|
||||||
|
lazy: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
// source: "http://localhost:9000/RemoteComponent.qml"
|
// source: "http://localhost:9000/RemoteComponent.qml"
|
||||||
source: "https://zhu-zichu.gitee.io/RemoteComponent.qml"
|
source: "https://zhu-zichu.gitee.io/RemoteComponent.qml"
|
||||||
|
@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.20)
|
|||||||
project(fluentuiplugin LANGUAGES CXX)
|
project(fluentuiplugin LANGUAGES CXX)
|
||||||
|
|
||||||
#配置通用编译
|
#配置通用编译
|
||||||
set(CMAKE_AUTOMOC ON)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
||||||
@ -13,10 +12,17 @@ endif()
|
|||||||
set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
|
set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
|
||||||
|
|
||||||
#设置版本号
|
#设置版本号
|
||||||
add_definitions(-DVERSION=1,3,6,0)
|
add_definitions(-DVERSION=1,3,6,2)
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)
|
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)
|
||||||
|
|
||||||
|
if(QT_VERSION VERSION_GREATER_EQUAL "6.3")
|
||||||
qt_standard_project_setup()
|
qt_standard_project_setup()
|
||||||
|
else()
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
#遍历所有Cpp文件
|
#遍历所有Cpp文件
|
||||||
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
|
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
|
||||||
@ -62,9 +68,9 @@ qt_add_qml_module(fluentuiplugin
|
|||||||
|
|
||||||
#链接库
|
#链接库
|
||||||
target_link_libraries(fluentuiplugin PUBLIC
|
target_link_libraries(fluentuiplugin PUBLIC
|
||||||
Qt::Core
|
Qt::CorePrivate
|
||||||
Qt::Quick
|
Qt::QuickPrivate
|
||||||
Qt::Qml
|
Qt::QmlPrivate
|
||||||
)
|
)
|
||||||
|
|
||||||
#安装
|
#安装
|
||||||
|
@ -38,13 +38,13 @@ void FluApp::run(){
|
|||||||
|
|
||||||
void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegister* fluRegister){
|
void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegister* fluRegister){
|
||||||
if(!routes().contains(route)){
|
if(!routes().contains(route)){
|
||||||
qErrnoWarning("没有找到当前路由");
|
qCritical()<<"No route found "<<route;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QQmlEngine *engine = qmlEngine(appWindow);
|
QQmlEngine *engine = qmlEngine(appWindow);
|
||||||
QQmlComponent component(engine, routes().value(route).toString());
|
QQmlComponent component(engine, routes().value(route).toString());
|
||||||
if (component.isError()) {
|
if (component.isError()) {
|
||||||
qWarning() << component.errors();
|
qCritical() << component.errors();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QVariantMap properties;
|
QVariantMap properties;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
#include <QCursor>
|
||||||
|
|
||||||
FluTools* FluTools::m_instance = nullptr;
|
FluTools* FluTools::m_instance = nullptr;
|
||||||
|
|
||||||
@ -63,6 +64,26 @@ bool FluTools::isWin(){
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FluTools::qtMajor(){
|
||||||
|
const QString qtVersion = QString::fromLatin1(qVersion());
|
||||||
|
const QStringList versionParts = qtVersion.split('.');
|
||||||
|
return versionParts[0].toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
int FluTools::qtMinor(){
|
||||||
|
const QString qtVersion = QString::fromLatin1(qVersion());
|
||||||
|
const QStringList versionParts = qtVersion.split('.');
|
||||||
|
return versionParts[1].toInt();
|
||||||
|
}
|
||||||
|
|
||||||
void FluTools::setQuitOnLastWindowClosed(bool val){
|
void FluTools::setQuitOnLastWindowClosed(bool val){
|
||||||
qApp->setQuitOnLastWindowClosed(val);
|
qApp->setQuitOnLastWindowClosed(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FluTools::setOverrideCursor(Qt::CursorShape shape){
|
||||||
|
qApp->setOverrideCursor(QCursor(shape));
|
||||||
|
}
|
||||||
|
|
||||||
|
void FluTools::restoreOverrideCursor(){
|
||||||
|
qApp->restoreOverrideCursor();
|
||||||
|
}
|
||||||
|
@ -50,6 +50,14 @@ public:
|
|||||||
|
|
||||||
Q_INVOKABLE void setQuitOnLastWindowClosed(bool val);
|
Q_INVOKABLE void setQuitOnLastWindowClosed(bool val);
|
||||||
|
|
||||||
|
Q_INVOKABLE int qtMajor();
|
||||||
|
|
||||||
|
Q_INVOKABLE int qtMinor();
|
||||||
|
|
||||||
|
Q_INVOKABLE void setOverrideCursor(Qt::CursorShape shape);
|
||||||
|
|
||||||
|
Q_INVOKABLE void restoreOverrideCursor();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUTOOLS_H
|
#endif // FLUTOOLS_H
|
||||||
|
@ -243,8 +243,6 @@ Item {
|
|||||||
}
|
}
|
||||||
FluTextButton{
|
FluTextButton{
|
||||||
id:title
|
id:title
|
||||||
leftPadding: 0
|
|
||||||
rightPadding: 0
|
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
left: parent.left
|
left: parent.left
|
||||||
|
@ -6,6 +6,7 @@ import QtQuick.Templates as T
|
|||||||
|
|
||||||
ComboBox {
|
ComboBox {
|
||||||
id: control
|
id: control
|
||||||
|
signal commit
|
||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/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 hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
||||||
@ -44,6 +45,7 @@ ComboBox {
|
|||||||
bottomPadding: 6 - control.padding
|
bottomPadding: 6 - control.padding
|
||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectionColor: FluTheme.primaryColor.lightest
|
||||||
|
selectedTextColor: control.palette.highlightedText
|
||||||
text: control.editable ? control.editText : control.displayText
|
text: control.editable ? control.editText : control.displayText
|
||||||
enabled: control.editable
|
enabled: control.editable
|
||||||
autoScroll: control.editable
|
autoScroll: control.editable
|
||||||
@ -57,12 +59,20 @@ ComboBox {
|
|||||||
leftInset:1
|
leftInset:1
|
||||||
topInset:1
|
topInset:1
|
||||||
bottomInset:1
|
bottomInset:1
|
||||||
focus: true
|
|
||||||
rightInset:1
|
rightInset:1
|
||||||
background: FluTextBoxBackground{
|
background: FluTextBoxBackground{
|
||||||
border.width: 0
|
border.width: 0
|
||||||
inputItem: contentItem
|
inputItem: contentItem
|
||||||
}
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
forceActiveFocus()
|
||||||
|
}
|
||||||
|
Keys.onEnterPressed: {
|
||||||
|
control.commit()
|
||||||
|
}
|
||||||
|
Keys.onReturnPressed: {
|
||||||
|
control.commit()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
@ -14,6 +14,7 @@ TextEdit {
|
|||||||
leftPadding: 0
|
leftPadding: 0
|
||||||
rightPadding: 0
|
rightPadding: 0
|
||||||
topPadding: 0
|
topPadding: 0
|
||||||
|
selectedTextColor: FluColors.Grey220
|
||||||
bottomPadding: 0
|
bottomPadding: 0
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectionColor: FluTheme.primaryColor.lightest
|
||||||
font:FluTextStyle.Body
|
font:FluTextStyle.Body
|
||||||
|
@ -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 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 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 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 showYear: true
|
||||||
property bool changeFlag: true
|
property var current
|
||||||
readonly property var rowData: ["","",""]
|
id:control
|
||||||
id:root
|
|
||||||
color: {
|
color: {
|
||||||
if(mouse_area.containsMouse){
|
if(mouse_area.containsMouse){
|
||||||
return hoverColor
|
return hoverColor
|
||||||
@ -24,6 +22,13 @@ Rectangle {
|
|||||||
radius: 4
|
radius: 4
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: dividerColor
|
border.color: dividerColor
|
||||||
|
Item{
|
||||||
|
id:d
|
||||||
|
property var window: Window.window
|
||||||
|
property bool changeFlag: true
|
||||||
|
property var rowData: ["","",""]
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
id:mouse_area
|
id:mouse_area
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
@ -317,8 +322,19 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
text: "确定"
|
text: "确定"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
changeFlag = false
|
d.changeFlag = false
|
||||||
popup.close()
|
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
|
y:35
|
||||||
function showPopup() {
|
function showPopup() {
|
||||||
changeFlag = true
|
d.changeFlag = true
|
||||||
rowData[0] = text_year.text
|
d.rowData[0] = text_year.text
|
||||||
rowData[1] = text_month.text
|
d.rowData[1] = text_month.text
|
||||||
rowData[2] = text_day.text
|
d.rowData[2] = text_day.text
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
var year = text_year.text === "年"? now.getFullYear() : Number(text_year.text);
|
var year = text_year.text === "年"? now.getFullYear() : Number(text_year.text);
|
||||||
var month = text_month.text === "月"? now.getMonth() + 1 : Number(text_month.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.model = generateMonthDaysArray(year,month)
|
||||||
list_view_3.currentIndex = list_view_3.model.indexOf(day)
|
list_view_3.currentIndex = list_view_3.model.indexOf(day)
|
||||||
text_day.text = day
|
text_day.text = day
|
||||||
var pos = root.mapToItem(null, 0, 0)
|
var pos = control.mapToItem(null, 0, 0)
|
||||||
if(window.height>pos.y+root.height+container.height){
|
if(d.window.height>pos.y+control.height+container.height){
|
||||||
popup.y = root.height
|
popup.y = control.height
|
||||||
} else if(pos.y>container.height){
|
} else if(pos.y>container.height){
|
||||||
popup.y = -container.height
|
popup.y = -container.height
|
||||||
} else {
|
} else {
|
||||||
popup.y = window.height-(pos.y+container.height)
|
popup.y = d.window.height-(pos.y+container.height)
|
||||||
}
|
}
|
||||||
popup.open()
|
popup.open()
|
||||||
}
|
}
|
||||||
onClosed: {
|
onClosed: {
|
||||||
if(changeFlag){
|
if(d.changeFlag){
|
||||||
text_year.text = rowData[0]
|
text_year.text = d.rowData[0]
|
||||||
text_month.text = rowData[1]
|
text_month.text = d.rowData[1]
|
||||||
text_day.text = rowData[2]
|
text_day.text = d.rowData[2]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import QtQuick.Controls.Basic
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
TextArea{
|
TextArea{
|
||||||
|
signal commit
|
||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
||||||
property color disableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
|
property color disableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
|
||||||
@ -34,6 +35,12 @@ TextArea{
|
|||||||
}
|
}
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
background: FluTextBoxBackground{ inputItem: control }
|
background: FluTextBoxBackground{ inputItem: control }
|
||||||
|
Keys.onEnterPressed: {
|
||||||
|
control.commit()
|
||||||
|
}
|
||||||
|
Keys.onBackPressed: {
|
||||||
|
control.commit()
|
||||||
|
}
|
||||||
TapHandler {
|
TapHandler {
|
||||||
acceptedButtons: Qt.RightButton
|
acceptedButtons: Qt.RightButton
|
||||||
onTapped: control.echoMode !== TextInput.Password && menu.popup()
|
onTapped: control.echoMode !== TextInput.Password && menu.popup()
|
||||||
|
@ -121,8 +121,7 @@ Item {
|
|||||||
}
|
}
|
||||||
Behavior on height {
|
Behavior on height {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 83
|
||||||
easing.type: Easing.InCubic
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,8 +137,7 @@ Item {
|
|||||||
}
|
}
|
||||||
Behavior on height {
|
Behavior on height {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 83
|
||||||
easing.type: Easing.InCubic
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
width: layout_list.width
|
width: layout_list.width
|
||||||
@ -330,8 +328,7 @@ Item {
|
|||||||
Item{
|
Item{
|
||||||
Behavior on height {
|
Behavior on height {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 83
|
||||||
easing.type: Easing.InCubic
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clip: true
|
clip: true
|
||||||
@ -685,7 +682,6 @@ Item {
|
|||||||
}
|
}
|
||||||
return "transparent"
|
return "transparent"
|
||||||
}
|
}
|
||||||
clip: true
|
|
||||||
x: visible ? 0 : -width
|
x: visible ? 0 : -width
|
||||||
Behavior on width {
|
Behavior on width {
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
@ -955,7 +951,6 @@ Item {
|
|||||||
radius: 4
|
radius: 4
|
||||||
}
|
}
|
||||||
color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
|
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){
|
function showPopup(pos,model){
|
||||||
control_popup.x = pos.x
|
control_popup.x = pos.x
|
||||||
|
@ -4,6 +4,7 @@ import QtQuick.Controls.Basic
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
TextField{
|
TextField{
|
||||||
|
signal commit
|
||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
property int iconSource: 0
|
property int iconSource: 0
|
||||||
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
||||||
@ -50,6 +51,12 @@ TextField{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Keys.onEnterPressed: {
|
||||||
|
control.commit()
|
||||||
|
}
|
||||||
|
Keys.onBackPressed: {
|
||||||
|
control.commit()
|
||||||
|
}
|
||||||
FluIconButton{
|
FluIconButton{
|
||||||
id:btn_reveal
|
id:btn_reveal
|
||||||
iconSource:FluentIcons.RevealPasswordMedium
|
iconSource:FluentIcons.RevealPasswordMedium
|
||||||
|
@ -4,15 +4,20 @@ import FluentUI
|
|||||||
|
|
||||||
FluStatusView {
|
FluStatusView {
|
||||||
property url source: ""
|
property url source: ""
|
||||||
|
property bool lazy: false
|
||||||
color:"transparent"
|
color:"transparent"
|
||||||
id:control
|
id:control
|
||||||
onErrorClicked: {
|
onErrorClicked: {
|
||||||
reload()
|
reload()
|
||||||
}
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
if(!lazy){
|
||||||
|
loader.source = control.source
|
||||||
|
}
|
||||||
|
}
|
||||||
Loader{
|
Loader{
|
||||||
id:loader
|
id:loader
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: control.source
|
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if(status === Loader.Error){
|
if(status === Loader.Error){
|
||||||
|
@ -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{
|
FluTooltip{
|
||||||
parent: control.handle
|
parent: control.handle
|
||||||
visible: control.tooltipEnabled && control.pressed
|
visible: control.tooltipEnabled && control.pressed
|
||||||
text:String(control.value)
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,22 @@ Rectangle {
|
|||||||
var com_column = Qt.createComponent("FluTableModelColumn.qml")
|
var com_column = Qt.createComponent("FluTableModelColumn.qml")
|
||||||
if (com_column.status === Component.Ready) {
|
if (com_column.status === Component.Ready) {
|
||||||
var columns= []
|
var columns= []
|
||||||
|
var header_rows = {}
|
||||||
columnSource.forEach(function(item){
|
columnSource.forEach(function(item){
|
||||||
var column = com_column.createObject(table_model,{display:item.dataIndex});
|
var column = com_column.createObject(table_model,{display:item.dataIndex});
|
||||||
columns.push(column)
|
columns.push(column)
|
||||||
|
header_rows[item.dataIndex] = item.title
|
||||||
})
|
})
|
||||||
table_model.columns = columns
|
table_model.columns = columns
|
||||||
|
header_model.columns = columns
|
||||||
|
d.header_rows = [header_rows]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
QtObject{
|
||||||
|
id:d
|
||||||
|
property var header_rows:[]
|
||||||
|
}
|
||||||
onDataSourceChanged: {
|
onDataSourceChanged: {
|
||||||
table_model.clear()
|
table_model.clear()
|
||||||
dataSource.forEach(function(item){
|
dataSource.forEach(function(item){
|
||||||
@ -38,12 +46,17 @@ Rectangle {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
text: display
|
text: display
|
||||||
verticalAlignment: TextInput.AlignVCenter
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
Component.onCompleted: selectAll()
|
Component.onCompleted: {
|
||||||
TableView.onCommit: {
|
forceActiveFocus()
|
||||||
|
selectAll()
|
||||||
|
}
|
||||||
|
onCommit: {
|
||||||
display = text
|
display = text
|
||||||
|
tableView.closeEditor()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollView{
|
ScrollView{
|
||||||
id:scroll_table
|
id:scroll_table
|
||||||
anchors.left: header_vertical.right
|
anchors.left: header_vertical.right
|
||||||
@ -60,38 +73,61 @@ Rectangle {
|
|||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
ScrollBar.horizontal: FluScrollBar{}
|
ScrollBar.horizontal: FluScrollBar{}
|
||||||
ScrollBar.vertical: FluScrollBar{}
|
ScrollBar.vertical: FluScrollBar{}
|
||||||
selectionModel: ItemSelectionModel {}
|
selectionModel: ItemSelectionModel {
|
||||||
|
id:selection_model
|
||||||
|
}
|
||||||
columnWidthProvider: function(column) {
|
columnWidthProvider: function(column) {
|
||||||
let w = explicitColumnWidth(column)
|
var w = columnSource[column].width
|
||||||
if (w >= 0){
|
if(column === item_loader.column){
|
||||||
var minimumWidth = columnSource[column].minimumWidth
|
item_loader.width = w
|
||||||
var maximumWidth = columnSource[column].maximumWidth
|
|
||||||
if(!minimumWidth){
|
|
||||||
minimumWidth = 100
|
|
||||||
}
|
}
|
||||||
if(!maximumWidth){
|
if(column === item_loader.column-1){
|
||||||
maximumWidth = 65535
|
let cellItem = table_view.itemAtCell(item_loader.column, item_loader.row)
|
||||||
|
if(cellItem){
|
||||||
|
let cellPosition = cellItem.mapToItem(scroll_table, 0, 0)
|
||||||
|
item_loader.x = table_view.contentX + cellPosition.x
|
||||||
}
|
}
|
||||||
|
|
||||||
return Math.min(Math.max(minimumWidth, w),maximumWidth)
|
|
||||||
}
|
}
|
||||||
return implicitColumnWidth(column)
|
return w
|
||||||
}
|
}
|
||||||
rowHeightProvider: function(row) {
|
rowHeightProvider: function(row) {
|
||||||
let h = explicitRowHeight(row)
|
var h = table_model.getRow(row).height
|
||||||
if (h >= 0){
|
if(row === item_loader.row){
|
||||||
return Math.max(40, h)
|
item_loader.height = h
|
||||||
}
|
}
|
||||||
return implicitRowHeight(row)
|
if(row === item_loader.row-1){
|
||||||
|
let cellItem = table_view.itemAtCell(item_loader.column, item_loader.row)
|
||||||
|
if(cellItem){
|
||||||
|
let cellPosition = cellItem.mapToItem(scroll_table, 0, 0)
|
||||||
|
item_loader.y = table_view.contentY + cellPosition.y
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return h
|
||||||
}
|
}
|
||||||
model: table_model
|
model: table_model
|
||||||
clip: true
|
clip: true
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
required property bool selected
|
required property bool selected
|
||||||
required property bool current
|
required property bool current
|
||||||
|
property var readOnly: columnSource[column].readOnly
|
||||||
color: selected ? FluTheme.primaryColor.lightest: (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06))
|
color: selected ? FluTheme.primaryColor.lightest: (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06))
|
||||||
implicitHeight: 40
|
implicitHeight: 40
|
||||||
implicitWidth: columnSource[column].width
|
implicitWidth: columnSource[column].width
|
||||||
|
TapHandler{
|
||||||
|
acceptedButtons: Qt.LeftButton
|
||||||
|
onDoubleTapped: {
|
||||||
|
if(readOnly){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
item_loader.sourceComponent = obtEditDelegate(column,row)
|
||||||
|
var index = table_view.index(row,column)
|
||||||
|
}
|
||||||
|
onTapped: {
|
||||||
|
if(!current){
|
||||||
|
item_loader.sourceComponent = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
FluText {
|
FluText {
|
||||||
text: display
|
text: display
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -99,16 +135,39 @@ Rectangle {
|
|||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
}
|
}
|
||||||
TableView.editDelegate: {
|
}
|
||||||
|
}
|
||||||
|
Loader{
|
||||||
|
id:item_loader
|
||||||
|
z:2
|
||||||
|
property var display
|
||||||
|
property int column
|
||||||
|
property int row
|
||||||
|
property var tableView: control
|
||||||
|
onDisplayChanged: {
|
||||||
|
table_model.setData(table_view.index(row,column),"display",display)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function obtEditDelegate(column,row){
|
||||||
|
var display = table_model.data(table_view.index(row,column),"display")
|
||||||
|
var cellItem = table_view.itemAtCell(column, row)
|
||||||
|
var cellPosition = cellItem.mapToItem(scroll_table, 0, 0)
|
||||||
|
item_loader.column = column
|
||||||
|
item_loader.row = row
|
||||||
|
item_loader.x = table_view.contentX + cellPosition.x
|
||||||
|
item_loader.y = table_view.contentY + cellPosition.y
|
||||||
|
item_loader.width = table_view.columnWidthProvider(column)
|
||||||
|
item_loader.height = table_view.rowHeightProvider(row)
|
||||||
|
item_loader.display = display
|
||||||
var obj =columnSource[column].editDelegate
|
var obj =columnSource[column].editDelegate
|
||||||
if(obj){
|
if(obj){
|
||||||
return obj
|
return obj
|
||||||
}
|
}
|
||||||
return com_edit
|
return com_edit
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component{
|
Component{
|
||||||
id:com_handle
|
id:com_handle
|
||||||
FluControl {
|
FluControl {
|
||||||
@ -138,27 +197,169 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
SelectionRectangle {
|
SelectionRectangle {
|
||||||
target: table_view
|
target: {
|
||||||
|
if(item_loader.sourceComponent){
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return table_view
|
||||||
|
}
|
||||||
bottomRightHandle:com_handle
|
bottomRightHandle:com_handle
|
||||||
topLeftHandle: com_handle
|
topLeftHandle: com_handle
|
||||||
}
|
}
|
||||||
FluHorizontalHeaderView {
|
TableView {
|
||||||
id: header_horizontal
|
id: header_horizontal
|
||||||
textRole: "title"
|
model: TableModel{
|
||||||
model: columnSource
|
id:header_model
|
||||||
|
rows: d.header_rows
|
||||||
|
}
|
||||||
|
syncDirection: Qt.Horizontal
|
||||||
anchors.left: scroll_table.left
|
anchors.left: scroll_table.left
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
implicitWidth: syncView ? syncView.width : 0
|
||||||
|
implicitHeight: Math.max(1, contentHeight)
|
||||||
syncView: table_view
|
syncView: table_view
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
clip: true
|
clip: true
|
||||||
|
delegate: Rectangle {
|
||||||
|
readonly property real cellPadding: 8
|
||||||
|
readonly property var obj : columnSource[column]
|
||||||
|
implicitWidth: column_text.implicitWidth + (cellPadding * 2)
|
||||||
|
implicitHeight: Math.max(header_horizontal.height, column_text.implicitHeight + (cellPadding * 2))
|
||||||
|
color:FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
||||||
|
border.color: FluTheme.dark ? "#252525" : "#e4e4e4"
|
||||||
|
FluText {
|
||||||
|
id: column_text
|
||||||
|
text: display
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height
|
||||||
|
font.bold: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
}
|
}
|
||||||
FluVerticalHeaderView {
|
TapHandler{
|
||||||
|
onDoubleTapped: {
|
||||||
|
selection_model.clear()
|
||||||
|
for(var i=0;i<=table_view.rows;i++){
|
||||||
|
selection_model.select(table_view.index(i,column),ItemSelectionModel.Select)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MouseArea{
|
||||||
|
property point clickPos: "0,0"
|
||||||
|
height: parent.height
|
||||||
|
width: 4
|
||||||
|
anchors.right: parent.right
|
||||||
|
acceptedButtons: Qt.LeftButton
|
||||||
|
visible: !(obj.width === obj.maximumWidth && obj.width === obj.maximumWidth)
|
||||||
|
cursorShape: Qt.SplitHCursor
|
||||||
|
preventStealing: true
|
||||||
|
propagateComposedEvents: true
|
||||||
|
onPressed :
|
||||||
|
(mouse)=>{
|
||||||
|
FluTools.setOverrideCursor(Qt.SplitHCursor)
|
||||||
|
clickPos = Qt.point(mouse.x, mouse.y)
|
||||||
|
}
|
||||||
|
onReleased:{
|
||||||
|
FluTools.restoreOverrideCursor()
|
||||||
|
}
|
||||||
|
onPositionChanged:
|
||||||
|
(mouse)=>{
|
||||||
|
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
|
||||||
|
var minimumWidth = obj.minimumWidth
|
||||||
|
var maximumWidth = obj.maximumWidth
|
||||||
|
if(!minimumWidth){
|
||||||
|
minimumWidth = 100
|
||||||
|
}
|
||||||
|
if(!maximumWidth){
|
||||||
|
maximumWidth = 65535
|
||||||
|
}
|
||||||
|
obj.width = Math.min(Math.max(minimumWidth, obj.width + delta.x),maximumWidth)
|
||||||
|
table_view.forceLayout()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TableView {
|
||||||
id: header_vertical
|
id: header_vertical
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
anchors.top: scroll_table.top
|
anchors.top: scroll_table.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
implicitWidth: Math.max(1, contentWidth)
|
||||||
|
implicitHeight: syncView ? syncView.height : 0
|
||||||
|
syncDirection: Qt.Vertical
|
||||||
syncView: table_view
|
syncView: table_view
|
||||||
clip: true
|
clip: true
|
||||||
|
model: TableModel{
|
||||||
|
TableModelColumn {}
|
||||||
|
rows: {
|
||||||
|
if(dataSource)
|
||||||
|
return dataSource
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delegate: Rectangle{
|
||||||
|
readonly property real cellPadding: 8
|
||||||
|
readonly property var obj : table_model.getRow(row)
|
||||||
|
implicitWidth: Math.max(header_vertical.width, row_text.implicitWidth + (cellPadding * 2))
|
||||||
|
implicitHeight: row_text.implicitHeight + (cellPadding * 2)
|
||||||
|
color:FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
||||||
|
border.color: FluTheme.dark ? "#252525" : "#e4e4e4"
|
||||||
|
FluText{
|
||||||
|
id:row_text
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: row + 1
|
||||||
|
}
|
||||||
|
TapHandler{
|
||||||
|
onDoubleTapped: {
|
||||||
|
selection_model.clear()
|
||||||
|
for(var i=0;i<=columnSource.length;i++){
|
||||||
|
selection_model.select(table_view.index(row,i),ItemSelectionModel.Select)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MouseArea{
|
||||||
|
property point clickPos: "0,0"
|
||||||
|
height: 4
|
||||||
|
width: parent.width
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
acceptedButtons: Qt.LeftButton
|
||||||
|
cursorShape: Qt.SplitVCursor
|
||||||
|
preventStealing: true
|
||||||
|
visible: !(obj.height === obj.minimumHeight && obj.width === obj.maximumHeight)
|
||||||
|
propagateComposedEvents: true
|
||||||
|
onPressed :
|
||||||
|
(mouse)=>{
|
||||||
|
FluTools.setOverrideCursor(Qt.SplitVCursor)
|
||||||
|
clickPos = Qt.point(mouse.x, mouse.y)
|
||||||
|
}
|
||||||
|
onReleased:{
|
||||||
|
FluTools.restoreOverrideCursor()
|
||||||
|
}
|
||||||
|
onPositionChanged:
|
||||||
|
(mouse)=>{
|
||||||
|
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
|
||||||
|
var minimumHeight = obj.minimumHeight
|
||||||
|
var maximumHeight = obj.maximumHeight
|
||||||
|
if(!minimumHeight){
|
||||||
|
minimumHeight = 40
|
||||||
|
}
|
||||||
|
if(!maximumHeight){
|
||||||
|
maximumHeight = 65535
|
||||||
|
}
|
||||||
|
obj.height = Math.min(Math.max(minimumHeight, obj.height + delta.y),maximumHeight)
|
||||||
|
table_model.setRow(row,obj)
|
||||||
|
table_view.forceLayout()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closeEditor(){
|
||||||
|
item_loader.sourceComponent = null
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetPosition(){
|
||||||
|
table_view.positionViewAtCell(Qt.point(0, 0),TableView.AlignTop|TableView.AlignLeft)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -4,6 +4,7 @@ import QtQuick.Controls.Basic
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
TextField{
|
TextField{
|
||||||
|
signal commit
|
||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
property int iconSource: 0
|
property int iconSource: 0
|
||||||
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
||||||
@ -32,6 +33,12 @@ TextField{
|
|||||||
}
|
}
|
||||||
return placeholderNormalColor
|
return placeholderNormalColor
|
||||||
}
|
}
|
||||||
|
Keys.onEnterPressed: {
|
||||||
|
control.commit()
|
||||||
|
}
|
||||||
|
Keys.onReturnPressed: {
|
||||||
|
control.commit()
|
||||||
|
}
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
rightPadding: icon_end.visible ? 50 : 30
|
rightPadding: icon_end.visible ? 50 : 30
|
||||||
background: FluTextBoxBackground{
|
background: FluTextBoxBackground{
|
||||||
|
@ -12,10 +12,8 @@ FluMenu{
|
|||||||
animEnabled: false
|
animEnabled: false
|
||||||
width: 120
|
width: 120
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if(visible){
|
|
||||||
inputItem.forceActiveFocus()
|
inputItem.forceActiveFocus()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Connections{
|
Connections{
|
||||||
target: inputItem
|
target: inputItem
|
||||||
function onTextChanged() {
|
function onTextChanged() {
|
||||||
|
@ -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 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 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 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 hourFormat: FluTimePicker.H
|
||||||
property int isH: hourFormat === FluTimePicker.H
|
property int isH: hourFormat === FluTimePicker.H
|
||||||
id:root
|
property var current
|
||||||
|
id:control
|
||||||
color: {
|
color: {
|
||||||
if(mouse_area.containsMouse){
|
if(mouse_area.containsMouse){
|
||||||
return hoverColor
|
return hoverColor
|
||||||
@ -27,6 +27,13 @@ Rectangle {
|
|||||||
radius: 4
|
radius: 4
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: dividerColor
|
border.color: dividerColor
|
||||||
|
Item{
|
||||||
|
id:d
|
||||||
|
property var window: Window.window
|
||||||
|
property bool changeFlag: true
|
||||||
|
property var rowData: ["","",""]
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
id:mouse_area
|
id:mouse_area
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
@ -312,8 +319,24 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
text: "确定"
|
text: "确定"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
changeFlag = false
|
d.changeFlag = false
|
||||||
popup.close()
|
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
|
y:35
|
||||||
function showPopup() {
|
function showPopup() {
|
||||||
changeFlag = true
|
d.changeFlag = true
|
||||||
rowData[0] = text_hour.text
|
d.rowData[0] = text_hour.text
|
||||||
rowData[1] = text_minute.text
|
d.rowData[1] = text_minute.text
|
||||||
rowData[2] = text_ampm.text
|
d.rowData[2] = text_ampm.text
|
||||||
|
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
|
|
||||||
@ -353,27 +376,24 @@ Rectangle {
|
|||||||
if(isH){
|
if(isH){
|
||||||
text_ampm.text = ampm
|
text_ampm.text = ampm
|
||||||
}
|
}
|
||||||
|
var pos = control.mapToItem(null, 0, 0)
|
||||||
var pos = root.mapToItem(null, 0, 0)
|
if(d.window.height>pos.y+control.height+container.height){
|
||||||
if(window.height>pos.y+root.height+container.height){
|
popup.y = control.height
|
||||||
popup.y = root.height
|
|
||||||
} else if(pos.y>container.height){
|
} else if(pos.y>container.height){
|
||||||
popup.y = -container.height
|
popup.y = -container.height
|
||||||
} else {
|
} else {
|
||||||
popup.y = window.height-(pos.y+container.height)
|
popup.y = d.window.height-(pos.y+container.height)
|
||||||
}
|
}
|
||||||
popup.open()
|
popup.open()
|
||||||
}
|
}
|
||||||
onClosed: {
|
onClosed: {
|
||||||
if(changeFlag){
|
if(d.changeFlag){
|
||||||
text_hour.text = rowData[0]
|
text_hour.text = d.rowData[0]
|
||||||
text_minute.text = rowData[1]
|
text_minute.text = d.rowData[1]
|
||||||
text_ampm.text = rowData[2]
|
text_ampm.text = d.rowData[2]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
property bool changeFlag: true
|
|
||||||
readonly property var rowData: ["","",""]
|
|
||||||
function generateArray(start, n) {
|
function generateArray(start, n) {
|
||||||
var arr = [];
|
var arr = [];
|
||||||
for (var i = start; i <= n; i++) {
|
for (var i = start; i <= n; i++) {
|
||||||
|
Reference in New Issue
Block a user