Commit Graph

14 Commits

Author SHA1 Message Date
J-P Nurmi fb05eafac5 ColorDialog: replace colorSelected() with a declarative property
This is consistent with the QML ColorDialog from QtQuick Dialogs 1.

Change-Id: I4068a98156494eb36b2d9ecf4c1af90ad173bb97
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
2016-08-14 09:25:52 +00:00
J-P Nurmi eecfe10207 texteditor: enable persistent selection
We want to keep the selection even if the editor loses focus when
a color or font dialog is opened. The selected color or font should
naturally apply to the whole text selection that was there before
the dialog was opened.

Change-Id: I76e6b95f979a090533b028be76e7b2cf1fd53e99
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
2016-08-13 22:39:31 +00:00
Mitch Curtis 5f324ed201 texteditor: use "brush" icon for text color and "A" for font
"F" looks a bit silly. Even though most word processing applications
seem to use the "A" icon with a bar underneath it for the text color,
we want to use it to represent the button that opens the font dialog,
since we don't use comboboxes for that.

Change-Id: I3cc60ffbe388644cdcbd9e8ec0dcffbc041aa124
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
2016-08-12 13:11:01 +00:00
J-P Nurmi 9f6005d967 texteditor: use a wrapping Flow for the toolbar
A proper toolbar extension would be better, but this is a workaround
to make the window scalable/resizable until we have a better solution
available.

The font button was moved together with the other formatting
buttons, because it looked a bit awkward when it was wrapping
alone on the second row, and in general it caused things looking
somehow mis-aligned when actions were wrapped on multiple rows.

Change-Id: I0c1f432e81d5fde6aa763c13ea9efbb8af68ad50
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2016-08-12 13:10:47 +00:00
J-P Nurmi bd0f52bc16 Platform: add MenuSeparator for convenience and consistency
Change-Id: I0c0aae219c81b9248a5a8a0fd0e78521cbe86360
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2016-08-12 10:51:43 +00:00
J-P Nurmi 9a6bdf52a3 texteditor: replace setFileUrl() with load()
This allows to remove the text property to avoid storing the whole
document's initial content for no real purpose.

Change-Id: Iad59576b5304be9739c1dfb0a7d4c263323b0edb
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2016-08-12 10:51:30 +00:00
J-P Nurmi 90842fdc86 texteditor: add fileName & fileType
'document.fileName' reads better than 'document.documentTitle',
and 'document.fileType' can be set as the default suffix for
the file save dialog.

Change-Id: I935586296c91d3efdd5edea03d81c685e7edcab2
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2016-08-12 10:51:27 +00:00
J-P Nurmi bb3453aead texteditor: cosmetic cleanup
Change-Id: Id1d5f0f8c1e7851ea33241fa09af5c0029b74db3
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2016-08-12 10:51:21 +00:00
J-P Nurmi b36652f906 texteditor: fix, unify and cleanup the setters
- setCursorPosition() was missing cursorPositionChanged()
- setAlignment() does not need to check for doc, it's done in textCursor()
- remove the unnecessary cursor.isNull() checks to gain shorter code

Change-Id: I4448224ab02fc22f43ef10749200aca80eed537c
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2016-08-12 10:51:18 +00:00
J-P Nurmi 14f46dc101 texteditor: remove uninitialized/duplicate pointer member
Use textDocument() similarly than textCursor() is already used,
to access the underlying document and cursors.

Change-Id: I1f90f95420132251792f4f9dda302c0509fbad0c
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2016-08-12 07:56:13 +00:00
J-P Nurmi 01eda3fa22 texteditor: re-order the property accessors
There's no reason to register all setters as slots. Properties are fine
for QML usage. Re-order them also in the .cpp file in the same order
than they are in the header. It's a bit easier to follow when logical
pairs are next to each other.

Change-Id: Ib8097ecafe10f2c785b05b045694c338977860ef
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2016-08-12 07:56:08 +00:00
J-P Nurmi 0d8e87d7f6 texteditor: simplify saveAs() - let FileDialog handle the suffix
Change-Id: Id1b415ebcbe12a9eeff9b54dcfa2cec67054a8d6
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2016-08-12 07:56:03 +00:00
J-P Nurmi 4a98152712 texteditor: fix the file dialog name filters
OS X interpreted the suffix literally ".html,"

Change-Id: Icdf889592e4457db5dd4ffd420501b890cbcfd27
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2016-08-12 07:55:59 +00:00
Mitch Curtis fcf4a1ed81 Add Text Editor example
A follow up commit will contain the touch UI.

Change-Id: I26275fdd31294506821fa3e3e4a4bb63329665b9
Task-number: QTBUG-54952
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
2016-08-11 16:47:48 +00:00