mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-28 22:26:43 +08:00
Compare commits
No commits in common. "ecd13a9cca59c18096b938a0731fb95fb3519d52" and "f701f9775659ed43b96338cbcc82186c8c06b37f" have entirely different histories.
ecd13a9cca
...
f701f97756
@ -2394,25 +2394,25 @@ Some contents...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TreeView.qml" line="185"/>
|
||||
<location filename="qml/page/T_TreeView.qml" line="230"/>
|
||||
<source>Title</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TreeView.qml" line="189"/>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TreeView.qml" line="193"/>
|
||||
<location filename="qml/page/T_TreeView.qml" line="238"/>
|
||||
<source>Avatar</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TreeView.qml" line="197"/>
|
||||
<location filename="qml/page/T_TreeView.qml" line="242"/>
|
||||
<source>Address</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TreeView.qml" line="234"/>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>T_Typography</name>
|
||||
|
@ -2504,22 +2504,22 @@ Some contents...</source>
|
||||
<translation type="obsolete">共计选中%1条数据</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TreeView.qml" line="185"/>
|
||||
<location filename="qml/page/T_TreeView.qml" line="230"/>
|
||||
<source>Title</source>
|
||||
<translation type="unfinished">标题</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TreeView.qml" line="197"/>
|
||||
<location filename="qml/page/T_TreeView.qml" line="242"/>
|
||||
<source>Address</source>
|
||||
<translation type="unfinished">地址</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TreeView.qml" line="193"/>
|
||||
<location filename="qml/page/T_TreeView.qml" line="238"/>
|
||||
<source>Avatar</source>
|
||||
<translation type="unfinished">头像</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="qml/page/T_TreeView.qml" line="189"/>
|
||||
<location filename="qml/page/T_TreeView.qml" line="234"/>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished">名称</translation>
|
||||
</message>
|
||||
|
@ -10,6 +10,7 @@ FluContentPage {
|
||||
title: qsTr("TreeView")
|
||||
|
||||
|
||||
|
||||
function treeData(){
|
||||
const names = ["孙悟空", "猪八戒", "沙和尚", "唐僧","白骨夫人","金角大王","熊山君","黄风怪","银角大王"]
|
||||
function getRandomName(){
|
||||
@ -28,7 +29,7 @@ FluContentPage {
|
||||
}
|
||||
const dig = (path = '0', level = 5) => {
|
||||
const list = [];
|
||||
for (let i = 0; i < 4; i += 1) {
|
||||
for (let i = 0; i < 5; i += 1) {
|
||||
const key = `${path}-${i}`;
|
||||
const treeNode = {
|
||||
title: key,
|
||||
@ -47,6 +48,67 @@ FluContentPage {
|
||||
return dig();
|
||||
}
|
||||
|
||||
// Row{
|
||||
// id: layout_column
|
||||
// spacing: 12
|
||||
// width: 340
|
||||
// anchors{
|
||||
// top:parent.top
|
||||
// left: parent.left
|
||||
// leftMargin: 10
|
||||
// bottom:parent.bottom
|
||||
// bottomMargin: 20
|
||||
// }
|
||||
// RowLayout{
|
||||
// spacing: 10
|
||||
// FluText{
|
||||
// text: "cellHeight:"
|
||||
// Layout.alignment: Qt.AlignVCenter
|
||||
// }
|
||||
// FluSlider{
|
||||
// id: slider_cell_height
|
||||
// value: 30
|
||||
// from: 30
|
||||
// to:100
|
||||
// }
|
||||
// }
|
||||
// RowLayout{
|
||||
// spacing: 10
|
||||
// FluText{
|
||||
// text: "depthPadding:"
|
||||
// Layout.alignment: Qt.AlignVCenter
|
||||
// }
|
||||
// FluSlider{
|
||||
// id: slider_depth_padding
|
||||
// value: 15
|
||||
// from: 15
|
||||
// to:100
|
||||
// }
|
||||
// }
|
||||
// FluToggleSwitch{
|
||||
// id: switch_showline
|
||||
// text:"showLine"
|
||||
// checked: false
|
||||
// }
|
||||
// FluToggleSwitch{
|
||||
// id: switch_checkable
|
||||
// text:"checkable"
|
||||
// checked: false
|
||||
// }
|
||||
// FluButton{
|
||||
// text: "all expand"
|
||||
// onClicked: {
|
||||
// tree_view.allExpand()
|
||||
// }
|
||||
// }
|
||||
// FluButton{
|
||||
// text: "all collapse"
|
||||
// onClicked: {
|
||||
// tree_view.allCollapse()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
Component{
|
||||
id:com_avatar
|
||||
Item{
|
||||
@ -144,21 +206,7 @@ FluContentPage {
|
||||
}
|
||||
}
|
||||
}
|
||||
FluButton{
|
||||
text: "print selection model"
|
||||
onClicked: {
|
||||
var printData = []
|
||||
var data = tree_view.selectionModel();
|
||||
console.debug(data.length)
|
||||
for(var i = 0; i <= data.length-1 ; i++){
|
||||
const newObj = Object.assign({}, data[i].data);
|
||||
delete newObj["__parent"];
|
||||
delete newObj["children"];
|
||||
printData.push(newObj)
|
||||
}
|
||||
console.debug(JSON.stringify(printData))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,9 +225,6 @@ FluContentPage {
|
||||
showLine: switch_showline.checked
|
||||
checkable:switch_checkable.checked
|
||||
depthPadding: slider_depth_padding.value
|
||||
onCurrentChanged: {
|
||||
showInfo(current.data.title)
|
||||
}
|
||||
columnSource:[
|
||||
{
|
||||
title: qsTr("Title"),
|
||||
|
@ -161,12 +161,19 @@ void FluFrameless::componentComplete() {
|
||||
if (!isCompositionEnabled()) {
|
||||
offsetSize = 0;
|
||||
}
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
if (!isMaximum) {
|
||||
clientRect->top = originalTop + offsetSize;
|
||||
clientRect->bottom = originalBottom;
|
||||
clientRect->left = originalLeft;
|
||||
clientRect->right = originalRight;
|
||||
}
|
||||
#else
|
||||
clientRect->top = originalTop + offsetSize;
|
||||
clientRect->bottom = originalBottom;
|
||||
clientRect->left = originalLeft;
|
||||
clientRect->right = originalRight;
|
||||
#endif
|
||||
_setMaximizeHovered(false);
|
||||
*result = WVR_REDRAW;
|
||||
return true;
|
||||
|
@ -113,7 +113,15 @@ void FluTreeModel::checkRow(int row, bool checked) {
|
||||
itemData->_checked = checked;
|
||||
}
|
||||
Q_EMIT dataChanged(index(0, 0), index(rowCount() - 1, 0));
|
||||
|
||||
QList<FluTreeNode *> data;
|
||||
foreach (auto item, _dataSource) {
|
||||
if (!item->hasChildren()) {
|
||||
if (item->_checked) {
|
||||
data.append(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
selectionModel(data);
|
||||
}
|
||||
|
||||
void FluTreeModel::setDataSource(QList<QMap<QString, QVariant>> data) {
|
||||
@ -264,13 +272,3 @@ void FluTreeModel::allCollapse() {
|
||||
_rows = _root->_children;
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
QVariant FluTreeModel::selectionModel(){
|
||||
QList<FluTreeNode *> data;
|
||||
foreach (auto item, _dataSource) {
|
||||
if (item->checked()) {
|
||||
data.append(item);
|
||||
}
|
||||
}
|
||||
return QVariant::fromValue(data);
|
||||
}
|
||||
|
@ -89,6 +89,7 @@ public:
|
||||
class FluTreeModel : public QAbstractItemModel {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY_AUTO(int, dataSourceSize)
|
||||
Q_PROPERTY_AUTO(QList<FluTreeNode *>, selectionModel)
|
||||
Q_PROPERTY_AUTO(QList<QVariantMap>, columnSource)
|
||||
QML_NAMED_ELEMENT(FluTreeModel)
|
||||
QML_ADDED_IN_MINOR_VERSION(1)
|
||||
@ -140,8 +141,6 @@ public:
|
||||
|
||||
Q_INVOKABLE void allCollapse();
|
||||
|
||||
Q_INVOKABLE QVariant selectionModel();
|
||||
|
||||
private:
|
||||
QList<FluTreeNode *> _rows;
|
||||
QList<FluTreeNode *> _dataSource;
|
||||
|
@ -80,7 +80,6 @@ FluButton {
|
||||
id:container
|
||||
width: 300
|
||||
height: 360
|
||||
radius: 4
|
||||
color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
@ -614,7 +613,7 @@ FluButton {
|
||||
}
|
||||
background: Item{
|
||||
FluShadow{
|
||||
radius: 4
|
||||
radius: 5
|
||||
}
|
||||
}
|
||||
function showPopup() {
|
||||
|
@ -710,6 +710,9 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
function selectionModel(){
|
||||
return tree_model.selectionModel
|
||||
}
|
||||
function count(){
|
||||
return tree_model.dataSourceSize
|
||||
}
|
||||
@ -738,7 +741,4 @@ Rectangle {
|
||||
d.editPosition = undefined
|
||||
d.editDelegate = undefined
|
||||
}
|
||||
function selectionModel(){
|
||||
return tree_model.selectionModel()
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,6 @@ FluButton {
|
||||
id:container
|
||||
width: 300
|
||||
height: 360
|
||||
radius: 4
|
||||
color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
@ -613,7 +612,7 @@ FluButton {
|
||||
}
|
||||
background: Item{
|
||||
FluShadow{
|
||||
radius: 4
|
||||
radius: 5
|
||||
}
|
||||
}
|
||||
function showPopup() {
|
||||
|
@ -710,6 +710,9 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
function selectionModel(){
|
||||
return tree_model.selectionModel
|
||||
}
|
||||
function count(){
|
||||
return tree_model.dataSourceSize
|
||||
}
|
||||
@ -738,7 +741,4 @@ Rectangle {
|
||||
d.editPosition = undefined
|
||||
d.editDelegate = undefined
|
||||
}
|
||||
function selectionModel(){
|
||||
return tree_model.selectionModel()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user