Commit Graph

180 Commits

Author SHA1 Message Date
Andrew den Exter 0142b11269 Use QQuickTextUtil to calculate alignment offsets in TextInput.
Change-Id: I8602f949c01cb4c5a3b05de5a2800dead0ae8b47
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-07-11 15:52:20 +02:00
Eskil Abrahamsen Blomfeldt b0b4869440 Add option to use native rasterizer for SceneGraph text
For old-style (desktop components) apps using QML 2 on regular density
displays, distance field text will look out of place. We introduce
an option to use the native rasterizer instead if you would rather
have native look and feel than scalable text items.

Change-Id: Idb38e3c89f2deab9ae1963357c6c5fb235ddeab8
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
2012-07-10 14:22:34 +02:00
Andrew den Exter 9d7ad80186 Use enumeration in preference to enum when referring to QML API.
Task-number: QTBUG-24666
Change-Id: I5197d4b4d1a1b53cae2033bd86ce26ba55d08384
Reviewed-by: Bea Lam <bea.lam@nokia.com>
2012-07-06 01:51:34 +02:00
Andrew den Exter a1ea8f59e6 Refresh the TextInput.acceptableInput property when validator changes.
Task-number: QTBUG-26260
Change-Id: I404640d9a2f000976887dcc2119f971c17a71c7e
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-07-04 03:35:18 +02:00
Andrew den Exter db7a351908 Remove outdated refactor comments.
It's not necessary to check whether the canvas has focus when gaining
active focus, as the focus of the root item follows the window focus
so an item should never gain active focus if the window doesn't have
focus.

Change-Id: I8992f673fb64467869d5fb9d23d011f19219feed
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
2012-07-03 04:35:06 +02:00
Pekka Vuorela fd754674d0 Fix right aligned cursor position in TextInput with geometry changes
Updating the text layout cannot be omitted with NoWrap because line width
needs to be updated even with empty content.

Change-Id: Ia9b168d6cfe7680cc1c9e7fa641ce7528d2b6d5e
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
2012-06-25 03:19:10 +02:00
Andrew den Exter 3721de405e Remove the open and closeSofwareInputPanel functions.
Functionality is provided by the global Qt.application.inputMethod
object.

Task-number: QTBUG-21449
Change-Id: I75c082bcbe44c8834ccaf966a3f9a09ab91ec290
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-06-22 08:18:15 +02:00
Chris Adams 5e33b0f580 Create new documentation structure
The documentation currently has no clear separation between Qt QML
and Qt Quick.  With recent commits like:
6c8378eaf1
and
ab1e510121
the separation between the language definition and implementation,
provided by Qt QML, and the standard library for the QML language,
provided by Qt Quick, is clear.

This commit creates a new documentation structure that is more
navigable and separates concepts into logical categories, with
clear separation between QtQML and QtQuick.  It also provides a more
generic QML Application Developer Resources page which contains links
to information for QML application developers.

Change-Id: Ia807ccfbfd24ffa0e1c7f0a51ed9d2ed3aa6a733
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-06-21 09:58:56 +02:00
Jerome Pasion ca6d49e6b4 Doc: Grouped Qt Quick types into several groups
-created new groups and converted some overviews into group pages
-edited type documentation and added \ingroup
-articles still need title fixes and link fixes

Groups:
qtquick-visual-types
qtquick-item-graphics
qtquick-shaders
qtquick-canvas
qtquick-text
qtquick-text-validator
qtquick-interaction
qtquick-positioners
qtquick-transformations
qtquick-states
qtquick-animation-define
qtquick-animation-properties
qtquick-animation-control
qtquick-animation-modifiers
qtquick-images-sprites
qtquick-images
qtquick-models
qtquick-containers
qtquick-views
qtquick-paths
qtquick-utility

Task: QTBUG-25685

Change-Id: I81d4df3320bf5daad5cabb5e42408013fb24f464
Reviewed-by: Bea Lam <bea.lam@nokia.com>
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
2012-06-06 06:27:41 +02:00
Andrew den Exter 5e6d1afb12 Hide the default cursor if a cursor item is available.
Change-Id: I9ef3350a60ddd355ab588c9cfb3256004ee4493e
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
2012-06-05 03:22:18 +02:00
Andrew den Exter 5b83c3c27f Ensure the cursor delegate position is updated on text changes.
Change-Id: I7518aa5969ea45538feccb87f4c296db6b7d6944
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
2012-06-05 03:22:18 +02:00
Andrew den Exter fbc66c4f42 Update the cursor rectangle when password echo timer expires.
Ensures the cursor is positioned correctly is if the echo mask glyph
has a different width to the character it replaced.

