Skip to content

Commit 4f20283

Browse files
author
朱子楚\zhuzi
committed
2 parents 29cee84 + 2d4e614 commit 4f20283

File tree

5 files changed

+281
-224
lines changed

5 files changed

+281
-224
lines changed

example/example_en_US.ts

+18-8
Original file line numberDiff line numberDiff line change
@@ -1968,7 +1968,7 @@ Some contents...</source>
19681968
</message>
19691969
<message>
19701970
<location filename="qml/page/T_TableView.qml" line="177"/>
1971-
<location filename="qml/page/T_TableView.qml" line="499"/>
1971+
<location filename="qml/page/T_TableView.qml" line="513"/>
19721972
<source>Name</source>
19731973
<translation type="unfinished"></translation>
19741974
</message>
@@ -1998,37 +1998,47 @@ Some contents...</source>
19981998
<translation type="unfinished"></translation>
19991999
</message>
20002000
<message>
2001-
<location filename="qml/page/T_TableView.qml" line="494"/>
2001+
<location filename="qml/page/T_TableView.qml" line="470"/>
2002+
<source>Insert a Row</source>
2003+
<translation type="unfinished"></translation>
2004+
</message>
2005+
<message>
2006+
<location filename="qml/page/T_TableView.qml" line="478"/>
2007+
<source>Focus not acquired: Please click any item in the form as the target for insertion!</source>
2008+
<translation type="unfinished"></translation>
2009+
</message>
2010+
<message>
2011+
<location filename="qml/page/T_TableView.qml" line="508"/>
20022012
<source>Avatar</source>
20032013
<translation type="unfinished"></translation>
20042014
</message>
20052015
<message>
2006-
<location filename="qml/page/T_TableView.qml" line="512"/>
2016+
<location filename="qml/page/T_TableView.qml" line="526"/>
20072017
<source>Address</source>
20082018
<translation type="unfinished"></translation>
20092019
</message>
20102020
<message>
2011-
<location filename="qml/page/T_TableView.qml" line="520"/>
2021+
<location filename="qml/page/T_TableView.qml" line="534"/>
20122022
<source>Nickname</source>
20132023
<translation type="unfinished"></translation>
20142024
</message>
20152025
<message>
2016-
<location filename="qml/page/T_TableView.qml" line="527"/>
2026+
<location filename="qml/page/T_TableView.qml" line="541"/>
20172027
<source>Long String</source>
20182028
<translation type="unfinished"></translation>
20192029
</message>
20202030
<message>
2021-
<location filename="qml/page/T_TableView.qml" line="535"/>
2031+
<location filename="qml/page/T_TableView.qml" line="549"/>
20222032
<source>Options</source>
20232033
<translation type="unfinished"></translation>
20242034
</message>
20252035
<message>
2026-
<location filename="qml/page/T_TableView.qml" line="554"/>
2036+
<location filename="qml/page/T_TableView.qml" line="568"/>
20272037
<source>&lt;Previous</source>
20282038
<translation type="unfinished"></translation>
20292039
</message>
20302040
<message>
2031-
<location filename="qml/page/T_TableView.qml" line="555"/>
2041+
<location filename="qml/page/T_TableView.qml" line="569"/>
20322042
<source>Next&gt;</source>
20332043
<translation type="unfinished"></translation>
20342044
</message>

example/example_zh_CN.ts

