diff --git a/applets/notes/package/contents/ui/main.qml b/applets/notes/package/contents/ui/main.qml --- a/applets/notes/package/contents/ui/main.qml +++ b/applets/notes/package/contents/ui/main.qml @@ -232,22 +232,30 @@ bottomMargin: verticalMargins } - readonly property int requiredWidth: toggleFormatBarButton.width + formatButtonsRow.width + settingsButton.width + 3 * spacing + readonly property int requiredWidth: formatButtonsRow.width + spacing + settingsButton.width readonly property bool showFormatButtons: width > requiredWidth - PlasmaComponents.ToolButton { - id: toggleFormatBarButton - tooltip: i18n("Toggle text format options") - iconSource: "draw-text" - checkable: true - Accessible.name: tooltip - visible: fontButtons.showFormatButtons - } - Row { id: formatButtonsRow spacing: units.smallSpacing - opacity: fontButtons.showFormatButtons && toggleFormatBarButton.checked ? 1 : 0 + // show format buttons if TextField or any of the buttons have focus + opacity: { + if (!fontButtons.showFormatButtons) { + return 0; + } + + if (mainTextArea.activeFocus || settingsButton.activeFocus) { + return 1; + } + + for (var i = 0; i < children.length; ++i) { + if (children[i].activeFocus) { + return 1; + } + } + + return 0; + } Behavior on opacity { NumberAnimation { duration: units.longDuration } } enabled: opacity > 0 visible: fontButtons.showFormatButtons