Skip to content

Commit 16f4837

Browse files
committed
Fix: #13 多个函数无效的问题.
1 parent 36c75a7 commit 16f4837

File tree

1 file changed

+17
-10
lines changed
  • DelegateUI_Qt5/src/imports/DelegateUI/Controls

1 file changed

+17
-10
lines changed

DelegateUI_Qt5/src/imports/DelegateUI/Controls/DelMenu.qml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ Item {
5656
}
5757
}
5858
}
59+
if (__rootItem.menuKey !== "" && __rootItem.menuKey === __private.gotoMenuKey) {
60+
__rootItem.expandParent();
61+
__menuButton.clicked();
62+
}
5963
}
6064

6165
required property var modelData
@@ -281,6 +285,7 @@ Item {
281285
}
282286

283287
function gotoMenu(key) {
288+
__private.gotoMenuKey = key;
284289
__private.gotoMenu(key);
285290
}
286291

@@ -293,29 +298,29 @@ Item {
293298

294299
function set(index, object) {
295300
if (index >= 0 && index < __listView.model.length) {
296-
__listView.model[index] = object;
297-
__listView.modelChanged();
301+
__private.model[index] = object;
302+
__listView.model = __private.model;
298303
}
299304
}
300305

301306
function setProperty(index, propertyName, value) {
302307
if (index >= 0 && index < __listView.model.length) {
303-
__listView.model[index][propertyName] = value;
304-
__listView.modelChanged();
308+
__private.model[index][propertyName] = value;
309+
__listView.model = __private.model;
305310
}
306311
}
307312

308313
function move(from, to, count = 1) {
309314
if (from >= 0 && from < __listView.model.length && to >= 0 && to < __listView.model.length) {
310315
const objects = __listView.model.splice(from, count);
311-
__listView.model.splice(to, 0, ...objects);
312-
__listView.modelChanged();
316+
__private.model.splice(to, 0, ...objects);
317+
__listView.model = __private.model;
313318
}
314319
}
315320

316321
function insert(index, object) {
317-
__listView.model.splice(index, 0, object);
318-
__listView.modelChanged();
322+
__private.model.splice(index, 0, object);
323+
__listView.model = __private.model;
319324
}
320325

321326
function append(object) {
@@ -325,12 +330,13 @@ Item {
325330

326331
function remove(index, count = 1) {
327332
if (index >= 0 && index < __listView.model.length) {
328-
__listView.model.splice(index, count);
329-
__listView.modelChanged();
333+
__private.model.splice(index, count);
334+
__listView.model = __private.model;
330335
}
331336
}
332337

333338
function clear() {
339+
__private.gotoMenuKey = '';
334340
__listView.model = [];
335341
}
336342

@@ -445,6 +451,7 @@ Item {
445451
Item {
446452
id: __private
447453
signal gotoMenu(key: string)
454+
property string gotoMenuKey: ''
448455
property var model: []
449456
property var window: Window.window
450457
property var selectedItem: null

0 commit comments

Comments
 (0)