+18-8
Original file line numberDiff line numberDiff line change
@@ -2110,7 +2110,7 @@ Some contents...</source>
21102110
</message>
21112111
<message>
21122112
<location filename="qml/page/T_TableView.qml" line="177"/>
2113-
<location filename="qml/page/T_TableView.qml" line="499"/>
2113+
<location filename="qml/page/T_TableView.qml" line="513"/>
21142114
<source>Name</source>
21152115
<translation type="unfinished">名称</translation>
21162116
</message>
@@ -2140,37 +2140,47 @@ Some contents...</source>
21402140
<translation type="unfinished">清除所有</translation>
21412141
</message>
21422142
<message>
2143-
<location filename="qml/page/T_TableView.qml" line="494"/>
2143+
<location filename="qml/page/T_TableView.qml" line="470"/>
2144+
<source>Insert a Row</source>
2145+
<translation type="unfinished">插入一行</translation>
2146+
</message>
2147+
<message>
2148+
<location filename="qml/page/T_TableView.qml" line="478"/>
2149+
<source>Focus not acquired: Please click any item in the form as the target for insertion!</source>
2150+
<translation type="unfinished">焦点未获取:请点击表格中的任意一项,作为插入的靶点!</translation>
2151+
</message>
2152+
<message>
2153+
<location filename="qml/page/T_TableView.qml" line="508"/>
21442154
<source>Avatar</source>
21452155
<translation type="unfinished">头像</translation>
21462156
</message>
21472157
<message>
2148-
<location filename="qml/page/T_TableView.qml" line="512"/>
2158+
<location filename="qml/page/T_TableView.qml" line="526"/>
21492159
<source>Address</source>
21502160
<translation type="unfinished">地址</translation>
21512161
</message>
21522162
<message>
2153-
<location filename="qml/page/T_TableView.qml" line="520"/>
2163+
<location filename="qml/page/T_TableView.qml" line="534"/>
21542164
<source>Nickname</source>
21552165
<translation type="unfinished">昵称</translation>
21562166
</message>
21572167
<message>
2158-
<location filename="qml/page/T_TableView.qml" line="527"/>
2168+
<location filename="qml/page/T_TableView.qml" line="541"/>
21592169
<source>Long String</source>
21602170
<translation type="unfinished">长字符串</translation>
21612171
</message>
21622172
<message>
2163-
<location filename="qml/page/T_TableView.qml" line="535"/>
2173+
<location filename="qml/page/T_TableView.qml" line="549"/>
21642174
<source>Options</source>
21652175
<translation type="unfinished">操作</translation>
21662176
</message>
21672177
<message>
2168-
<location filename="qml/page/T_TableView.qml" line="554"/>
2178+
<location filename="qml/page/T_TableView.qml" line="568"/>
21692179
<source>&lt;Previous</source>
21702180
<translation type="unfinished">&lt;上一页</translation>
21712181
</message>
21722182
<message>
2173-
<location filename="qml/page/T_TableView.qml" line="555"/>
2183+
<location filename="qml/page/T_TableView.qml" line="569"/>
21742184
<source>Next&gt;</source>
21752185
<translation type="unfinished">下一页&gt;</translation>
21762186
</message>

example/qml/page/T_TableView.qml

+22-8
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ FluContentPage{
1313

1414
property var dataSource : []
1515
property int sortType: 0
16-
property bool seletedAll: true
16+
property bool selectedAll: true
1717
property string nameKeyword: ""
1818

1919
onNameKeywordChanged: {
@@ -32,11 +32,11 @@ FluContentPage{
3232
onCheckBoxChanged: {
3333
for(var i =0;i< table_view.rows ;i++){
3434
if(false === table_view.getRow(i).checkbox.options.checked){
35-
root.seletedAll = false
35+
root.selectedAll = false
3636
return
3737
}
3838
}
39-
root.seletedAll = true
39+
root.selectedAll = true
4040
}
4141

4242
onSortTypeChanged: {
@@ -238,12 +238,12 @@ FluContentPage{
238238
Layout.alignment: Qt.AlignVCenter
239239
}
240240
FluCheckBox{
241-
checked: true === root.seletedAll
241+
checked: true === root.selectedAll
242242
animationEnabled: false
243243
Layout.alignment: Qt.AlignVCenter
244244
clickListener: function(){
245-
root.seletedAll = !root.seletedAll
246-
var checked = root.seletedAll
245+
root.selectedAll = !root.selectedAll
246+
var checked = root.selectedAll
247247
itemModel.display = table_view.customItem(com_column_checbox,{"checked":checked})
248248
for(var i =0;i< table_view.rows ;i++){
249249
var rowData = table_view.getRow(i)
@@ -466,6 +466,20 @@ FluContentPage{
466466
table_view.appendRow(genTestObject())
467467
}
468468
}
469+
FluButton{
470+
text: qsTr("Insert a Row")
471+
onClicked: {
472+
if(typeof table_view.current !== 'undefined'){
473+
var newLine = genTestObject()
474+
var currentLine = dataSource.findIndex(obj => obj._key === table_view.current._key)
475+
root.dataSource.splice(currentLine, 0, newLine);
476+
table_view.dataSource = root.dataSource
477+
}else{
478+
showWarning(qsTr("Focus not acquired: Please click any item in the form as the target for insertion!"))
479+
}
480+
481+
}
482+
}
469483

470484
}
471485
}
@@ -588,7 +602,7 @@ FluContentPage{
588602
return avatars[randomIndex];
589603
}
590604
return {
591-
checkbox: table_view.customItem(com_checbox,{checked:root.seletedAll}),
605+
checkbox: table_view.customItem(com_checbox,{checked:root.selectedAll}),
592606
avatar:table_view.customItem(com_avatar,{avatar:getAvatar()}),
593607
name: getRandomName(),
594608
age:getRandomAge(),
@@ -601,7 +615,7 @@ FluContentPage{
601615
}
602616
}
603617
function loadData(page,count){
604-
root.seletedAll = true
618+
root.selectedAll = true
605619
const dataSource = []
606620
for(var i=0;i<count;i++){
607621
dataSource.push(genTestObject())

0 commit comments

Comments
 (0)