aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextinput.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Doc: QQuickTextInput: Mark all readonly properties as suchIvan Tkachenko2022-06-021-3/+20
| | | | | | | Change-Id: I5fa12286ac594bafff89a56358bdda4051733e05 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit cb2cccd5578ffcfcbf6793c0a445022a6fd4a8ae) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Docs: Document textInput.acceptableInput as read onlyNicholas Bennett2022-05-071-0/+1
| | | | | | | | | | Added \readonly to the qml property comment. Fixes: QTBUG-103224 Change-Id: I42ddad6501700c586fe4154cd675d881a4686f8d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit c00e9fbbf397bb155da43b2b0c18ca5e8e2697cd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Improve cursorPosition description in TextInput and TextEdit docsJaishree Vyas2022-03-291-1/+14
| | | | | | | | | | | Fixes: QTBUG-97169 Change-Id: I060be767dd980c489d8e5426d67f2e8b6d21e96c Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Ivan Tkachenko <me@ratijas.tk> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 79807f37b5e9e9744fdaf7af380fd7bfb7ed85f4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qquicktextinput: Allow adjusting selections through IMRichard Moe Gustavsen2021-11-021-5/+1
| | | | | | | | | | | | | | | | | | | | | Even if a TextInput is readOnly, it doesn't mean that Qt, or the application itself, cannot change the text. It's user input that is restricted. E.g a call to QQuickTextInput::setText() will change the text even if it's read-only. Moreover, QPA plugins (iOS) might adjust a selection in the input by letting the user drag on selection handles. And for this, IM events are also used. The QPA plugins will still need to (as before) check if the focus object has Qt::ImEnabled or Qt::ImReadOnly before changing the text. Therefore, this patch will remove the check before processing an IM event. Change-Id: Id2d9b54df3606108e3dafce34fdb2843668bd9c6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* qquicktextinput: add ImReadOnlyRichard Moe Gustavsen2021-11-021-0/+2
| | | | | | | | | | | Follow up 99f08e98be, and add ImReadOnly to qquicktextinput as well. This will let the QPA backends be more precise when aiding text selection with selection handles etc. Task-number: QTBUG-91545 Task-number: QTBUG-75556 Change-Id: I85f43554f9a97d09ce47bbe6fe09753fd2fd5478 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickTextInput: fix cursor positioning for QInputMethodEventIvan Solovev2021-10-141-1/+6
| | | | | | | | | | | On Android the cursor position was calculated incorrectly, which could results in rewriting the previously entered symbol. Change-Id: I7404979e098974d2e2cd8c91c6012cf5a52909b2 Fixes: QTBUG-94253 Pick-to: 6.2 5.15 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* qquicktextinput: fix formatGong Weia2021-09-131-2/+2
| | | | | | | add space between "){" Change-Id: Idcad221bb0643963ce44a9c1660e21b4053f225b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* qquicktextinput: fix return nullptrGong Weia2021-09-131-1/+1
| | | | | | | fix return nullptr rather than 0 Change-Id: I6e3b15685e505c1921ae0ad96c43e99c9ccee54f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* qquicktextinput: Clear pre-edit text after input method resetJarkko Koivikko2021-08-231-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | The QPlatformInputContext::reset() function does not allow any further input method events to be called. Therefore, clearing the pre-edit text is the sole responsibility of the text input control. This change modifies the QQuickTextInputPrivate::resetInputMethod() function and calls QQuickTextInputPrivate::cancelPreedit() instead of QInputMethod::reset() directly. The cancelPreedit() function will send a QInputMethodEvent which clears the IM state (in addition of calling QInputMethod::reset() function). Also, rename the QQuickTextInputPrivate::resetInputMethod() function to cancelInput, since it does not call inputMethod()->reset() directly. Fixes: QTBUG-95461 Pick-to: 5.15 6.1 6.2 Change-Id: I6ab3b9dbe71956af72656e2a25a05d79603b34ea Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Inho Lee <inho.lee@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
* Pass the focus reason through to the control on mouse pressVolker Hilsheimer2021-07-231-4/+4
| | | | | | | | | | | | | | | | | Otherwise, a TextInput item will always receive OtherFocusReason when clicking into it. Add a test that simulates focus changes with mouse and keys, records the incoming focus events and verifies the correct focus reason is set in the event. Qt Quick provides no mechanism to access the focus reason from within QML (onActiveFocusChange only has a bool parameter, the focusReason property exists only in QtQuickControl). Task-number: QTBUG-75862 Pick-to: 6.2 6.1 5.15 Change-Id: Ifea95c7ef2ac88c6c8e8bbdc8d2dbe5205ff922e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQuickTextInput: update cursor rectangle after padding changedWang Chuan2021-04-161-0/+5
| | | | | | | | | | The position of cursor delegate needs to be updated when we change padding, otherwise it will be in a wrong position. Fixes: QTBUG-91867 Pick-to: 5.12 5.15 6.0 6.1 Change-Id: I89ca84fe893ebf517ab67890196eede14a4055d7 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* qquicktextinput: Fix validation for IM eventBartlomiej Moskal2021-02-191-1/+19
| | | | | | | | | | | | | | | | | If validation did not pass after text pre-editing is finished, it need to be roll back to state before pre-editing started. Before this change, if validation did not pass, text was always rolled back to previous state. In pre-editing text case, it means back to the state in which part of the text was removed (and later changed to pre-edited text). It may cause a situation of removing part of the text that was already validated Pick-to: 5.15 6.0 6.1 Fixes: QTBUG-90239 Change-Id: I3ec39e0f6b8a93d4e6fd190af30d4c80a0e495eb Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* qquicktextinput: Fix Undo history for IM eventBartlomiej Moskal2021-02-151-4/+6
| | | | | | | | | | | | | | | | | | Do not set m_cursor (cursor position) before calling removeSelectedText() in processInputMethodEvent(QInputMethodEvent *) method. Before this change, DeleteSelection command was added to history with new cursor position. If this command will be later rolled back, cursor position will not be set correctly. It should be set to position before handling the event. Pick-to: 5.15 6.0 6.1 Task-number: QTBUG-90239 Change-Id: Ib5e46d232e6b32f904e745da4f9e5bc03a58963f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* qquicktextinput: ensure we update IM when cursor changes positionRichard Moe Gustavsen2021-02-041-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Normally the cursor will change position inside a text input after receiving a touch or a keypress event. But it can also change position by sending it a QInputMethodEvent. But as it stood, we would in that case not inform the platform input context about it, which meant that the IM state in QQuickTextInput would be different from the IM state in QPA. A bug on iOS could be seen from this when dragging the cursor around using the magnifier glass. In that case QIOSTextResponder would move the cursor in QQuickTextInput using QInputMethodEvents. But since this would not be forwarded back to UITextInput, the result would be that if you e.g pushed backspace on the input panel, you would delete the character at the position the cursor had before the drag. This patch will ensure that we update platform IM state whenever the cursor changes position from QInputMethodEvents. Pick-to: 6.0 5.15 Fixes: QTBUG-72757 Change-Id: Ic39c60fbce982f80d014befddbb2d4439ddeea4f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Don't hide the inputMethod when finishing the editAndy Shaw2021-02-041-2/+0
| | | | | | | | | | | | | There is no reason to hide the inputMethod explicitly when finishing the editing. This will be taken care of for us by the platform plugin and will account for a situation where Qt Quick Controls 2 will check if the item had focus when it is in an popup being closed at this point too. Pick-to: 6.1 Change-Id: I687718ae9b4fabbf6456597a475507d2ec1a1f45 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QQuickTextInput: Store mask data in std::unique_ptrFabian Kosmale2020-11-241-4/+2
| | | | | | | | | This ensures that the memory is freed reliably Fixes: QTBUG-88807 Pick-to: 5.15 6.0 Change-Id: I841a5a2b226a69ce50975d95702a948857d1b54f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* qquicktextinput: compile with explicit QChar(int) constructorDavid Faure2020-11-091-11/+11
| | | | | Change-Id: I78fe89cd97b462299969d57cda099ce54fa8078a Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Use OpenType font weightsJonas Karlsson2020-08-281-1/+1
| | | | | | Task-number: QTBUG-42248 Change-Id: Ib26d4945307b630b054e270b3213e1c9ad0d5357 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Replace Qt's MidButton with MiddleButtonEdward Welbourne2020-07-221-1/+1
| | | | | | | | | | The latter has been the preferred name since Qt 4.7.0. Added a comment on where the old name is exposed to QML that it's only for backwards compatibility. Pick-to: 5.15 Change-Id: I2c5088d597dd7327cc5899d06afb180d0ec2893e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add ; to Q_UNUSED and UNUSED_PARAMLars Schmertmann2020-06-261-2/+2
| | | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: Iead53d18fd790fb2d870d80ef2db79666f0d2392 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Port QtDeclarative from QStringRef to QStringViewKarsten Heimrich2020-06-161-5/+5
| | | | | | | | Task-number: QTBUG-84319 Change-Id: I2dcfb8a2db98282c7a1acdad1e6f4f949f26df15 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QQuickTextInputPrivate: refactor getImplicitWidth() to calculateImplicitWidth()Mitch Curtis2020-06-121-23/+27
| | | | | | | | | | | | This patch moves the implicit width calculation in getImplicitWidth() into calculateImplicitWidth(const QString &text). This allows QQuickComboBox in qtquickcontrols2 to get the implicit width of a TextInput (TextField) item, as QQuickTextInput does some extra layouting and accounting for padding that QFontMetrics does not. Change-Id: I81e6c2627e21ca4d89ea9502abbb6aec79068793 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Replace calls to deprecated QEvent accessor functionsShawn Rutledge2020-06-111-8/+8
| | | | | | | | | | | | | | | | | | | | Several event accessors were deprecated in qtbase/24e52c10deedbaef833c0e2c3ee7bee03eacc4f5. Replacements were generated by clazy using the new qevent-accessors check: $ export CLAZY_CHECKS=qevent-accessors $ export CLAZY_EXPORT_FIXES=1 $ ../qt6/configure -platform linux-clang -developer-build -debug -no-optimize-debug -opensource -confirm-license -no-pch QMAKE_CXX=clazy $ make $ cd ../../qt6/qtdeclarative $ find . -name "*.clazy.yaml" $ clang-apply-replacements . Task-number: QTBUG-20885 Task-number: QTBUG-84775 Change-Id: I1be5819506fd5039e86b4494223acbe193e6b0c9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-241-2/+1
|\ | | | | | | Change-Id: I77f3400914fbce58f98cb3a5602fd0cebf219ac6
| * Merge remote-tracking branch 'origin/5.14' into 5.15Liang Qi2020-04-221-2/+1
| |\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/labsmodels/qqmltablemodel.cpp tests/auto/qml/qqmltablemodel/tst_qqmltablemodel.cpp This follows edc8512580fa16892dc13034e93300cc6a2bba59. Change-Id: I515d44d5d8309f4d7b911996c0ab65ea803176fa
| | * Don't replace all characters below 0x20 with spaces as they may be validAndy Shaw2020-03-021-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some fonts will still render something for characters below 0x20 so these should not be replaced with a space and should just be left as is. It will not be rendered as a box if the dontPrint flag is set so we can trust the renderer to do the right thing here. Change-Id: Ie091c14713d8c2948c82b1991c295d80bc35dfde Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | | QQuickItem: rename geometryChanged to geometryChangeMitch Curtis2020-04-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This brings it in line with the existing convention in this and other modules, where virtual handlers are named "nounChange"; e.g. itemChange. Signals are named "nounChanged". This also allows adding a geometryChanged signal, which would enable users to listen to one signal for all changes to x/y/width/height. [ChangeLog][QQuickItem] Renamed geometryChanged to geometryChange in order to follow existing naming conventions and have consistency with existing API, such as itemChange. Task-number: QTBUG-82994 Change-Id: I0547358c796a0047982ccfbf2c38bab952e7a634 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | Remove QRegExpValidator usagesLars Knoll2020-03-181-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also means the RegExpValidator QML type will be gone. Use QRegularExpressionValidator instead. [ChangeLog][QtQuick][RegExpValidator] The RegExpValidator QML type has been removed. Use RegularExpressionValidator instead. Change-Id: If25fc5a258a669dfd28e705271757caa252ce05c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-111-6/+0
|\| | | | | | | | | | | Change-Id: I0d32fc5b99f8c9e4acb922fffe4dd5f3c5be553c
| * | Remove hard-coded notes for 'Corresponding handler' for QML signalsTopi Reinio2020-03-101-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | QDoc will generate these notes automatically. Task-number: QTBUG-37355 Change-Id: I8ed058ecbbcc630ad0351f6ce167c3fa61936f6f Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-01-301-0/+12
|\| | | | | | | | | | | Change-Id: I1e1d9585d876a8eacd4c24afc894a33075f51a13
| * | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-01-291-0/+12
| |\| | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp Change-Id: I133bfd4bd9dd6f704252c956c90f05e8a8a40d6a
| | * Doc: document behavior and caveats of TextInput's padding propertiesMitch Curtis2020-01-281-0/+12
| | | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-80699 Task-number: QTBUG-81679 Change-Id: I9c936a020ffa358dfa97d9b7044a90a27d3336dc Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | | Make Font.weight an integer instead of enumerationEskil Abrahamsen Blomfeldt2020-01-211-4/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The weight in QFont is an integer, allowing you to request a font of any weight given the predefined scale. In Qt Quick, however, you were limited to the predefined values. This is done in Qt 6 because it breaks conversions from string to weight, as the change in the autotest illustrates. [ChangeLog][Font] Made Font.weight an integer value rather than limit it to a predefined set of weights. As a side effect, conversion from strings to font weights are no longer supported. Fixes: QTBUG-80402 Change-Id: Ifbe9a0e608b63bfa93bb54999b0b3c1851ccfa88 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* / Make inputmask 'X' mask character require non-blank inputEirik Aavitsland2019-12-101-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | The implementation for the X mask would accept any printable character. Since that includes the blank character, there was no difference in behavior between the requiring X and optional x: both would allow the input to be unset, i.e. blank. This change should be seen in conjunction with the doc improvement qtbase:da0af1e and the corresponding change to the QLineEdit widget, where the same input mask handling code is duplicated. This patch series also concludes the old task questioning whether text() should strip blanks even when they are valid input (answer: yes, continue to do that), and so a couple of XFAILS was removed from the autotest. [ChangeLog][QtQuick][TextInput] Inputmask X character now requires non-blank input. Task-number: QTBUG-76320 Change-Id: I606ae04259f29f748b3ce604048c6eb6f10c2ff9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Do not emit inputMaskChanged when setting the same input maskJan Arve Sæther2019-12-021-1/+4
| | | | | | | | | | | | | If you did not specify a blank character (e.g. "; " as suffix) it would internally add that suffix to the property, resulting in that the property itself actually got a "; " suffix even when not specified. So when setting the same input mask again, it wouldn't match the existing inputMask property, and it would emit inputMaskChanged again. Change-Id: Ia47d63d56c640b4be9d6d0a704ddfaff01befbdb Fixes: QTBUG-80190 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-10-151-2/+2
|\ | | | | | | Change-Id: I7759f6b60f8fda6525b239c7ee2e034194d4ab85
| * QQuickTextInput::remove: Fix selection logicFabian Kosmale2019-10-111-2/+2
| | | | | | | | | | | | | | | | Fixes: QTBUG-77814 Change-Id: I96b8990656117430eb12fc4b294a8ece612d3a4b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Small performance improvements suggested by clang-tidyAlbert Astals Cid2019-10-071-1/+1
| | | | | | | | | | | | | | | | | | mostly add const &, a few std::move and in particular case, remove const so the std::move being done over the variable actually has effect Change-Id: Id611cd31bc012f219d7a17d4626b1c2a5fbddd66 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into 5.14Liang Qi2019-09-121-12/+13
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4engine.cpp src/quick/handlers/qquicktaphandler.cpp src/quick/items/qquicktableview.cpp Done-With: Richard Moe Gustavsen <richard.gustavsen@qt.io> Done-With: Ulf Hermann <ulf.hermann@qt.io> Done-With: Shawn Rutledge <shawn.rutledge@qt.io> Change-Id: If9558a33f01693ce96420c094e0b57dfff0626cd
| * Doc: Fix documentation warnings for qtdeclarativeTopi Reinio2019-08-291-12/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After recent changes to QDoc, it now correctly warns about missing documentation for QML method parameters - fix all of these and also do some minor language editing. Remove duplicated entries for - \qmlmodule Qt.labs.qmlmodels - \group qtjavascript as they were causing issues. Change-Id: I55cd670cc8a0cc6427cdb7945dbd7c28ea94f796 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Register QRegularExpressionValidator in QtQuickUlf Hermann2019-06-121-3/+4
|/ | | | | | | | This should replace QRegExpValidator. RegExpValidator is deprecated now. Task-nunber: QTBUG-72588 Change-Id: I072deb382914fd322ce192509782b241824ccd7b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.12' into 5.13Liang Qi2019-02-011-0/+6
|\ | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4codegen.cpp Done-With: Erik Verbruggen <erik.verbruggen@qt.io> Change-Id: I3ae3d64317e4f3fccba6605f4c6da15479ca75e0
| * TextInput: Stop leaking password values to process memoryIvan Čukić2019-01-291-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The contents of a deleted QString can still remain in memory and can be accessible by tools that read the raw process memory. The same problem appears when the QString reallocates -- the old buffer gets deleted, but its contents will remain in memory. This means that a TextInput that serves as a password input field can leak parts of the password while the user is entering it (due to reallocation) and the whole password when the TextInput instance is destroyed. With this patch, the contents of the m_text string member variable will be zeroed-out before the TextInput is destructed. This is done only in the cases when the TextInput serves as a password field. Also, this patch reserves the space for 30 characters for m_text when the TextInput is used for password input. This is enough to make sure no reallocation happens in majority of cases as barely anyone uses passwords longer than 30 characters. [ChangeLog][QtQuick][TextInput/security] When the TextInput is used for password input, preallocate a buffer for the string that stores the entered value and zero-out the string on TextInput destruction to avoid leaking sensitive data to process memory Change-Id: I8f1f307b1cfc25ad51f48bae8509a258042a2e7f Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | Fix QFont-related deprecation warningsFriedemann Kleint2019-01-081-2/+2
|/ | | | | | | | | | | | | | Replace QFontMetrics::width() by horizontalAdvance(), fixing: items/qquicktextcontrol.cpp:1001:80: warning: ‘int QFontMetrics::width(QChar) const’ is deprecated: Use QFont::horizontalAdvance [-Wdeprecated-declarations] items/qquicktextinput.cpp:880:60: warning: ‘int QFontMetrics::width(QChar) const’ is deprecated: Use QFont::horizontalAdvance [-Wdeprecated-declarations] items/qquicktextinput.cpp:1380:60: warning: ‘int QFontMetrics::width(QChar) const’ is deprecated: Use QFont::horizontalAdvance [-Wdeprecated-declarations] items/context2d/qquickcontext2d.cpp:2980:57: warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated: Use QFont::horizontalAdvance [-Wdeprecated-declarations] items/context2d/qquickcontext2d.cpp:4060:36: warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated: Use QFont::horizontalAdvance [-Wdeprecated-declarations] items/context2d/qquickcontext2d.cpp:4063:36: warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated: Use QFont::horizontalAdvance [-Wdeprecated-declarations] Change-Id: Ie97be4a6cf1ce087caeb4d83fe016fa1a471f3ec Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Doc: Add missing dots (qtdeclarative)Paul Wicking2018-06-191-1/+1
| | | | | | Task-number: QTBUG-68933 Change-Id: Ibb5aa227e82825085e7214e17dcffcb17fd44157 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-6/+6
| | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.10' into 5.11Liang Qi2018-02-121-27/+9
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/shapes/qquickshape.cpp src/imports/shapes/qquickshape_p_p.h src/qml/compiler/qqmlpropertycachecreator_p.h src/qml/jsruntime/qv4value_p.h src/quick/items/qquickloader_p.h tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp tools/qmlprofiler/qmlprofilerapplication.cpp Change-Id: Iafc66ae84bf78630ed72a986acb678e9d19e3a69
| * Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2018-02-021-27/+9
| |\ | | | | | | | | | Change-Id: I41ca9120a470a905c2f5c168c1de4cf970fa0fff
| | * Prevent invalid characters being entered at the appropriate timesAndy Shaw2018-02-021-27/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a validator does not allow for certain characters to be entered, then it should not allow these to be entered in even if an input mask is set. This fixes a regression introduced in 1b21b73e89942d567c90a17a3bf7a7ecae3de258. The test modified is because this is in fact a general limitation when combining validators and input masks, when a separator is used. Whereas the original patch did allow this to be possible, this is now not possible again. Task-number: QTBUG-64616 Change-Id: Ic6a3f40a9faa7c04abc055cfc2752044fddd33a0 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Robin Burchell <robin.burchell@crimson.no>