Change-Id: I924234d4ae29cbb2e61638918005fcc3dc230993
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
2012-05-29 08:54:52 +02:00
Nico Vertriest 6112c0f571 Doc: Sanitized QML types
-modified \brief
-checked QML modules
-added qml directory to the qdocconf file
-added particles directory to the qdocconf file

Change-Id: I589e32d3106cda37c7fa4d55a941afd9876fc2b2
Reviewed-by: Geir Vattekar <geir.vattekar@nokia.com>
2012-05-24 15:41:16 +02:00
Andrew den Exter bd5e23a00e Defer construction of TextEdit/TextInput delegates.
Don't create instances of the delegate components until the item
gains focus, or the cursorVisible property is set to true.

Cursor delegates are typically small and relatively fast to create and
so won't have a significant cost during a one off focus in event,
but that cost can still add up when creating a number of TextInputs
or TextEdits at once.  If a delegate that is instantiated immeditately
is required it is possible to instead create a child item and bind to
the cursorRectangle and cursorVisible properties.

Change-Id: I5ec2b5b6a30e534aee3dd5a58c6a5ac0686f5ce2
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
2012-05-14 00:51:15 +02:00
Andrew den Exter bf817782e6 Ensure the cursor rectangle is updated when preedit text changes.
Updating only when the cursor position changes isn't enough because
changing pre-edit text changes the width of the pre-edit area and
the x offset of all cursor positions within it.

Change-Id: I3c0a5e4ad4714a903ca84c1a25374491f34d95a0
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
2012-05-03 07:04:03 +02:00
Pekka Vuorela a150d1211f QQuickTextInput aligment to follow input method on neutral content
Earlier input method was followed only on empty editor. This made
inputting one space character with arabic to be visualized left to
right.

As related change arabic numbers are aligned right even though the
flow goes left to right.

Change-Id: I36448949569f6290faad69de14df424575d8b97e
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
2012-04-27 13:47:03 +02:00
Andrew den Exter 2a6e105f43 Fix bounding rects of text items.
Ensure the rectangles are correctly positioned with right
and center aligned text, not just sized correctly. Also add
padding to the clip rects so the cursor and styled text aren't
clipped at the item boundaries.

Change-Id: I03ef140589154ebd49b600b0a4c4fbeff845c10f
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
2012-04-27 06:27:46 +02:00
Andrew den Exter a701746515 Propagate left key presses to the parent item when TextInput is empty.
Don't overwrite the ignore value once it's been set to true.

Task-number: QTBUG-25447
Change-Id: I7284147bc525d0971564570f0dd0599cec190905
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
2012-04-27 03:45:16 +02:00
Bea Lam 8320616dfb Paint TextInput when it is reparented
Wasn't being repainted if it was moved off then back into view as part
of a VisualItemModel with a ListView.

Task-number: QTBUG-24731
Change-Id: I4ba8035709d3e889fb3f0fe82ef0c0523a39ead8
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
2012-04-20 06:20:11 +02:00
Andreas Holzammer d4eb0e4531 Compile fix if QT_NO_CLIPBOARD defined
Change-Id: Ic287a89193c98b2405032fe5859782286d4528d0
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-04-19 17:48:29 +02:00
Andrew den Exter 368a3a736c Set cursorVisible to false when im cursor length is 0.
If the length of the QInputMethodEvent::Cursor attribute is 0 the
cursor is supposed to be hidden.  To ensure this and any other IM
state is reverted when the input method is reset send a empty
event to the editor when preedit is cancelled or removed and
count formatting or cursor changes when determining if the
input method is composing (i.e has state that needs to be reset).

Change-Id: Ifca69aa0c18776b1aef355ed6ae9aecc40b9d475
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
2012-04-02 10:45:55 +02:00
Pekka Vuorela fc1d66130b TextInput to use password mask delay if platform style defines one
Change-Id: I05b98db2d7855f29b11749524a74e04a71178347
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
2012-03-27 16:03:16 +02:00
Pekka Vuorela f32ae39ac4 Remove tentative commit from editors
Feature to be reimplemented simplified. Now using new
FocusAboutToChange event for using input method to commit stuff when
window is losing focus.

