Compare commits

...

23 Commits

Author SHA1 Message Date
bf3006415b update 2023-06-28 13:16:21 +08:00
cdba8b7921 update 2023-06-28 13:15:33 +08:00
192c65a510 update 2023-06-28 13:13:39 +08:00
90943674b3 update 2023-06-28 12:12:15 +08:00
157dc9166b update 2023-06-28 09:45:47 +08:00
a7e8a5e4cf update 2023-06-28 02:28:34 +08:00
96071ac8d7 update 2023-06-27 22:14:27 +08:00
e25b944704 update 2023-06-27 21:14:20 +08:00
1566e3934e update 2023-06-27 21:02:57 +08:00
16e71f01b1 Merge pull request #172 from mentalfl0w/dev
Make the FluTableView readonly text copiable.
2023-06-27 20:47:21 +08:00
e54c161aa6 Make the FluTableView readonly text copiable. 2023-06-27 20:39:57 +08:00
2147965b00 update 2023-06-27 00:17:01 +08:00
3a940466d5 update 2023-06-27 00:00:41 +08:00
564b27cd02 update 2023-06-26 23:57:50 +08:00
4be2ad6ba0 Merge pull request #171 from mentalfl0w/dev
FluTableView bug fixed.
2023-06-26 23:41:14 +08:00
1d9f6f5eff FluTableView bug fixed. 2023-06-26 23:21:15 +08:00
0610f63f26 update 2023-06-26 19:59:28 +08:00
d741b3eb4f update 2023-06-26 18:20:01 +08:00
cb7d2097f2 update 2023-06-26 18:12:58 +08:00
dff77d3d4f update 2023-06-26 11:43:49 +08:00
6d0834c653 update 2023-06-25 23:39:23 +08:00
059a1b17cc update 2023-06-25 23:17:44 +08:00
e1096b8e22 update 2023-06-25 19:01:22 +08:00
23 changed files with 461 additions and 98 deletions

View File

@ -19,7 +19,7 @@ endif()
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
#设置版本号
add_definitions(-DVERSION=1,3,6,1)
add_definitions(-DVERSION=1,3,7,0)
find_package(Qt6 REQUIRED COMPONENTS Quick)

View File

@ -5,7 +5,8 @@ import QtQuick.Layouts
import FluentUI
Window {
id:app
id: app
flags: Qt.SplashScreen
Component.onCompleted: {
FluApp.init(app)
FluTheme.darkMode = FluDarkMode.System

View File

@ -76,5 +76,4 @@ FluScrollablePage{
}
'
}
}

View File

