Changeset View
Changeset View
Standalone View
Standalone View
src/controls/ActionToolBar.qml
Show All 13 Lines | |||||
14 | * You should have received a copy of the GNU Library General Public | 14 | * You should have received a copy of the GNU Library General Public | ||
15 | * License along with this program; if not, write to the | 15 | * License along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.7 | 20 | import QtQuick 2.7 | ||
21 | import QtQuick.Layouts 1.2 | 21 | import QtQuick.Layouts 1.2 | ||
22 | import QtQuick.Controls 2.5 as Controls | 22 | import QtQuick.Controls 2.4 as Controls | ||
23 | import org.kde.kirigami 2.5 as Kirigami | 23 | import org.kde.kirigami 2.5 as Kirigami | ||
24 | import "private" | 24 | import "private" | ||
25 | 25 | | |||
26 | /** | 26 | /** | ||
27 | * This is a simple toolbar built out of a list of actions | 27 | * This is a simple toolbar built out of a list of actions | ||
28 | * each action is represented by a ToolButton, those that won't fit | 28 | * each action is represented by a ToolButton, those that won't fit | ||
29 | * the size will go in a menu under a button with the overflow ... icon | 29 | * the size will go in a menu under a button with the overflow ... icon | ||
30 | * | 30 | * | ||
▲ Show 20 Lines • Show All 134 Lines • ▼ Show 20 Line(s) | 163 | PrivateActionToolButton { | |||
165 | 165 | | |||
166 | Layout.alignment: Qt.AlignRight | 166 | Layout.alignment: Qt.AlignRight | ||
167 | 167 | | |||
168 | visible: hiddenActions.length > 0 || actionsLayout.overflowSet.length > 0 | 168 | visible: hiddenActions.length > 0 || actionsLayout.overflowSet.length > 0 | ||
169 | showMenuArrow: false | 169 | showMenuArrow: false | ||
170 | 170 | | |||
171 | kirigamiAction: Kirigami.Action { | 171 | kirigamiAction: Kirigami.Action { | ||
172 | icon.name: "overflow-menu" | 172 | icon.name: "overflow-menu" | ||
173 | children: Array.prototype.map.call(root.actions, i => i).concat(Array.prototype.map.call(hiddenActions, i => i)) | 173 | children: Array.prototype.map.call(root.actions, function (i) { return i }).concat(Array.prototype.map.call(hiddenActions, function (i) { return i })) | ||
broulik: I don't think you can replace arrow functions by a simple assignment. Isn't this just a hack to… | |||||
Thanks for the review. I was ignorant of arrow functions. The new version should fix that. mgallien: Thanks for the review. I was ignorant of arrow functions. The new version should fix that. | |||||
174 | } | 174 | } | ||
175 | 175 | | |||
176 | menu.submenuComponent: ActionsMenu { | 176 | menu.submenuComponent: ActionsMenu { | ||
177 | Binding { | 177 | Binding { | ||
178 | target: parentItem | 178 | target: parentItem | ||
179 | property: "visible" | 179 | property: "visible" | ||
180 | value: !actionsLayout.isActionVisible(parentAction) && (parentAction.visible === undefined || parentAction.visible) | 180 | value: !actionsLayout.isActionVisible(parentAction) && (parentAction.visible === undefined || parentAction.visible) | ||
181 | } | 181 | } | ||
182 | } | 182 | } | ||
183 | 183 | | |||
184 | menu.itemDelegate: ActionMenuItem { | 184 | menu.itemDelegate: ActionMenuItem { | ||
185 | visible: !actionsLayout.isActionVisible(ourAction) && (ourAction.visible === undefined || ourAction.visible) | 185 | visible: !actionsLayout.isActionVisible(ourAction) && (ourAction.visible === undefined || ourAction.visible) | ||
186 | } | 186 | } | ||
187 | } | 187 | } | ||
188 | } | 188 | } | ||
189 | } | 189 | } |
I don't think you can replace arrow functions by a simple assignment. Isn't this just a hack to turn that list into an Array?