Change-Id: I81c96c36d9f0a1b38adb4324f3b892c33547cb50
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
2012-03-26 10:36:31 +02:00
Frederik Gladhorn 3d8f103c26 Add accessibility updates.
Re-add all accessibility updates with new api.

Change-Id: Iec91c41a0137911ccf6e9f4fa907a378d9dd335a
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2012-03-23 11:47:58 +01:00
Andrew den Exter 336c338c9f Fix text wrapping and eliding with implicitWidth.
Update the implicitWidth of the item before continuing with the layout
rather than after it's completed this gives any bindings dependent on
the implicitWidth the opportunity to update the width before the layout
continues.

Task-number: QTBUG-22680
Task-number: QTBUG-24251
Change-Id: I61cd96ad9891b22d8b83937ad2c06719f88976b6
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-03-22 04:06:12 +01:00
Andrew den Exter b6380adcf0 Don't overwrite text selections made in focus handlers.
Defer giving focus to TextInput or TextEdit until after other mouse
press handling has been performed, otherwise setting the cursor position
will overwrite any selection or cursor position set in the
on(Active)FocusChanged handler.

Change-Id: I6332642484de65138a444987b5a81be69c6f835f
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
2012-03-21 06:52:37 +01:00
Andrew den Exter 0e1baa28e5 Content size should not include trailing spaces.
Excluding trailing spaces from the content size means the cursor
position also needs to considered in determining the width used
by the text as unwrapped white space can push the cursor over
the width of the item.

Also corrects an auto scroll issue with right to left text
identified in extending the tests.

Task-number: QTBUG-24630

Change-Id: Iaab9eac03824b22f507154fa1d6e55376bd075a0
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
2012-03-21 05:18:35 +01:00
Andrew den Exter d38e9e413c Fix unused variable warning.
Change-Id: I5e10bc5e2d42bcbc641ebea8b9bb123479ea857a
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
2012-03-20 06:49:30 +01:00
Andrew den Exter 7a9cd9d4fe Add additional key sequence tests.
Change-Id: Ie77a61a3ea0d1bdccd59dd519346db74bdf59c44
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
2012-03-20 06:49:30 +01:00
Frederik Gladhorn bfa7648ca4 Remove all accessibility updates to allow changes in qtbase.
In order to integrate pending api changes these are temporarily
removed and will return fixed as soon as qtbase is up to date.

Change-Id: I558b6049ac3342d41d67441ddfba6821fc370533
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2012-03-14 11:39:50 +01:00
Casper van Donderen c291efff26 Remove the usage of deprecated qdoc macros.
QDoc now has support for Doxygen style commands for italics, bold
and list items. This change applies that change in QDoc to the
actual documentation.

Task-number: QTBUG-24578
Change-Id: I62d203f21df63a95ee236e578b10418fd9680707
Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
2012-03-13 16:34:49 +01:00
Frederik Gladhorn b262e81d52 Send accessibility updates for the right item.
Child 0 means the first child.
The index needs to be -1 which the default ctor does.

Change-Id: I71fbdf5a15dd4593178cb250f06d42f601e40d4d
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2012-03-13 14:00:45 +01:00
Andrew den Exter c0f032de77 Remove unused init function.
Change-Id: Id66e177a544fd8e019bae86fff6bd04bd0497d7c
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
2012-03-13 14:00:45 +01:00
Matthew Vogt 0284817d6c Merge master <-> api_changes
Change-Id: Iad2f07b989b25349fd2d4fff010e24dcd5a1688f
2012-03-05 11:39:54 +10:00
Matthew Vogt b855240b78 Rename QDeclarative symbols to QQuick and QQml
Symbols beginning with QDeclarative are already exported
by the quick1 module.

Users can apply the bin/rename-qtdeclarative-symbols.sh
script to modify client code using the previous names of the
renamed symbols.

Task-number: QTBUG-23737
Change-Id: Ifaa482663767634931e8711a8e9bf6e404859e66
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-02-24 04:51:31 +01:00
Andrew den Exter 5fee1e79cc Use floating point types for position offsets and cursorRectangle.
Rounding to align painting to pixel boundaries is no longer necessary
are largely removed.  Correct the few instances remaining in TextEdit
and TextInput.