@ -10,7 +10,29 @@ FluContentPage{
title:"TableView"
Component.onCompleted: {
loadData(1,2000)
loadData(1,1000)
}
Component{
id:com_action
Item{
RowLayout{
anchors.centerIn: parent
FluButton{
text:"删除"
onClicked: {
table_view.closeEditor()
tableModel.removeRow(row)
}
}
FluFilledButton{
text:"编辑"
onClicked: {
showSuccess(JSON.stringify(tableModel.getRow(row)))
}
}
}
}
}
function loadData(page,count){
@ -40,7 +62,11 @@ FluContentPage{
name: getRandomName(),
age:getRandomAge(),
address: getRandomAddresses(),
nickname: getRandomNickname()
nickname: getRandomNickname(),
height:40,
minimumHeight:40,
maximumHeight:200,
action:com_action
})
}
table_view.dataSource = dataSource
@ -48,9 +74,9 @@ FluContentPage{
Component{
id:com_combobox
FluComboBox {
anchors.fill: parent
focus: true
currentIndex: display
editable: true
model: ListModel {
@ -63,23 +89,30 @@ FluContentPage{
currentIndex=[100,300,500,1000].findIndex((element) => element === Number(display))
selectAll()
}
TableView.onCommit: {
onCommit: {
display = editText
tableView.closeEditor()
}
}
}
FluTableView{
id:table_view
anchors.fill: parent
anchors{
left: parent.left
right: parent.right
top: parent.top
bottom: gagination.top
}
anchors.topMargin: 20
columnSource:[
{
title: '姓名',
dataIndex: 'name',
width:100,
minimumWidth:50
minimumWidth:80,
maximumWidth:200,
readOnly:true
},
{
title: '年龄',
@ -87,19 +120,50 @@ FluContentPage{
editDelegate:com_combobox,
width:100,
minimumWidth:100,
maximumWidth: 100
maximumWidth:100
},
{
title: '住址',
dataIndex: 'address',
width:200
width:200,
minimumWidth:100,
maximumWidth:250
},
{
title: '别名',
dataIndex: 'nickname',
width:100,
minimumWidth:80,
maximumWidth:200
},
{
title: '操作',
dataIndex: 'action',
width:160,
minimumWidth:160,
maximumWidth:160
}
]
}
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()
}
}
}

View File

@ -112,6 +112,12 @@ CustomWindow {
}
Row{
z:8
anchors{
top: parent.top
left: parent.left
topMargin: FluTools.isMacos() ? 20 : 5
leftMargin: 5
}
FluIconButton{
iconSource: FluentIcons.ChromeBack
width: 30
@ -134,6 +140,7 @@ CustomWindow {
FluRemoteLoader{
id:loader
lazy: true
anchors.fill: parent
// source: "http://localhost:9000/RemoteComponent.qml"
source: "https://zhu-zichu.gitee.io/RemoteComponent.qml"
@ -233,12 +240,13 @@ CustomWindow {
ctx.save()
if(img_cache.source.toString().length!==0){
try{
ctx.drawImage(img_cache, 0, 0, canvasSize.width, canvasSize.height, 0, 0, canvasSize.width, canvasSize.height)
ctx.drawImage(img_cache.source, 0, 0, canvasSize.width, canvasSize.height, 0, 0, canvasSize.width, canvasSize.height)
}catch(e){
img_cache.source = ""
}
}
clearArc(ctx, centerX, centerY, radius)
canvas.unloadImage(img_cache.source)
ctx.restore()
}
function clearArc(ctx,x, y, radius, startAngle, endAngle) {

View File

@ -12,7 +12,7 @@ endif()
set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
#设置版本号
add_definitions(-DVERSION=1,3,6,1)
add_definitions(-DVERSION=1,3,7,0)
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)

View File

@ -38,13 +38,13 @@ void FluApp::run(){
void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegister* fluRegister){
if(!routes().contains(route)){
qFatal()<<"No route found "<<route;
qCritical()<<"No route found "<<route;
return;
}
QQmlEngine *engine = qmlEngine(appWindow);
QQmlComponent component(engine, routes().value(route).toString());
if (component.isError()) {
qFatal() << component.errors();
qCritical() << component.errors();
return;
}
QVariantMap properties;
@ -109,3 +109,11 @@ QJsonArray FluApp::awesomelist(const QString& keyword)
void FluApp::closeApp(){
qApp->exit(0);
}
void FluApp::deleteWindow(QQuickWindow* window){
if(window){
wnds.remove(window->winId());
window->deleteLater();
window = nullptr;
}
}

View File

@ -73,6 +73,8 @@ public:
*/
Q_INVOKABLE void closeApp();
Q_INVOKABLE void deleteWindow(QQuickWindow* window);
public:
/**
* @brief wnds

View File

@ -2,6 +2,7 @@
#include <QGuiApplication>
#include <QClipboard>
#include <QUuid>
#include <QCursor>
FluTools* FluTools::m_instance = nullptr;
@ -63,6 +64,33 @@ bool FluTools::isWin(){
#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){
qApp->setQuitOnLastWindowClosed(val);
}
void FluTools::setOverrideCursor(Qt::CursorShape shape){
qApp->setOverrideCursor(QCursor(shape));
}
void FluTools::restoreOverrideCursor(){
qApp->restoreOverrideCursor();
}
void FluTools::deleteItem(QObject *p){
if(p){
delete p;
p = nullptr;
}
}

View File

@ -50,6 +50,15 @@ public:
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();
Q_INVOKABLE void deleteItem(QObject *p);
};
#endif // FLUTOOLS_H

View File

@ -1,7 +1,6 @@
#include "WindowHelper.h"
#include "FluRegister.h"
#include "FluApp.h"
WindowHelper::WindowHelper(QObject *parent)
: QObject{parent}
@ -19,10 +18,3 @@ QVariant WindowHelper::createRegister(QQuickWindow* window,const QString& path){
p->path(path);
return QVariant::fromValue(p);
}
void WindowHelper::deleteWindow(){
if(this->window){
FluApp::getInstance()->wnds.remove(this->window->winId());
this->window->deleteLater();
}
}

View File

@ -24,11 +24,6 @@ public:
*/
Q_INVOKABLE void initWindow(QQuickWindow* window);
/**
* @brief deleteWindow 销毁窗口释放资源QML中的Window close并不会销毁窗口只是把窗口隐藏了
*/
Q_INVOKABLE void deleteWindow();
/**
* @brief createRegister 创建一个FluRegsiter对象在FluWindow中registerForWindowResult方法调用
* @param window

View File

@ -6,6 +6,7 @@ import QtQuick.Templates as T
ComboBox {
id: control
signal commit
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 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
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectionColor: FluTheme.primaryColor.lightest
selectedTextColor: control.palette.highlightedText
text: control.editable ? control.editText : control.displayText
enabled: control.editable
autoScroll: control.editable
@ -57,12 +59,20 @@ ComboBox {
leftInset:1
topInset:1
bottomInset:1
focus: true
rightInset:1
background: FluTextBoxBackground{
border.width: 0
inputItem: contentItem
}
Component.onCompleted: {
forceActiveFocus()
}
Keys.onEnterPressed: {
control.commit()
}
Keys.onReturnPressed: {
control.commit()
}
}
background: Rectangle {

View File

@ -14,15 +14,19 @@ TextEdit {
leftPadding: 0
rightPadding: 0
topPadding: 0
selectByMouse: true
selectedTextColor: FluColors.Grey220
bottomPadding: 0
selectionColor: FluTheme.primaryColor.lightest
font:FluTextStyle.Body
onSelectedTextChanged: {
control.forceActiveFocus()
}
TapHandler {
MouseArea{
anchors.fill: parent
cursorShape: Qt.IBeamCursor
acceptedButtons: Qt.RightButton
onTapped: control.echoMode !== TextInput.Password && menu.popup()
onClicked: control.echoMode !== TextInput.Password && menu.popup()
}
FluTextBoxMenu{
id:menu

View File

@ -4,6 +4,7 @@ import QtQuick.Controls.Basic
import FluentUI
TextArea{
signal commit
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 disableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
@ -34,9 +35,17 @@ TextArea{
}
selectByMouse: true
background: FluTextBoxBackground{ inputItem: control }
TapHandler {
Keys.onEnterPressed: {
control.commit()
}
Keys.onBackPressed: {
control.commit()
}
MouseArea{
anchors.fill: parent
cursorShape: Qt.IBeamCursor
acceptedButtons: Qt.RightButton
onTapped: control.echoMode !== TextInput.Password && menu.popup()
onClicked: control.echoMode !== TextInput.Password && menu.popup()
}
FluTextBoxMenu{
id:menu

View File

@ -31,7 +31,6 @@ Item {
id:control
QtObject{
id:d
property var pageMap: ({})
property var stackItems: []
property int displayMode: FluNavigationView.Open
property bool enableNavigationPanel: false
@ -519,7 +518,7 @@ Item {
disabled: nav_swipe.depth <= 1
iconSize: 13
onClicked: {
nav_swipe.pop()
FluTools.deleteItem(nav_swipe.pop())
d.stackItems.pop()
var item = d.stackItems[d.stackItems.length-1]
if(item.idx<(nav_list.count - layout_footer.count)){
@ -997,7 +996,7 @@ Item {
case FluNavigationView.SingleTask:
while(nav_swipe.currentItem !== page)
{
nav_swipe.pop()
FluTools.deleteItem(nav_swipe.pop())
d.stackItems.pop()
}
return

View File

@ -4,6 +4,7 @@ import QtQuick.Controls.Basic
import FluentUI
TextField{
signal commit
property bool disabled: false
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)
@ -50,6 +51,12 @@ TextField{
}
}
}
Keys.onEnterPressed: {
control.commit()
}
Keys.onBackPressed: {
control.commit()
}
FluIconButton{
id:btn_reveal
iconSource:FluentIcons.RevealPasswordMedium
@ -64,10 +71,6 @@ TextField{
rightMargin: icon_end.visible ? 25 : 5
}
}
TapHandler {
acceptedButtons: Qt.RightButton
onTapped: control.echoMode !== TextInput.Password && menu.popup()
}
FluTextBoxMenu{
id:menu
inputItem: control

View File

@ -4,15 +4,20 @@ import FluentUI
FluStatusView {
property url source: ""
property bool lazy: false
color:"transparent"
id:control
onErrorClicked: {
reload()
}
Component.onCompleted: {
if(!lazy){
loader.source = control.source
}
}
Loader{
id:loader
anchors.fill: parent
source: control.source
asynchronous: true
onStatusChanged: {
if(status === Loader.Error){

View File

@ -15,14 +15,22 @@ Rectangle {
var com_column = Qt.createComponent("FluTableModelColumn.qml")
if (com_column.status === Component.Ready) {
var columns= []
var header_rows = {}
columnSource.forEach(function(item){
var column = com_column.createObject(table_model,{display:item.dataIndex});
columns.push(column)
header_rows[item.dataIndex] = item.title
})
table_model.columns = columns
header_model.columns = columns
d.header_rows = [header_rows]
}
}
}
QtObject{
id:d
property var header_rows:[]
}
onDataSourceChanged: {
table_model.clear()
dataSource.forEach(function(item){
@ -37,11 +45,28 @@ Rectangle {
FluTextBox {
anchors.fill: parent
text: display
readOnly: true === columnSource[column].readOnly
verticalAlignment: TextInput.AlignVCenter
Component.onCompleted: selectAll()
TableView.onCommit: {
display = text
Component.onCompleted: {
forceActiveFocus()
selectAll()
}
onCommit: {
if(!readOnly){
display = text
}
tableView.closeEditor()
}
}
}
Component{
id:com_text
FluText {
text: itemData
anchors.fill: parent
anchors.margins: 10
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
}
ScrollView{
@ -60,55 +85,112 @@ Rectangle {
boundsBehavior: Flickable.StopAtBounds
ScrollBar.horizontal: FluScrollBar{}
ScrollBar.vertical: FluScrollBar{}
selectionModel: ItemSelectionModel {}
selectionModel: ItemSelectionModel {
id:selection_model
model: table_model
}
columnWidthProvider: function(column) {
let w = explicitColumnWidth(column)
if (w >= 0){
var minimumWidth = columnSource[column].minimumWidth
var maximumWidth = columnSource[column].maximumWidth
if(!minimumWidth){
minimumWidth = 100
}
if(!maximumWidth){
maximumWidth = 65535
}
return Math.min(Math.max(minimumWidth, w),maximumWidth)
var w = columnSource[column].width
if(column === item_loader.column){
item_loader.width = w
}
return implicitColumnWidth(column)
if(column === item_loader.column-1){
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 w
}
rowHeightProvider: function(row) {
let h = explicitRowHeight(row)
if (h >= 0){
return Math.max(40, h)
var h = table_model.getRow(row).height
if(row === item_loader.row){
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
clip: true
delegate: Rectangle {
id:item_table
property var position: Qt.point(column,row)
required property bool selected
required property bool current
property bool current: selection_model.currentIndex === table_model.index(row,column)
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
implicitWidth: columnSource[column].width
FluText {
text: display
anchors.fill: parent
anchors.margins: 10
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
TableView.editDelegate: {
var obj =columnSource[column].editDelegate
if(obj){
return obj
TapHandler{
acceptedButtons: Qt.LeftButton
onDoubleTapped: {
if(display instanceof Component){
return
}
selection_model.setCurrentIndex(table_model.index(row,column), ItemSelectionModel.Current)
item_loader.sourceComponent = obtEditDelegate(column,row)
var index = table_model.index(row,column)
}
onTapped: {
if(!current){
item_loader.sourceComponent = null
}
}
}
Loader{
property var itemData: display
property var tableView: table_view
property var tableModel: table_model
property var position: item_table.position
property int row: position.y
property int column: position.x
anchors.fill: parent
sourceComponent: {
if(itemData instanceof Component){
return itemData
}
return com_text
}
return com_edit
}
}
}
Loader{
id:item_loader
z:2
property var display
property int column
property int row
property var tableView: control
onDisplayChanged: {
table_model.setData(table_model.index(row,column),"display",display)
}
}
}
function obtEditDelegate(column,row){
var display = table_model.data(table_model.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
if(obj){
return obj
}
return com_edit
}
Component{
id:com_handle
FluControl {
@ -138,27 +220,166 @@ Rectangle {
}
}
SelectionRectangle {
target: table_view
target: {
if(item_loader.sourceComponent){
return null
}
return table_view
}
bottomRightHandle:com_handle
topLeftHandle: com_handle
}
FluHorizontalHeaderView {
TableView {
id: header_horizontal
textRole: "title"
model: columnSource
model: TableModel{
id:header_model
rows: d.header_rows
}
syncDirection: Qt.Horizontal
anchors.left: scroll_table.left
anchors.top: parent.top
implicitWidth: syncView ? syncView.width : 0
implicitHeight: Math.max(1, contentHeight)
syncView: table_view
boundsBehavior: Flickable.StopAtBounds
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
}
TapHandler{
onDoubleTapped: {
selection_model.clear()
for(var i=0;i<=table_view.rows;i++){
selection_model.select(table_model.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.minimumWidth && 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()
}
}
}
}
FluVerticalHeaderView {
TableView {
id: header_vertical
boundsBehavior: Flickable.StopAtBounds
anchors.top: scroll_table.top
anchors.left: parent.left
implicitWidth: Math.max(1, contentWidth)
implicitHeight: syncView ? syncView.height : 0
syncDirection: Qt.Vertical
syncView: table_view
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_model.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),Qt.AlignTop|Qt.AlignLeft)
}
}

View File

@ -4,6 +4,7 @@ import QtQuick.Controls.Basic
import FluentUI
TextField{
signal commit
property bool disabled: false
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)
@ -32,6 +33,12 @@ TextField{
}
return placeholderNormalColor
}
Keys.onEnterPressed: {
control.commit()
}
Keys.onReturnPressed: {
control.commit()
}
selectByMouse: true
rightPadding: icon_end.visible ? 50 : 30
background: FluTextBoxBackground{
@ -49,13 +56,23 @@ TextField{
}
}
}
MouseArea{
anchors.fill: parent
cursorShape: Qt.IBeamCursor
acceptedButtons: Qt.RightButton
onClicked: control.echoMode !== TextInput.Password && menu.popup()
}
FluIconButton{
iconSource:FluentIcons.ChromeClose
iconSize: 10
width: 20
height: 20
opacity: 0.5
visible: control.text !== ""
visible: {
if(control.readOnly)
return false
return control.text !== ""
}
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
@ -65,10 +82,6 @@ TextField{
control.text = ""
}
}
TapHandler {
acceptedButtons: Qt.RightButton
onTapped: control.echoMode !== TextInput.Password && menu.popup()
}
FluTextBoxMenu{
id:menu
inputItem: control

View File

@ -12,9 +12,7 @@ FluMenu{
animEnabled: false
width: 120
onVisibleChanged: {
if(visible){
inputItem.forceActiveFocus()
}
inputItem.forceActiveFocus()
}
Connections{
target: inputItem

View File

@ -44,11 +44,6 @@ Window {
id: bg
anchors.fill: parent
color: backgroundColor
Behavior on color{
ColorAnimation {
duration: 300
}
}
}
Item{
id:container
@ -78,7 +73,7 @@ Window {
return helper.createRegister(window,path)
}
function deleteWindow(){
helper.deleteWindow()
FluApp.deleteWindow(window)
}
function onResult(data){
if(pageRegister){