aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quickcontrols2/texteditor/documenthandler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix texteditor example for AndroidTomi Korpipaa2022-10-211-0/+69
| | | | | | | | Fixes: QTBUG-103939 Change-Id: I60237f8cc58ebb6781a4df272fb7da13467d6640 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 51ddad5ffde6f14f8a826ef57e652e56578afd76) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use SPDX license identifiersLucie Gérard2022-06-141-49/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 0dc4fd240a2897c5c443a0ef6d84c416843e4938) Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* TextEditor: Clean up example and use quick dialogsOliver Eftevaag2021-09-291-101/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The text editor example is dependent on Qt.labs for its dialogs and native menus. The long term goal is to remove the Qt.labs dependency, and replace it with components from QtQuick. Currently we have a file and a font dialog, that should be used instead of the Qt.labs dialogs. I'm also replacing some of the properties in the DocumentHandler, since I don't think it makes sense for the font to be limited to only a few font weights and styles (which can be selected through the font dialog). Selecting the most common font weight and style is still possible using the bold and italic shortcuts and toolbar buttons. Some more features includes: * An additional toolbar button, which can be used to strikeout the selected font. This required adding an additional glyph to fontello.ttf. * When coupled with the fix for QTBUG-96934, the font for the current selection should automatically update the listviews in the font dialog to select the correct family, style, sizes and effects for what is selected in the document handler. Fixes: QTBUG-95976 Pick-to: 6.2 Change-Id: I2907a2270e2a139b1ccb3fcb3ce3a788306a42e3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Update QStringConverter usageMårten Nordheim2020-10-091-1/+1
| | | | | | | | Following fa8d021fa6fcb040fb702b6ffd2deee52a3b748a Change-Id: Ifa08b5e1bceecb8657ce528eb315c19fa34a1e1f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Support Markdown in the TextEditor example, including local pathsShawn Rutledge2020-08-101-10/+17
| | | | | | | | | | | | | The example still loads an HTML file from resources by default, but now it's possible to give either a relative or absolute file path on the command line to load an html, markdown or plain text file. Alternatively you can use the file dialog to load any of these types. We assume that any resources (such as images) with relative paths are to be loaded from the directory where the source text file is. Pick-to: 5.15 Change-Id: I37bc2d6aa2306016453770dc2fd66efa41a16618 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Port QtQuickControls2 from QTextCodec to QString{Converter|Decoder}Karsten Heimrich2020-06-171-4/+11
| | | | | | Task-number: QTBUG-75665 Change-Id: Ib66a260dc3bfc39e2e50c38db56ca72b8186a4ac Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build failures as a result of QMetaType changes in qtbaseAlexandru Croitor2020-03-121-0/+2
| | | | | | | | | | | | | | | | | | | moc now stores the QMetaType of properties as a result of 46f407126ef3e94d59254012cdc34d6a4ad2faf2 in qtbase, which requires full type information about the property type inside the moc generated source file. Many of the property types were forward-declared, and this resulted in build errors like "invalid application of 'sizeof' to an incomplete type 'QQuickTransition'" Make sure to explicitly include the moc files inside the counterpart .cpp files, so that full information is available from included headers. Fixes: QTBUG-82774 Change-Id: I5971713864992398daed72ce9f6ab866668cf8e1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* TextEditor: Add modified handlingFriedemann Kleint2019-08-211-0/+15
| | | | | | | | | | Add a modified property to the document and add handling in onClosing(). Connect the actions to call close() instead of Qt.quit() for it to become active. Change-Id: I0fec75629db64e91508ed8ba45d4fb60be146b1b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add missing includesJ-P Nurmi2017-02-241-0/+1
| | | | | | | Found while doing a -no-accessibility build. Change-Id: I9772316eed3d544b21926970371a590ef2c15bef Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Welcome to 2017J-P Nurmi2017-01-091-1/+1
| | | | | Change-Id: If68cff4efacc7dc5719c8b8e61937e85e9076870 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* texteditor: add touch UIMitch Curtis2016-08-241-1/+10
| | | | | | Task-number: QTBUG-54952 Change-Id: I14fe95608c4393b928edc80fc93ebaa843ce478f Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* texteditor: replace setFileUrl() with load()J-P Nurmi2016-08-121-18/+2
| | | | | | | | 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>
* texteditor: add fileName & fileTypeJ-P Nurmi2016-08-121-15/+16
| | | | | | | | | '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>
* texteditor: cosmetic cleanupJ-P Nurmi2016-08-121-2/+1
| | | | | Change-Id: Id1d5f0f8c1e7851ea33241fa09af5c0029b74db3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* texteditor: fix, unify and cleanup the settersJ-P Nurmi2016-08-121-9/+1
| | | | | | | | | - 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>
* texteditor: remove uninitialized/duplicate pointer memberJ-P Nurmi2016-08-121-17/+22
| | | | | | | | 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>
* texteditor: re-order the property accessorsJ-P Nurmi2016-08-121-152/+166
| | | | | | | | | | 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>
* texteditor: simplify saveAs() - let FileDialog handle the suffixJ-P Nurmi2016-08-121-23/+9
| | | | | Change-Id: Id1b415ebcbe12a9eeff9b54dcfa2cec67054a8d6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add Text Editor exampleMitch Curtis2016-08-111-0/+381
A follow up commit will contain the touch UI. Change-Id: I26275fdd31294506821fa3e3e4a4bb63329665b9 Task-number: QTBUG-54952 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>