Change-Id: Ic6ec57092d74ec43b23d85cd8868e0190acc3e09
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
2012-02-24 01:46:49 +01:00
Andrew den Exter d70b27dd68 Reduce the size of QQuickTextInputPrivate.
Remove some redundant or obsolete member and reorder members to
minimise padding for alignment.

Change-Id: I2660007baa07bea076e9ad307061af87c07e37cf
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
2012-02-22 01:23:49 +01:00
Pekka Vuorela c79f36c51f Have input method hints on only classes using them
Removed inputMethodHints setter and getter from QQuickItem.
No need to consume memory for input method hints on every item when
only QQuickTextInput and QQuickTextEdit actually use them.
Additionally introduced change signals on the editor hint properties.

Change-Id: Ice380d4f4dd47fdde73d2468f4a44a7d1540ad45
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
2012-02-17 04:28:49 +01:00
Pekka Vuorela e761f5b906 Use QInputMethod instead of deprecated QInputPanel
Similarly deprecate Qt.application.inputPanel and
introduce replacement Qt.inputMethod.

Change-Id: Ie4fd467f93f75023c86b0a2d038d858fe5001146
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Sami Kananoja <sami.kananoja@nokia.com>
2012-02-10 09:54:58 +01:00
Andrew den Exter 8550ed6915 Add linkColor property to Text.
Allows the color of links in text to be changed from the default blue.

This currently only works with StyledText and the distance field
rendererer.  It could be made to work with RichText overwriting the
specified foreground color in all instances or by not setting a default
color in the html parser.  The former would prevent the color being
set with CSS or some future means for altering text formats.  The latter
would break rendering with QPainter.

Task-number: QTBUG-23048
Change-Id: I98df215cabe8a089f648fd4a6206622b4318fb8f
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-02-09 09:10:31 +01:00
Andrew den Exter 51b7425329 Add contentWidth and contentHeight properties to Text elements.
For Text and TextEdit this is a rename of paintedWidth and paintedHeight
both of which remain as synonyms of the content properties for
compatability.  For TextInput this is a new property.

Task-number: QTBUG-23691
Task-number: QTBUG-15160
Change-Id: Idbdc72fad34922be21b649ca45fc39b5e533ed1a
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
2012-02-07 06:36:05 +01:00
Andrew den Exter 4cd28a7f8c Fix vertical offset of TextInput.positionToRectangle.
Offset the y value of the rectangle by the vertical scroll and line
offset.

Task-number: QTBUG-23934
Change-Id: I43815b480f43a089a9a03b0aec32dfc0598b6154
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-02-06 08:28:35 +01:00
Matthew Vogt 01dc7e2ea4 Remove QtQuick1 elements from qtdeclarative
QtQuick1 is now contained in a separate repository.

Task-number: QTBUG-23737
Change-Id: I09eae67af5693a22b896b916f816f73ccc3a89b1
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-02-03 00:39:18 +01:00
Andrew den Exter 054a1e942f Add a persistentSelection property to TextInput.
Improves feature parity with TextEdit.

Task-number: QTBUG-16355
Change-Id: I3919c71454a4f4574a1ee35ad38969459beb8363
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-02-02 02:36:00 +01:00
Friedemann Kleint ae6acb42a3 Accessibility: Use new updateAccessibility() API in declarative.
Change-Id: I7ab5c767c9d21c9cad1ee7f7c1f6e21ed4dccef3
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2012-02-01 16:30:03 +01:00
Jason McDonald 45b14259fc Remove "All rights reserved" line from license headers.
As in the past, to avoid rewriting various autotests that contain
line-number information, an extra blank line has been inserted at the
end of the license text to ensure that this commit does not change the
total number of lines in the license header.

Change-Id: If39bd256b0fa85eba17ea30f8ab87ea27d758908
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-30 23:52:43 +01:00
Pekka Vuorela ed576da671 Enhance editors notifying input panel for input method changes
Introduced protected QQuickItem::updateInputMethod() and removed
similar, but badly named updateMicroFocus(). Added some missing
notifications from the editors and avoided unnecessary updates when not
having focus.

