summaryrefslogtreecommitdiffstats
path: root/src/widgets/accessible/qaccessiblewidgets.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add feature.abstractbuttonStephan Binner2017-03-131-1/+0
| | | | | Change-Id: Ie93c6d0a8256bc466d3419408b753d5f3738aa6b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add feature.dialogbuttonboxStephan Binner2017-03-061-2/+4
| | | | | | Change-Id: I8c136024c3bf431529033a806be646d867919daa Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build with -no-feature-menuPaul Olav Tvete2017-01-251-0/+2
| | | | | Change-Id: I8f9d5ef6b7f7102e56816677f1d3a5b5144b7083 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use QString::fromLatin1() less to avoid string allocationsAnton Kudryavtsev2016-09-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | QString::fromLatin1 always allocates memory, but there are cases where we can avoid/reduce allocations or/and reduce text size, e.g.: QStringBuilder expressions Fix: replace QString::fromLatin1 with QL1S QString::fromLatin1().arg(String) pattern Fix: replace with QStringBuilder Overloaded functions with QL1S arg Fix: replace QString::fromLatin1 with QL1S In rare cases if there is no overloaded function with QL1S and we have deal with string literal, replace QString::fromLatin1 with QStringLiteral. Change-Id: Iabe1a3cc0830f40ef78a0548afa4368583c31def Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Use QStringLiteral more judiciouslyAnton Kudryavtsev2016-07-081-6/+6
| | | | | | | | | | | | | | | Replace it with QL1S in QStringBuilder expressions and in overloaded functions. Replace patterns 'QString::number() + QStringLiteral' and 'QStringLiteral + QString::number()' with QString::asprintf. Saves some text size. Change-Id: Ib39b2332264dfc3df04e77f2c101b47a1030cef4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Don't re-evaluate QTextCharFormat::font() all the time in ↵Marc Mutz2015-12-211-5/+7
| | | | | | | | | | QAccessibleTextWidget::attributes() Saves ~100b in text size. Change-Id: I144b8c1d02ce8a24f1654d54abad90ba1054be9a Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Boris Dušek <me@dusek.me>
* Remove a use of a QMap in QAccessibleTextWidget::attributes()Marc Mutz2015-12-211-7/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QMap<QByteArray, QString> was only used to hold key/value pairs until they were serialized into a QString at the end of the function. Serialize into QString directly instead, dropping the temporary QMap. The problem is that we'd like to keep the line formatting central while at the same time harnessing the power of QStringBuilder. This is possible with a templated function with an input/output parameter: format_attr(QString &result, const char *key, T &&value) format_attr(result, text-foo, str + str2 + str3); Or with return type deduction: formatted(const char *key, T &&value) -> decltype((expr)) { return expr; } result += formatted(text-foo, str + str2 + str3); I don't like out parameters, and we can't rely on auto return type deduction, yet, so I opted for a miniature expression template solution that can only match the expression attr[key] = value; where 'key' is a const char* and 'value' can be anything that QStringBuilder supports. This allows to keep the syntax of a map while at the same time serializing to QString immediately. The only behavioral difference to the old code is that the attributes are no longer sorted, but order doesn't matter. Saves more than 10KiB in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: I7b3bec0466ef24156c693adaa95f0316007e0bfe Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QtWidgets: replace some index-based for loops with C++11 range-forMarc Mutz2015-12-161-6/+4
| | | | | | | | | | | | | | | | | | | | This needs to be handled a bit carefully, because Qt containers will detach upon being iteratoed over using range-for. In the cases of this patch, that cannot happen, because all containers are marked as const (either by this patch or before). Separate patches will deal with other situations. Apart from being more readable, range-for loops are also the most efficient for loop. This patch shaves almost 2K of text size off an optimized Linux AMD64 GCC 4.9 build. Change-Id: I53810c7b25420b4fd449d20c90c07503c5e76a66 Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QtWidgets: use Q_UNLIKELY for every qWarning() (2)Marc Mutz2015-11-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If, after checking a condition, we issue a qWarning(), by definition that check is unlikely to be true. Tell the compiler so it can move the error handling code out of the normal code path to increase the effective icache size. This change contains the changes to the accessible/, effects/, kernel/, styles/ and itemviews/ subdirs. Moved conditional code around where possible so that we could always use Q_UNLIKELY, instead of having to revert to Q_LIKELY here and there. In QWidgetPrivate::setWindowModified_helper(), as a drive-by, I swapped the evaluation order of an &&-expression (newly wrapped in Q_UNLIKELY) to be more readable and more efficient (cheaper check first) at the same time. In qDraw* (qdrawutil.cpp), simplified boolean expressions (sometimes by skipping re-checking conditions already checked in a previous guard clause). Change-Id: I58be22be0a33522c2629a66c2f6c795771a99f3f Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2015-10-021-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/tools/qstring.h src/gui/image/qimagereader.cpp src/network/access/qnetworkaccessmanager.cpp src/tools/qdoc/doc/examples/examples.qdoc src/widgets/accessible/qaccessiblewidgetfactory_p.h src/widgets/doc/qtwidgets.qdocconf Change-Id: I8fae62283aebefe24e5ca4b4abd97386560c0fcb
| * Do not install headers for private classesFrederik Gladhorn2015-09-071-1/+1
| | | | | | | | | | | | | | | | | | | | When merging the accessibility plugin into the widgets library, the headers were just moved. They should have gotten the _p at that time. Task-number: QTBUG-47569 Change-Id: I0a2290dae3a8187596e9d7541ccf69beeb603296 Reviewed-by: Dimitar Dobrev Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Fix QAccessibleTextWidget::characterRect for off-cursor positionsBoris Dušek2015-03-251-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current code retrieved the character format at position where the cursor currently was, irrespective of the position actually passed to the characterRect function. This is now fixed and we retrieve the character format for the QTextFragment containing the specified offset. This fixes display of visual bounds around text by screen reader in some cases. E.g. on OS X, when searching text using VoiceOver, VoiceOver first queries the visual bounds of the found text (and thus also characterRect), and only then it moves cursor position to the found text. If before the change of position the cursor was on some text with different metrics (i.e. a bigger font), the visual bounds for the found text reflected those metrics, not the metrics of the actual found text for which the bounds were drawn. This resulted in smaller/bigger rectangles around the found text than was actually correct. Change-Id: Ie2a4dfc714504b7923cdaf8ff875c438aeccddee Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
| * Fix QAccessibleTextWidget::characterRect for complex linesBoris Dušek2015-03-251-1/+1
| | | | | | | | | | | | | | | | | | | | Current implementation of QAccessibleTextWidget::characterRect returned rect with correct vertical position only when the font point size did not vary inside the line. This commit makes it work for lines where point size changes by taking text ascent and descent into account. Change-Id: I4ee43701a30ce9bff1db2f2d0422227496c3df4c Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
| * Support all underline types in accessibilityBoris Dušek2015-03-251-1/+36
| | | | | | | | | | Change-Id: I9eccc66624f5d789cc8778d4376338207beb4a14 Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
* | Support "writing-mode" accessibility text attributeBoris Dušek2015-03-051-0/+3
| | | | | | | | | | Change-Id: Ib682b6f7828cfd42050bcb9c846fd8aeb7fdd05f Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
* | Fix QAccessibleTextWidget::characterRect for off-cursor positionsBoris Dušek2015-03-051-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current code retrieved the character format at position where the cursor currently was, irrespective of the position actually passed to the characterRect function. This is now fixed and we retrieve the character format for the QTextFragment containing the specified offset. This fixes display of visual bounds around text by screen reader in some cases. E.g. on OS X, when searching text using VoiceOver, VoiceOver first queries the visual bounds of the found text (and thus also characterRect), and only then it moves cursor position to the found text. If before the change of position the cursor was on some text with different metrics (i.e. a bigger font), the visual bounds for the found text reflected those metrics, not the metrics of the actual found text for which the bounds were drawn. This resulted in smaller/bigger rectangles around the found text than was actually correct. Change-Id: If23b4b8492ec77f0f073fc5c25628b67b483724e Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
* | Fix QAccessibleTextWidget::characterRect for complex linesBoris Dušek2015-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | Current implementation of QAccessibleTextWidget::characterRect returned rect with correct vertical position only when the font point size did not vary inside the line. This commit makes it work for lines where point size changes by taking text ascent and descent into account. Change-Id: I9684b4872566ddfa86dc7a2e9c803a1be0138000 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.5' into devFrederik Gladhorn2015-02-251-8/+20
|\| | | | | | | Change-Id: Ie709286a14b452dae7abb59830f584bb33f1ccf5
| * Merge remote-tracking branch 'origin/5.4' into 5.5Frederik Gladhorn2015-02-241-8/+20
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/xml/htmlinfo/simpleexample.html examples/xml/rsslisting/rsslisting.cpp qmake/generators/win32/msbuild_objectmodel.cpp src/3rdparty/harfbuzz-ng/src/hb-private.hh src/corelib/global/qlogging.cpp src/corelib/io/qstorageinfo_unix.cpp src/corelib/thread/qwaitcondition_unix.cpp src/gui/kernel/qguiapplication.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp src/testlib/doc/src/qt-webpages.qdoc tests/auto/other/qaccessibility/tst_qaccessibility.cpp Change-Id: Ib272ff0bc30a1a5d51275eb3cd2f201dc82c11ff
| | * Fix crash in QAccessibleTextWidget::attributes()Jan Arve Saether2015-02-171-8/+20
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-44006 Change-Id: I79d7d84206a3e4abcd49c7c6e5e91b7c9c753dd6 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
* | | Support all underline types in accessibilityBoris Dušek2015-02-251-1/+36
|/ / | | | | | | | | Change-Id: I74684167eef13d407e94d3b9668077fe61553672 Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
* | Make QAccessibleTextWidget::attributes respect default document fontBoris Dušek2015-02-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | QTextFormat::font{Weight,PointSize}() etc. return the font trait explicitly set on the QTextFormat, while QTextFormat::font() returns font which also uses the QTextDocument::defaultFont() as a default for any font traits not explicitly set on the QTextFormat. Accessibility support for text attributes used the former, which was wrong; this commit fixes it to use the latter. Also includes tests to verify the fix. Change-Id: Iab7f2be1b68adaad847d1f29c9e5af2195416035 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
* | Fix text-align justify in accessibility supportBoris Dušek2015-02-131-1/+1
| | | | | | | | | | Change-Id: If43be193d64d7df29eb3f89b6c528ee1e8de310f Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
* | Update copyright headersJani Heikkinen2015-02-111-7/+7
|/ | | | | | | | | | | | | | | | | | 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-241-18/+10
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Improve accelerator stripping in accessible widgetsFrederik Gladhorn2014-09-041-0/+3
| | | | | | | | | | | When we strip the & we should also report the hotkey. In addition only strip labels when they are buddys and try not to remove ampersands from all kinds of random text. This fixes https://bugs.kde.org/show_bug.cgi?id=338282 Change-Id: I401281cd9ff43b23a3923ad9909ca9c469b59506 Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
* Accessibility: Top level widgets should only be in the hierarchy onceFrederik Gladhorn2014-07-301-6/+6
| | | | | | | | | On Linux for example Orca gets confused when showing a dialog that is a child of another widget since it would show up twice in the hierarchy. Task-number: QTBUG-39444 Change-Id: I84773ecc3d6774a652dbeb29ad201779f5b3191c Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
* Update copyright to 2014 for accessibilityFrederik Gladhorn2014-07-041-1/+1
| | | | | Change-Id: I4210456122bf8a6d3730f017f3ce6dd1a1bcb3f5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Accessibility: improve text attribute rangesFrederik Gladhorn2014-06-261-33/+30
| | | | | | | | | Improve consistency and use QTextDocument functions to find ranges instead of coming up with our own scheme. This is important since QCursor's char format depends on block positions. Change-Id: I94eb137882dc6b5f7b01fa7693b4a536cc48d02a Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
* Accessibility: Fix select state usageFrederik Gladhorn2014-05-311-0/+1
| | | | | | | | | | The selectable/selected states refer to items in a list and similar, do not interpret them as text selection states. Without this change NVDA for example announces text edits as selected which makes no sense and which it doesn't do for native text items. Change-Id: Ib1d109523bd4cc2b9b40ace8a8c3d7d3a7f9f25c Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
* Fix warnings produced by QT_ASCII_CAST_WARNINGS in widgets/accessibleJan Arve Saether2014-04-021-21/+21
| | | | | | Change-Id: Ibd468f6f7b4f8b5c4776655d33f27989bafa9b58 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-03-241-1/+5
| | | | | | | Conflicts: src/gui/image/qjpeghandler.cpp Change-Id: I9db3acea7d5c82f5da679c8eaeb29431136665f0
* Accessibility: Use factory function instead of pluginFrederik Gladhorn2014-03-131-0/+1019
This simplifies deployment and makes instantiating accessible interfaces faster since no plugin needs to be loaded. [ChangeLog][QtWidgets] Accessibility for widgets is now included in the widget library instead of being a separate plugin. For static builds this means that libqtaccessiblewidgets is no longer required. Task-number: QTBUG-32888 Change-Id: Ie7347898868fd67c1fc568f0d251cbd2ef71e041 Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>