[ModelContextMenu] Silence warnings
When using a regular JavaScript Array as model and omitting certain roles (e.g. not having a "text" for a separator) it would throw a warning. Differential Revision: https://phabricator.kde.org/D5247
This commit is contained in:
parent
8d42e0072f
commit
edb05ef989
@ -69,10 +69,10 @@ PlasmaComponents.ContextMenu {
|
|||||||
delegate: PlasmaComponents.MenuItem {
|
delegate: PlasmaComponents.MenuItem {
|
||||||
//for QList<QAction*> Repeater adds an attached property modelData
|
//for QList<QAction*> Repeater adds an attached property modelData
|
||||||
//for QAbstractItemModel* it doesn't. Not checking causes errors
|
//for QAbstractItemModel* it doesn't. Not checking causes errors
|
||||||
text: typeof(modelData) != "undefined" ? modelData.text : model.display
|
text: (typeof(modelData) != "undefined" ? modelData.text : model.display) || ""
|
||||||
icon: typeof(modelData) != "undefined" ? modelData.icon : model.decoration
|
icon: typeof(modelData) != "undefined" ? modelData.icon : model.decoration
|
||||||
separator: typeof(modelData) != "undefined" ? modelData.separator : model.separator === true
|
separator: (typeof(modelData) != "undefined" ? modelData.separator : model.separator === true) || false
|
||||||
section: typeof(modelData) != "undefined" ? modelData.section : model.section === true
|
section: (typeof(modelData) != "undefined" ? modelData.section : model.section === true) || false
|
||||||
onClicked: {
|
onClicked: {
|
||||||
menu.clicked(typeof(modelData) != "undefined" ? modelData : model)
|
menu.clicked(typeof(modelData) != "undefined" ? modelData : model)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user