Change-Id: Id5c00e87dc26fd35c3f919006817511d4ed6418d
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
2012-01-27 15:38:09 +01:00
Andrew den Exter 8df8bc5062 Add a locale property to IntValidator and DoubleValidator.
Allow the locale used for interpreting numbers to be changed from the
application default.

Task-number: QTBUG-23713
Change-Id: I28463485c86236fb2586eeb703ec4b051405c5a8
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-01-25 10:57:36 +01:00
Eskil Abrahamsen Blomfeldt 47a5c708bf Add support for shared glyph cache
Use a shared graphics cache to back the distance fields if
it is available.

Change-Id: Id5e6e7a28e38e349d787e66016b2d0faebc791d7
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
2012-01-24 13:03:03 +01:00
Damian Jansen 2752011990 TextInput documentation fix
A few instances where TextEdit is indicated

Change-Id: I6d6a6c1f92d673978856befb9c2581b657cdb0f7
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
2012-01-24 08:10:42 +01:00
Jason McDonald e6b224aa28 Update obsolete contact address.
Replace Nokia contact email address with Qt Project website.

Change-Id: I6a730abc0c396fb545a48b2d6938abedac2e3f1c
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
2012-01-23 06:28:53 +01:00
Andrew den Exter c0e0f9f52b Update TextInput.acceptableInput on component complete.
QValidator doesn't notify when it's validation criteria changes so is
susceptible to order of evaluation issues.  Deferring the initial
validation will ensure validators with static criteria are correctly
applied.  Notification from QValidator on changes would solve this
for all cases: QTBUG-23694.

Task-number: QTBUG-21103
Change-Id: I920f36645fd18ce809db56b5daf73545f1d603dc
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-01-20 07:12:19 +01:00
Andrew den Exter 3121a0d410 Extend the documentation on DoubleValidator.
Elaborate on what is valid, intermediate, and invalid.

Task-number: QTBUG-22081
Change-Id: If0ef270eaee60b530fdf6275e36b2208d41c7639
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-01-19 11:11:02 +01:00
Pekka Vuorela 6a5b9cb964 Made QQuickTextInput follow input direction changes
Cursor of empty field should align based on input method
direction. Now input method allowed to change direction
on run time.

Also earlier cursor wasn't properly drawn on correct alignment
at all.

Change-Id: I4601f10e6b5dde09591bd484b05f001add6c1573
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
2012-01-17 13:15:30 +01:00
Jiang Jiang 2f9608630b Fix preedit text visibility when TextInput is empty
Task-number: QTBUG-22646

Change-Id: I5162ffdebdee6f956a9a79b2307a2ac53cc4890b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
2012-01-12 17:34:09 +01:00
Pekka Vuorela 39f9b5def1 Adapt to QInputPanel::inputDirection() API
Information moved from QGuiApplication into QInputPanel.

Change-Id: Idd80609f4b67bffae7222a1fa27918724ebf60f6
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
2012-01-12 16:21:35 +01:00
Andrew den Exter 0cafd920cc Fix validators not allowing backspace or delete.
TextInput will allow non-valid changes to already invalid text, when
a validator is changed update the current validity so changes can
be made to bring the text back to a valid state.

Task-number: QTBUG-22080
Change-Id: I501961b473f58c317bce474b1df8d91fd1f967d4
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-01-12 09:33:32 +01:00
Andrew den Exter 9d73bf289e Add undo and redo functions to TextInput and TextEdit.
The functionality already existed and was usable through keyboard short
cuts but was not accessible through API.

Task-number: QTBUG-16191
Change-Id: I080fa2ddb76668a7a632aa7477004f99037ea68b
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-01-12 09:33:32 +01:00
Andrew den Exter 21e6e0e6aa Fix failing tst_qquicktextinput::horizontalAlignment_RightToLeft test.
How the text is laid out is dependent on the horizontalAlignment so
that needs to be determined before updating the display text and doing
the layout.

Task-number: QTBUG-23485
Change-Id: I1872b1bfc60fd829a0d69c21a19cd3b2b4dc8340
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
2012-01-12 09:33:32 +01:00
Pekka Vuorela 4e9efd590d QQuickTextInput to better call QInputPanel::update()
Some updates were previously omitted, e.g. if text content
changed but cursor position remained the same, or if input
method changed the selection.

