summaryrefslogtreecommitdiffstats
path: root/src/widgets/accessible
Commit message (Collapse)AuthorAgeFilesLines
* 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-163-16/+12
| | | | | | | | | | | | | | | | | | | | 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-253-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0214-19/+85
|\ | | | | | | | | | | | | | | | | | | | | | | | | 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-0715-19/+96
| | | | | | | | | | | | | | | | | | | | 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>
* | Fix missing "We mean it" in qtbase private headersThiago Macieira2015-10-011-0/+11
| | | | | | | | | | Change-Id: I42e7ef1a481840699a8dffff1408dfd4fd9c8e32 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Fix inefficient code foreaching on container.values()Sérgio Martins2015-07-082-3/+3
| | | | | | | | | | | | | | Saves one full iteration and memory allocation. Change-Id: Ice527499b5f5f62bd1e47d76fdf40119948ee3a1 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QtWidgets: Use Q_NULLPTR instead of 0 in all public headersMarc Mutz2015-07-061-7/+7
| | | | | | | | | | | | | | | | | | This is in preparation of adding -Wzero-as-null-pointer-constant (or similar) to the headers check. Task-number: QTBUG-45291 Change-Id: Ie67d235151ca8d4ef5e721c9cf4a6fd32bd167a0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* | widgets: Use QList::reserve(), reduces reallocations.Sérgio Martins2015-06-231-5/+11
| | | | | | | | | | Change-Id: I49cc03f365c77f142f62c8e77505ec09723a44d9 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Fix crash during autotest execution on Mac OS XLars Knoll2015-06-021-0/+3
| | | | | | | | | | Change-Id: Ib9cd6791a7b48a0cde9e6d991b2d7f6fb4020819 Reviewed-by: Simon Hausmann <simon.hausmann@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-1116-112/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Add Q_DECL_OVERRIDE in the src subdirectoryOlivier Goffart2014-12-032-18/+18
|/ | | | | | | | | | Done automatically with clang-modernize on linux (But does not add Q_DECL_OVERRIDE to the function that are marked as inline because it a compilation error with MSVC2010) Change-Id: I2196ee26e3e6fe20816834ecea5ea389eeab3171 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Compile fix for QT_NO_TEXTHTMLPARSER in QtWidgetsJulien Brianceau2014-11-111-0/+2
| | | | | Change-Id: If67c851cf45ca53ac4af56d4dc36db24ea896ba1 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Removing a few unneeded "? true : false"Alessandro Portale2014-10-091-1/+1
| | | | | | | Change-Id: Ib13f0ddd65fe78f5559f343f2fc30756b1d3ef76 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Update license headers and add new license filesMatti Paaso2014-09-2416-288/+160
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* a11y: Make QAccessibleButton and friends resolve role dynamicallyTor Arne Vestbø2014-09-203-38/+49
| | | | | | | | | The role may changed based on the checkable state of the button, eg, so we need to resolve the role at runtime instead of hard-coding it in the constructor. Change-Id: I78faee08189c5510ca9964b07ad94bcf5d4fa11b Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Improve accelerator stripping in accessible widgetsFrederik Gladhorn2014-09-043-7/+14
| | | | | | | | | | | 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: Improve line boundary helper functionsFrederik Gladhorn2014-09-041-6/+0
| | | | | | | | | These functions are supposed to make it easy for third parties (and QLineEdit) to implement the textAt/Before/AfterOffset functions. Before the functions were ignoring newlines completely and thus only somewhat useful. Change-Id: I7136b9502a7fa6f8ad9ad7236761a34c1a7fd4da Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
* Clean up QAccessibleTabBarFrederik Gladhorn2014-08-261-9/+24
| | | | | Change-Id: Ic0949e4d76a7332ef1a42c93a06a0e4515c1192d Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
* Remove QAccessibleToolButton::textFrederik Gladhorn2014-08-262-25/+0
| | | | | | | | | This function actually is worse than just calling QAccessibleButton::text which it already does. It would mess up the shortcut handling in addition to that. Change-Id: I56cb95a44624da4c5fccb43e6835f6012a083337 Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
* Remove unused variableFrederik Gladhorn2014-08-261-1/+0
| | | | | Change-Id: I0414d7bab89371f330d5b0cfa88758e3f1668f32 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Accessibility: QSpinBox should not have any childrenFrederik Gladhorn2014-08-195-5/+160
| | | | | | | | | | On both iOS and Android it is very confusing to be able to move the focus to both, the line edit and the outer frame that is the spin box. For Linux this fixes an issue that orca would not read the value correctly after pressing the up/down buttons. Task-number: QTBUG-39861 Task-number: QTBUG-39442 Change-Id: I73c50c91e9021324c52d168d537afd0ea719a48f Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
* Accessibility: Fix boundaries for text functions in QLineEditFrederik Gladhorn2014-08-131-0/+12
| | | | | | | | | | Make the functions work consistently. For example asking for the line at the cursor position when the cursor was at the end returned an empty line before. Task-number: QTBUG-38500 Change-Id: I60fc78c7be129a59c83efcfce6d8fdd16f2c3f65 Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
* Accessibility: Top level widgets should only be in the hierarchy onceFrederik Gladhorn2014-07-303-16/+12
| | | | | | | | | 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>
* Accessibility: Improve handling current valueFrederik Gladhorn2014-07-071-9/+1
| | | | | | | | | Value interfaces on OS X and iOS can be strings, so can the value property of MSAA. Before we'd always only send doubles, instead change it to use strings as well. Change-Id: I1b4410c68238ba7a69a5507d87c251f2ac61c568 Reviewed-by: Caroline Chao <caroline.chao@digia.com>
* Update copyright to 2014 for accessibilityFrederik Gladhorn2014-07-0416-16/+16
| | | | | Change-Id: I4210456122bf8a6d3730f017f3ce6dd1a1bcb3f5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Accessibility: Password QLineEdit should use * as text replacementFrederik Gladhorn2014-07-011-0/+2
| | | | | Change-Id: Ie07e86f1b6dff3096cab462f918994efa07b2a87 Reviewed-by: Caroline Chao <caroline.chao@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-312-3/+2
| | | | | | | | | | 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>
* Accessibility: Fix rect for QComboBox and QRadioButtonFrederik Gladhorn2014-05-302-0/+21
| | | | | | | | | This is especially relevant on mobile devices where screen readers often send mouse clicks to the middle of the object. Task-number: QTBUG-39100 Change-Id: I5972f21dd12434601d86136215ab9b61248c9691 Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-05-131-4/+0
|\ | | | | | | | | | | | | Manually changed enum to LibGL in src/plugins/platforms/xcb/qglxintegration.cpp Change-Id: If34ee6cce3d1d51fb4bb1fdfa59c30389ea0d207
* \ Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵Frederik Gladhorn2014-05-081-3/+3
|\ \ | | | | | | | | | refs/staging/dev
| * | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-05-061-3/+3
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/qnx-x86-qcc/qplatformdefs.h src/corelib/global/qglobal.h src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp src/opengl/qgl.cpp src/opengl/qglpixelbuffer.cpp src/opengl/qglshaderprogram.cpp tests/auto/opengl/qglthreads/tst_qglthreads.cpp Change-Id: Iaba137884d3526a139000ca26fee02bb27b5cdb5
* | | Don't repeat Tab names in the QTabBarJan Arve Saether2014-05-081-1/+11
|/ / | | | | | | | | | | Task-number: QTBUG-38503 Change-Id: I1f7e599b46526a8c4b8e0f3534be9c717727a4aa Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-04-111-0/+1
|\| | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/qnx-armv7le-qcc/qplatformdefs.h src/printsupport/kernel/qcups.cpp src/widgets/styles/qstyle.h tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp Change-Id: Ia41e13051169a6d4a8a1267548e7d47b859bb267
* | Remove some unused forward declarations.Jan Arve Saether2014-04-082-9/+0
| | | | | | | | | | | | Change-Id: I7816635ec37f3a70d23f0ab5aaf6c53481dbdbf9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@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>