Changeset View
Changeset View
Standalone View
Standalone View
containments/panel/contents/ui/ConfigOverlay.qml
Show All 15 Lines | |||||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | import QtQuick 2.1 | 19 | import QtQuick 2.1 | ||
20 | import QtQuick.Layouts 1.0 | 20 | import QtQuick.Layouts 1.0 | ||
21 | 21 | | |||
22 | import org.kde.plasma.core 2.0 as PlasmaCore | 22 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
23 | import org.kde.plasma.components 2.0 as PlasmaComponents | 23 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
24 | import org.kde.plasma.extras 2.0 as PlasmaExtras | ||||
24 | import org.kde.kquickcontrolsaddons 2.0 | 25 | import org.kde.kquickcontrolsaddons 2.0 | ||
25 | 26 | | |||
26 | MouseArea { | 27 | MouseArea { | ||
27 | id: configurationArea | 28 | id: configurationArea | ||
28 | 29 | | |||
29 | z: 1000 | 30 | z: 1000 | ||
30 | 31 | | |||
31 | anchors.fill: currentLayout | 32 | anchors.fill: currentLayout | ||
▲ Show 20 Lines • Show All 319 Lines • ▼ Show 20 Line(s) | 351 | if (visualParent) { | |||
351 | configureButton.visible = currentApplet.applet.action("configure") && currentApplet.applet.action("configure").enabled; | 352 | configureButton.visible = currentApplet.applet.action("configure") && currentApplet.applet.action("configure").enabled; | ||
352 | closeButton.visible = currentApplet.applet.action("remove") && currentApplet.applet.action("remove").enabled; | 353 | closeButton.visible = currentApplet.applet.action("remove") && currentApplet.applet.action("remove").enabled; | ||
353 | label.text = currentApplet.applet.title; | 354 | label.text = currentApplet.applet.title; | ||
354 | } | 355 | } | ||
355 | } | 356 | } | ||
356 | 357 | | |||
357 | mainItem: MouseArea { | 358 | mainItem: MouseArea { | ||
358 | enabled: currentApplet | 359 | enabled: currentApplet | ||
359 | width: handleRow.childrenRect.width + (2 * handleRow.spacing) | 360 | width: handleButtons.width | ||
360 | height: Math.max(configureButton.height, label.contentHeight, closeButton.height) | 361 | height: handleButtons.height | ||
broulik: The `label` is *inside* the `ColumnLayout` so just doing `handleButtons.width` should suffice. | |||||
361 | hoverEnabled: true | 362 | hoverEnabled: true | ||
362 | onEntered: hideTimer.stop(); | 363 | onEntered: hideTimer.stop(); | ||
363 | onExited: hideTimer.restart(); | 364 | onExited: hideTimer.restart(); | ||
364 | 365 | | |||
365 | LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft | 366 | ColumnLayout { | ||
I think if you used ColumnLayout you could let it figure out the width on its own rather than having to do manual calculations for every item ColumnLayout { Heading { Layout.fillWidth: true; ... } ToolButton { Layout.fillWidth: true; ... } } broulik: I think if you used `ColumnLayout` you could let it figure out the width on its own rather than… | |||||
366 | LayoutMirroring.childrenInherit: true | 367 | id: handleButtons | ||
Could be removed now that the dialog has the exact size of the column, previously it added 2 * spacing broulik: Could be removed now that the dialog has the exact size of the column, previously it added `2 *… | |||||
367 | | ||||
368 | Row { | | |||
369 | id: handleRow | | |||
370 | anchors.horizontalCenter: parent.horizontalCenter | | |||
371 | spacing: units.smallSpacing | 368 | spacing: units.smallSpacing | ||
369 | | ||||
370 | PlasmaExtras.Heading { | ||||
371 | id: label | ||||
broulik: Can be removed once you addressed the `width` above | |||||
This is still needed because it's referred to on line 354 (label.text = currentApplet.applet.title;) ngraham: This is still needed because it's referred to on line 354 (`label.text = currentApplet.applet. | |||||
372 | level: 3 | ||||
373 | Layout.fillWidth: true | ||||
broulik: I think `Heading` never wraps on its own | |||||
374 | Layout.leftMargin: units.smallSpacing * 2 | ||||
This doesn't seem to do anything? (You might want to use leftPadding and the like but I recall that messing up the width calculation of the label/column) broulik: This doesn't seem to do anything? (You might want to use `leftPadding` and the like but I… | |||||
This adds a bit of padding on the left and right sides of the label so it's vertically aligned with the icons below it and also so the whole menu doesn't seem so cramped. ngraham: This adds a bit of padding on the left and right sides of the label so it's vertically aligned… | |||||
375 | Layout.rightMargin: units.smallSpacing * 2 | ||||
376 | } | ||||
372 | PlasmaComponents.ToolButton { | 377 | PlasmaComponents.ToolButton { | ||
373 | id: configureButton | 378 | id: configureButton | ||
374 | anchors.verticalCenter: parent.verticalCenter | 379 | Layout.fillWidth: true | ||
375 | iconSource: "configure" | 380 | iconSource: "configure" | ||
381 | text: i18n("Configure...") | ||||
broulik: Doesn't this need an ellipsis, `i18n("Configure...")` | |||||
376 | onClicked: { | 382 | onClicked: { | ||
377 | tooltip.visible = false; | 383 | tooltip.visible = false; | ||
378 | currentApplet.applet.action("configure").trigger() | 384 | currentApplet.applet.action("configure").trigger() | ||
379 | } | 385 | } | ||
380 | } | 386 | } | ||
381 | PlasmaComponents.Label { | | |||
382 | id: label | | |||
383 | anchors.verticalCenter: parent.verticalCenter | | |||
384 | textFormat: Text.PlainText | | |||
385 | maximumLineCount: 1 | | |||
386 | } | | |||
387 | PlasmaComponents.ToolButton { | 387 | PlasmaComponents.ToolButton { | ||
388 | id: closeButton | 388 | id: closeButton | ||
389 | anchors.verticalCenter: parent.verticalCenter | 389 | Layout.fillWidth: true | ||
390 | iconSource: "delete" | 390 | iconSource: "delete" | ||
391 | text: i18n("Remove") | ||||
391 | onClicked: { | 392 | onClicked: { | ||
392 | tooltip.visible = false; | 393 | tooltip.visible = false; | ||
393 | currentApplet.applet.action("remove").trigger(); | 394 | currentApplet.applet.action("remove").trigger(); | ||
394 | } | 395 | } | ||
395 | } | 396 | } | ||
396 | } | 397 | } | ||
397 | } | 398 | } | ||
398 | } | 399 | } | ||
399 | } | 400 | } |
The label is *inside* the ColumnLayout so just doing handleButtons.width should suffice.