Changeset View
Changeset View
Standalone View
Standalone View
applets/notes/package/contents/ui/main.qml
Show First 20 Lines • Show All 118 Lines • ▼ Show 20 Line(s) | 36 | PlasmaCore.SvgItem { | |||
---|---|---|---|---|---|
119 | DocumentHandler { | 119 | DocumentHandler { | ||
120 | id: documentHandler | 120 | id: documentHandler | ||
121 | target: mainTextArea | 121 | target: mainTextArea | ||
122 | cursorPosition: mainTextArea.cursorPosition | 122 | cursorPosition: mainTextArea.cursorPosition | ||
123 | selectionStart: mainTextArea.selectionStart | 123 | selectionStart: mainTextArea.selectionStart | ||
124 | selectionEnd: mainTextArea.selectionEnd | 124 | selectionEnd: mainTextArea.selectionEnd | ||
125 | } | 125 | } | ||
126 | 126 | | |||
127 | FocusScope { | ||||
128 | id: focusScope | ||||
129 | anchors { | ||||
130 | fill: parent | ||||
131 | leftMargin: horizontalMargins | ||||
132 | rightMargin: horizontalMargins | ||||
133 | topMargin: verticalMargins | ||||
134 | bottomMargin: verticalMargins | ||||
davidedmundson: you've added an extra margin to the bottom. | |||||
That's the bottomMargin the fontButtons Row originally had. I moved all the margins to the FocusScope and then just anchored the items inside without. broulik: That's the bottomMargin the fontButtons Row originally had. I moved all the margins to the… | |||||
135 | } | ||||
136 | | ||||
127 | PlasmaComponents.TextArea { | 137 | PlasmaComponents.TextArea { | ||
128 | id: mainTextArea | 138 | id: mainTextArea | ||
129 | anchors { | 139 | anchors { | ||
130 | top: parent.top | 140 | top: parent.top | ||
131 | left: parent.left | 141 | left: parent.left | ||
132 | right: parent.right | 142 | right: parent.right | ||
133 | | ||||
134 | leftMargin: horizontalMargins | | |||
135 | rightMargin: horizontalMargins | | |||
136 | topMargin: verticalMargins | | |||
137 | | ||||
138 | bottom: fontButtons.top | 143 | bottom: fontButtons.top | ||
139 | bottomMargin: Math.round(units.largeSpacing / 2) | 144 | bottomMargin: Math.round(units.largeSpacing / 2) | ||
140 | } | 145 | } | ||
141 | 146 | | |||
142 | backgroundVisible: false | 147 | backgroundVisible: false | ||
143 | frameVisible: false | 148 | frameVisible: false | ||
144 | textFormat: TextEdit.RichText | 149 | textFormat: TextEdit.RichText | ||
145 | 150 | | |||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Line(s) | |||||
222 | 227 | | |||
223 | RowLayout { | 228 | RowLayout { | ||
224 | id: fontButtons | 229 | id: fontButtons | ||
225 | spacing: units.smallSpacing | 230 | spacing: units.smallSpacing | ||
226 | anchors { | 231 | anchors { | ||
227 | bottom: parent.bottom | 232 | bottom: parent.bottom | ||
228 | left: parent.left | 233 | left: parent.left | ||
229 | right: parent.right | 234 | right: parent.right | ||
230 | leftMargin: horizontalMargins | | |||
231 | rightMargin: horizontalMargins | | |||
232 | bottomMargin: verticalMargins | | |||
233 | } | 235 | } | ||
234 | 236 | | |||
235 | readonly property int requiredWidth: formatButtonsRow.width + spacing + settingsButton.width | 237 | readonly property int requiredWidth: formatButtonsRow.width + spacing + settingsButton.width | ||
236 | readonly property bool showFormatButtons: width > requiredWidth | 238 | readonly property bool showFormatButtons: width > requiredWidth | ||
237 | 239 | | |||
238 | Row { | 240 | Row { | ||
239 | id: formatButtonsRow | 241 | id: formatButtonsRow | ||
240 | spacing: units.smallSpacing | 242 | spacing: units.smallSpacing | ||
241 | // show format buttons if TextField or any of the buttons have focus | 243 | // show format buttons if TextField or any of the buttons have focus | ||
242 | 244 | opacity: fontButtons.showFormatButtons && focusScope.activeFocus | |||
243 | opacity: { | | |||
244 | if (!fontButtons.showFormatButtons) { | | |||
245 | return 0; | | |||
246 | } | | |||
247 | | ||||
248 | if (mainTextArea.activeFocus || settingsButton.activeFocus) { | | |||
249 | return 1; | | |||
250 | } | | |||
251 | | ||||
252 | for (var i = 0; i < children.length; ++i) { | | |||
253 | if (children[i].activeFocus) { | | |||
254 | return 1; | | |||
255 | } | | |||
256 | } | | |||
257 | | ||||
258 | return 0; | | |||
259 | } | | |||
260 | 245 | | |||
261 | Behavior on opacity { NumberAnimation { duration: units.longDuration } } | 246 | Behavior on opacity { NumberAnimation { duration: units.longDuration } } | ||
262 | enabled: opacity > 0 | 247 | enabled: opacity > 0 | ||
263 | visible: fontButtons.showFormatButtons | 248 | visible: fontButtons.showFormatButtons | ||
264 | 249 | | |||
265 | PlasmaComponents.ToolButton { | 250 | PlasmaComponents.ToolButton { | ||
266 | tooltip: i18n("Bold") | 251 | tooltip: i18n("Bold") | ||
267 | iconSource: "format-text-bold" | 252 | iconSource: "format-text-bold" | ||
Show All 32 Lines | |||||
300 | PlasmaComponents.ToolButton { | 285 | PlasmaComponents.ToolButton { | ||
301 | id: settingsButton | 286 | id: settingsButton | ||
302 | tooltip: plasmoid.action("configure").text | 287 | tooltip: plasmoid.action("configure").text | ||
303 | iconSource: "configure" | 288 | iconSource: "configure" | ||
304 | onClicked: plasmoid.action("configure").trigger() | 289 | onClicked: plasmoid.action("configure").trigger() | ||
305 | Accessible.name: tooltip | 290 | Accessible.name: tooltip | ||
306 | } | 291 | } | ||
307 | } | 292 | } | ||
293 | } | ||||
308 | 294 | | |||
309 | Component.onCompleted: { | 295 | Component.onCompleted: { | ||
310 | plasmoid.setAction("change_note_color_white", i18n("White")); | 296 | plasmoid.setAction("change_note_color_white", i18n("White")); | ||
311 | plasmoid.setAction("change_note_color_black", i18n("Black")); | 297 | plasmoid.setAction("change_note_color_black", i18n("Black")); | ||
312 | plasmoid.setAction("change_note_color_red", i18n("Red")); | 298 | plasmoid.setAction("change_note_color_red", i18n("Red")); | ||
313 | plasmoid.setAction("change_note_color_orange", i18n("Orange")); | 299 | plasmoid.setAction("change_note_color_orange", i18n("Orange")); | ||
314 | plasmoid.setAction("change_note_color_yellow", i18n("Yellow")); | 300 | plasmoid.setAction("change_note_color_yellow", i18n("Yellow")); | ||
315 | plasmoid.setAction("change_note_color_green", i18n("Green")); | 301 | plasmoid.setAction("change_note_color_green", i18n("Green")); | ||
Show All 22 Lines |
you've added an extra margin to the bottom.