summaryrefslogtreecommitdiffstats
path: root/examples/widgets/richtext
Commit message (Collapse)AuthorAgeFilesLines
* Markdown importer: use Unicode decodingGiuseppe D'Angelo2020-02-031-4/+4
| | | | | | | | | | | | | | | Given we feed UTF-8 data into the importer, it must be able to cope with Unicode. Build md4c with UTF-8 support, advertise it at usage site, and change a couple of broken decodings. Driveby: the textedit example used the wrong codec to decode a Markdown file. While the Markdown spec doesn't deal with encodings, using the default one for HTML is certainly wrong. Port the loading of both markdown and plaintext to UTF-8, as that what _saving_ via QTextDocumentWriter would use by default. Change-Id: I51c6214cfe45ebfc5a67a7366f7866a5328366ec Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Examples: fix compile without printsupportChristian Ehrlicher2020-01-312-2/+2
| | | | | | | | | | | Checking for QT_CONFIG(printdialog) is not enough when printsupport is completely disabled since then the macro will throw an error. Therefore add an additional check 'defined(QT_PRINTSUPPORT_LIB)' before using the QT_CONFIG macro. Fixes: QTBUG-81626 Change-Id: Ie9898f057cdd6bf9daf4ba9135987cb6e901e7bf Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Prepare for deprecating the QDesktopWidgetSona Kurazyan2019-10-151-2/+2
| | | | | | | | | | | | | | QDesktopWidget is marked as obsolete in docs, but it is not yet completely deprecated, some of its methods are still in use. Replace uses of the following methods marked as obsolete: - QDesktopWidget::screenNumber(QWidget*) -> QWidget::screen() - QDesktopWidget::screenGeometry(QWidget*) -> QWidget::screen()->geometry() - QDesktopWidget::availableGeometry(QWidget*) -> QWidget::screen()->availableGeometry() Task-number: QTBUG-76491 Change-Id: I2cca30f2b4caa6e6848e8190e09f959d2c272f33 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Make QTextBlockFormat::MarkerType an enum classShawn Rutledge2019-10-101-6/+6
| | | | | | | This came up during API review. Change-Id: I9198e1eb96db0c21e46a226a032919bb62d3ca66 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Fix heading level in style combobox in TextEdit exampleShawn Rutledge2019-05-061-2/+2
| | | | | | | | | | | | Amends 0df30ff22e50aa301791fc72f106ab15ce385a6a: when adding the checked and unchecked styles to the combobox, it changed the offsets for the heading styles; so the combobox stopped changing to the correct index when clicking on a heading, and also changed the heading two sizes smaller than it should when attempting to select a different heading level. Change-Id: Ib3f61987c786e34f32a81bf7b3ebc5ca730f40df Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* TextEdit example: add indent/unindent featureShawn Rutledge2019-05-067-0/+55
| | | | | | | | | | | It was not possible to interactively create the example text without this feature; and in general it's necessary to work with nested lists. But currently it does not deal with all possible changes of list nesting, because the API seems incomplete for that purpose. Task-number: QTBUG-75589 Change-Id: I3e29ca15a2e7c37300a0103ceb90670716472ffb Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Add task list checkbox manipulation features to the TextEdit exampleShawn Rutledge2019-05-027-9/+61
| | | | | Change-Id: I5f0b8cb94d1af609ec531f9765d58be65b1129a3 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Render markdown task lists (checkboxes instead of bullets) in QTextEditShawn Rutledge2019-05-021-0/+6
| | | | | | | | | Checkboxes are right-aligned with any bullets that are in the same QTextList so that there is enough space to make them larger than bullets. But hopefully mixing bullets and checkboxes will be a rarely-used feature. Change-Id: I28e274d1f7883aa093df29eb4988e99641e87a71 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* TextEdit example: add Markdown as a supported formatShawn Rutledge2019-05-022-4/+125
| | | | | | | | Also use QT_CONFIG to disable features gracefully if Qt is configured without them. Change-Id: I38e92bf5fd70f77fc4d5158769d590619be8905f Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Examples: replace deprecated QComboBox functionsChristian Ehrlicher2019-03-041-2/+2
| | | | | | | | | Replace the deprecated currentIndexChanged(QString) and activated(QString) with the new currentTextChanged() and textActivated() functions Change-Id: I8616354fa06cc63dce6f5cfef0902f4b55981043 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Cleanup Widgets examples - foreachChristian Ehrlicher2019-01-233-22/+23
| | | | | | | | | Cleanup the Widgets examples - replace foreach with range-based for loop in the remaining directories Change-Id: I321e6c0f414401a1ae4fb65762b97d894b725afa Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
* Cleanup Widgets examples - new signal/slot syntaxChristian Ehrlicher2019-01-063-10/+15
| | | | | | | | | Cleanup the Widget examples - use the new signal/slot syntax where possible - painting and richtext subdirectory Change-Id: If0e365ab1cabf9184076595494cfca151406fddf Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12Liang Qi2018-11-093-0/+0
|\ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf qmake/Makefile.unix src/gui/text/qtextdocument.cpp src/gui/text/qtextdocument.h Change-Id: Iba26da0ecbf2aa4ff4b956391cfb373f977f88c9
| * Update the floppy disk icon (save) to be physically correctThiago Macieira2018-11-063-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][Documentation] Fixed the icons for the "file save" action that were inaccurate representations of a 3.5-inch floppy disk (the cut edge was on the wrong side). Now all floppy representations are physically accurate. Change-Id: Ia3b27ae12a1a4fefa3b7fffd155bb86fee5271c3 Fixes: QTBUG-71012 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Make the textedit example use dark text on light background on macOSMorten Johan Sørvig2018-09-251-0/+8
| | | | | | | | | | | | | | | | | | Many text documents will be designed for a white-paper look, and in these cases it is desirable that the editor colors matches. Change-Id: I66d721f8c2e27b78a2b885c6cfd74f897fe42389 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-05-242-4/+4
|\| | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/qt_common.prf src/corelib/tools/qstring.cpp src/plugins/platforms/windows/qwindowsmousehandler.cpp src/widgets/widgets/qmainwindowlayout_p.h Change-Id: I5df613008f6336f69b257d08e49a133d033a9d65
| * Doc: Update connect syntax Order Form ExampleNico Vertriest2018-05-162-4/+4
| | | | | | | | | | | | | | Task-number: QTBUG-60635 Change-Id: Ia474a23db7c32e68cb23ffa6ec14b9c6376cadec Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* | textedit example: Fix disabled Cut/Copy menu itemsGabriel de Dietrich2018-04-101-0/+2
| | | | | | | | | | | | | | This amends commit fe1ea010b946518803ca1cec1332945c26be83af. Change-Id: Ia1f9fa4a6dd4481b5295df986f882f1120c3d8b0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Examples: replace QDate::longMonthName()/longDayName()Christian Ehrlicher2018-03-271-3/+3
| | | | | | | | | | | | | | | | QDate::longMonthName()/longDayName was deprecated in 5.10 and replaced by QLocale::system().monthName()/dayName() in this case Change-Id: I666cccfa1b8a437cc830804bbe3504511265ea9b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | preserve HTML heading level in QTextBlockFormat; demonstrate in exampleShawn Rutledge2018-03-022-49/+95
|/ | | | | | | | | | | | | | | | | | When reading an HTML file with <H1> for example, we still set the font size as before (that's how it always was done), but now it remembers that it came from an H1 tag, so it writes <h1 ...><span font-size:xx-large ...> ... rather than <p ...><span ...> ... This will help with the upcoming Markdown format, where heading level is saved but the font is not. Now the style combobox in examples/widgets/richtext/textedit can set list item type, heading type or "standard" formatting, and also shows the current formatting of the line that has the cursor. It was always a shortcoming in this example that it only allowed setting the current line's block format but had no feedback to show the current format. Change-Id: I0a7849b74f23fea84d3375c487c3a6b9f43240c1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* qtlite: Skip building examples when configured with no-feature-itemviewsRainer Keller2018-01-124-0/+4
| | | | | | | | | Compiling the default examples should be possible without compile errors. Task-number: QTBUG-53141 Change-Id: I73d8787241291ae6230861a89b38e91d900fede0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Convert features.printdialog to QT_[REQUIRE_]CONFIGStephan Binner2017-05-302-5/+15
| | | | | Change-Id: Ifb016ae2a0986b436f788b34513c81ea91f3804a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Doc: updated QSyntaxHighlighter documentation and use QRegularExpressionSamuel Gaist2017-04-122-22/+22
| | | | | | | | | The documentation of QSyntaxHighlighter still uses the deprecated QRegExp class. This patch updates the code samples as well as cleanup some typos. Change-Id: I87b525fddb560b7c5bb38f96d9aaceadb594f76c Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
* examples: Use QOverload to select overloaded signals and slotsAlexander Volkov2016-12-221-5/+3
| | | | | | | | | | | We can use QOverload since Qt 5.7 (it depends on Q_COMPILER_VARIADIC_TEMPLATES which is required since Qt 5.7). Use it in the examples to show the best practice. qOverload currently can't be used because it requires c++14. Change-Id: I94a3c0db9d551fe169fa3d19c07ec0b329d5946c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Examples: Remove a redundant virtual specifier for overridersAlexander Volkov2016-11-251-1/+1
| | | | | | | | It's a good practice to use override without virtual: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rh-override Change-Id: I5c2d73600e6c706424589c0487133c03a4ef3629 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Examples: Replace 'Q_DECL_OVERRIDE' by 'override'hjk2016-06-152-2/+2
| | | | | | | | Examples should demonstrate best practice, and we can use the keyword directly nowadays. Change-Id: I1f122e5caceca17290757ffbaf3d660e7daa9ae4 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* QtWidgets: Remove Windows CE.Friedemann Kleint2016-04-071-7/+0
| | | | | | | | | Remove Windows CE-specific files, #ifdef sections for Q_OS_WINCE and wince .pro file clauses in library, examples and tests. Task-number: QTBUG-51673 Change-Id: I102745aaca9d9737f2108fe7618111743d5ae980 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Unify license header usage.Jani Heikkinen2016-03-2914-44/+174
| | | | | | | | | Update files using old header.LGPL3 to header.LGPL Update files using old FDL template to use new one Update files using old BSD template to use new one Change-Id: I36a78272516f9953d02956522f285b40adfc8915 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-213-48/+99
| | | | | | | | | | | | From Qt 5.7 -> examples are lisenced under BSD license, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new BSD header instead of LGPL21 one (in those files which will be under BSD) Change-Id: I3ad61caaf07802eb9da7d29eca3fe49d8a51b6a8 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* TextEdit example: fix build when clipboard is disabled.Rafael Roquetto2015-10-192-2/+4
| | | | | Change-Id: Ib25563e3dc299dc2d23bed8b3071af1ba81150e7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Polish rich text example.Friedemann Kleint2015-08-313-221/+196
| | | | | | | | | | | | | - Introduce Qt 5 signals & slot syntax. - Use mime types in the file dialogs. - Streamline the code creating the actions. - Introduce QCommandLineParser. - Query the available size when determining the initial size instead of using hard-coded values for High-DPI screens. Change-Id: Ifc84a41ed55a4a674b6eafdb6120ac42441405b6 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-07-011-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qglobal.h src/corelib/global/qsysinfo.h src/corelib/global/qsystemdetection.h src/corelib/kernel/qobjectdefs.h src/plugins/plugins.pro tests/auto/widgets/itemviews/qlistview/qlistview.pro Change-Id: Ib55aa79d707c4c1453fb9d697f6cf92211ed665c
| * fix usage of wince scopeOswald Buddenhagen2015-06-051-1/+1
| | | | | | | | | | | | | | Fix style issues along the way. Change-Id: Ic6a6de28e198eb0b14c198b802e78845703909b9 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
* | use INSTALLS instead of DEPLOYMENTJoerg Bornemann2015-06-031-1/+1
|/ | | | | | | The DEPLOYMENT variable has been deprecated. Change-Id: I1c7c07b36a2e665ae302e4f43f7f2dc752f3c1f4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Updated BSD licensed file headersJani Heikkinen2015-02-1513-39/+39
| | | | | Change-Id: I6441ff931dbd33b698d762e6f6784898f3f60fe7 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-1117-92/+92
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-243-57/+33
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Changed font-family to Times New RomanTomi Korpipää2014-09-191-1/+1
| | | | | | Task-number: QTBUG-40839 Change-Id: I3be6de829b6f26b26e7ec654ccb117bdb58cdf41 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-08-121-0/+3
|\ | | | | | | | | | | | | | | | | | | | | | | Manually included changes from 3a347a4e70e5a10ee92dd2578316c926a399e894 in src/opengl/qgl.cpp. Conflicts: src/opengl/qgl_qpa.cpp src/plugins/platforms/android/androidjnimain.cpp Change-Id: Ic26b58ee587d4884c9d0fba45c5a94b5a45ee929
| * Font Database: Add support for private, system UI font familiesGabriel de Dietrich2014-08-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We introduce QPlatformFontDatabase::isPrivateFontFamily() to allow testing for private, system UI font families. Both QFontComboBox and QFontDialog need to filter out those private font families which, by definition, should be hidden from the end user. (The textedit example had to be updated to fix the issue where the default font would be private. In 5.4, we will be adding an equivalent, public API in QFontDatabase, and a better solution for the textedit example and QTexEdit in general). In particular, on OS X and iOS, private fonts are used for the system UI font. Those have their font family name prefixed by a dot. QCoreTextFontDatabase knows about this, and makes sure those are tested positive as private font families. In order to have a cleaner layer separation, we moved the QPA theme font resolution from the platform theme classes into QCoreTextFontDatabase for both Cocoa and iOS QPA plugins. In both cases, we use CoreText's CTFontCreateUIFontForLanguage(), that nicely maps to the HITheme API we were using so far on Mac. That means one HITheme dependency less. We also cache the font descriptors we get for these font for each time QCTFD::populateFamilies() gets called. (While not common, this currently happens in auto-tests, like tst_QFontDatabase, and could happen in actual applications -- specially when adding and removing application fonts.) Change-Id: Ic6f0b60f9f597afee1a43596a669742dc546b97f Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* | Examples: Add Q_DECL_OVERRIDE to overridden functionsOlivier Goffart2014-07-152-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Q_DECL_OVERRIDE (which expands to 'override' for supported compiler) helps to declare the intent (that it is an overridden function) and force compilation error when there is no such virtual function in the base class. The examples should show the best practice of having it, as it may save the programmer quite some time in case of change of API or typo in the function name or arguments. This change was done automatically with clang-modernize -add-override -override-macros And fixed MSVC compilation by removing inline for TorrentViewDelegate::paint Change-Id: Ice66ae93fae571266f908703d5b8892b2c1ebb1a Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | Use the new unified toolbar implementation in examples on OS X.Jake Petroules2014-05-121-0/+4
|/ | | | | Change-Id: Ica3476d16a4baab1f75e253eb406505f88018d47 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* expand tabs and related whitespace fixes in *.{cpp,h,qdoc}Oswald Buddenhagen2014-01-131-1/+1
| | | | | | | | the diff -w for this commit is empty. Started-by: Thiago Macieira <thiago.macieira@intel.com> Change-Id: I77bb84e71c63ce75e0709e5b94bee18e3ce6ab9e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Do not attempt to save a file in the resourcesGiuseppe D'Angelo2013-08-271-2/+3
| | | | | | | | | | A wrong code path caused the textedit example to attempting to try to save the file it was currently editing even if it was loaded from the resource system. Task-number: QTBUG-33105 Change-Id: I9e03168968a98a421e8ab93a8d06f808b72ac3b0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Whitespace cleanup: remove trailing whitespaceAxel Waggershauser2013-03-162-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Remove all trailing whitespace from the following list of files: *.cpp *.h *.conf *.qdoc *.pro *.pri *.mm *.rc *.pl *.qps *.xpm *.txt *README excluding 3rdparty, test-data and auto generated code. Note A): the only non 3rdparty c++-files that still have trailing whitespace after this change are: * src/corelib/codecs/cp949codetbl_p.h * src/corelib/codecs/qjpunicode.cpp * src/corelib/codecs/qbig5codec.cpp * src/corelib/xml/qxmlstream_p.h * src/tools/qdoc/qmlparser/qqmljsgrammar.cpp * src/tools/uic/ui4.cpp * tests/auto/other/qtokenautomaton/tokenizers/* * tests/benchmarks/corelib/tools/qstring/data.cpp * util/lexgen/tokenizer.cpp Note B): in about 30 files some overlapping 'leading tab' and 'TAB character in non-leading whitespace' issues have been fixed to make the sanity bot happy. Plus some general ws-fixes here and there as asked for during review. Change-Id: Ia713113c34d82442d6ce4d93d8b1cf545075d11d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Compile fix when QT_NO_PRINTDIALOG is definedPaul Olav Tvete2013-02-262-3/+3
| | | | | | | ...but QT_NO_PRINTER isn't. Change-Id: I888c177cfdd2245eb55de766dfd93f6acd4293e9 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-1817-17/+17
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* add and use qtHaveModule() functionOswald Buddenhagen2012-12-212-2/+2
| | | | | | | | | | | this is much more elegant than the so far propagated !isEmpty(QT.foo.name). also replace feature-specific tests (no-gui and no-widgets) and the obsolete contains(QT_CONFIG, foo) syntax. Change-Id: Ia4b3c8febcabf9eeca67b1f9173a523820b1038b Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com> Reviewed-by: Tasuku Suzuki <stasuku@gmail.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* clean up example project files, mostly wrt QT+=widgetsOswald Buddenhagen2012-12-174-10/+10
| | | | | | | | | move QT+=widgets (and printsupport) statements before the install statements, and de-duplicate some cases. also move some TARGET assignments to a more conventional place. Change-Id: I6140d8611680f66c24490e5894e4eb90cae95635 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* remove some unnecessary CONFIG additionsOswald Buddenhagen2012-12-171-2/+0
| | | | | | | | qt is already added by spec_pre.prf, warn_on and depend_includepath by default_pre.prf. Change-Id: Ic00e0ba496d698ed9659c476f2ca99fc0f86a093 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>