Commit graph

32 commits

Author SHA1 Message Date
Simon Hausmann
7ca66d62b9 Fix crash in TextInput when deleting a left-directed selection
When selecting to the left, the anchor remains to the right of the cursor.
When deleting such a selection, we fetch the cursor and anchor using a helper
method, which ensures that the anchor is to the left of the cursor.
Finally when setting the cursor then to the anchor, we need to also
set the anchor, since both were swapped.

This also add an automated test for this scenario.
2020-09-23 17:33:09 +02:00
Olivier Goffart
b7796b1c49 Slightly better way to avoid repeating one self 2020-09-23 14:06:08 +02:00
Simon Hausmann
c96a955f81 Fix doc warning 2020-09-23 12:31:47 +02:00
Simon Hausmann
babfd17813 Add support for copy & paste in TextInput 2020-09-23 11:46:38 +02:00
Olivier Goffart
fa55c1f015 Flickable: properly grab the mouse
otherwise the Flickable think the mouse stay pressed forever if it is released while outside of it.
2020-09-22 17:39:51 +02:00
Simon Hausmann
19c53c6b19 Fix C++ build
Add missing #[repr(C)]
2020-09-21 14:58:16 +02:00
Simon Hausmann
bb81c99ddb Add support for keyboard modifiers in the internal key event 2020-09-21 14:30:16 +02:00
Simon Hausmann
39fabdee9e Pass a window reference to Item::key_event
Similar to the input_event.
2020-09-18 16:22:00 +02:00
Simon Hausmann
7053aee0c8 Pass the ComponentWindow to ItemVTable::input_event 2020-09-18 16:18:48 +02:00
Simon Hausmann
546818ee55 Add key event data structures and event function boiler plate 2020-09-15 11:16:55 +02:00
Simon Hausmann
0924519734 Add some missing docs to the input module
Now we can require docs.
2020-09-15 11:16:00 +02:00
Olivier Goffart
953d3e0422 Fix crash when rendering an empty widget
QPainter does not like to draw in an empty QImage.
And the rendering code does not like to render it.

So we would get this on the console:

```
QPainter::begin: Paint device returned engine == 0, type: 3
QPainter::save: Painter not active
QPainter::save: Painter not active
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::save: Painter not active
QPainter::setClipRegion: Painter not active
QPainter::setPen: Painter not active
QPainter::setBrush: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::setPen: Painter not active
QPainter::setBrush: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::save: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::restore: Unbalanced save/restore
thread 'main' panicked at 'attempt to subtract with overflow', sixtyfps_runtime/rendering_backends/gl/texture.rs:285:42
```
2020-09-02 11:50:19 +02:00
Olivier Goffart
58cdaeb8dd Update license header to mention that commertial option are available 2020-08-26 13:23:42 +02:00
Simon Hausmann
2823f32692 Apply license headers to all non-binary/non-json sources 2020-08-17 17:55:20 +02:00
Simon Hausmann
d3a474af26 Move corelib::Component and friends back into their dedicated component module 2020-08-12 11:39:07 +02:00
Simon Hausmann
0df86d7eeb Move corelib::abi::datastructures::Component to corelib 2020-08-12 10:53:03 +02:00
Olivier Goffart
36243ccdf7 Traverse item front to back for input events 2020-08-10 10:45:02 +02:00
Olivier Goffart
5de801d023 C++: grabbed mouse input 2020-08-07 16:06:49 +02:00
Olivier Goffart
0a56912d0f Mouse grab in rust 2020-08-07 16:06:49 +02:00
Simon Hausmann
829990f9b1 WIP
Co-authored-by: Olivier Goffart <ogoffart@woboq.com>
2020-08-07 16:06:49 +02:00
Simon Hausmann
37fa04098f Move MouseEvent and MouseEventType from datastructures into input 2020-08-03 13:55:33 +02:00
Olivier Goffart
e00491811b Get rid of the context in properties/signal 2020-07-13 18:49:06 +02:00
Olivier Goffart
1b748792ad Visit the item as Pin
A preparation to have Property::get to take Pin<Self>
2020-06-25 18:50:20 +02:00
Olivier Goffart
caca0d0ba4 Put the component in a Pin<>
Removed the drop and create from the ComponentVTable:
since we are not using VBox<ComponentVTable>, this simplifies a bit
the code of the interpreter and everything else.

But there is still a lot of changes everywhere to support that the Component
is pinned.
This is just for the component. Which would be required if later we want
to access the properties as Pin<Property<_>>. But we have not yet ability
to do projections
2020-06-24 14:13:27 +02:00
Olivier Goffart
f8b7989c0b Access the properties in the parent component of a repeated element
This required some refactoring of the EvaluationContext structure to include the parent context
2020-06-22 14:38:38 +02:00
Olivier Goffart
d7fe69ff74 Lookup the index from a repeater expression 2020-06-16 17:23:38 +02:00
Olivier Goffart
30b201d946 Reduce the use of unsafe in corelib and in the rust backend 2020-06-12 19:03:15 +02:00
Olivier Goffart
f6d1151832 Use the EvaluationContext in the signal handler 2020-05-28 14:26:35 +02:00
Simon Hausmann
f2df9293a9 Fix the C++ build
Remove the Optional from the evaluation context passing for property
evaluation. Unfortunately there are nullptr uses left on the C++ side,
that need to be replaced with passing through.
2020-05-28 12:07:11 +02:00
Simon Hausmann
c4dd857e0d Add an evaluation context to property evaluations
The context is not used yet or passed on to the binding closure.
2020-05-28 09:20:11 +02:00
Olivier Goffart
4575011293 More work on signal: the C++ part is working 2020-05-20 19:28:58 +02:00
Olivier Goffart
94c58dc1c4 Add an mouse handler for the TouchArea 2020-05-20 12:03:36 +02:00