Change-Id: I11abd105632d73f8ebb23d0e8c308c53c236cc15
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-01-05 16:31:56 +01:00
Jason McDonald da0839735c Update copyright year in license headers.
Change-Id: I0a8d99909cac867dce72da70b1bbcb649989a51b
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-05 09:12:53 +01:00
Andrew den Exter 966e885683 Document inputMethodHints and cursorRectangle properties.
Task-number: QTBUG-22612
Task-number: QTBUG-20764
Change-Id: Ibab86c5934f0ad6e3115a00371a5b2a6961720b5
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-01-05 04:51:26 +01:00
Andrew den Exter 82803517a6 Fix clipping of TextInput contents.
The boundingRect represents the clip rectangle of an item rather than
the size and position of its unclipped content.  This would prevent any
content from being clipped except the boundingRect is only re-evaluated
when the size of the item changes so the content is instead clipped to
the size of the original content.

Task-number: QTBUG-23422
Change-Id: I96f830f833129b3230f65452db67b00028c40d6a
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-01-05 00:55:28 +01:00
Andrew den Exter c7a4650b88 Add length property and insert, remove and getText functions to TextInput.
These mimic the functionality of their pre-existing counterparts in
TextEdit.

Change-Id: Idcb7549cd07ed3c287ab00b7828a3158690faf0e
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-01-04 06:58:07 +01:00
Andrew den Exter 8bd497a614 Fix crash in TextInput.
Ensure the text is laid out before calling componentComplete() on
QImplicitSizeItem, as that can potentially evaluate bindings which
would then access the uninitialized layout.

Change-Id: I5152c1494c54209dae61c13b2f45d343fb76bf9e
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
2012-01-04 05:43:14 +01:00
Andrew den Exter bda2f4bdd8 Speed up TextInput and TextEdit creation.
Update the canPaste property directly when changing the read-only
property instead of connecting to the readOnlyChanged signal.

Change-Id: Ic6f6ba66f6b94448045703f7d2a66218548190dd
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2012-01-04 01:19:14 +01:00
Pekka Vuorela f9a574aee1 Use Qt::ImhSensitiveData input hint on TextInput with password echo mode
Change-Id: I1e9255af24b51ca42c1e6df7a92664be532ce725
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
2012-01-03 14:57:36 +01:00
Pekka Vuorela 9b571bd1c6 Remove use of Qt::ImhMultiLine, to be deprecated/removed
Change-Id: I02a1611c945bf3804081bb9d0cd8da470a5774d8
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
2012-01-03 14:54:49 +01:00
Andrew den Exter 71b64a4ab7 Remove uneccessary layout in TextInput initialization.
The layout was only done to ensure there was always at least one
QTextLine in the layout to avoid validity checks later, but since
lineForTextPosition can return an invalid QTextLine the checks are still
needed anyway.

Change-Id: Iae65e3460812a60e2aafecd553bf4241bd640d04
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
2011-12-21 08:57:12 +01:00
Andrew den Exter 3db5afa714 Delay initializing the canPaste property until it's requested.
With xcb querying data from the clipboard can take as long as 50 ms.
Deferring the check until it is requested speeds up construction time
when it's not used and only checking the available formats when it is
requested should also help.

Change-Id: I796fc83d0457d9ac1490cfb9f510c6342eb8a872
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2011-12-21 01:36:57 +01:00
Pekka Vuorela 9697e2af14 Make editors commit preedit themselves on losing focus
Change-Id: I1d42a8804068718c7347b4f652289f9724c25a3c
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
2011-12-20 13:36:16 +01:00
Pekka Vuorela 0332e605f9 QQuickLineControl more robust on input method & selection state
Input method event having replacement information out of bounds
left the controller in selection state when it shouldn't be.
Also now more liberal on accepted events. We cannot detect if input
method is confused for replacement inside boundaries, but going beyond
the end is more likely to be meant to replace until the end than to
leave previous text in addition to the new one.

Change-Id: I485009ac682c11876b39f7e22d7dfb91a6d162fe
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
2011-12-20 12:40:31 +01:00
Andrew den Exter 657f6d7111 Delay masking the last character in Password echo mode.
If QT_GUI_PASSWORD_ECHO_DELAY is defined in qplatformdefs.h with an
integer value in milliseconds, QLineEdit and TextInput will display
the last character entered unmasked for that delay period and then
mask the character as normal.  If QT_GUI_PASSWORD_ECHO_DELAY is
not defined then the behaviour is unchanged.

