mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-30 07:03:46 +08:00
fix #246
This commit is contained in:
parent
153090637b
commit
cb8b128598
@ -64,9 +64,6 @@ FluContentPage{
|
|||||||
address: getRandomAddresses(),
|
address: getRandomAddresses(),
|
||||||
nickname: getRandomNickname(),
|
nickname: getRandomNickname(),
|
||||||
longstring:"你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好",
|
longstring:"你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好",
|
||||||
height:42,
|
|
||||||
minimumHeight:42,
|
|
||||||
maximumHeight:300,
|
|
||||||
action:com_action
|
action:com_action
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -110,10 +107,7 @@ FluContentPage{
|
|||||||
{
|
{
|
||||||
title: '姓名',
|
title: '姓名',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
width:100,
|
readOnly:true,
|
||||||
minimumWidth:80,
|
|
||||||
maximumWidth:200,
|
|
||||||
readOnly:true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '年龄',
|
title: '年龄',
|
||||||
|
@ -32,6 +32,8 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
QtObject{
|
QtObject{
|
||||||
id:d
|
id:d
|
||||||
|
property int defaultItemWidth: 100
|
||||||
|
property int defaultItemHeight: 42
|
||||||
property var header_rows:[]
|
property var header_rows:[]
|
||||||
property bool selectionFlag: true
|
property bool selectionFlag: true
|
||||||
function obtEditDelegate(column,row){
|
function obtEditDelegate(column,row){
|
||||||
@ -182,6 +184,12 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
columnWidthProvider: function(column) {
|
columnWidthProvider: function(column) {
|
||||||
var w = columnSource[column].width
|
var w = columnSource[column].width
|
||||||
|
if(!w){
|
||||||
|
w = columnSource[column].minimumWidth
|
||||||
|
}
|
||||||
|
if(!w){
|
||||||
|
w = d.defaultItemWidth
|
||||||
|
}
|
||||||
if(column === item_loader.column){
|
if(column === item_loader.column){
|
||||||
item_loader.width = w
|
item_loader.width = w
|
||||||
}
|
}
|
||||||
@ -199,6 +207,12 @@ Rectangle {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
var h = table_model.getRow(row).height
|
var h = table_model.getRow(row).height
|
||||||
|
if(!h){
|
||||||
|
h = table_model.getRow(row).minimumHeight
|
||||||
|
}
|
||||||
|
if(!h){
|
||||||
|
return d.defaultItemHeight
|
||||||
|
}
|
||||||
if(row === item_loader.row){
|
if(row === item_loader.row){
|
||||||
item_loader.height = h
|
item_loader.height = h
|
||||||
}
|
}
|
||||||
@ -219,7 +233,16 @@ Rectangle {
|
|||||||
required property bool selected
|
required property bool selected
|
||||||
color: (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06))
|
color: (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: {
|
||||||
|
var w = columnSource[column].width
|
||||||
|
if(!w){
|
||||||
|
w = columnSource[column].minimumWidth
|
||||||
|
}
|
||||||
|
if(!w){
|
||||||
|
w = d.defaultItemWidth
|
||||||
|
}
|
||||||
|
return w
|
||||||
|
}
|
||||||
Rectangle{
|
Rectangle{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: !item_loader.sourceComponent
|
visible: !item_loader.sourceComponent
|
||||||
@ -378,7 +401,7 @@ Rectangle {
|
|||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
visible: !(obj.width === obj.minimumWidth && obj.width === obj.maximumWidth)
|
visible: !(obj.width === obj.minimumWidth && obj.width === obj.maximumWidth && obj.width)
|
||||||
cursorShape: Qt.SplitHCursor
|
cursorShape: Qt.SplitHCursor
|
||||||
onPressed :
|
onPressed :
|
||||||
(mouse)=>{
|
(mouse)=>{
|
||||||
@ -402,13 +425,17 @@ Rectangle {
|
|||||||
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
|
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
|
||||||
var minimumWidth = obj.minimumWidth
|
var minimumWidth = obj.minimumWidth
|
||||||
var maximumWidth = obj.maximumWidth
|
var maximumWidth = obj.maximumWidth
|
||||||
|
var w = obj.width
|
||||||
|
if(!w){
|
||||||
|
w = d.defaultItemWidth
|
||||||
|
}
|
||||||
if(!minimumWidth){
|
if(!minimumWidth){
|
||||||
minimumWidth = 100
|
minimumWidth = d.defaultItemWidth
|
||||||
}
|
}
|
||||||
if(!maximumWidth){
|
if(!maximumWidth){
|
||||||
maximumWidth = 65535
|
maximumWidth = 65535
|
||||||
}
|
}
|
||||||
obj.width = Math.min(Math.max(minimumWidth, obj.width + delta.x),maximumWidth)
|
obj.width = Math.min(Math.max(minimumWidth, w + delta.x),maximumWidth)
|
||||||
table_view.forceLayout()
|
table_view.forceLayout()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -492,7 +519,7 @@ Rectangle {
|
|||||||
cursorShape: Qt.SplitVCursor
|
cursorShape: Qt.SplitVCursor
|
||||||
visible: {
|
visible: {
|
||||||
var obj = table_model.getRow(row)
|
var obj = table_model.getRow(row)
|
||||||
return !(obj.height === obj.minimumHeight && obj.width === obj.maximumHeight)
|
return !(obj.height === obj.minimumHeight && obj.height === obj.maximumHeight && obj.height)
|
||||||
}
|
}
|
||||||
onPressed :
|
onPressed :
|
||||||
(mouse)=>{
|
(mouse)=>{
|
||||||
@ -517,13 +544,17 @@ Rectangle {
|
|||||||
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
|
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
|
||||||
var minimumHeight = obj.minimumHeight
|
var minimumHeight = obj.minimumHeight
|
||||||
var maximumHeight = obj.maximumHeight
|
var maximumHeight = obj.maximumHeight
|
||||||
|
var h = obj.height
|
||||||
|
if(!h){
|
||||||
|
h = d.defaultItemHeight
|
||||||
|
}
|
||||||
if(!minimumHeight){
|
if(!minimumHeight){
|
||||||
minimumHeight = 42
|
minimumHeight = d.defaultItemHeight
|
||||||
}
|
}
|
||||||
if(!maximumHeight){
|
if(!maximumHeight){
|
||||||
maximumHeight = 65535
|
maximumHeight = 65535
|
||||||
}
|
}
|
||||||
obj.height = Math.min(Math.max(minimumHeight, obj.height + delta.y),maximumHeight)
|
obj.height = Math.min(Math.max(minimumHeight, h + delta.y),maximumHeight)
|
||||||
table_model.setRow(row,obj)
|
table_model.setRow(row,obj)
|
||||||
table_view.forceLayout()
|
table_view.forceLayout()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user