Task-number: QTBUG-17003
Task-number: QTBUG-20719
(cherry picked from commit f9e7aee2019d321edd655bfde7de43f20a106971)

Change-Id: I9a8647a0adeb94fc6beea949cdce7336671c898e
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2011-12-20 07:33:37 +01:00
Andrew den Exter 59e607a2ce Add wrapMode and verticalAlignment properties to TextInput.
Wrap mode provides an alternative to horizontal scrolling when the width
of the text exceeds the width of the TextInput. With auto scroll
wrapping introdoces an implicit verticalAlignment so support setting it
explicitly as well.

Task-number: QTBUG-22305
Task-number: QTBUG-16203
Change-Id: I1bd3a5335edb3ac48df3d5ccd8ae7274caa91883
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2011-12-20 07:33:37 +01:00
Andrew den Exter e7fb84adb5 Merge QQuickLineControl into QQuickTextInput.
There's no clear separation of responsibilty between these classes and
keeping them in sync and forwarding signals is a unnecessary overhead
that can be avoided by combining them.

Task-number: QTBUG-22627
Change-Id: I4350eb3c612b10d4ed34886374889ae893b8183a
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2011-12-16 00:53:17 +01:00
Andrew den Exter d8da1372ae Remove unused code from QQuickLineControl.
Task-number: QTBUG-22627

Change-Id: I234977638ac6d42ad0fa648ae366823e5c542ed6
Reviewed-by: Martin Jones <martin.jones@nokia.com>
2011-12-15 09:07:04 +01:00
Andrew den Exter 3f83388dba Create a copy of QLineControl in the QtDeclarative library.
First half of a move of QLineControl from qtbase to qtdeclarative, some
time in the future QLineControl will be deleted from qtbase to finish
the move.

Task-number: QTBUG-22627
Change-Id: I0c3449f57f1a3296a0ff52f2b9a1a78041ae28b2
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
2011-12-12 12:56:20 +01:00
Andrew den Exter 841e6ae8ac Fix TextInput not reacting to text color change.
Trigger a relayout with the new color when the color property is
changed.

Task-number: QTBUG-22402

Change-Id: I2dc190e097e878ac498fd04c2800a6e11947527c
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
2011-12-12 08:20:32 +01:00
Andrew den Exter a1a4abe377 Size TextInput cursor correctly.
Use the cursorRectangle property to size and position the TextNode's
cursor rather than recalculating the rectangle in an incompatible way.

Task-number: QTBUG-22386
Change-Id: I8ee02b590796b0304683b9b246aba1e59c1fd6a5
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
2011-12-12 07:05:45 +01:00
Kent Hansen 6c8378eaf1 Say hello to QtQuick module
This change moves the QtQuick 2 types and C++ API (including
SceneGraph) to a new module (AKA library), QtQuick.

99% of this change is moving files from src/declarative to
src/quick, and from tests/auto/declarative to
tests/auto/qtquick2.

The loading of QtQuick 2 ("import QtQuick 2.0") is now delegated to
a plugin, src/imports/qtquick2, just like it's done for QtQuick 1.

All tools, examples, and tests that use QtQuick C++ API have gotten
"QT += quick" or "QT += quick-private" added to their .pro file.

A few additional internal QtDeclarative classes had to be exported
(via Q_DECLARATIVE_PRIVATE_EXPORT) since they're needed by the
QtQuick 2 implementation.

The old header locations (e.g. QtDeclarative/qquickitem.h) will
still be supported for some time, but will produce compile-time
warnings. (To avoid the QtQuick implementation using the
compatibility headers (since QtDeclarative's includepath comes
first), a few include statements were modified, e.g. from
"#include <qsgnode.h>" to "#include <QtQuick/qsgnode.h>".)

There's a change in qtbase that automatically adds QtQuick to the
module list if QtDeclarative is used. Together with the compatibility
headers, this should help reduce the migration pain for existing
projects.

In theory, simply getting an existing QtDeclarative-based project
to compile and link shouldn't require any changes for now -- but
porting to the new scheme is of course recommended, and will
eventually become mandatory.

Task-number: QTBUG-22889
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Change-Id: Ia52be9373172ba2f37e7623231ecb060316c96a7
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
2011-12-02 14:18:20 +01:00